summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ttk_textonly.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_ttk_textonly.py')
-rw-r--r--Lib/test/test_ttk_textonly.py32
1 files changed, 25 insertions, 7 deletions
diff --git a/Lib/test/test_ttk_textonly.py b/Lib/test/test_ttk_textonly.py
index 96dc179..e6525c4 100644
--- a/Lib/test/test_ttk_textonly.py
+++ b/Lib/test/test_ttk_textonly.py
@@ -179,7 +179,7 @@ class InternalFunctionsTest(unittest.TestCase):
# don't format returned values as a tcl script
# minimum acceptable for image type
self.assertEqual(ttk._format_elemcreate('image', False, 'test'),
- ("test ", ()))
+ ("test", ()))
# specifying a state spec
self.assertEqual(ttk._format_elemcreate('image', False, 'test',
('', 'a')), ("test {} a", ()))
@@ -203,17 +203,19 @@ class InternalFunctionsTest(unittest.TestCase):
# don't format returned values as a tcl script
# minimum acceptable for vsapi
self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b'),
- ("a b ", ()))
+ ('a', 'b', ('', 1), ()))
# now with a state spec with multiple states
self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b',
- ('a', 'b', 'c')), ("a b {a b} c", ()))
+ [('a', 'b', 'c')]), ('a', 'b', ('a b', 'c'), ()))
# state spec and option
self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b',
- ('a', 'b'), opt='x'), ("a b a b", ("-opt", "x")))
+ [('a', 'b')], opt='x'), ('a', 'b', ('a', 'b'), ("-opt", "x")))
# format returned values as a tcl script
# state spec with a multivalue and an option
self.assertEqual(ttk._format_elemcreate('vsapi', True, 'a', 'b',
- ('a', 'b', [1, 2]), opt='x'), ("{a b {a b} {1 2}}", "-opt x"))
+ opt='x'), ("a b {{} 1}", "-opt x"))
+ self.assertEqual(ttk._format_elemcreate('vsapi', True, 'a', 'b',
+ [('a', 'b', [1, 2])], opt='x'), ("a b {{a b} {1 2}}", "-opt x"))
# Testing type = from
# from type expects at least a type name
@@ -222,9 +224,9 @@ class InternalFunctionsTest(unittest.TestCase):
self.assertEqual(ttk._format_elemcreate('from', False, 'a'),
('a', ()))
self.assertEqual(ttk._format_elemcreate('from', False, 'a', 'b'),
- ('a', ('b', )))
+ ('a', ('b',)))
self.assertEqual(ttk._format_elemcreate('from', True, 'a', 'b'),
- ('{a}', 'b'))
+ ('a', 'b'))
def test_format_layoutlist(self):
@@ -326,6 +328,22 @@ class InternalFunctionsTest(unittest.TestCase):
"ttk::style element create thing image {name {state1 state2} val} "
"-opt {3 2m}")
+ vsapi = {'pin': {'element create':
+ ['vsapi', 'EXPLORERBAR', 3, [
+ ('pressed', '!selected', 3),
+ ('active', '!selected', 2),
+ ('pressed', 'selected', 6),
+ ('active', 'selected', 5),
+ ('selected', 4),
+ ('', 1)]]}}
+ self.assertEqual(ttk._script_from_settings(vsapi),
+ "ttk::style element create pin vsapi EXPLORERBAR 3 {"
+ "{pressed !selected} 3 "
+ "{active !selected} 2 "
+ "{pressed selected} 6 "
+ "{active selected} 5 "
+ "selected 4 "
+ "{} 1} ")
def test_tclobj_to_py(self):
self.assertEqual(