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:
5 # 1.x - Construction/Destruction tests
6 # 2.x - Configuration option tests
9 # Copyright (c) 1995 DSC Technologies Corporation
11 # See the file "license.terms" for information on usage and redistribution
12 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
16 package require tcltest
17 namespace import -force ::tcltest::*
19 package require Iwidgets 3.0
21 if {[string compare test [info procs test]] == 1} {
33 # Initial construction test
35 test Spintime-1.$c {Spintime construction} {
36 iwidgets::Spintime .st
37 pack .st -padx 10 -pady 10 -fill both -expand yes
44 # Option tests which are successful.
46 test Spintime-2.$o {configuration option} {
47 llength [.st configure]
53 {-arroworient horizontal horizontal}
54 {-arroworient vertical vertical}
55 {-background #d9d9d9 #d9d9d9}
57 {-hourlabel Hour: Hour:}
68 {-minutelabel Minute: Minute:}
69 {-minuteon false false}
72 {-orient horizontal horizontal}
73 {-orient vertical vertical}
74 {-secondlabel Second: Second:}
75 {-secondon false false}
78 {-textbackground GhostWhite GhostWhite}
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
90 # Method tests which are successful.
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]]
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]]
114 # Conclusion of constrcution/destruction tests
116 test Spintime-1.$c {Spintime destruction} {
123 test Spintime-1.$c {Spintime construction} {
124 iwidgets::spintime .st
125 pack .st -padx 10 -pady 10 -fill both -expand yes
131 test Spintime-1.$c {Spintime destruction} {
138 test Spintime-1.$c {Spintime destruction} {
139 iwidgets::spintime .st
145 ::tcltest::cleanupTests