Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-37706: fix sidebar drag tests #15103

Merged

Conversation

taleinat
Copy link
Contributor

@taleinat taleinat commented Aug 4, 2019

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

@taleinat
Copy link
Contributor Author

taleinat commented Aug 4, 2019

I think this doesn't need a NEWS entry since it hasn't yet been included in any (non-beta) release.

Copy link
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@miss-islington
Copy link
Contributor

Thanks @taleinat for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 4, 2019
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>
@bedevere-bot
Copy link

GH-15107 is a backport of this pull request to the 3.8 branch.

@bedevere-bot
Copy link

GH-15108 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 4, 2019
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>
miss-islington added a commit that referenced this pull request Aug 4, 2019
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>
miss-islington added a commit that referenced this pull request Aug 4, 2019
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>
@taleinat taleinat deleted the bpo-37706/fix-sidebar-drag-tests branch August 13, 2019 18:04
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
Convert mouse y to line number in the sidebar rather than the text.
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
Convert mouse y to line number in the sidebar rather than the text.
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
Convert mouse y to line number in the sidebar rather than the text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants