Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 11f00f3

Browse files
committed
Issue #10736: Fix test_ttk test_widgets failures with Cocoa Tk 8.5.9
on Mac OS X. (Patch by Ronald Oussoren)
1 parent 68b543a commit 11f00f3

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

Lib/tkinter/test/test_ttk/test_widgets.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
from tkinter import ttk
55
from test.support import requires, run_unittest
6+
import sys
67

78
import tkinter.test.support as support
89
from tkinter.test.test_ttk.test_functions import MockTclObj, MockStateSpec
@@ -561,11 +562,19 @@ def test_tab_identifiers(self):
561562

562563
self.nb.pack()
563564
self.nb.wait_visibility()
564-
self.assertEqual(self.nb.tab('@5,5'), self.nb.tab('current'))
565+
if sys.platform == 'darwin':
566+
tb_idx = "@20,5"
567+
else:
568+
tb_idx = "@5,5"
569+
self.assertEqual(self.nb.tab(tb_idx), self.nb.tab('current'))
565570

566571
for i in range(5, 100, 5):
567-
if self.nb.tab('@%d, 5' % i, text=None) == 'a':
568-
break
572+
try:
573+
if self.nb.tab('@%d, 5' % i, text=None) == 'a':
574+
break
575+
except tkinter.TclError:
576+
pass
577+
569578
else:
570579
self.fail("Tab with text 'a' not found")
571580

@@ -722,7 +731,10 @@ def test_traversal(self):
722731
self.nb.enable_traversal()
723732
self.nb.focus_force()
724733
support.simulate_mouse_click(self.nb, 5, 5)
725-
self.nb.event_generate('<Alt-a>')
734+
if sys.platform == 'darwin':
735+
self.nb.event_generate('<Option-a>')
736+
else:
737+
self.nb.event_generate('<Alt-a>')
726738
self.assertEqual(self.nb.select(), str(self.child1))
727739

728740

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ Build
106106
Tests
107107
-----
108108

109+
- Issue #10736: Fix test_ttk test_widgets failures with Cocoa Tk 8.5.9
110+
on Mac OS X. (Patch by Ronald Oussoren)
111+
109112
- Issue #12057: Add tests for ISO 2022 codecs (iso2022_jp, iso2022_jp_2,
110113
iso2022_kr).
111114

0 commit comments

Comments
 (0)