bpo-37706: fix sidebar drag tests#15103
Conversation
|
I think this doesn't need a NEWS entry since it hasn't yet been included in any (non-beta) release. |
terryjreedy
left a comment
There was a problem hiding this comment.
Given the clear description of how to reproduce the bug, I verified its presence in .0b3 on Win10 both with htest and live editor, and it absence after the patch.
I noticed editwin.getlineno before, but did not think to question it either.
Factoring out simulated drag into a helper function is a good idea. If it is ever needed for another test, it should go into idle_test/mock_tk.py. More so for simulated mouse/key click, which already had duplicated code in multiple files.
|
Thanks @taleinat for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8. |
Convert mouse y to line number in the sidebar rather than the text. (cherry picked from commit 86f1a18) Co-authored-by: Tal Einat <taleinat+github@gmail.com>
|
GH-15107 is a backport of this pull request to the 3.8 branch. |
|
GH-15108 is a backport of this pull request to the 3.7 branch. |
Convert mouse y to line number in the sidebar rather than the text. (cherry picked from commit 86f1a18) Co-authored-by: Tal Einat <taleinat+github@gmail.com>
Convert mouse y to line number in the sidebar rather than the text.
Convert mouse y to line number in the sidebar rather than the text.
Convert mouse y to line number in the sidebar rather than the text.
The test failures were caused by the sidebar code getting screen coordinates from the main editor window's text widget rather than the sidebar's text widget. Empirically, these are not in sync quite as expected when running tests.
This PR also fixes an actual bug (i.e. not only tests): Drag-selecting a range of lines by click-dragging on the line numbers, and then clicking a line number outside of the selected range, expands the selection range rather than selecting only the corresponding line. This is very problematic to test automatically, so the htest has been expanded to cover this too.
https://bugs.python.org/issue37706