Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f87854e7
Commit
f87854e7
authored
Nov 09, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Tkinter tests on Tk 8.5 with patchlevel < 8.5.11 (issue #19085).
parent
b8147452
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
22 deletions
+31
-22
Lib/lib-tk/test/test_tkinter/test_widgets.py
Lib/lib-tk/test/test_tkinter/test_widgets.py
+8
-3
Lib/lib-tk/test/test_ttk/support.py
Lib/lib-tk/test/test_ttk/support.py
+15
-0
Lib/lib-tk/test/widget_tests.py
Lib/lib-tk/test/widget_tests.py
+8
-19
No files found.
Lib/lib-tk/test/test_tkinter/test_widgets.py
View file @
f87854e7
...
@@ -3,7 +3,8 @@ import Tkinter
...
@@ -3,7 +3,8 @@ import Tkinter
import
os
import
os
from
test.test_support
import
requires
,
run_unittest
from
test.test_support
import
requires
,
run_unittest
from
test_ttk.support
import
tcl_version
,
requires_tcl
,
widget_eq
from
test_ttk.support
import
(
tcl_version
,
requires_tcl
,
get_tk_patchlevel
,
widget_eq
)
from
widget_tests
import
(
from
widget_tests
import
(
add_standard_options
,
noconv
,
noconv_meth
,
int_round
,
pixels_round
,
add_standard_options
,
noconv
,
noconv_meth
,
int_round
,
pixels_round
,
AbstractWidgetTest
,
StandardOptionsTests
,
AbstractWidgetTest
,
StandardOptionsTests
,
...
@@ -536,7 +537,7 @@ class TextTest(AbstractWidgetTest, unittest.TestCase):
...
@@ -536,7 +537,7 @@ class TextTest(AbstractWidgetTest, unittest.TestCase):
def
test_selectborderwidth
(
self
):
def
test_selectborderwidth
(
self
):
widget
=
self
.
create
()
widget
=
self
.
create
()
self
.
checkPixelsParam
(
widget
,
'selectborderwidth'
,
self
.
checkPixelsParam
(
widget
,
'selectborderwidth'
,
1.3
,
2.6
,
-
2
,
'10p'
,
conv
=
False
,
1.3
,
2.6
,
-
2
,
'10p'
,
conv
=
noconv
,
keep_orig
=
tcl_version
>=
(
8
,
5
))
keep_orig
=
tcl_version
>=
(
8
,
5
))
def
test_spacing1
(
self
):
def
test_spacing1
(
self
):
...
@@ -577,6 +578,10 @@ class TextTest(AbstractWidgetTest, unittest.TestCase):
...
@@ -577,6 +578,10 @@ class TextTest(AbstractWidgetTest, unittest.TestCase):
def
test_tabs
(
self
):
def
test_tabs
(
self
):
widget
=
self
.
create
()
widget
=
self
.
create
()
if
get_tk_patchlevel
()
<
(
8
,
5
,
11
):
self
.
checkParam
(
widget
,
'tabs'
,
(
10.2
,
20.7
,
'1i'
,
'2i'
),
expected
=
(
'10.2'
,
'20.7'
,
'1i'
,
'2i'
))
else
:
self
.
checkParam
(
widget
,
'tabs'
,
(
10.2
,
20.7
,
'1i'
,
'2i'
))
self
.
checkParam
(
widget
,
'tabs'
,
(
10.2
,
20.7
,
'1i'
,
'2i'
))
self
.
checkParam
(
widget
,
'tabs'
,
'10.2 20.7 1i 2i'
,
self
.
checkParam
(
widget
,
'tabs'
,
'10.2 20.7 1i 2i'
,
expected
=
(
'10.2'
,
'20.7'
,
'1i'
,
'2i'
))
expected
=
(
'10.2'
,
'20.7'
,
'1i'
,
'2i'
))
...
...
Lib/lib-tk/test/test_ttk/support.py
View file @
f87854e7
...
@@ -41,6 +41,21 @@ def requires_tcl(*version):
...
@@ -41,6 +41,21 @@ def requires_tcl(*version):
return
unittest
.
skipUnless
(
tcl_version
>=
version
,
return
unittest
.
skipUnless
(
tcl_version
>=
version
,
'requires Tcl version >= '
+
'.'
.
join
(
map
(
str
,
version
)))
'requires Tcl version >= '
+
'.'
.
join
(
map
(
str
,
version
)))
_tk_patchlevel
=
None
def
get_tk_patchlevel
():
global
_tk_patchlevel
if
_tk_patchlevel
is
None
:
tcl
=
Tkinter
.
Tcl
()
patchlevel
=
[]
for
x
in
tcl
.
call
(
'info'
,
'patchlevel'
).
split
(
'.'
):
try
:
x
=
int
(
x
,
10
)
except
ValueError
:
x
=
-
1
patchlevel
.
append
(
x
)
_tk_patchlevel
=
tuple
(
patchlevel
)
return
_tk_patchlevel
units
=
{
units
=
{
'c'
:
72
/
2.54
,
# centimeters
'c'
:
72
/
2.54
,
# centimeters
'i'
:
72
,
# inches
'i'
:
72
,
# inches
...
...
Lib/lib-tk/test/widget_tests.py
View file @
f87854e7
...
@@ -2,31 +2,23 @@
...
@@ -2,31 +2,23 @@
import
Tkinter
import
Tkinter
from
ttk
import
setup_master
,
Scale
from
ttk
import
setup_master
,
Scale
from
test_ttk.support
import
tcl_version
,
requires_tcl
,
pixels_conv
,
tcl_obj_eq
from
test_ttk.support
import
(
tcl_version
,
requires_tcl
,
get_tk_patchlevel
,
pixels_conv
,
tcl_obj_eq
)
noconv
=
str
if
tcl_version
<
(
8
,
5
)
else
False
noconv
=
noconv_meth
=
False
if
get_tk_patchlevel
()
<
(
8
,
5
,
11
):
noconv
=
str
noconv_meth
=
noconv
and
staticmethod
(
noconv
)
noconv_meth
=
noconv
and
staticmethod
(
noconv
)
def
int_round
(
x
):
def
int_round
(
x
):
return
int
(
round
(
x
))
return
int
(
round
(
x
))
pixels_round
=
int_round
pixels_round
=
int_round
if
tcl_version
[:
2
]
==
(
8
,
5
):
if
get_tk_patchlevel
()[:
3
]
==
(
8
,
5
,
11
):
# Issue #19085: Workaround a bug in Tk
# Issue #19085: Workaround a bug in Tk
# http://core.tcl.tk/tk/info/3497848
# http://core.tcl.tk/tk/info/3497848
_pixels_round
=
None
pixels_round
=
int
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
=
int_round
return
_pixels_round
(
x
)
_sentinel
=
object
()
_sentinel
=
object
()
...
@@ -424,10 +416,7 @@ class StandardOptionsTests(object):
...
@@ -424,10 +416,7 @@ class StandardOptionsTests(object):
def
test_wraplength
(
self
):
def
test_wraplength
(
self
):
widget
=
self
.
create
()
widget
=
self
.
create
()
if
tcl_version
<
(
8
,
5
):
self
.
checkPixelsParam
(
widget
,
'wraplength'
,
100
)
self
.
checkPixelsParam
(
widget
,
'wraplength'
,
100
)
else
:
self
.
checkParams
(
widget
,
'wraplength'
,
100
)
def
test_xscrollcommand
(
self
):
def
test_xscrollcommand
(
self
):
widget
=
self
.
create
()
widget
=
self
.
create
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment