(self)
| 300 | eq(cc.context.get('1.0', 'end-1c'), ' def __init__(self, a, b):') |
| 301 | |
| 302 | def test_jumptoline(self): |
| 303 | eq = self.assertEqual |
| 304 | cc = self.cc |
| 305 | jump = cc.jumptoline |
| 306 | |
| 307 | if not cc.context: |
| 308 | cc.toggle_code_context_event() |
| 309 | |
| 310 | # Empty context. |
| 311 | cc.text.yview('2.0') |
| 312 | cc.update_code_context() |
| 313 | eq(cc.topvisible, 2) |
| 314 | cc.context.mark_set('insert', '1.5') |
| 315 | jump() |
| 316 | eq(cc.topvisible, 1) |
| 317 | |
| 318 | # 4 lines of context showing. |
| 319 | cc.text.yview('12.0') |
| 320 | cc.update_code_context() |
| 321 | eq(cc.topvisible, 12) |
| 322 | cc.context.mark_set('insert', '3.0') |
| 323 | jump() |
| 324 | eq(cc.topvisible, 8) |
| 325 | |
| 326 | # More context lines than limit. |
| 327 | cc.context_depth = 2 |
| 328 | cc.text.yview('12.0') |
| 329 | cc.update_code_context() |
| 330 | eq(cc.topvisible, 12) |
| 331 | cc.context.mark_set('insert', '1.0') |
| 332 | jump() |
| 333 | eq(cc.topvisible, 8) |
| 334 | |
| 335 | # Context selection stops jump. |
| 336 | cc.text.yview('5.0') |
| 337 | cc.update_code_context() |
| 338 | cc.context.tag_add('sel', '1.0', '2.0') |
| 339 | cc.context.mark_set('insert', '1.0') |
| 340 | jump() # Without selection, to line 2. |
| 341 | eq(cc.topvisible, 5) |
| 342 | |
| 343 | @mock.patch.object(codecontext.CodeContext, 'update_code_context') |
| 344 | def test_timer_event(self, mock_update): |
nothing calls this directly
no test coverage detected