Commit 65994395 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Fixed new Tkinter tests added in issue #21522 with Tk 8.4.

parent 4f0e1674
...@@ -958,12 +958,15 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase): ...@@ -958,12 +958,15 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
self.assertEqual(v, p.paneconfigure(b, k)) self.assertEqual(v, p.paneconfigure(b, k))
self.assertEqual(v[4], p.panecget(b, k)) self.assertEqual(v[4], p.panecget(b, k))
def check_paneconfigure(self, p, b, name, value, expected): def check_paneconfigure(self, p, b, name, value, expected, stringify=False):
if not self.wantobjects: conv = lambda x: x
if not self.wantobjects or stringify:
expected = str(expected) expected = str(expected)
if self.wantobjects and stringify:
conv = str
p.paneconfigure(b, **{name: value}) p.paneconfigure(b, **{name: value})
self.assertEqual(p.paneconfigure(b, name)[4], expected) self.assertEqual(conv(p.paneconfigure(b, name)[4]), expected)
self.assertEqual(p.panecget(b, name), expected) self.assertEqual(conv(p.panecget(b, name)), expected)
def check_paneconfigure_bad(self, p, b, name, msg): def check_paneconfigure_bad(self, p, b, name, msg):
with self.assertRaisesRegexp(TclError, msg): with self.assertRaisesRegexp(TclError, msg):
...@@ -983,10 +986,12 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase): ...@@ -983,10 +986,12 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
def test_paneconfigure_height(self): def test_paneconfigure_height(self):
p, b, c = self.create2() p, b, c = self.create2()
self.check_paneconfigure(p, b, 'height', 10, 10) self.check_paneconfigure(p, b, 'height', 10, 10,
stringify=tcl_version < (8, 5))
self.check_paneconfigure_bad(p, b, 'height', self.check_paneconfigure_bad(p, b, 'height',
'bad screen distance "badValue"') 'bad screen distance "badValue"')
@requires_tcl(8, 5)
def test_paneconfigure_hide(self): def test_paneconfigure_hide(self):
p, b, c = self.create2() p, b, c = self.create2()
self.check_paneconfigure(p, b, 'hide', False, 0) self.check_paneconfigure(p, b, 'hide', False, 0)
...@@ -1019,6 +1024,7 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase): ...@@ -1019,6 +1024,7 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
'be a string containing zero or more of ' 'be a string containing zero or more of '
'n, e, s, and w') 'n, e, s, and w')
@requires_tcl(8, 5)
def test_paneconfigure_stretch(self): def test_paneconfigure_stretch(self):
p, b, c = self.create2() p, b, c = self.create2()
self.check_paneconfigure(p, b, 'stretch', 'alw', 'always') self.check_paneconfigure(p, b, 'stretch', 'alw', 'always')
...@@ -1028,7 +1034,8 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase): ...@@ -1028,7 +1034,8 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
def test_paneconfigure_width(self): def test_paneconfigure_width(self):
p, b, c = self.create2() p, b, c = self.create2()
self.check_paneconfigure(p, b, 'width', 10, 10) self.check_paneconfigure(p, b, 'width', 10, 10,
stringify=tcl_version < (8, 5))
self.check_paneconfigure_bad(p, b, 'width', self.check_paneconfigure_bad(p, b, 'width',
'bad screen distance "badValue"') 'bad screen distance "badValue"')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment