1 # This file is a Tcl script to test out [incr Widgets] Labeledframe 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 if [catch {package require Iwidgets 4.0}] {
20 # Let's try modifying the auto_path. Note that the IWIDGETS_LIBRARY
21 # env var is initialized in the Makefile when doing a 'make test'.
22 # If sourcing this file independently, this variable must be set manually.
23 if ![info exists env(IWIDGETS_LIBRARY)] {
24 error "Unable to locate Iwidgets package. Set your IWIDGETS_LIBRARY\
25 environment\nvariable to the directory that contains iwidgets.tcl"
27 lappend auto_path $env(IWIDGETS_LIBRARY)
28 package require Iwidgets 4.0
31 if {[string compare test [info procs test]] == 1} {
43 # Initial construction test
45 test Labeledframe-1.$c {Labeledframe construction} {
46 iwidgets::Labeledframe .lf
47 set cs [.lf childsite]
48 .lf configure -background yellow
49 pack [radiobutton $cs.w1 -anchor w -text "Button1"] -anchor w -fill x
50 pack [radiobutton $cs.w2 -anchor w -text "Button2"] -anchor w -fill x
51 pack [radiobutton $cs.w3 -anchor w -text "Button3"] -anchor w -fill x
52 pack [radiobutton $cs.w4 -anchor w -text "Button4"] -anchor w -fill x
53 pack [radiobutton $cs.w5 -anchor w -text "Button5"] -anchor w -fill x
54 pack [radiobutton $cs.w6 -anchor w -text "Button6"] -anchor w -fill x
55 pack [radiobutton $cs.w7 -anchor w -text "Button7"] -anchor w -fill x
56 pack [radiobutton $cs.w8 -anchor w -text "Button8"] -anchor w -fill x
58 pack .lf -fill both -expand yes
65 # Option tests which are successful.
67 test Labeledframe-2.$o {configuration option} {
68 llength [.lf configure]
74 {-labeltext "Label" "Label"}
87 {-labelfont 6x13 6x13}
100 {-relief groove groove}
101 {-relief sunken sunken}
102 {-relief raised raised}
103 {-relief ridge ridge}
117 set option [lindex $test 0]
118 test Labeledframe-1.$o "configuration options, $option" {
119 .lf configure $option [lindex $test 1]
120 lindex [.lf configure $option] 4
127 # Method tests which are successful.
129 test Labeledframe-3.$m {object method, childsite} {
130 list [catch {.lf childsite} msg] $msg
131 } [list 0 .lf.childsite]
135 test Labeledframe-3.$m {object static method, initTable} {
142 # Method tests which fail and produce errors
144 test Labeledframe-3.$m {initTable static method} {
151 test Labeledframe-1.$c {Labeledframe destruction} {
159 test Labeledframe-1.$c {Labeledframe construction} {
160 iwidgets::labeledframe .lf -labeltext "ListBox" -labelpos s
161 set cs [.lf childsite]
162 .lf configure -background yellow
163 pack [radiobutton $cs.w1 -anchor w -text "Button1"] -anchor w -fill x
164 pack [radiobutton $cs.w2 -anchor w -text "Button2"] -anchor w -fill x
165 pack [radiobutton $cs.w3 -anchor w -text "Button3"] -anchor w -fill x
166 pack [radiobutton $cs.w4 -anchor w -text "Button4"] -anchor w -fill x
167 pack [radiobutton $cs.w5 -anchor w -text "Button5"] -anchor w -fill x
168 pack [radiobutton $cs.w6 -anchor w -text "Button6"] -anchor w -fill x
169 pack [radiobutton $cs.w7 -anchor w -text "Button7"] -anchor w -fill x
170 pack [radiobutton $cs.w8 -anchor w -text "Button8"] -anchor w -fill x
171 pack .lf -fill both -expand yes
177 test Labeledframe-1.$c {Labeledframe destruction} {
184 test Labeledframe-1.$c {Labeledframe construction} {
185 iwidgets::labeledframe .lf
193 ::tcltest::cleanupTests