Skip to content

[3.15] gh-154357: Fix tkinter, ttk and IDLE tests depending on the window manager (GH-154370) - #157063

Open
serhiy-storchaka wants to merge 2 commits into
python:3.15from
serhiy-storchaka:backport-3b56438-3.15
Open

[3.15] gh-154357: Fix tkinter, ttk and IDLE tests depending on the window manager (GH-154370)#157063
serhiy-storchaka wants to merge 2 commits into
python:3.15from
serhiy-storchaka:backport-3b56438-3.15

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

Manual backport of GH-154370: the cherry-pick does not apply, because this branch does not have all the tests which the original commit changes. The changes to test_wm_stackorder are omitted -- there is no such test on this branch.

The window manager can take the focus from the application, ignore lift() and resize a toplevel on its own. Tk delivers generated keyboard events to the window which has the focus, so a test which lost the focus does not get the event at all.

  • Hide the root window in the dialog tests, so that it does not compete for the focus.
  • Take the focus right before generating a key event.
  • Tolerate additional focus events.
  • Do not check focus_get() and focus_displayof() without the focus.
  • Resize the toplevel to fit its content in wait_until_mapped().

…the window manager (pythonGH-154370)

The window manager can take the focus from the application, ignore
lift() and resize a toplevel on its own.

* Hide the root window in the dialog tests, so that it does not compete
  for the focus.
* Take the focus right before generating a key event.
* Tolerate additional focus events.
* Do not check focus_get() and focus_displayof() without the focus.
* Resize the toplevel to fit its content in wait_until_mapped().

(cherry picked from commit 3b56438)
SimpleDialog makes its window transient for the master unconditionally on
this branch, and a transient of a hidden window is never mapped on
Windows, so that go() blocks in wait_visibility().
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.

1 participant