FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-69134: Wait until mapped in SimpleDialog keyboard tests by serhiy-storchaka · Pull Request #152690 · python/cpython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
7 changes: 7 additions & 0 deletions Lib/test/test_tkinter/test_simpledialog.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_use_ttk(self):
self.assertEqual(str(d.root.cget('background')),
ttk.Style(d.root).lookup('.', 'background'))
# The bindings work with the themed buttons too.
self.require_mapped(d.root)
d._buttons[0].focus_force()
d.root.update()
d.root.event_generate('<Return>')
Expand Down Expand Up @@ -139,6 +140,7 @@ def test_alt_key(self):
# Alt + an underlined character (the "underline" button option) invokes
# the matching button (cf. tk::AmpWidget in tk::MessageBox).
d = self.create(buttons=['Yes', {'text': 'No', 'underline': 0}])
self.require_mapped(d.root)
d._buttons[0].focus_force()
d.root.update()
d.root.event_generate('<Alt-n>') # "No" -> underline 0 -> "N"
Expand All @@ -149,6 +151,7 @@ def test_return_invokes_focused_button(self):
# <Return> invokes the button with the focus, even if it is not the
# default and the focus was not moved by keyboard traversal.
d = self.create(buttons=['Yes', 'No']) # default 0
self.require_mapped(d.root)
d._buttons[1].focus_force()
d.root.update()
d.root.event_generate('<Return>')
Expand All @@ -158,6 +161,7 @@ def test_return_invokes_focused_button(self):
def test_focus_next_then_return(self):
# <Tab> moves the focus to the next button; <Return> invokes it.
d = self.create(buttons=['Yes', 'No'])
self.require_mapped(d.root)
d._buttons[0].focus_force()
d.root.update()
d._buttons[0].event_generate('<Tab>')
Expand All @@ -169,6 +173,7 @@ def test_focus_next_then_return(self):
def test_focus_prev_then_return(self):
# <Shift-Tab> moves the focus to the previous button.
d = self.create(buttons=['Yes', 'No'])
self.require_mapped(d.root)
d._buttons[1].focus_force()
d.root.update()
d._buttons[1].event_generate('<Shift-Tab>')
Expand All @@ -180,6 +185,7 @@ def test_focus_prev_then_return(self):
def test_return_activates_default(self):
# <Return> with the focus off the buttons invokes the default button.
d = self.create() # default 0
self.require_mapped(d.root)
d.root.focus_force() # the dialog, not a button, has the focus
d.root.update()
d.root.event_generate('<Return>')
Expand All @@ -190,6 +196,7 @@ def test_return_no_default(self):
# With no default button, <Return> off the buttons rings the bell and
# leaves the dialog open instead of activating a button.
d = self.create(default=None)
self.require_mapped(d.root)
d.root.focus_force() # the dialog, not a button, has the focus
d.root.update()
bells = []
Expand Down
Loading

Back | FazBrowse Home | New Git URL