]> granicus.if.org Git - python/commitdiff
Issue #19085: Fix Tkinter tests on Tk 8.5 with patchlevel < 8.5.12.
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 4 Nov 2013 20:10:35 +0000 (22:10 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 4 Nov 2013 20:10:35 +0000 (22:10 +0200)
Lib/lib-tk/test/widget_tests.py

index 7402d91f2d7cc1ef619cfbe848ee38edaa495857..c60673cc2d13c4d0192dc75b29845d770bc63d64 100644 (file)
@@ -11,10 +11,22 @@ noconv_meth = noconv and staticmethod(noconv)
 def int_round(x):
     return int(round(x))
 
+pixels_round = int_round
+if tcl_version[:2] == (8, 5):
+    # Issue #19085: Workaround a bug in Tk
+    # http://core.tcl.tk/tk/info/3497848
+    root = setup_master()
+    patchlevel = root.call('info', 'patchlevel')
+    patchlevel = tuple(map(int, patchlevel.split('.')))
+    if patchlevel < (8, 5, 12):
+        pixels_round = int
+    del root
+
+
 _sentinel = object()
 
 class AbstractWidgetTest(object):
-    _conv_pixels = staticmethod(int_round)
+    _conv_pixels = staticmethod(pixels_round)
     _conv_pad_pixels = None
     wantobjects = True