Skip to content

Commit 57fa1da

Browse files
serhiy-storchakaclaude
authored andcommitted
gh-69134: Wait until mapped in keyboard virtual-event tests (GH-152599)
test_virtual_events and test_selection_event generate key events after focus_force(). On Windows these are only delivered once the toplevel is mapped, so they could be dropped and the test fail. Wait until the widget is mapped, as the other GUI tests already do. (cherry picked from commit be4eebb) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 9bea12a commit 57fa1da

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/test/test_tkinter/test_widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,7 +1934,7 @@ def test_selection_event(self):
19341934
lb = self.create(selectmode='browse', exportselection=False)
19351935
lb.insert(0, *('el%d' % i for i in range(5)))
19361936
lb.pack()
1937-
lb.update()
1937+
self.require_mapped(lb)
19381938
events = []
19391939
lb.bind('<<ListboxSelect>>', lambda e: events.append(lb.curselection()))
19401940
lb.focus_force()

Lib/test/test_ttk/test_widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,7 @@ def test_virtual_events(self):
19771977
self.tv.insert(parent, 'end')
19781978
item2 = self.tv.insert('', 'end')
19791979
self.tv.pack()
1980-
self.tv.update()
1980+
self.require_mapped(self.tv)
19811981
selects, opens, closes = [], [], []
19821982
self.tv.bind('<<TreeviewSelect>>',
19831983
lambda e: selects.append(self.tv.selection()))

0 commit comments

Comments
 (0)