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 72 73 74 75 76 77
|
# Based on iwidgets2.2.0/tests/scrolledtext.test code.
import Test
import Pmw
Test.initialise()
c = Pmw.ScrolledText
kw_1 = {'labelpos': 'n', 'label_text': 'ScrolledText'}
tests_1 = (
(c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}),
(Test.num_options, (), 7),
(c.importfile, 'ScrolledText_test.py'),
('hull_background', 'aliceblue'),
('text_borderwidth', 3),
('Scrollbar_borderwidth', 3),
('hull_cursor', 'gumby'),
('text_exportselection', 0),
('text_exportselection', 1),
('text_foreground', 'Black'),
('text_height', 10),
('text_width', 20),
('text_insertbackground', 'Black'),
('text_insertborderwidth', 1),
('text_insertofftime', 200),
('text_insertontime', 500),
('text_insertwidth', 3),
('label_text', 'Label'),
('text_relief', 'raised'),
('text_relief', 'sunken'),
('Scrollbar_repeatdelay', 200),
('Scrollbar_repeatinterval', 105),
('vscrollmode', 'none'),
('vscrollmode', 'static'),
('vscrollmode', 'dynamic'),
('hscrollmode', 'none'),
('hscrollmode', 'static'),
('hscrollmode', 'dynamic'),
('Scrollbar_width', 20),
('text_selectborderwidth', 2),
('text_state', 'disabled'),
('text_state', 'normal'),
('text_background', 'GhostWhite'),
('text_wrap', 'char'),
('text_wrap', 'none'),
('vscrollmode', 'bogus', 'ValueError: bad vscrollmode ' +
'option "bogus": should be static, dynamic, or none'),
('hscrollmode', 'bogus', 'ValueError: bad hscrollmode ' +
'option "bogus": should be static, dynamic, or none'),
(c.insert, ('end', 'Hello there\n')),
(c.clear, ()),
(c.get, (), '\n'),
)
kw_2 = {
'hscrollmode' : 'dynamic',
'label_text' : 'Label',
'labelpos' : 'n',
'scrollmargin': 20,
}
tests_2 = (
(c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}),
(c.importfile, 'ScrolledText_test.py'),
('text_relief', 'raised'),
('text_relief', 'sunken'),
)
alltests = (
(tests_1, kw_1),
(tests_2, kw_2),
)
testData = ((Pmw.ScrolledText, alltests),)
if __name__ == '__main__':
Test.runTests(testData)
|