diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-07-23 19:00:44 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-07-23 19:00:44 (GMT) |
commit | 320f339131c8b64b6be85f31e739f269be09950d (patch) | |
tree | dbf167140cce05b707e386523c36d85687564de2 /Lib/tkinter/test | |
parent | 6e20460dc6356d213e816bbbd8dc6a336c83bbd0 (diff) | |
download | cpython-320f339131c8b64b6be85f31e739f269be09950d.zip cpython-320f339131c8b64b6be85f31e739f269be09950d.tar.gz cpython-320f339131c8b64b6be85f31e739f269be09950d.tar.bz2 |
Issue #6167: Scrollbar.activate() now returns the name of active element if
the argument is not specified. Scrollbar.set() now always accepts only 2
arguments. Added tests for Scrollbar.activate() and Scrollbar.set().
Diffstat (limited to 'Lib/tkinter/test')
-rw-r--r-- | Lib/tkinter/test/test_tkinter/test_widgets.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/tkinter/test/test_tkinter/test_widgets.py b/Lib/tkinter/test/test_tkinter/test_widgets.py index 310fa92..6e3836f 100644 --- a/Lib/tkinter/test/test_tkinter/test_widgets.py +++ b/Lib/tkinter/test/test_tkinter/test_widgets.py @@ -916,6 +916,25 @@ class ScrollbarTest(AbstractWidgetTest, unittest.TestCase): self.checkEnumParam(widget, 'orient', 'vertical', 'horizontal', errmsg='bad orientation "{}": must be vertical or horizontal') + def test_activate(self): + sb = self.create() + for e in ('arrow1', 'slider', 'arrow2'): + sb.activate(e) + self.assertEqual(sb.activate(), e) + sb.activate('') + self.assertIsNone(sb.activate()) + self.assertRaises(TypeError, sb.activate, 'arrow1', 'arrow2') + + def test_set(self): + sb = self.create() + sb.set(0.2, 0.4) + self.assertEqual(sb.get(), (0.2, 0.4)) + self.assertRaises(TclError, sb.set, 'abc', 'def') + self.assertRaises(TclError, sb.set, 0.6, 'def') + self.assertRaises(TclError, sb.set, 0.6, None) + self.assertRaises(TypeError, sb.set, 0.6) + self.assertRaises(TypeError, sb.set, 0.6, 0.7, 0.8) + @add_standard_options(StandardOptionsTests) class PanedWindowTest(AbstractWidgetTest, unittest.TestCase): |