@@ -167,6 +167,7 @@ def test_configure_labelwidget(self):
167167
168168
169169class AbstractLabelTest (AbstractWidgetTest ):
170+ _allow_empty_justify = True
170171
171172 def checkImageParam (self , widget , name ):
172173 image = tkinter .PhotoImage (master = self .root , name = 'image1' )
@@ -188,6 +189,8 @@ def test_configure_compound(self):
188189 widget = self .create ()
189190 self .checkEnumParam (widget , 'compound' , * values , allow_empty = True )
190191
192+ test_configure_justify = requires_tk (8 , 7 )(StandardOptionsTests .test_configure_justify )
193+
191194 def test_configure_width (self ):
192195 widget = self .create ()
193196 self .checkParams (widget , 'width' , 402 , - 402 , 0 )
@@ -203,28 +206,19 @@ class LabelTest(AbstractLabelTest, unittest.TestCase):
203206 'underline' , 'width' , 'wraplength' ,
204207 )
205208 _conv_pixels = False
209+ _allow_empty_justify = tk_version >= (8 , 7 )
206210
207211 def create (self , ** kwargs ):
208212 return ttk .Label (self .root , ** kwargs )
209213
210- def test_configure_font (self ):
211- widget = self .create ()
212- self .checkParam (widget , 'font' ,
213- '-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*' )
214+ test_configure_justify = StandardOptionsTests .test_configure_justify
214215
215- def test_configure_justify (self ):
216- widget = self .create ()
217- values = ('left' , 'right' , 'center' )
218- if tk_version >= (8 , 7 ):
219- values += ('' ,)
220- self .checkEnumParam (widget , 'justify' , * values ,
221- fullname = 'justification' )
222216
223217@add_standard_options (StandardTtkOptionsTests )
224218class ButtonTest (AbstractLabelTest , unittest .TestCase ):
225219 OPTIONS = (
226220 'class' , 'command' , 'compound' , 'cursor' , 'default' ,
227- 'image' , 'padding' , 'state' , 'style' ,
221+ 'image' , 'justify' , ' padding' , 'state' , 'style' ,
228222 'takefocus' , 'text' , 'textvariable' ,
229223 'underline' , 'width' ,
230224 )
@@ -249,7 +243,7 @@ def test_invoke(self):
249243class CheckbuttonTest (AbstractLabelTest , unittest .TestCase ):
250244 OPTIONS = (
251245 'class' , 'command' , 'compound' , 'cursor' ,
252- 'image' ,
246+ 'image' , 'justify' ,
253247 'offvalue' , 'onvalue' ,
254248 'padding' , 'state' , 'style' ,
255249 'takefocus' , 'text' , 'textvariable' ,
@@ -338,6 +332,7 @@ class EntryTest(AbstractWidgetTest, unittest.TestCase):
338332 'background' , 'class' , 'cursor' ,
339333 'exportselection' , 'font' , 'foreground' ,
340334 'invalidcommand' , 'justify' ,
335+ 'placeholder' , 'placeholderforeground' ,
341336 'show' , 'state' , 'style' , 'takefocus' , 'textvariable' ,
342337 'validate' , 'validatecommand' , 'width' , 'xscrollcommand' ,
343338 )
@@ -460,7 +455,8 @@ class ComboboxTest(EntryTest, unittest.TestCase):
460455 OPTIONS = (
461456 'background' , 'class' , 'cursor' , 'exportselection' ,
462457 'font' , 'foreground' , 'height' , 'invalidcommand' ,
463- 'justify' , 'postcommand' , 'show' , 'state' , 'style' ,
458+ 'justify' , 'placeholder' , 'placeholderforeground' , 'postcommand' ,
459+ 'show' , 'state' , 'style' ,
464460 'takefocus' , 'textvariable' ,
465461 'validate' , 'validatecommand' , 'values' ,
466462 'width' , 'xscrollcommand' ,
@@ -720,7 +716,7 @@ def test_sashpos(self):
720716class RadiobuttonTest (AbstractLabelTest , unittest .TestCase ):
721717 OPTIONS = (
722718 'class' , 'command' , 'compound' , 'cursor' ,
723- 'image' ,
719+ 'image' , 'justify' ,
724720 'padding' , 'state' , 'style' ,
725721 'takefocus' , 'text' , 'textvariable' ,
726722 'underline' , 'value' , 'variable' , 'width' ,
@@ -774,7 +770,7 @@ def cb_test():
774770class MenubuttonTest (AbstractLabelTest , unittest .TestCase ):
775771 OPTIONS = (
776772 'class' , 'compound' , 'cursor' , 'direction' ,
777- 'image' , 'menu' , 'padding' , 'state' , 'style' ,
773+ 'image' , 'justify' , ' menu' , 'padding' , 'state' , 'style' ,
778774 'takefocus' , 'text' , 'textvariable' ,
779775 'underline' , 'width' ,
780776 )
@@ -906,16 +902,28 @@ def test_set(self):
906902@add_standard_options (StandardTtkOptionsTests )
907903class ProgressbarTest (AbstractWidgetTest , unittest .TestCase ):
908904 OPTIONS = (
909- 'class' , 'cursor' , 'orient' , 'length' ,
910- 'mode' , 'maximum' , 'phase' ,
905+ 'anchor' , 'class' , 'cursor' , 'font' , 'foreground' , 'justify' ,
906+ 'orient' , 'length' ,
907+ 'mode' , 'maximum' , 'phase' , 'text' , 'wraplength' ,
911908 'style' , 'takefocus' , 'value' , 'variable' ,
912909 )
913910 _conv_pixels = False
911+ _allow_empty_justify = True
914912 default_orient = 'horizontal'
915913
916914 def create (self , ** kwargs ):
917915 return ttk .Progressbar (self .root , ** kwargs )
918916
917+ @requires_tk (8 , 7 )
918+ def test_configure_anchor (self ):
919+ widget = self .create ()
920+ self .checkEnumParam (widget , 'anchor' ,
921+ 'n' , 'ne' , 'e' , 'se' , 's' , 'sw' , 'w' , 'nw' , 'center' , '' )
922+
923+ test_configure_font = requires_tk (8 , 7 )(StandardOptionsTests .test_configure_font )
924+ test_configure_foreground = requires_tk (8 , 7 )(StandardOptionsTests .test_configure_foreground )
925+ test_configure_justify = requires_tk (8 , 7 )(StandardTtkOptionsTests .test_configure_justify )
926+
919927 def test_configure_length (self ):
920928 widget = self .create ()
921929 self .checkPixelsParam (widget , 'length' , 100.1 , 56.7 , '2i' )
@@ -932,11 +940,15 @@ def test_configure_phase(self):
932940 # XXX
933941 pass
934942
943+ test_configure_text = requires_tk (8 , 7 )(StandardOptionsTests .test_configure_text )
944+
935945 def test_configure_value (self ):
936946 widget = self .create ()
937947 self .checkFloatParam (widget , 'value' , 150.2 , 77.7 , 0 , - 10 ,
938948 conv = False )
939949
950+ test_configure_wraplength = requires_tk (8 , 7 )(StandardOptionsTests .test_configure_wraplength )
951+
940952
941953@unittest .skipIf (sys .platform == 'darwin' ,
942954 'ttk.Scrollbar is special on MacOSX' )
@@ -1173,7 +1185,9 @@ class SpinboxTest(EntryTest, unittest.TestCase):
11731185 OPTIONS = (
11741186 'background' , 'class' , 'command' , 'cursor' , 'exportselection' ,
11751187 'font' , 'foreground' , 'format' , 'from' , 'increment' ,
1176- 'invalidcommand' , 'justify' , 'show' , 'state' , 'style' ,
1188+ 'invalidcommand' , 'justify' ,
1189+ 'placeholder' , 'placeholderforeground' ,
1190+ 'show' , 'state' , 'style' ,
11771191 'takefocus' , 'textvariable' , 'to' , 'validate' , 'validatecommand' ,
11781192 'values' , 'width' , 'wrap' , 'xscrollcommand' ,
11791193 )
@@ -1347,8 +1361,9 @@ def test_configure_values(self):
13471361class TreeviewTest (AbstractWidgetTest , unittest .TestCase ):
13481362 OPTIONS = (
13491363 'class' , 'columns' , 'cursor' , 'displaycolumns' ,
1350- 'height' , 'padding' , 'selectmode' , 'show' ,
1351- 'style' , 'takefocus' , 'xscrollcommand' , 'yscrollcommand' ,
1364+ 'height' , 'padding' , 'selectmode' , 'selecttype' , 'show' , 'striped' ,
1365+ 'style' , 'takefocus' , 'titlecolumns' , 'titleitems' ,
1366+ 'xscrollcommand' , 'yscrollcommand' ,
13521367 )
13531368
13541369 def setUp (self ):
@@ -1393,6 +1408,11 @@ def test_configure_selectmode(self):
13931408 self .checkEnumParam (widget , 'selectmode' ,
13941409 'none' , 'browse' , 'extended' )
13951410
1411+ @requires_tk (8 , 7 )
1412+ def test_configure_selecttype (self ):
1413+ widget = self .create ()
1414+ self .checkEnumParam (widget , 'selecttype' , 'item' , 'cell' )
1415+
13961416 def test_configure_show (self ):
13971417 widget = self .create ()
13981418 self .checkParam (widget , 'show' , 'tree headings' ,
@@ -1402,6 +1422,23 @@ def test_configure_show(self):
14021422 self .checkParam (widget , 'show' , 'tree' , expected = ('tree' ,))
14031423 self .checkParam (widget , 'show' , 'headings' , expected = ('headings' ,))
14041424
1425+ @requires_tk (8 , 7 )
1426+ def test_configure_striped (self ):
1427+ widget = self .create ()
1428+ self .checkBooleanParam (widget , 'striped' )
1429+
1430+ @requires_tk (8 , 7 )
1431+ def test_configure_titlecolumns (self ):
1432+ widget = self .create ()
1433+ self .checkIntegerParam (widget , 'titlecolumns' , 0 , 1 , 5 )
1434+ self .checkInvalidParam (widget , 'titlecolumns' , - 2 )
1435+
1436+ @requires_tk (8 , 7 )
1437+ def test_configure_titleitems (self ):
1438+ widget = self .create ()
1439+ self .checkIntegerParam (widget , 'titleitems' , 0 , 1 , 5 )
1440+ self .checkInvalidParam (widget , 'titleitems' , - 2 )
1441+
14051442 def test_bbox (self ):
14061443 self .tv .pack ()
14071444 self .assertEqual (self .tv .bbox ('' ), '' )
0 commit comments