Skip to content

Commit b066cd5

Browse files
miss-islingtonserhiy-storchakaclaude
authored
[3.13] gh-69134: Wait until mapped in keyboard virtual-event tests (GH-152599) (GH-152607)
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 a24c036 commit b066cd5

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
@@ -1845,7 +1845,7 @@ def test_selection_event(self):
18451845
lb = self.create(selectmode='browse', exportselection=False)
18461846
lb.insert(0, *('el%d' % i for i in range(5)))
18471847
lb.pack()
1848-
lb.update()
1848+
self.require_mapped(lb)
18491849
events = []
18501850
lb.bind('<<ListboxSelect>>', lambda e: events.append(lb.curselection()))
18511851
lb.focus_force()

Lib/test/test_ttk/test_widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ def test_virtual_events(self):
19421942
self.tv.insert(parent, 'end')
19431943
item2 = self.tv.insert('', 'end')
19441944
self.tv.pack()
1945-
self.tv.update()
1945+
self.require_mapped(self.tv)
19461946
selects, opens, closes = [], [], []
19471947
self.tv.bind('<<TreeviewSelect>>',
19481948
lambda e: selects.append(self.tv.selection()))

0 commit comments

Comments
 (0)