Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | # Based on iwidgets2.2.0/tests/buttonbox.test code. |
2 | ||
3 | import Tkinter | |
4 | import Test | |
5 | import Pmw | |
6 | ||
7 | Test.initialise() | |
8 | ||
9 | c = Pmw.ButtonBox | |
10 | ||
11 | kw_1 = {} | |
12 | tests_1 = ( | |
13 | (c.pack, ()), | |
14 | (c.add, 'Yes', Tkinter.Button), | |
15 | (c.add, 'No', Tkinter.Button), | |
16 | (c.setdefault, 'Yes'), | |
17 | (c.alignbuttons, ()), | |
18 | (Test.num_options, (), 5), | |
19 | ('Button_activebackground', '#ececec'), | |
20 | ('Button_activeforeground', 'Black'), | |
21 | ('hull_background', '#d9d9d9'), | |
22 | ('hull_cursor', 'gumby'), | |
23 | ('Button_background', 'aliceblue'), | |
24 | ('Button_disabledforeground', '#a3a3a3'), | |
25 | ('Button_foreground', 'Black'), | |
26 | ('Button_highlightcolor', 'Black'), | |
27 | ('Button_highlightthickness', 2), | |
28 | (c.index, 0, 0), | |
29 | (c.index, Pmw.END, 1), | |
30 | (c.index, Pmw.DEFAULT, 0), | |
31 | (c.index, 'No', 1), | |
32 | (c.index, 'Yes', 0), | |
33 | (c.add, 'Maybe', Tkinter.Button), | |
34 | (c.insert, ('Never', 0), {'text' : 'Never Never'}, Tkinter.Button), | |
35 | (c.setdefault, 'Never'), | |
36 | (c.invoke, 'Yes', ''), | |
37 | (c.invoke, (), ''), | |
38 | (c.invoke, Pmw.DEFAULT, ''), | |
39 | (c.delete, 'Maybe'), | |
40 | ('Yes_text', 'YES'), | |
41 | (c.index, 12, 'ValueError: index "12" is out of range'), | |
42 | (c.index, 'bogus', 'ValueError: bad index "bogus": ' + \ | |
43 | 'must be a name, a number, Pmw.END or Pmw.DEFAULT'), | |
44 | ) | |
45 | ||
46 | kw_2 = { | |
47 | 'orient' : 'vertical', | |
48 | 'padx' : 30, | |
49 | 'pady' : 30, | |
50 | 'labelpos' : 'w', | |
51 | 'label_text' : 'Vertical\nButtonBox', | |
52 | } | |
53 | tests_2 = ( | |
54 | (c.pack, ()), | |
55 | (c.add, 'Hello', Tkinter.Button), | |
56 | (c.insert, ('GoodBye', Pmw.END), Tkinter.Button), | |
57 | (c.setdefault, 'Hello'), | |
58 | (c.setdefault, 'GoodBye'), | |
59 | (c.setdefault, None), | |
60 | (c.index, Pmw.DEFAULT, 'ValueError: ButtonBox has no default'), | |
61 | ) | |
62 | ||
63 | alltests = ( | |
64 | (tests_1, kw_1), | |
65 | (tests_2, kw_2), | |
66 | ) | |
67 | ||
68 | testData = ((c, alltests),) | |
69 | ||
70 | if __name__ == '__main__': | |
71 | Test.runTests(testData) |