File: ButtonBox_test.py

package info (click to toggle)
python-pmw 0.8.5-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,820 kB
  • ctags: 3,468
  • sloc: python: 14,898; makefile: 37; sh: 17
file content (71 lines) | stat: -rw-r--r-- 1,741 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Based on iwidgets2.2.0/tests/buttonbox.test code.

import Tkinter
import Test
import Pmw

Test.initialise()

c = Pmw.ButtonBox

kw_1 = {}
tests_1 = (
  (c.pack, ()),
  (c.add, 'Yes', Tkinter.Button),
  (c.add, 'No', Tkinter.Button),
  (c.setdefault, 'Yes'),
  (c.alignbuttons, ()),
  (Test.num_options, (), 5),
  ('Button_activebackground', '#ececec'),
  ('Button_activeforeground', 'Black'),
  ('hull_background', '#d9d9d9'),
  ('hull_cursor', 'gumby'),
  ('Button_background', 'aliceblue'),
  ('Button_disabledforeground', '#a3a3a3'),
  ('Button_foreground', 'Black'),
  ('Button_highlightcolor', 'Black'),
  ('Button_highlightthickness', 2),
  (c.index, 0, 0),
  (c.index, Pmw.END, 1),
  (c.index, Pmw.DEFAULT, 0),
  (c.index, 'No', 1),
  (c.index, 'Yes', 0),
  (c.add, 'Maybe', Tkinter.Button),
  (c.insert, ('Never', 0), {'text' : 'Never Never'}, Tkinter.Button),
  (c.setdefault, 'Never'),
  (c.invoke, 'Yes', ''),
  (c.invoke, (), ''),
  (c.invoke, Pmw.DEFAULT, ''),
  (c.delete, 'Maybe'),
  ('Yes_text', 'YES'),
  (c.index, 12, 'ValueError: index "12" is out of range'),
  (c.index, 'bogus', 'ValueError: bad index "bogus": ' + \
      'must be a name, a number, Pmw.END or Pmw.DEFAULT'),
)

kw_2 = {
    'orient' : 'vertical',
    'padx' : 30,
    'pady' : 30,
    'labelpos' : 'w',
    'label_text' : 'Vertical\nButtonBox',
}
tests_2 = (
  (c.pack, ()),
  (c.add, 'Hello', Tkinter.Button),
  (c.insert, ('GoodBye', Pmw.END), Tkinter.Button),
  (c.setdefault, 'Hello'),
  (c.setdefault, 'GoodBye'),
  (c.setdefault, None),
  (c.index, Pmw.DEFAULT, 'ValueError: ButtonBox has no default'),
)

alltests = (
  (tests_1, kw_1),
  (tests_2, kw_2),
)

testData = ((c, alltests),)

if __name__ == '__main__':
    Test.runTests(testData)