Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | import Tkinter |
2 | import Test | |
3 | import Pmw | |
4 | ||
5 | Test.initialise() | |
6 | ||
7 | c = Pmw.OptionMenu | |
8 | ||
9 | kw_1 = { | |
10 | 'labelpos' : 'nw', | |
11 | 'label_text' : 'Option Menu:', | |
12 | 'items' : ('Chips', 'Lollies', 'Junk', 'More junk'), | |
13 | 'initialitem' : 1, | |
14 | } | |
15 | tests_1 = ( | |
16 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), | |
17 | (Test.num_options, (), 6), | |
18 | (c.getcurselection, (), 'Lollies'), | |
19 | (c.index, 'Junk', 2), | |
20 | (c.index, 'Nowhere', 'ValueError: bad index "Nowhere": must be ' + | |
21 | 'a name, a number, Pmw.END or Pmw.SELECT'), | |
22 | (c.index, Pmw.END, 3), | |
23 | (c.index, Pmw.SELECT, 1), | |
24 | (c.index, 1, 1), | |
25 | (c.invoke, 'Chips'), | |
26 | (c.getcurselection, (), 'Chips'), | |
27 | ('command', Test.callback1), | |
28 | (c.invoke, (), 'Chips'), | |
29 | (c.invoke, 'Lollies', 'Lollies'), | |
30 | (c.getcurselection, (), 'Lollies'), | |
31 | ('hull_background', 'yellow'), | |
32 | ('hull_show', 'X', 'TclError: unknown option "-show"'), | |
33 | (c.index, Pmw.SELECT, 1), | |
34 | (c.setitems, (('Chips', 'Junk', 'Lollies', 'More junk'),)), | |
35 | (c.index, Pmw.SELECT, 2), | |
36 | (c.setitems, (('Fruit', 'Vegetables', 'Cereals', 'Legumes'),)), | |
37 | (c.index, Pmw.SELECT, 0), | |
38 | (c.getcurselection, (), 'Fruit'), | |
39 | (c.setitems, (('Vegetables', 'Cereals', 'Legumes'), Pmw.END)), | |
40 | (c.getcurselection, (), 'Legumes'), | |
41 | (c.index, 'Vegetables', 0), | |
42 | (c.invoke, 'Legumes', 'Legumes'), | |
43 | ('hull_cursor', 'gumby'), | |
44 | ('label_foreground', 'Green'), | |
45 | ('label_foreground', 'Black'), | |
46 | ('label_highlightcolor', 'Red'), | |
47 | ('label_text', 'Label'), | |
48 | ) | |
49 | ||
50 | testData = ((c, ((tests_1, kw_1),)),) | |
51 | ||
52 | if __name__ == '__main__': | |
53 | Test.runTests(testData) |