@@ -167,6 +167,7 @@ def test_configure_labelwidget(self):
167
167
168
168
169
169
class AbstractLabelTest (AbstractWidgetTest ):
170
+ _allow_empty_justify = True
170
171
171
172
def checkImageParam (self , widget , name ):
172
173
image = tkinter .PhotoImage (master = self .root , name = 'image1' )
@@ -188,6 +189,8 @@ def test_configure_compound(self):
188
189
widget = self .create ()
189
190
self .checkEnumParam (widget , 'compound' , * values , allow_empty = True )
190
191
192
+ test_configure_justify = requires_tk (8 , 7 )(StandardOptionsTests .test_configure_justify )
193
+
191
194
def test_configure_width (self ):
192
195
widget = self .create ()
193
196
self .checkParams (widget , 'width' , 402 , - 402 , 0 )
@@ -203,28 +206,19 @@ class LabelTest(AbstractLabelTest, unittest.TestCase):
203
206
'underline' , 'width' , 'wraplength' ,
204
207
)
205
208
_conv_pixels = False
209
+ _allow_empty_justify = tk_version >= (8 , 7 )
206
210
207
211
def create (self , ** kwargs ):
208
212
return ttk .Label (self .root , ** kwargs )
209
213
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
214
215
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' )
222
216
223
217
@add_standard_options (StandardTtkOptionsTests )
224
218
class ButtonTest (AbstractLabelTest , unittest .TestCase ):
225
219
OPTIONS = (
226
220
'class' , 'command' , 'compound' , 'cursor' , 'default' ,
227
- 'image' , 'padding' , 'state' , 'style' ,
221
+ 'image' , 'justify' , ' padding' , 'state' , 'style' ,
228
222
'takefocus' , 'text' , 'textvariable' ,
229
223
'underline' , 'width' ,
230
224
)
@@ -249,7 +243,7 @@ def test_invoke(self):
249
243
class CheckbuttonTest (AbstractLabelTest , unittest .TestCase ):
250
244
OPTIONS = (
251
245
'class' , 'command' , 'compound' , 'cursor' ,
252
- 'image' ,
246
+ 'image' , 'justify' ,
253
247
'offvalue' , 'onvalue' ,
254
248
'padding' , 'state' , 'style' ,
255
249
'takefocus' , 'text' , 'textvariable' ,
@@ -338,6 +332,7 @@ class EntryTest(AbstractWidgetTest, unittest.TestCase):
338
332
'background' , 'class' , 'cursor' ,
339
333
'exportselection' , 'font' , 'foreground' ,
340
334
'invalidcommand' , 'justify' ,
335
+ 'placeholder' , 'placeholderforeground' ,
341
336
'show' , 'state' , 'style' , 'takefocus' , 'textvariable' ,
342
337
'validate' , 'validatecommand' , 'width' , 'xscrollcommand' ,
343
338
)
@@ -460,7 +455,8 @@ class ComboboxTest(EntryTest, unittest.TestCase):
460
455
OPTIONS = (
461
456
'background' , 'class' , 'cursor' , 'exportselection' ,
462
457
'font' , 'foreground' , 'height' , 'invalidcommand' ,
463
- 'justify' , 'postcommand' , 'show' , 'state' , 'style' ,
458
+ 'justify' , 'placeholder' , 'placeholderforeground' , 'postcommand' ,
459
+ 'show' , 'state' , 'style' ,
464
460
'takefocus' , 'textvariable' ,
465
461
'validate' , 'validatecommand' , 'values' ,
466
462
'width' , 'xscrollcommand' ,
@@ -720,7 +716,7 @@ def test_sashpos(self):
720
716
class RadiobuttonTest (AbstractLabelTest , unittest .TestCase ):
721
717
OPTIONS = (
722
718
'class' , 'command' , 'compound' , 'cursor' ,
723
- 'image' ,
719
+ 'image' , 'justify' ,
724
720
'padding' , 'state' , 'style' ,
725
721
'takefocus' , 'text' , 'textvariable' ,
726
722
'underline' , 'value' , 'variable' , 'width' ,
@@ -774,7 +770,7 @@ def cb_test():
774
770
class MenubuttonTest (AbstractLabelTest , unittest .TestCase ):
775
771
OPTIONS = (
776
772
'class' , 'compound' , 'cursor' , 'direction' ,
777
- 'image' , 'menu' , 'padding' , 'state' , 'style' ,
773
+ 'image' , 'justify' , ' menu' , 'padding' , 'state' , 'style' ,
778
774
'takefocus' , 'text' , 'textvariable' ,
779
775
'underline' , 'width' ,
780
776
)
@@ -906,16 +902,28 @@ def test_set(self):
906
902
@add_standard_options (StandardTtkOptionsTests )
907
903
class ProgressbarTest (AbstractWidgetTest , unittest .TestCase ):
908
904
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' ,
911
908
'style' , 'takefocus' , 'value' , 'variable' ,
912
909
)
913
910
_conv_pixels = False
911
+ _allow_empty_justify = True
914
912
default_orient = 'horizontal'
915
913
916
914
def create (self , ** kwargs ):
917
915
return ttk .Progressbar (self .root , ** kwargs )
918
916
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
+
919
927
def test_configure_length (self ):
920
928
widget = self .create ()
921
929
self .checkPixelsParam (widget , 'length' , 100.1 , 56.7 , '2i' )
@@ -932,11 +940,15 @@ def test_configure_phase(self):
932
940
# XXX
933
941
pass
934
942
943
+ test_configure_text = requires_tk (8 , 7 )(StandardOptionsTests .test_configure_text )
944
+
935
945
def test_configure_value (self ):
936
946
widget = self .create ()
937
947
self .checkFloatParam (widget , 'value' , 150.2 , 77.7 , 0 , - 10 ,
938
948
conv = False )
939
949
950
+ test_configure_wraplength = requires_tk (8 , 7 )(StandardOptionsTests .test_configure_wraplength )
951
+
940
952
941
953
@unittest .skipIf (sys .platform == 'darwin' ,
942
954
'ttk.Scrollbar is special on MacOSX' )
@@ -1173,7 +1185,9 @@ class SpinboxTest(EntryTest, unittest.TestCase):
1173
1185
OPTIONS = (
1174
1186
'background' , 'class' , 'command' , 'cursor' , 'exportselection' ,
1175
1187
'font' , 'foreground' , 'format' , 'from' , 'increment' ,
1176
- 'invalidcommand' , 'justify' , 'show' , 'state' , 'style' ,
1188
+ 'invalidcommand' , 'justify' ,
1189
+ 'placeholder' , 'placeholderforeground' ,
1190
+ 'show' , 'state' , 'style' ,
1177
1191
'takefocus' , 'textvariable' , 'to' , 'validate' , 'validatecommand' ,
1178
1192
'values' , 'width' , 'wrap' , 'xscrollcommand' ,
1179
1193
)
@@ -1347,8 +1361,9 @@ def test_configure_values(self):
1347
1361
class TreeviewTest (AbstractWidgetTest , unittest .TestCase ):
1348
1362
OPTIONS = (
1349
1363
'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' ,
1352
1367
)
1353
1368
1354
1369
def setUp (self ):
@@ -1393,6 +1408,11 @@ def test_configure_selectmode(self):
1393
1408
self .checkEnumParam (widget , 'selectmode' ,
1394
1409
'none' , 'browse' , 'extended' )
1395
1410
1411
+ @requires_tk (8 , 7 )
1412
+ def test_configure_selecttype (self ):
1413
+ widget = self .create ()
1414
+ self .checkEnumParam (widget , 'selecttype' , 'item' , 'cell' )
1415
+
1396
1416
def test_configure_show (self ):
1397
1417
widget = self .create ()
1398
1418
self .checkParam (widget , 'show' , 'tree headings' ,
@@ -1402,6 +1422,23 @@ def test_configure_show(self):
1402
1422
self .checkParam (widget , 'show' , 'tree' , expected = ('tree' ,))
1403
1423
self .checkParam (widget , 'show' , 'headings' , expected = ('headings' ,))
1404
1424
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
+
1405
1442
def test_bbox (self ):
1406
1443
self .tv .pack ()
1407
1444
self .assertEqual (self .tv .bbox ('' ), '' )
0 commit comments