Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 61e6b6a

Browse files
[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 974a978) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent a860b1d commit 61e6b6a

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

Lib/test/test_ttk/test_widgets.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
import sys
66

77
from test.test_ttk_textonly import MockTclObj
8-
from test.test_tkinter.support import (AbstractTkTest, tk_version, get_tk_patchlevel,
9-
simulate_mouse_click, AbstractDefaultRootTest)
8+
from test.test_tkinter.support import (
9+
AbstractTkTest, requires_tk, tk_version, get_tk_patchlevel,
10+
simulate_mouse_click, AbstractDefaultRootTest)
1011
from test.test_tkinter.widget_tests import (add_standard_options,
1112
AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests)
1213

@@ -44,6 +45,10 @@ def padding_conv(value):
4445
self.checkParam(widget, 'padding', ('5p', '6p', '7p', '8p'))
4546
self.checkParam(widget, 'padding', (), expected='')
4647

48+
def test_configure_state(self):
49+
widget = self.create()
50+
self.checkParams(widget, 'state', 'active', 'disabled', 'readonly')
51+
4752
def test_configure_style(self):
4853
widget = self.create()
4954
self.assertEqual(widget['style'], '')
@@ -183,10 +188,6 @@ def test_configure_compound(self):
183188
widget = self.create()
184189
self.checkEnumParam(widget, 'compound', *values, allow_empty=True)
185190

186-
def test_configure_state(self):
187-
widget = self.create()
188-
self.checkParams(widget, 'state', 'active', 'disabled', 'normal')
189-
190191
def test_configure_width(self):
191192
widget = self.create()
192193
self.checkParams(widget, 'width', 402, -402, 0)
@@ -359,11 +360,6 @@ def test_configure_show(self):
359360
self.checkParam(widget, 'show', '')
360361
self.checkParam(widget, 'show', ' ')
361362

362-
def test_configure_state(self):
363-
widget = self.create()
364-
self.checkParams(widget, 'state',
365-
'disabled', 'normal', 'readonly')
366-
367363
def test_configure_validate(self):
368364
widget = self.create()
369365
self.checkEnumParam(widget, 'validate',
@@ -803,7 +799,7 @@ def test_configure_menu(self):
803799
class ScaleTest(AbstractWidgetTest, unittest.TestCase):
804800
OPTIONS = (
805801
'class', 'command', 'cursor', 'from', 'length',
806-
'orient', 'style', 'takefocus', 'to', 'value', 'variable',
802+
'orient', 'state', 'style', 'takefocus', 'to', 'value', 'variable',
807803
)
808804
_conv_pixels = False
809805
default_orient = 'horizontal'
@@ -825,6 +821,8 @@ def test_configure_length(self):
825821
widget = self.create()
826822
self.checkPixelsParam(widget, 'length', 130, 131.2, 135.6, '5i')
827823

824+
test_configure_state = requires_tk(8, 6, 9)(StandardTtkOptionsTests.test_configure_state)
825+
828826
def test_configure_to(self):
829827
widget = self.create()
830828
self.checkFloatParam(widget, 'to', 300, 14.9, 15.1, -10, conv=False)

0 commit comments

Comments
 (0)