Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / lib / python2.4 / site-packages / Pmw / Pmw_1_2 / tests / Colors_test.py
CommitLineData
86530b38
AT
1# Tests for Pmw color handling.
2
3import Tkinter
4import Test
5import Pmw
6
7Test.initialise()
8testData = ()
9
10defaultPalette = Pmw.Color.getdefaultpalette(Test.root)
11
12c = Tkinter.Button
13
14colors = ('red', 'orange', 'yellow', 'green', 'blue', 'purple', 'white')
15normalcolors = map(Pmw.Color.changebrightness,
16 (Test.root,) * len(colors), colors, (0.85,) * len(colors))
17
18kw = {}
19tests = (
20 (Pmw.Color.setscheme, (Test.root, normalcolors[0]), {'foreground' : 'white'}),
21)
22testData = testData + ((c, ((tests, kw),)),)
23
24for color in normalcolors[1:]:
25 kw = {'text' : color}
26 tests = (
27 (c.pack, ()),
28 ('state', 'active'),
29 )
30 testData = testData + ((c, ((tests, kw),)),)
31
32 kw = {}
33 tests = (
34 (Pmw.Color.setscheme, (Test.root, color), {'foreground' : 'red'}),
35 )
36 testData = testData + ((c, ((tests, kw),)),)
37
38# Restore the default colors.
39kw = {}
40tests = (
41 (Pmw.Color.setscheme, (Test.root,), defaultPalette),
42)
43testData = testData + ((c, ((tests, kw),)),)
44
45if __name__ == '__main__':
46 Test.runTests(testData)