The SimpleDialog keyboard tests generate key events after focus_force(),
which on Windows are dropped until the toplevel is mapped, so they could
fail intermittently (seen on the Windows10 buildbot as
test_return_no_default). Wait until the window is mapped in these tests,
as GH-152599 did for the other keyboard tests.
(cherry picked from commit
7d619c2fea131722d0bfdad150c081c44cc0abd7)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
def test_return_activates_default(self):
# <Return> invokes the default button.
d = self.create() # default 0
+ self.require_mapped(d.root)
d.root.focus_force()
d.root.update()
d.root.event_generate('<Return>')
# With no default button, <Return> 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()
d.root.update()
bells = []