mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix Tkinter tests on Tk 8.5 with patchlevel < 8.5.11 (issue #19085).
This commit is contained in:
parent
2915933f4f
commit
affb9b255b
3 changed files with 31 additions and 23 deletions
|
@ -2,28 +2,19 @@
|
|||
|
||||
import tkinter
|
||||
from tkinter.ttk import setup_master, Scale
|
||||
from tkinter.test.support import (tcl_version, requires_tcl, pixels_conv,
|
||||
tcl_obj_eq)
|
||||
from tkinter.test.support import (tcl_version, requires_tcl, get_tk_patchlevel,
|
||||
pixels_conv, tcl_obj_eq)
|
||||
|
||||
|
||||
noconv = str if tcl_version < (8, 5) else False
|
||||
noconv = False
|
||||
if get_tk_patchlevel() < (8, 5, 11):
|
||||
noconv = str
|
||||
|
||||
pixels_round = round
|
||||
if tcl_version[:2] == (8, 5):
|
||||
if get_tk_patchlevel()[:3] == (8, 5, 11):
|
||||
# Issue #19085: Workaround a bug in Tk
|
||||
# http://core.tcl.tk/tk/info/3497848
|
||||
_pixels_round = None
|
||||
def pixels_round(x):
|
||||
global _pixels_round
|
||||
if _pixels_round is None:
|
||||
root = setup_master()
|
||||
patchlevel = root.call('info', 'patchlevel')
|
||||
patchlevel = tuple(map(int, patchlevel.split('.')))
|
||||
if patchlevel < (8, 5, 12):
|
||||
_pixels_round = int
|
||||
else:
|
||||
_pixels_round = round
|
||||
return _pixels_round(x)
|
||||
pixels_round = int
|
||||
|
||||
|
||||
_sentinel = object()
|
||||
|
@ -406,10 +397,7 @@ class StandardOptionsTests:
|
|||
|
||||
def test_wraplength(self):
|
||||
widget = self.create()
|
||||
if tcl_version < (8, 5):
|
||||
self.checkPixelsParam(widget, 'wraplength', 100)
|
||||
else:
|
||||
self.checkParams(widget, 'wraplength', 100)
|
||||
self.checkPixelsParam(widget, 'wraplength', 100)
|
||||
|
||||
def test_xscrollcommand(self):
|
||||
widget = self.create()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue