]> SALOME platform Git repositories - tools/eficas.git/blob - Pmw/Pmw_1_2/tests/ScrolledFrame_test.py
Salome HOME
Modif V6_4_°
[tools/eficas.git] / Pmw / Pmw_1_2 / tests / ScrolledFrame_test.py
1 import Test
2 import Pmw
3
4 Test.initialise()
5
6 c = Pmw.ScrolledFrame
7
8 def _createInterior():
9     w = Test.currentWidget()
10     for i in range(3):
11         lb = Pmw.ScrolledListBox(w.interior(),
12                 items = range(20), listbox_height = 6)
13         lb.pack(padx = 10, pady = 10)
14
15 def _testYView(doBottom):
16     w = Test.currentWidget()
17     top, bottom = w.yview()
18     if type(top) != type(0.0) or type(bottom) != type(0.0):
19         return 'bad type ' + str(top) + ' ' + str(bottom)
20     if doBottom:
21         if bottom != 1.0:
22             return 'bottom is ' + str(bottom)
23     else:
24         if top != 0.0:
25             return 'top is ' + str(top)
26
27 kw_1 = {'labelpos': 'n', 'label_text': 'ScrolledFrame'}
28 tests_1 = (
29   (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}),
30   (Test.num_options, (), 11),
31   (_createInterior, ()),
32   ('hull_background', 'aliceblue'),
33   ('Scrollbar_borderwidth', 3),
34   ('hull_cursor', 'gumby'),
35   ('label_text', 'Label'),
36   ('Scrollbar_repeatdelay', 200),
37   ('Scrollbar_repeatinterval', 105),
38   ('vscrollmode', 'none'),
39   ('vscrollmode', 'static'),
40   ('vscrollmode', 'dynamic'),
41   ('hscrollmode', 'none'),
42   ('hscrollmode', 'static'),
43   ('hscrollmode', 'dynamic'),
44   ('Scrollbar_width', 20),
45   ('vscrollmode', 'bogus', 'ValueError: bad vscrollmode ' +
46     'option "bogus": should be static, dynamic, or none'),
47   ('hscrollmode', 'bogus', 'ValueError: bad hscrollmode ' +
48     'option "bogus": should be static, dynamic, or none'),
49   (c.cget, 'vscrollmode', 'bogus'),
50   (c.cget, 'hscrollmode', 'bogus'),
51   ('vscrollmode', 'dynamic'),
52   ('hscrollmode', 'dynamic'),
53   (_testYView, 0),
54   (c.yview, ('moveto', 0.02)),
55   (c.yview, ('moveto', 0.04)),
56   (c.yview, ('moveto', 0.06)),
57   (c.yview, ('moveto', 0.08)),
58   (c.yview, ('moveto', 0.10)),
59   (c.yview, ('moveto', 0.12)),
60   (c.yview, ('moveto', 0.14)),
61   (c.yview, ('moveto', 0.16)),
62   (c.yview, ('moveto', 0.18)),
63   (c.yview, ('moveto', 0.20)),
64   (c.yview, ('moveto', 0.22)),
65   (c.yview, ('moveto', 0.24)),
66   (c.yview, ('moveto', 0.26)),
67   (c.yview, ('moveto', 0.28)),
68   (c.yview, ('moveto', 0.98)),
69   (_testYView, 1),
70   (c.yview, ('scroll', -1, 'page')),
71   (c.yview, ('scroll', -1, 'page')),
72   (c.yview, ('scroll', -1, 'page')),
73   (_testYView, 0),
74   (c.yview, ('scroll', 1, 'page')),
75   (c.yview, ('scroll', 1, 'page')),
76   (c.yview, ('scroll', 1, 'page')),
77   (_testYView, 1),
78 )
79
80 kw_2 = {
81   'hscrollmode' : 'dynamic',
82   'label_text' : 'Label',
83   'labelpos' : 'n',
84   'scrollmargin': 20,
85 }
86 tests_2 = (
87   (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}),
88 )
89
90 alltests = (
91   (tests_1, kw_1),
92   (tests_2, kw_2),
93 )
94
95 testData = ((Pmw.ScrolledFrame, alltests),)
96
97 if __name__ == '__main__':
98     Test.runTests(testData)