diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-06-22 11:45:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-22 11:45:19 (GMT) |
commit | 61e6b6ab4abc36fe82f42677e3212caf973da467 (patch) | |
tree | e77d3f02fe8d9b820a789b798240c44cffd9495d | |
parent | a860b1d60b8e3d09c58daf6996a38606f407a009 (diff) | |
download | cpython-61e6b6ab4abc36fe82f42677e3212caf973da467.zip cpython-61e6b6ab4abc36fe82f42677e3212caf973da467.tar.gz cpython-61e6b6ab4abc36fe82f42677e3212caf973da467.tar.bz2 |
[3.13] gh-120873: Add test for "state" option in ttk.Scale (GH-120874) (GH-120875)
Also refactor the "state" option tests for other ttk widgets.
(cherry picked from commit 974a978631bfbfa6f617e927d5eaa82b06694ae5)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
-rw-r--r-- | Lib/test/test_ttk/test_widgets.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Lib/test/test_ttk/test_widgets.py b/Lib/test/test_ttk/test_widgets.py index 2eb2c44..0c8931b 100644 --- a/Lib/test/test_ttk/test_widgets.py +++ b/Lib/test/test_ttk/test_widgets.py @@ -5,8 +5,9 @@ from test.support import requires, gc_collect import sys from test.test_ttk_textonly import MockTclObj -from test.test_tkinter.support import (AbstractTkTest, tk_version, get_tk_patchlevel, - simulate_mouse_click, AbstractDefaultRootTest) +from test.test_tkinter.support import ( + AbstractTkTest, requires_tk, tk_version, get_tk_patchlevel, + simulate_mouse_click, AbstractDefaultRootTest) from test.test_tkinter.widget_tests import (add_standard_options, AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests) @@ -44,6 +45,10 @@ class StandardTtkOptionsTests(StandardOptionsTests): self.checkParam(widget, 'padding', ('5p', '6p', '7p', '8p')) self.checkParam(widget, 'padding', (), expected='') + def test_configure_state(self): + widget = self.create() + self.checkParams(widget, 'state', 'active', 'disabled', 'readonly') + def test_configure_style(self): widget = self.create() self.assertEqual(widget['style'], '') @@ -183,10 +188,6 @@ class AbstractLabelTest(AbstractWidgetTest): widget = self.create() self.checkEnumParam(widget, 'compound', *values, allow_empty=True) - def test_configure_state(self): - widget = self.create() - self.checkParams(widget, 'state', 'active', 'disabled', 'normal') - def test_configure_width(self): widget = self.create() self.checkParams(widget, 'width', 402, -402, 0) @@ -359,11 +360,6 @@ class EntryTest(AbstractWidgetTest, unittest.TestCase): self.checkParam(widget, 'show', '') self.checkParam(widget, 'show', ' ') - def test_configure_state(self): - widget = self.create() - self.checkParams(widget, 'state', - 'disabled', 'normal', 'readonly') - def test_configure_validate(self): widget = self.create() self.checkEnumParam(widget, 'validate', @@ -803,7 +799,7 @@ class MenubuttonTest(AbstractLabelTest, unittest.TestCase): class ScaleTest(AbstractWidgetTest, unittest.TestCase): OPTIONS = ( 'class', 'command', 'cursor', 'from', 'length', - 'orient', 'style', 'takefocus', 'to', 'value', 'variable', + 'orient', 'state', 'style', 'takefocus', 'to', 'value', 'variable', ) _conv_pixels = False default_orient = 'horizontal' @@ -825,6 +821,8 @@ class ScaleTest(AbstractWidgetTest, unittest.TestCase): widget = self.create() self.checkPixelsParam(widget, 'length', 130, 131.2, 135.6, '5i') + test_configure_state = requires_tk(8, 6, 9)(StandardTtkOptionsTests.test_configure_state) + def test_configure_to(self): widget = self.create() self.checkFloatParam(widget, 'to', 300, 14.9, 15.1, -10, conv=False) |