OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/base.git] / util / src / TclTk / tk8.6.12 / tests / ttk / progressbar.test
1 package require Tk
2 package require tcltest 2.2
3 namespace import -force tcltest::*
4 loadTestedCommands
5
6
7 test progressbar-1.1 "Setup" -body {
8     ttk::progressbar .pb
9 } -result .pb
10
11 test progressbar-1.2 "Linked variable" -body {
12     set PB 50
13     .pb configure -variable PB
14     .pb cget -value
15 } -result 50
16
17 test progressbar-1.3 "Change linked variable" -body {
18     set PB 80
19     .pb cget -value
20 } -result 80
21
22 test progressbar-1.4 "Set linked variable to bad value" -body {
23     set PB "bogus"
24     .pb instate invalid
25 } -result 1
26
27 test progressbar-1.4.1 "Set linked variable back to a good value" -body {
28     set PB 80
29     .pb instate invalid
30 } -result 0
31
32 test progressbar-1.5 "Set -variable to illegal variable" -body {
33     set BAD "bogus"
34     .pb configure -variable BAD
35     .pb instate invalid
36 } -result 1
37
38 test progressbar-1.6 "Unset -variable" -body {
39     unset -nocomplain UNSET
40     .pb configure -variable UNSET
41     .pb instate disabled
42 } -result 1
43
44 test progressbar-2.0 "step command" -body {
45     .pb configure -variable {}          ;# @@@
46     .pb configure -value 5 -maximum 10 -mode determinate
47     .pb step
48     .pb cget -value
49 } -result 6.0
50
51 test progressbar-2.1 "step command, with stepamount" -body {
52     .pb step 3
53     .pb cget -value
54 } -result 9.0
55
56 test progressbar-2.2 "step wraps at -maximum in determinate mode" -body {
57     .pb step
58     .pb cget -value
59 } -result 0.0
60
61 test progressbar-2.3 "step doesn't wrap in indeterminate mode" -body {
62     .pb configure -value 8 -maximum 10 -mode indeterminate
63     .pb step
64     .pb step
65     .pb step
66     .pb cget -value
67 } -result 11.0
68
69 test progressbar-2.4 "step with linked variable" -body {
70     .pb configure -variable PB          ;# @@@
71     set PB 5
72     .pb step
73     set PB
74 } -result 6.0
75
76 test progressbar-2.5 "error in write trace" -body {
77     trace variable PB w { error "YIPES!" ;# }
78     .pb step
79     set PB              ;# NOTREACHED
80 } -cleanup { unset PB } -returnCodes error -match glob -result "*YIPES!"
81
82 test progressbar-end "Cleanup" -body {
83     destroy .pb
84 }
85
86 tcltest::cleanupTests