OSDN Git Service

touched all sources to ease next import
[pf3gnuchains/pf3gnuchains3x.git] / itcl / iwidgets3.0.0 / tests / spintime.test
1 # This file is a Tcl script to test out [incr Widgets] Spintime class.
2 # It is organized in the standard fashion for Tcl tests with the following
3 # notation for test case labels:
4 #
5 #   1.x - Construction/Destruction tests
6 #   2.x - Configuration option tests
7 #   3.x - Method tests
8 #
9 # Copyright (c) 1995 DSC Technologies Corporation
10 #
11 # See the file "license.terms" for information on usage and redistribution
12 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 #
14 # @(#) $Id$
15
16 package require tcltest
17 namespace import -force ::tcltest::*
18
19 package require Iwidgets 3.0
20
21 if {[string compare test [info procs test]] == 1} {
22     source defs
23 }
24
25 wm geometry . {}
26 raise .
27
28 set c 1
29 set o 1
30 set m 1
31
32 #
33 # Initial construction test
34 #
35 test Spintime-1.$c {Spintime construction} {
36     iwidgets::Spintime .st
37     pack .st -padx 10 -pady 10 -fill both -expand yes
38     update 
39 } {}
40
41 incr c
42
43 #
44 # Option tests which are successful.
45 #
46 test Spintime-2.$o {configuration option} {
47     llength [.st configure]
48 } {25}
49
50 incr o
51
52 foreach test {
53     {-arroworient horizontal horizontal}
54     {-arroworient vertical vertical}
55     {-background #d9d9d9 #d9d9d9}
56     {-cursor gumby gumby}
57     {-hourlabel Hour: Hour:}
58     {-houron false false}
59     {-houron true true}
60     {-hourwidth 4 4}
61     {-labelmargin 4 4}
62     {-labelpos n n}
63     {-labelpos s s}
64     {-labelpos e e}
65     {-labelpos w w}
66     {-militaryon no no}
67     {-militaryon yes yes}
68     {-minutelabel Minute: Minute:}
69     {-minuteon false false}
70     {-minuteon true true}
71     {-minutewidth 4 4}
72     {-orient horizontal horizontal}
73     {-orient vertical vertical}
74     {-secondlabel Second: Second:}
75     {-secondon false false}
76     {-secondon true true}
77     {-secondwidth 4 4}
78     {-textbackground GhostWhite GhostWhite}
79     {-timemargin 3 3}} {
80         set option [lindex $test 0]
81         test Spintime-2.$o "configuration options, $option" {
82             .st configure $option [lindex $test 1]
83             lindex [.st configure $option] 4
84         } [lindex $test 2]
85         update 
86         incr o
87 }
88
89 #
90 # Method tests which are successful.
91 #
92 foreach test {
93     {{.st show "21:21:21"} {}}
94     {{.st get -string} "21:21:21"}} {
95         set method [lindex [lindex $test 0] 1]
96         test Spintime-3.$m "object methods, $method" {
97             list [catch {eval [lindex $test 0]} msg] $msg
98         } [list 0 [lindex $test 1]]
99         update 
100         incr m
101 }
102
103 foreach test {
104     {{.st show bogus} {bad time: "bogus", must be a valid time string, clock clicks value or the keyword now}}
105     {{.st get bogus} {bad format option "bogus": should be -string or -clicks}}} {
106         set method [lindex [lindex $test 0] 1]
107         test ScrolledListBox-3.$m "object methods, $method" {
108             list [catch {eval [lindex $test 0]} msg] $msg
109         } [list 1 [lindex $test 1]]
110         incr m
111 }
112
113 #
114 # Conclusion of constrcution/destruction tests
115 #
116 test Spintime-1.$c {Spintime destruction} {
117     destroy .st
118     update 
119 } {}
120
121 incr c
122
123 test Spintime-1.$c {Spintime construction} {
124     iwidgets::spintime .st 
125     pack .st -padx 10 -pady 10 -fill both -expand yes
126     update 
127 } {}
128
129 incr c
130
131 test Spintime-1.$c {Spintime destruction} {
132     destroy .st 
133     update 
134 } {}
135
136 incr c
137
138 test Spintime-1.$c {Spintime destruction} {
139     iwidgets::spintime .st
140     pack .st
141     destroy .st 
142     update 
143 } {}
144
145 ::tcltest::cleanupTests
146 exit