Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets.

Added few missed tests for configure options.
This commit is contained in:
Serhiy Storchaka 2016-03-09 10:33:51 +02:00
parent 0554d83f0f
commit 42a4366ad5
6 changed files with 183 additions and 138 deletions

View file

@ -206,6 +206,33 @@ class AbstractWidgetTest(AbstractTkTest):
break
def test_keys(self):
widget = self.create()
keys = widget.keys()
# XXX
if not isinstance(widget, Scale):
self.assertEqual(sorted(keys), sorted(widget.configure()))
for k in keys:
widget[k]
# Test if OPTIONS contains all keys
if test.support.verbose:
aliases = {
'bd': 'borderwidth',
'bg': 'background',
'fg': 'foreground',
'invcmd': 'invalidcommand',
'vcmd': 'validatecommand',
}
keys = set(keys)
expected = set(self.OPTIONS)
for k in sorted(keys - expected):
if not (k in aliases and
aliases[k] in keys and
aliases[k] in expected):
print('%s.OPTIONS doesn\'t contain "%s"' %
(self.__class__.__name__, k))
class StandardOptionsTests:
STANDARD_OPTIONS = (
'activebackground', 'activeborderwidth', 'activeforeground', 'anchor',