mirror of https://github.com/python/cpython
gh-120873: Add tests for new widget options in Tk 8.7 (GH-120877)
This commit is contained in:
parent
974a978631
commit
a046c848c1
|
@ -61,11 +61,11 @@ class AbstractToplevelTest(AbstractWidgetTest, PixelSizeTests):
|
||||||
@add_standard_options(StandardOptionsTests)
|
@add_standard_options(StandardOptionsTests)
|
||||||
class ToplevelTest(AbstractToplevelTest, unittest.TestCase):
|
class ToplevelTest(AbstractToplevelTest, unittest.TestCase):
|
||||||
OPTIONS = (
|
OPTIONS = (
|
||||||
'background', 'borderwidth',
|
'background', 'backgroundimage', 'borderwidth',
|
||||||
'class', 'colormap', 'container', 'cursor', 'height',
|
'class', 'colormap', 'container', 'cursor', 'height',
|
||||||
'highlightbackground', 'highlightcolor', 'highlightthickness',
|
'highlightbackground', 'highlightcolor', 'highlightthickness',
|
||||||
'menu', 'padx', 'pady', 'relief', 'screen',
|
'menu', 'padx', 'pady', 'relief', 'screen',
|
||||||
'takefocus', 'use', 'visual', 'width',
|
'takefocus', 'tile', 'use', 'visual', 'width',
|
||||||
)
|
)
|
||||||
|
|
||||||
def create(self, **kwargs):
|
def create(self, **kwargs):
|
||||||
|
@ -104,10 +104,10 @@ class ToplevelTest(AbstractToplevelTest, unittest.TestCase):
|
||||||
@add_standard_options(StandardOptionsTests)
|
@add_standard_options(StandardOptionsTests)
|
||||||
class FrameTest(AbstractToplevelTest, unittest.TestCase):
|
class FrameTest(AbstractToplevelTest, unittest.TestCase):
|
||||||
OPTIONS = (
|
OPTIONS = (
|
||||||
'background', 'borderwidth',
|
'background', 'backgroundimage', 'borderwidth',
|
||||||
'class', 'colormap', 'container', 'cursor', 'height',
|
'class', 'colormap', 'container', 'cursor', 'height',
|
||||||
'highlightbackground', 'highlightcolor', 'highlightthickness',
|
'highlightbackground', 'highlightcolor', 'highlightthickness',
|
||||||
'padx', 'pady', 'relief', 'takefocus', 'visual', 'width',
|
'padx', 'pady', 'relief', 'takefocus', 'tile', 'visual', 'width',
|
||||||
)
|
)
|
||||||
|
|
||||||
def create(self, **kwargs):
|
def create(self, **kwargs):
|
||||||
|
@ -338,7 +338,8 @@ class EntryTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
'highlightbackground', 'highlightcolor', 'highlightthickness',
|
'highlightbackground', 'highlightcolor', 'highlightthickness',
|
||||||
'insertbackground', 'insertborderwidth',
|
'insertbackground', 'insertborderwidth',
|
||||||
'insertofftime', 'insertontime', 'insertwidth',
|
'insertofftime', 'insertontime', 'insertwidth',
|
||||||
'invalidcommand', 'justify', 'readonlybackground', 'relief',
|
'invalidcommand', 'justify', 'placeholder', 'placeholderforeground',
|
||||||
|
'readonlybackground', 'relief',
|
||||||
'selectbackground', 'selectborderwidth', 'selectforeground',
|
'selectbackground', 'selectborderwidth', 'selectforeground',
|
||||||
'show', 'state', 'takefocus', 'textvariable',
|
'show', 'state', 'takefocus', 'textvariable',
|
||||||
'validate', 'validatecommand', 'width', 'xscrollcommand',
|
'validate', 'validatecommand', 'width', 'xscrollcommand',
|
||||||
|
@ -432,8 +433,8 @@ class SpinboxTest(EntryTest, unittest.TestCase):
|
||||||
'increment',
|
'increment',
|
||||||
'insertbackground', 'insertborderwidth',
|
'insertbackground', 'insertborderwidth',
|
||||||
'insertofftime', 'insertontime', 'insertwidth',
|
'insertofftime', 'insertontime', 'insertwidth',
|
||||||
'invalidcommand', 'justify', 'relief', 'readonlybackground',
|
'invalidcommand', 'justify', 'placeholder', 'placeholderforeground',
|
||||||
'repeatdelay', 'repeatinterval',
|
'relief', 'readonlybackground', 'repeatdelay', 'repeatinterval',
|
||||||
'selectbackground', 'selectborderwidth', 'selectforeground',
|
'selectbackground', 'selectborderwidth', 'selectforeground',
|
||||||
'state', 'takefocus', 'textvariable', 'to',
|
'state', 'takefocus', 'textvariable', 'to',
|
||||||
'validate', 'validatecommand', 'values',
|
'validate', 'validatecommand', 'values',
|
||||||
|
@ -1176,10 +1177,6 @@ class ScrollbarTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
def create(self, **kwargs):
|
def create(self, **kwargs):
|
||||||
return tkinter.Scrollbar(self.root, **kwargs)
|
return tkinter.Scrollbar(self.root, **kwargs)
|
||||||
|
|
||||||
def test_configure_activerelief(self):
|
|
||||||
widget = self.create()
|
|
||||||
self.checkReliefParam(widget, 'activerelief')
|
|
||||||
|
|
||||||
def test_configure_elementborderwidth(self):
|
def test_configure_elementborderwidth(self):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkPixelsParam(widget, 'elementborderwidth', 4.3, 5.6, '1m')
|
self.checkPixelsParam(widget, 'elementborderwidth', 4.3, 5.6, '1m')
|
||||||
|
@ -1386,6 +1383,7 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
class MenuTest(AbstractWidgetTest, unittest.TestCase):
|
class MenuTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
OPTIONS = (
|
OPTIONS = (
|
||||||
'activebackground', 'activeborderwidth', 'activeforeground',
|
'activebackground', 'activeborderwidth', 'activeforeground',
|
||||||
|
'activerelief',
|
||||||
'background', 'borderwidth', 'cursor',
|
'background', 'borderwidth', 'cursor',
|
||||||
'disabledforeground', 'font', 'foreground',
|
'disabledforeground', 'font', 'foreground',
|
||||||
'postcommand', 'relief', 'selectcolor', 'takefocus',
|
'postcommand', 'relief', 'selectcolor', 'takefocus',
|
||||||
|
@ -1401,6 +1399,8 @@ class MenuTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
i = widget.index('none')
|
i = widget.index('none')
|
||||||
self.assertIsNone(i)
|
self.assertIsNone(i)
|
||||||
|
|
||||||
|
test_configure_activerelief = requires_tk(8, 7)(StandardOptionsTests.test_configure_activerelief)
|
||||||
|
|
||||||
def test_configure_postcommand(self):
|
def test_configure_postcommand(self):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkCommandParam(widget, 'postcommand')
|
self.checkCommandParam(widget, 'postcommand')
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import tkinter
|
import tkinter
|
||||||
from test.test_tkinter.support import (AbstractTkTest, tk_version,
|
from test.test_tkinter.support import (AbstractTkTest, requires_tk, tk_version,
|
||||||
pixels_conv, tcl_obj_eq)
|
pixels_conv, tcl_obj_eq)
|
||||||
import test.support
|
import test.support
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ class AbstractWidgetTest(AbstractTkTest):
|
||||||
_clip_highlightthickness = True
|
_clip_highlightthickness = True
|
||||||
_clip_pad = False
|
_clip_pad = False
|
||||||
_clip_borderwidth = False
|
_clip_borderwidth = False
|
||||||
|
_allow_empty_justify = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def scaling(self):
|
def scaling(self):
|
||||||
|
@ -200,6 +201,7 @@ class AbstractWidgetTest(AbstractTkTest):
|
||||||
aliases = {
|
aliases = {
|
||||||
'bd': 'borderwidth',
|
'bd': 'borderwidth',
|
||||||
'bg': 'background',
|
'bg': 'background',
|
||||||
|
'bgimg': 'backgroundimage',
|
||||||
'fg': 'foreground',
|
'fg': 'foreground',
|
||||||
'invcmd': 'invalidcommand',
|
'invcmd': 'invalidcommand',
|
||||||
'vcmd': 'validatecommand',
|
'vcmd': 'validatecommand',
|
||||||
|
@ -242,6 +244,10 @@ class StandardOptionsTests:
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkColorParam(widget, 'activeforeground')
|
self.checkColorParam(widget, 'activeforeground')
|
||||||
|
|
||||||
|
def test_configure_activerelief(self):
|
||||||
|
widget = self.create()
|
||||||
|
self.checkReliefParam(widget, 'activerelief')
|
||||||
|
|
||||||
def test_configure_anchor(self):
|
def test_configure_anchor(self):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkEnumParam(widget, 'anchor',
|
self.checkEnumParam(widget, 'anchor',
|
||||||
|
@ -253,6 +259,11 @@ class StandardOptionsTests:
|
||||||
if 'bg' in self.OPTIONS:
|
if 'bg' in self.OPTIONS:
|
||||||
self.checkColorParam(widget, 'bg')
|
self.checkColorParam(widget, 'bg')
|
||||||
|
|
||||||
|
@requires_tk(8, 7)
|
||||||
|
def test_configure_backgroundimage(self):
|
||||||
|
widget = self.create()
|
||||||
|
self.checkImageParam(widget, 'backgroundimage')
|
||||||
|
|
||||||
def test_configure_bitmap(self):
|
def test_configure_bitmap(self):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkParam(widget, 'bitmap', 'questhead')
|
self.checkParam(widget, 'bitmap', 'questhead')
|
||||||
|
@ -299,8 +310,10 @@ class StandardOptionsTests:
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkParam(widget, 'font',
|
self.checkParam(widget, 'font',
|
||||||
'-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*')
|
'-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*')
|
||||||
self.checkInvalidParam(widget, 'font', '',
|
is_ttk = widget.__class__.__module__ == 'tkinter.ttk'
|
||||||
errmsg='font "" doesn\'t exist')
|
if not is_ttk:
|
||||||
|
self.checkInvalidParam(widget, 'font', '',
|
||||||
|
errmsg='font "" doesn\'t exist')
|
||||||
|
|
||||||
def test_configure_foreground(self):
|
def test_configure_foreground(self):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
|
@ -355,7 +368,10 @@ class StandardOptionsTests:
|
||||||
|
|
||||||
def test_configure_justify(self):
|
def test_configure_justify(self):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkEnumParam(widget, 'justify', 'left', 'right', 'center',
|
values = ('left', 'right', 'center')
|
||||||
|
if self._allow_empty_justify:
|
||||||
|
values += ('',)
|
||||||
|
self.checkEnumParam(widget, 'justify', *values,
|
||||||
fullname='justification')
|
fullname='justification')
|
||||||
|
|
||||||
def test_configure_orient(self):
|
def test_configure_orient(self):
|
||||||
|
@ -379,6 +395,16 @@ class StandardOptionsTests:
|
||||||
self.checkParam(widget, 'pady', -2, expected=expected,
|
self.checkParam(widget, 'pady', -2, expected=expected,
|
||||||
conv=self._conv_pad_pixels)
|
conv=self._conv_pad_pixels)
|
||||||
|
|
||||||
|
@requires_tk(8, 7)
|
||||||
|
def test_configure_placeholder(self):
|
||||||
|
widget = self.create()
|
||||||
|
self.checkParam(widget, 'placeholder', 'xxx')
|
||||||
|
|
||||||
|
@requires_tk(8, 7)
|
||||||
|
def test_configure_placeholderforeground(self):
|
||||||
|
widget = self.create()
|
||||||
|
self.checkColorParam(widget, 'placeholderforeground')
|
||||||
|
|
||||||
def test_configure_relief(self):
|
def test_configure_relief(self):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkReliefParam(widget, 'relief')
|
self.checkReliefParam(widget, 'relief')
|
||||||
|
@ -424,6 +450,11 @@ class StandardOptionsTests:
|
||||||
var = tkinter.StringVar(self.root)
|
var = tkinter.StringVar(self.root)
|
||||||
self.checkVariableParam(widget, 'textvariable', var)
|
self.checkVariableParam(widget, 'textvariable', var)
|
||||||
|
|
||||||
|
@requires_tk(8, 7)
|
||||||
|
def test_configure_tile(self):
|
||||||
|
widget = self.create()
|
||||||
|
self.checkBooleanParam(widget, 'tile')
|
||||||
|
|
||||||
def test_configure_troughcolor(self):
|
def test_configure_troughcolor(self):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkColorParam(widget, 'troughcolor')
|
self.checkColorParam(widget, 'troughcolor')
|
||||||
|
|
|
@ -167,6 +167,7 @@ class LabelFrameTest(AbstractToplevelTest, unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
class AbstractLabelTest(AbstractWidgetTest):
|
class AbstractLabelTest(AbstractWidgetTest):
|
||||||
|
_allow_empty_justify = True
|
||||||
|
|
||||||
def checkImageParam(self, widget, name):
|
def checkImageParam(self, widget, name):
|
||||||
image = tkinter.PhotoImage(master=self.root, name='image1')
|
image = tkinter.PhotoImage(master=self.root, name='image1')
|
||||||
|
@ -188,6 +189,8 @@ class AbstractLabelTest(AbstractWidgetTest):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkEnumParam(widget, 'compound', *values, allow_empty=True)
|
self.checkEnumParam(widget, 'compound', *values, allow_empty=True)
|
||||||
|
|
||||||
|
test_configure_justify = requires_tk(8, 7)(StandardOptionsTests.test_configure_justify)
|
||||||
|
|
||||||
def test_configure_width(self):
|
def test_configure_width(self):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkParams(widget, 'width', 402, -402, 0)
|
self.checkParams(widget, 'width', 402, -402, 0)
|
||||||
|
@ -203,28 +206,19 @@ class LabelTest(AbstractLabelTest, unittest.TestCase):
|
||||||
'underline', 'width', 'wraplength',
|
'underline', 'width', 'wraplength',
|
||||||
)
|
)
|
||||||
_conv_pixels = False
|
_conv_pixels = False
|
||||||
|
_allow_empty_justify = tk_version >= (8, 7)
|
||||||
|
|
||||||
def create(self, **kwargs):
|
def create(self, **kwargs):
|
||||||
return ttk.Label(self.root, **kwargs)
|
return ttk.Label(self.root, **kwargs)
|
||||||
|
|
||||||
def test_configure_font(self):
|
test_configure_justify = StandardOptionsTests.test_configure_justify
|
||||||
widget = self.create()
|
|
||||||
self.checkParam(widget, 'font',
|
|
||||||
'-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*')
|
|
||||||
|
|
||||||
def test_configure_justify(self):
|
|
||||||
widget = self.create()
|
|
||||||
values = ('left', 'right', 'center')
|
|
||||||
if tk_version >= (8, 7):
|
|
||||||
values += ('',)
|
|
||||||
self.checkEnumParam(widget, 'justify', *values,
|
|
||||||
fullname='justification')
|
|
||||||
|
|
||||||
@add_standard_options(StandardTtkOptionsTests)
|
@add_standard_options(StandardTtkOptionsTests)
|
||||||
class ButtonTest(AbstractLabelTest, unittest.TestCase):
|
class ButtonTest(AbstractLabelTest, unittest.TestCase):
|
||||||
OPTIONS = (
|
OPTIONS = (
|
||||||
'class', 'command', 'compound', 'cursor', 'default',
|
'class', 'command', 'compound', 'cursor', 'default',
|
||||||
'image', 'padding', 'state', 'style',
|
'image', 'justify', 'padding', 'state', 'style',
|
||||||
'takefocus', 'text', 'textvariable',
|
'takefocus', 'text', 'textvariable',
|
||||||
'underline', 'width',
|
'underline', 'width',
|
||||||
)
|
)
|
||||||
|
@ -249,7 +243,7 @@ class ButtonTest(AbstractLabelTest, unittest.TestCase):
|
||||||
class CheckbuttonTest(AbstractLabelTest, unittest.TestCase):
|
class CheckbuttonTest(AbstractLabelTest, unittest.TestCase):
|
||||||
OPTIONS = (
|
OPTIONS = (
|
||||||
'class', 'command', 'compound', 'cursor',
|
'class', 'command', 'compound', 'cursor',
|
||||||
'image',
|
'image', 'justify',
|
||||||
'offvalue', 'onvalue',
|
'offvalue', 'onvalue',
|
||||||
'padding', 'state', 'style',
|
'padding', 'state', 'style',
|
||||||
'takefocus', 'text', 'textvariable',
|
'takefocus', 'text', 'textvariable',
|
||||||
|
@ -338,6 +332,7 @@ class EntryTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
'background', 'class', 'cursor',
|
'background', 'class', 'cursor',
|
||||||
'exportselection', 'font', 'foreground',
|
'exportselection', 'font', 'foreground',
|
||||||
'invalidcommand', 'justify',
|
'invalidcommand', 'justify',
|
||||||
|
'placeholder', 'placeholderforeground',
|
||||||
'show', 'state', 'style', 'takefocus', 'textvariable',
|
'show', 'state', 'style', 'takefocus', 'textvariable',
|
||||||
'validate', 'validatecommand', 'width', 'xscrollcommand',
|
'validate', 'validatecommand', 'width', 'xscrollcommand',
|
||||||
)
|
)
|
||||||
|
@ -460,7 +455,8 @@ class ComboboxTest(EntryTest, unittest.TestCase):
|
||||||
OPTIONS = (
|
OPTIONS = (
|
||||||
'background', 'class', 'cursor', 'exportselection',
|
'background', 'class', 'cursor', 'exportselection',
|
||||||
'font', 'foreground', 'height', 'invalidcommand',
|
'font', 'foreground', 'height', 'invalidcommand',
|
||||||
'justify', 'postcommand', 'show', 'state', 'style',
|
'justify', 'placeholder', 'placeholderforeground', 'postcommand',
|
||||||
|
'show', 'state', 'style',
|
||||||
'takefocus', 'textvariable',
|
'takefocus', 'textvariable',
|
||||||
'validate', 'validatecommand', 'values',
|
'validate', 'validatecommand', 'values',
|
||||||
'width', 'xscrollcommand',
|
'width', 'xscrollcommand',
|
||||||
|
@ -720,7 +716,7 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
class RadiobuttonTest(AbstractLabelTest, unittest.TestCase):
|
class RadiobuttonTest(AbstractLabelTest, unittest.TestCase):
|
||||||
OPTIONS = (
|
OPTIONS = (
|
||||||
'class', 'command', 'compound', 'cursor',
|
'class', 'command', 'compound', 'cursor',
|
||||||
'image',
|
'image', 'justify',
|
||||||
'padding', 'state', 'style',
|
'padding', 'state', 'style',
|
||||||
'takefocus', 'text', 'textvariable',
|
'takefocus', 'text', 'textvariable',
|
||||||
'underline', 'value', 'variable', 'width',
|
'underline', 'value', 'variable', 'width',
|
||||||
|
@ -774,7 +770,7 @@ class RadiobuttonTest(AbstractLabelTest, unittest.TestCase):
|
||||||
class MenubuttonTest(AbstractLabelTest, unittest.TestCase):
|
class MenubuttonTest(AbstractLabelTest, unittest.TestCase):
|
||||||
OPTIONS = (
|
OPTIONS = (
|
||||||
'class', 'compound', 'cursor', 'direction',
|
'class', 'compound', 'cursor', 'direction',
|
||||||
'image', 'menu', 'padding', 'state', 'style',
|
'image', 'justify', 'menu', 'padding', 'state', 'style',
|
||||||
'takefocus', 'text', 'textvariable',
|
'takefocus', 'text', 'textvariable',
|
||||||
'underline', 'width',
|
'underline', 'width',
|
||||||
)
|
)
|
||||||
|
@ -906,16 +902,28 @@ class ScaleTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
@add_standard_options(StandardTtkOptionsTests)
|
@add_standard_options(StandardTtkOptionsTests)
|
||||||
class ProgressbarTest(AbstractWidgetTest, unittest.TestCase):
|
class ProgressbarTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
OPTIONS = (
|
OPTIONS = (
|
||||||
'class', 'cursor', 'orient', 'length',
|
'anchor', 'class', 'cursor', 'font', 'foreground', 'justify',
|
||||||
'mode', 'maximum', 'phase',
|
'orient', 'length',
|
||||||
|
'mode', 'maximum', 'phase', 'text', 'wraplength',
|
||||||
'style', 'takefocus', 'value', 'variable',
|
'style', 'takefocus', 'value', 'variable',
|
||||||
)
|
)
|
||||||
_conv_pixels = False
|
_conv_pixels = False
|
||||||
|
_allow_empty_justify = True
|
||||||
default_orient = 'horizontal'
|
default_orient = 'horizontal'
|
||||||
|
|
||||||
def create(self, **kwargs):
|
def create(self, **kwargs):
|
||||||
return ttk.Progressbar(self.root, **kwargs)
|
return ttk.Progressbar(self.root, **kwargs)
|
||||||
|
|
||||||
|
@requires_tk(8, 7)
|
||||||
|
def test_configure_anchor(self):
|
||||||
|
widget = self.create()
|
||||||
|
self.checkEnumParam(widget, 'anchor',
|
||||||
|
'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw', 'center', '')
|
||||||
|
|
||||||
|
test_configure_font = requires_tk(8, 7)(StandardOptionsTests.test_configure_font)
|
||||||
|
test_configure_foreground = requires_tk(8, 7)(StandardOptionsTests.test_configure_foreground)
|
||||||
|
test_configure_justify = requires_tk(8, 7)(StandardTtkOptionsTests.test_configure_justify)
|
||||||
|
|
||||||
def test_configure_length(self):
|
def test_configure_length(self):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkPixelsParam(widget, 'length', 100.1, 56.7, '2i')
|
self.checkPixelsParam(widget, 'length', 100.1, 56.7, '2i')
|
||||||
|
@ -932,11 +940,15 @@ class ProgressbarTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
# XXX
|
# XXX
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
test_configure_text = requires_tk(8, 7)(StandardOptionsTests.test_configure_text)
|
||||||
|
|
||||||
def test_configure_value(self):
|
def test_configure_value(self):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkFloatParam(widget, 'value', 150.2, 77.7, 0, -10,
|
self.checkFloatParam(widget, 'value', 150.2, 77.7, 0, -10,
|
||||||
conv=False)
|
conv=False)
|
||||||
|
|
||||||
|
test_configure_wraplength = requires_tk(8, 7)(StandardOptionsTests.test_configure_wraplength)
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(sys.platform == 'darwin',
|
@unittest.skipIf(sys.platform == 'darwin',
|
||||||
'ttk.Scrollbar is special on MacOSX')
|
'ttk.Scrollbar is special on MacOSX')
|
||||||
|
@ -1173,7 +1185,9 @@ class SpinboxTest(EntryTest, unittest.TestCase):
|
||||||
OPTIONS = (
|
OPTIONS = (
|
||||||
'background', 'class', 'command', 'cursor', 'exportselection',
|
'background', 'class', 'command', 'cursor', 'exportselection',
|
||||||
'font', 'foreground', 'format', 'from', 'increment',
|
'font', 'foreground', 'format', 'from', 'increment',
|
||||||
'invalidcommand', 'justify', 'show', 'state', 'style',
|
'invalidcommand', 'justify',
|
||||||
|
'placeholder', 'placeholderforeground',
|
||||||
|
'show', 'state', 'style',
|
||||||
'takefocus', 'textvariable', 'to', 'validate', 'validatecommand',
|
'takefocus', 'textvariable', 'to', 'validate', 'validatecommand',
|
||||||
'values', 'width', 'wrap', 'xscrollcommand',
|
'values', 'width', 'wrap', 'xscrollcommand',
|
||||||
)
|
)
|
||||||
|
@ -1347,8 +1361,9 @@ class SpinboxTest(EntryTest, unittest.TestCase):
|
||||||
class TreeviewTest(AbstractWidgetTest, unittest.TestCase):
|
class TreeviewTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
OPTIONS = (
|
OPTIONS = (
|
||||||
'class', 'columns', 'cursor', 'displaycolumns',
|
'class', 'columns', 'cursor', 'displaycolumns',
|
||||||
'height', 'padding', 'selectmode', 'show',
|
'height', 'padding', 'selectmode', 'selecttype', 'show', 'striped',
|
||||||
'style', 'takefocus', 'xscrollcommand', 'yscrollcommand',
|
'style', 'takefocus', 'titlecolumns', 'titleitems',
|
||||||
|
'xscrollcommand', 'yscrollcommand',
|
||||||
)
|
)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -1393,6 +1408,11 @@ class TreeviewTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
self.checkEnumParam(widget, 'selectmode',
|
self.checkEnumParam(widget, 'selectmode',
|
||||||
'none', 'browse', 'extended')
|
'none', 'browse', 'extended')
|
||||||
|
|
||||||
|
@requires_tk(8, 7)
|
||||||
|
def test_configure_selecttype(self):
|
||||||
|
widget = self.create()
|
||||||
|
self.checkEnumParam(widget, 'selecttype', 'item', 'cell')
|
||||||
|
|
||||||
def test_configure_show(self):
|
def test_configure_show(self):
|
||||||
widget = self.create()
|
widget = self.create()
|
||||||
self.checkParam(widget, 'show', 'tree headings',
|
self.checkParam(widget, 'show', 'tree headings',
|
||||||
|
@ -1402,6 +1422,23 @@ class TreeviewTest(AbstractWidgetTest, unittest.TestCase):
|
||||||
self.checkParam(widget, 'show', 'tree', expected=('tree',))
|
self.checkParam(widget, 'show', 'tree', expected=('tree',))
|
||||||
self.checkParam(widget, 'show', 'headings', expected=('headings',))
|
self.checkParam(widget, 'show', 'headings', expected=('headings',))
|
||||||
|
|
||||||
|
@requires_tk(8, 7)
|
||||||
|
def test_configure_striped(self):
|
||||||
|
widget = self.create()
|
||||||
|
self.checkBooleanParam(widget, 'striped')
|
||||||
|
|
||||||
|
@requires_tk(8, 7)
|
||||||
|
def test_configure_titlecolumns(self):
|
||||||
|
widget = self.create()
|
||||||
|
self.checkIntegerParam(widget, 'titlecolumns', 0, 1, 5)
|
||||||
|
self.checkInvalidParam(widget, 'titlecolumns', -2)
|
||||||
|
|
||||||
|
@requires_tk(8, 7)
|
||||||
|
def test_configure_titleitems(self):
|
||||||
|
widget = self.create()
|
||||||
|
self.checkIntegerParam(widget, 'titleitems', 0, 1, 5)
|
||||||
|
self.checkInvalidParam(widget, 'titleitems', -2)
|
||||||
|
|
||||||
def test_bbox(self):
|
def test_bbox(self):
|
||||||
self.tv.pack()
|
self.tv.pack()
|
||||||
self.assertEqual(self.tv.bbox(''), '')
|
self.assertEqual(self.tv.bbox(''), '')
|
||||||
|
|
Loading…
Reference in New Issue