1 |
578 |
markom |
# This file is a Tcl script to test out the "frame" and "toplevel"
|
2 |
|
|
# commands of Tk. It is organized in the standard fashion for Tcl
|
3 |
|
|
# tests.
|
4 |
|
|
#
|
5 |
|
|
# Copyright (c) 1994 The Regents of the University of California.
|
6 |
|
|
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
7 |
|
|
#
|
8 |
|
|
# See the file "license.terms" for information on usage and redistribution
|
9 |
|
|
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
10 |
|
|
#
|
11 |
|
|
# RCS: @(#) $Id: frame.test,v 1.1.1.1 2002-01-16 10:25:58 markom Exp $
|
12 |
|
|
|
13 |
|
|
if {[info procs test] != "test"} {
|
14 |
|
|
source defs
|
15 |
|
|
}
|
16 |
|
|
|
17 |
|
|
foreach i [winfo children .] {
|
18 |
|
|
catch {destroy $i}
|
19 |
|
|
}
|
20 |
|
|
wm geometry . {}
|
21 |
|
|
raise .
|
22 |
|
|
|
23 |
|
|
# eatColors --
|
24 |
|
|
# Creates a toplevel window and allocates enough colors in it to
|
25 |
|
|
# use up all the slots in the colormap.
|
26 |
|
|
#
|
27 |
|
|
# Arguments:
|
28 |
|
|
# w - Name of toplevel window to create.
|
29 |
|
|
|
30 |
|
|
proc eatColors {w} {
|
31 |
|
|
catch {destroy $w}
|
32 |
|
|
toplevel $w
|
33 |
|
|
wm geom $w +0+0
|
34 |
|
|
canvas $w.c -width 400 -height 200 -bd 0
|
35 |
|
|
pack $w.c
|
36 |
|
|
for {set y 0} {$y < 8} {incr y} {
|
37 |
|
|
for {set x 0} {$x < 40} {incr x} {
|
38 |
|
|
set color [format #%02x%02x%02x [expr $x*6] [expr $y*30] 0]
|
39 |
|
|
$w.c create rectangle [expr 10*$x] [expr 20*$y] \
|
40 |
|
|
[expr 10*$x + 10] [expr 20*$y + 20] -outline {} \
|
41 |
|
|
-fill $color
|
42 |
|
|
}
|
43 |
|
|
}
|
44 |
|
|
update
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
# colorsFree --
|
48 |
|
|
#
|
49 |
|
|
# Returns 1 if there appear to be free colormap entries in a window,
|
50 |
|
|
# 0 otherwise.
|
51 |
|
|
#
|
52 |
|
|
# Arguments:
|
53 |
|
|
# w - Name of window in which to check.
|
54 |
|
|
# red, green, blue - Intensities to use in a trial color allocation
|
55 |
|
|
# to see if there are colormap entries free.
|
56 |
|
|
|
57 |
|
|
proc colorsFree {w {red 31} {green 245} {blue 192}} {
|
58 |
|
|
set vals [winfo rgb $w [format #%02x%02x%02x $red $green $blue]]
|
59 |
|
|
expr ([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green) \
|
60 |
|
|
&& ([lindex $vals 2]/256 == $blue)
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
test frame-1.1 {frame configuration options} {
|
64 |
|
|
frame .f -class NewFrame
|
65 |
|
|
list [.f configure -class] [catch {.f configure -class Different} msg] $msg
|
66 |
|
|
} {{-class class Class Frame NewFrame} 1 {can't modify -class option after widget is created}}
|
67 |
|
|
catch {destroy .f}
|
68 |
|
|
test frame-1.2 {frame configuration options} {
|
69 |
|
|
list [catch {frame .f -colormap new} msg] $msg
|
70 |
|
|
} {0 .f}
|
71 |
|
|
catch {destroy .f}
|
72 |
|
|
test frame-1.3 {frame configuration options} {
|
73 |
|
|
list [catch {frame .f -visual default} msg] $msg
|
74 |
|
|
} {0 .f}
|
75 |
|
|
catch {destroy .f}
|
76 |
|
|
test frame-1.4 {frame configuration options} {
|
77 |
|
|
list [catch {frame .f -screen bogus} msg] $msg
|
78 |
|
|
} {1 {unknown option "-screen"}}
|
79 |
|
|
test frame-1.5 {frame configuration options} {
|
80 |
|
|
set result [list [catch {frame .f -container true} msg] $msg \
|
81 |
|
|
[.f configure -container]]
|
82 |
|
|
destroy .f
|
83 |
|
|
set result
|
84 |
|
|
} {0 .f {-container container Container 0 1}}
|
85 |
|
|
test frame-1.6 {frame configuration options} {
|
86 |
|
|
list [catch {frame .f -container bogus} msg] $msg
|
87 |
|
|
} {1 {expected boolean value but got "bogus"}}
|
88 |
|
|
test frame-1.7 {frame configuration options} {
|
89 |
|
|
frame .f
|
90 |
|
|
set result [list [catch {.f configure -container 1} msg] $msg]
|
91 |
|
|
destroy .f
|
92 |
|
|
set result
|
93 |
|
|
} {1 {can't modify -container option after widget is created}}
|
94 |
|
|
frame .f
|
95 |
|
|
set i 8
|
96 |
|
|
foreach test {
|
97 |
|
|
{-background #ff0000 #ff0000 non-existent
|
98 |
|
|
{unknown color name "non-existent"}}
|
99 |
|
|
{-bd 4 4 badValue {bad screen distance "badValue"}}
|
100 |
|
|
{-bg #00ff00 #00ff00 non-existent
|
101 |
|
|
{unknown color name "non-existent"}}
|
102 |
|
|
{-borderwidth 1.3 1 badValue {bad screen distance "badValue"}}
|
103 |
|
|
{-cursor arrow arrow badValue {bad cursor spec "badValue"}}
|
104 |
|
|
{-height 100 100 not_a_number {bad screen distance "not_a_number"}}
|
105 |
|
|
{-highlightbackground #112233 #112233 ugly {unknown color name "ugly"}}
|
106 |
|
|
{-highlightcolor #123456 #123456 non-existent
|
107 |
|
|
{unknown color name "non-existent"}}
|
108 |
|
|
{-highlightthickness 6 6 badValue {bad screen distance "badValue"}}
|
109 |
|
|
{-relief ridge ridge badValue {bad relief type "badValue": must be flat, groove, raised, ridge, solid, or sunken}}
|
110 |
|
|
{-takefocus "any string" "any string" {} {}}
|
111 |
|
|
{-width 32 32 badValue {bad screen distance "badValue"}}
|
112 |
|
|
} {
|
113 |
|
|
set name [lindex $test 0]
|
114 |
|
|
test frame-1.$i {frame configuration options} {
|
115 |
|
|
.f configure $name [lindex $test 1]
|
116 |
|
|
lindex [.f configure $name] 4
|
117 |
|
|
} [lindex $test 2]
|
118 |
|
|
incr i
|
119 |
|
|
if {[lindex $test 3] != ""} {
|
120 |
|
|
test frame-1.$i {frame configuration options} {
|
121 |
|
|
list [catch {.f configure $name [lindex $test 3]} msg] $msg
|
122 |
|
|
} [list 1 [lindex $test 4]]
|
123 |
|
|
}
|
124 |
|
|
.f configure $name [lindex [.f configure $name] 3]
|
125 |
|
|
incr i
|
126 |
|
|
}
|
127 |
|
|
destroy .f
|
128 |
|
|
|
129 |
|
|
set i 1
|
130 |
|
|
test frame-2.1 {toplevel configuration options} {
|
131 |
|
|
catch {destroy .t}
|
132 |
|
|
toplevel .t -width 200 -height 100 -class NewClass
|
133 |
|
|
wm geometry .t +0+0
|
134 |
|
|
list [.t configure -class] [catch {.t configure -class Another} msg] $msg
|
135 |
|
|
} {{-class class Class Toplevel NewClass} 1 {can't modify -class option after widget is created}}
|
136 |
|
|
test frame-2.2 {toplevel configuration options} {
|
137 |
|
|
catch {destroy .t}
|
138 |
|
|
toplevel .t -width 200 -height 100 -colormap new
|
139 |
|
|
wm geometry .t +0+0
|
140 |
|
|
list [.t configure -colormap] [catch {.t configure -colormap .} msg] $msg
|
141 |
|
|
} {{-colormap colormap Colormap {} new} 1 {can't modify -colormap option after widget is created}}
|
142 |
|
|
test frame-2.3 {toplevel configuration options} {
|
143 |
|
|
catch {destroy .t}
|
144 |
|
|
toplevel .t -width 200 -height 100
|
145 |
|
|
wm geometry .t +0+0
|
146 |
|
|
list [catch {.t configure -container 1} msg] $msg [.t configure -container]
|
147 |
|
|
} {1 {can't modify -container option after widget is created} {-container container Container 0 0}}
|
148 |
|
|
test frame-2.4 {toplevel configuration options} {
|
149 |
|
|
catch {destroy .t}
|
150 |
|
|
list [catch {toplevel .t -width 200 -height 100 -colormap bogus} msg] $msg
|
151 |
|
|
} {1 {bad window path name "bogus"}}
|
152 |
|
|
set default "[winfo visual .] [winfo depth .]"
|
153 |
|
|
test frame-2.5 {toplevel configuration options} {
|
154 |
|
|
catch {destroy .t}
|
155 |
|
|
toplevel .t -width 200 -height 100
|
156 |
|
|
wm geometry .t +0+0
|
157 |
|
|
list [catch {.t configure -use 0x44022} msg] $msg [.t configure -use]
|
158 |
|
|
} {1 {can't modify -use option after widget is created} {-use use Use {} {}}}
|
159 |
|
|
test frame-2.6 {toplevel configuration options} {
|
160 |
|
|
catch {destroy .t}
|
161 |
|
|
toplevel .t -width 200 -height 100 -visual default
|
162 |
|
|
wm geometry .t +0+0
|
163 |
|
|
list [.t configure -visual] [catch {.t configure -visual best} msg] $msg
|
164 |
|
|
} {{-visual visual Visual {} default} 1 {can't modify -visual option after widget is created}}
|
165 |
|
|
test frame-2.7 {toplevel configuration options} {
|
166 |
|
|
catch {destroy .t}
|
167 |
|
|
list [catch {toplevel .t -width 200 -height 100 -visual who_knows?} msg] $msg
|
168 |
|
|
} {1 {unknown or ambiguous visual name "who_knows?": class must be best, directcolor, grayscale, greyscale, pseudocolor, staticcolor, staticgray, staticgrey, truecolor, or default}}
|
169 |
|
|
if [info exists env(DISPLAY)] {
|
170 |
|
|
test frame-2.8 {toplevel configuration options} {
|
171 |
|
|
catch {destroy .t}
|
172 |
|
|
toplevel .t -width 200 -height 100 -screen $env(DISPLAY)
|
173 |
|
|
wm geometry .t +0+0
|
174 |
|
|
list [.t configure -screen] \
|
175 |
|
|
[catch {.t configure -screen another} msg] $msg
|
176 |
|
|
} [list [list -screen screen Screen {} $env(DISPLAY)] 1 {can't modify -screen option after widget is created}]
|
177 |
|
|
}
|
178 |
|
|
test frame-2.9 {toplevel configuration options} {
|
179 |
|
|
catch {destroy .t}
|
180 |
|
|
list [catch {toplevel .t -width 200 -height 100 -screen bogus} msg] $msg
|
181 |
|
|
} {1 {couldn't connect to display "bogus"}}
|
182 |
|
|
catch {destroy .t}
|
183 |
|
|
toplevel .t -width 300 -height 150
|
184 |
|
|
wm geometry .t +0+0
|
185 |
|
|
update
|
186 |
|
|
set i 8
|
187 |
|
|
foreach test {
|
188 |
|
|
{-background #ff0000 #ff0000 non-existent
|
189 |
|
|
{unknown color name "non-existent"}}
|
190 |
|
|
{-bd 4 4 badValue {bad screen distance "badValue"}}
|
191 |
|
|
{-bg #00ff00 #00ff00 non-existent
|
192 |
|
|
{unknown color name "non-existent"}}
|
193 |
|
|
{-borderwidth 1.3 1 badValue {bad screen distance "badValue"}}
|
194 |
|
|
{-cursor arrow arrow badValue {bad cursor spec "badValue"}}
|
195 |
|
|
{-height 100 100 not_a_number {bad screen distance "not_a_number"}}
|
196 |
|
|
{-highlightcolor #123456 #123456 non-existent
|
197 |
|
|
{unknown color name "non-existent"}}
|
198 |
|
|
{-highlightthickness 3 3 badValue {bad screen distance "badValue"}}
|
199 |
|
|
{-relief ridge ridge badValue {bad relief type "badValue": must be flat, groove, raised, ridge, solid, or sunken}}
|
200 |
|
|
{-width 32 32 badValue {bad screen distance "badValue"}}
|
201 |
|
|
} {
|
202 |
|
|
set name [lindex $test 0]
|
203 |
|
|
test frame-2.$i {frame configuration options} {
|
204 |
|
|
.t configure $name [lindex $test 1]
|
205 |
|
|
lindex [.t configure $name] 4
|
206 |
|
|
} [lindex $test 2]
|
207 |
|
|
incr i
|
208 |
|
|
if {[lindex $test 3] != ""} {
|
209 |
|
|
test frame-2.$i {frame configuration options} {
|
210 |
|
|
list [catch {.t configure $name [lindex $test 3]} msg] $msg
|
211 |
|
|
} [list 1 [lindex $test 4]]
|
212 |
|
|
}
|
213 |
|
|
.t configure $name [lindex [.t configure $name] 3]
|
214 |
|
|
incr i
|
215 |
|
|
}
|
216 |
|
|
|
217 |
|
|
test frame-3.1 {TkCreateFrame procedure} {
|
218 |
|
|
list [catch frame msg] $msg
|
219 |
|
|
} {1 {wrong # args: should be "frame pathName ?options?"}}
|
220 |
|
|
test frame-3.2 {TkCreateFrame procedure} {
|
221 |
|
|
catch {destroy .f}
|
222 |
|
|
frame .f
|
223 |
|
|
set result [.f configure -class]
|
224 |
|
|
destroy .f
|
225 |
|
|
set result
|
226 |
|
|
} {-class class Class Frame Frame}
|
227 |
|
|
test frame-3.3 {TkCreateFrame procedure} {
|
228 |
|
|
catch {destroy .t}
|
229 |
|
|
toplevel .t
|
230 |
|
|
wm geometry .t +0+0
|
231 |
|
|
set result [.t configure -class]
|
232 |
|
|
destroy .t
|
233 |
|
|
set result
|
234 |
|
|
} {-class class Class Toplevel Toplevel}
|
235 |
|
|
test frame-3.4 {TkCreateFrame procedure} {
|
236 |
|
|
catch {destroy .t}
|
237 |
|
|
toplevel .t -width 350 -class NewClass -bg black -visual default -height 90
|
238 |
|
|
wm geometry .t +0+0
|
239 |
|
|
update
|
240 |
|
|
list [lindex [.t configure -width] 4] \
|
241 |
|
|
[lindex [.t configure -background] 4] \
|
242 |
|
|
[lindex [.t configure -height] 4]
|
243 |
|
|
} {350 black 90}
|
244 |
|
|
|
245 |
|
|
# Be sure that the -class, -colormap, and -visual options are processed
|
246 |
|
|
# before configuring the widget.
|
247 |
|
|
|
248 |
|
|
test frame-3.5 {TkCreateFrame procedure} {
|
249 |
|
|
catch {destroy .f}
|
250 |
|
|
option add *NewFrame.background #123456
|
251 |
|
|
frame .f -class NewFrame
|
252 |
|
|
option clear
|
253 |
|
|
lindex [.f configure -background] 4
|
254 |
|
|
} {#123456}
|
255 |
|
|
test frame-3.6 {TkCreateFrame procedure} {
|
256 |
|
|
catch {destroy .f}
|
257 |
|
|
option add *NewFrame.background #123456
|
258 |
|
|
frame .f -class NewFrame
|
259 |
|
|
option clear
|
260 |
|
|
lindex [.f configure -background] 4
|
261 |
|
|
} {#123456}
|
262 |
|
|
test frame-3.7 {TkCreateFrame procedure} {
|
263 |
|
|
catch {destroy .f}
|
264 |
|
|
option add *NewFrame.background #332211
|
265 |
|
|
option add *f.class NewFrame
|
266 |
|
|
frame .f
|
267 |
|
|
option clear
|
268 |
|
|
list [lindex [.f configure -class] 4] [lindex [.f configure -background] 4]
|
269 |
|
|
} {NewFrame #332211}
|
270 |
|
|
test frame-3.8 {TkCreateFrame procedure} {
|
271 |
|
|
catch {destroy .f}
|
272 |
|
|
option add *Silly.background #122334
|
273 |
|
|
option add *f.Class Silly
|
274 |
|
|
frame .f
|
275 |
|
|
option clear
|
276 |
|
|
list [lindex [.f configure -class] 4] [lindex [.f configure -background] 4]
|
277 |
|
|
} {Silly #122334}
|
278 |
|
|
test frame-3.9 {TkCreateFrame procedure, -use option} unixOnly {
|
279 |
|
|
catch {destroy .t}
|
280 |
|
|
catch {destroy .x}
|
281 |
|
|
toplevel .t -container 1 -width 300 -height 120
|
282 |
|
|
wm geometry .t +0+0
|
283 |
|
|
toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green
|
284 |
|
|
tkwait visibility .x
|
285 |
|
|
set result "[expr [winfo rootx .x] - [winfo rootx .t]] [expr [winfo rooty .x] - [winfo rooty .t]] [winfo width .t] [winfo height .t]"
|
286 |
|
|
destroy .t
|
287 |
|
|
set result
|
288 |
|
|
} {0 0 140 300}
|
289 |
|
|
test frame-3.10 {TkCreateFrame procedure, -use option} unixOnly {
|
290 |
|
|
catch {destroy .t}
|
291 |
|
|
catch {destroy .x}
|
292 |
|
|
toplevel .t -container 1 -width 300 -height 120
|
293 |
|
|
wm geometry .t +0+0
|
294 |
|
|
option add *x.use [winfo id .t]
|
295 |
|
|
toplevel .x -width 140 -height 300 -bg green
|
296 |
|
|
tkwait visibility .x
|
297 |
|
|
set result "[expr [winfo rootx .x] - [winfo rootx .t]] [expr [winfo rooty .x] - [winfo rooty .t]] [winfo width .t] [winfo height .t]"
|
298 |
|
|
destroy .t
|
299 |
|
|
option clear
|
300 |
|
|
set result
|
301 |
|
|
} {0 0 140 300}
|
302 |
|
|
|
303 |
|
|
# The tests below require specific display characteristics. Even so,
|
304 |
|
|
# they are non-portable: some machines don't seem to ever run out of
|
305 |
|
|
# colors.
|
306 |
|
|
|
307 |
|
|
if {([winfo visual .] == "pseudocolor") && ([winfo depth .] == 8)} {
|
308 |
|
|
eatColors .t1
|
309 |
|
|
test frame-3.11 {TkCreateFrame procedure} {nonPortable} {
|
310 |
|
|
catch {destroy .t}
|
311 |
|
|
toplevel .t -width 300 -height 200 -bg #475601
|
312 |
|
|
wm geometry .t +0+0
|
313 |
|
|
update
|
314 |
|
|
colorsFree .t
|
315 |
|
|
} {0}
|
316 |
|
|
test frame-3.12 {TkCreateFrame procedure} {nonPortable} {
|
317 |
|
|
catch {destroy .t}
|
318 |
|
|
toplevel .t -width 300 -height 200 -bg #475601 -colormap new
|
319 |
|
|
wm geometry .t +0+0
|
320 |
|
|
update
|
321 |
|
|
colorsFree .t
|
322 |
|
|
} {1}
|
323 |
|
|
test frame-3.13 {TkCreateFrame procedure} {nonPortable} {
|
324 |
|
|
catch {destroy .t}
|
325 |
|
|
option add *t.class Toplevel2
|
326 |
|
|
option add *Toplevel2.colormap new
|
327 |
|
|
toplevel .t -width 300 -height 200 -bg #475601
|
328 |
|
|
wm geometry .t +0+0
|
329 |
|
|
update
|
330 |
|
|
option clear
|
331 |
|
|
colorsFree .t
|
332 |
|
|
} {1}
|
333 |
|
|
test frame-3.14 {TkCreateFrame procedure} {nonPortable} {
|
334 |
|
|
catch {destroy .t}
|
335 |
|
|
option add *t.class Toplevel3
|
336 |
|
|
option add *Toplevel3.Colormap new
|
337 |
|
|
toplevel .t -width 300 -height 200 -bg #475601 -colormap new
|
338 |
|
|
wm geometry .t +0+0
|
339 |
|
|
update
|
340 |
|
|
option clear
|
341 |
|
|
colorsFree .t
|
342 |
|
|
} {1}
|
343 |
|
|
test frame-3.15 {TkCreateFrame procedure, -use and -colormap} {unixOnly nonPortable} {
|
344 |
|
|
catch {destroy .t}
|
345 |
|
|
catch {destroy .x}
|
346 |
|
|
toplevel .t -container 1 -width 300 -height 120
|
347 |
|
|
wm geometry .t +0+0
|
348 |
|
|
toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green -colormap new
|
349 |
|
|
tkwait visibility .x
|
350 |
|
|
set result "[colorsFree .t] [colorsFree .x]"
|
351 |
|
|
destroy .t
|
352 |
|
|
set result
|
353 |
|
|
} {0 1}
|
354 |
|
|
test frame-3.16 {TkCreateFrame procedure} {nonPortable} {
|
355 |
|
|
catch {destroy .t}
|
356 |
|
|
toplevel .t -width 300 -height 200 -bg #475601 -visual default
|
357 |
|
|
wm geometry .t +0+0
|
358 |
|
|
update
|
359 |
|
|
colorsFree .t
|
360 |
|
|
} {0}
|
361 |
|
|
test frame-3.17 {TkCreateFrame procedure} {nonPortable} {
|
362 |
|
|
catch {destroy .t}
|
363 |
|
|
toplevel .t -width 300 -height 200 -bg #475601 -visual default \
|
364 |
|
|
-colormap new
|
365 |
|
|
wm geometry .t +0+0
|
366 |
|
|
update
|
367 |
|
|
colorsFree .t
|
368 |
|
|
} {1}
|
369 |
|
|
if {[lsearch -exact [winfo visualsavailable .] {grayscale 8}] >= 0} {
|
370 |
|
|
test frame-3.18 {TkCreateFrame procedure} {nonPortable} {
|
371 |
|
|
catch {destroy .t}
|
372 |
|
|
toplevel .t -visual {grayscale 8} -width 300 -height 200 \
|
373 |
|
|
-bg #434343
|
374 |
|
|
wm geometry .t +0+0
|
375 |
|
|
update
|
376 |
|
|
colorsFree .t 131 131 131
|
377 |
|
|
} {1}
|
378 |
|
|
test frame-3.19 {TkCreateFrame procedure} {nonPortable} {
|
379 |
|
|
catch {destroy .t}
|
380 |
|
|
option add *t.class T4
|
381 |
|
|
option add *T4.visual {grayscale 8}
|
382 |
|
|
toplevel .t -width 300 -height 200 -bg #434343
|
383 |
|
|
wm geometry .t +0+0
|
384 |
|
|
update
|
385 |
|
|
option clear
|
386 |
|
|
list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4]
|
387 |
|
|
} {1 {grayscale 8}}
|
388 |
|
|
test frame-3.20 {TkCreateFrame procedure} {nonPortable} {
|
389 |
|
|
catch {destroy .t}
|
390 |
|
|
set x ok
|
391 |
|
|
option add *t.class T5
|
392 |
|
|
option add *T5.Visual {grayscale 8}
|
393 |
|
|
toplevel .t -width 300 -height 200 -bg #434343
|
394 |
|
|
wm geometry .t +0+0
|
395 |
|
|
update
|
396 |
|
|
option clear
|
397 |
|
|
list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4]
|
398 |
|
|
} {1 {grayscale 8}}
|
399 |
|
|
test frame-3.21 {TkCreateFrame procedure} {nonPortable} {
|
400 |
|
|
catch {destroy .t}
|
401 |
|
|
set x ok
|
402 |
|
|
toplevel .t -visual {grayscale 8} -width 300 -height 200 \
|
403 |
|
|
-bg #434343
|
404 |
|
|
wm geometry .t +0+0
|
405 |
|
|
update
|
406 |
|
|
colorsFree .t 131 131 131
|
407 |
|
|
} {1}
|
408 |
|
|
}
|
409 |
|
|
destroy .t1
|
410 |
|
|
}
|
411 |
|
|
test frame-3.22 {TkCreateFrame procedure, default dimensions} {
|
412 |
|
|
catch {destroy .t}
|
413 |
|
|
toplevel .t
|
414 |
|
|
wm geometry .t +0+0
|
415 |
|
|
update
|
416 |
|
|
set result "[winfo reqwidth .t] [winfo reqheight .t]"
|
417 |
|
|
frame .t.f -bg red
|
418 |
|
|
pack .t.f
|
419 |
|
|
update
|
420 |
|
|
lappend result [winfo reqwidth .t.f] [winfo reqheight .t.f]
|
421 |
|
|
destroy .t
|
422 |
|
|
set result
|
423 |
|
|
} {200 200 1 1}
|
424 |
|
|
test frame-3.23 {TkCreateFrame procedure} {
|
425 |
|
|
catch {destroy .f}
|
426 |
|
|
list [catch {frame .f -gorp glob} msg] $msg
|
427 |
|
|
} {1 {unknown option "-gorp"}}
|
428 |
|
|
test frame-3.24 {TkCreateFrame procedure} {
|
429 |
|
|
catch {destroy .t}
|
430 |
|
|
list [catch {
|
431 |
|
|
toplevel .t -width 300 -height 200 -colormap new -bogus option
|
432 |
|
|
wm geometry .t +0+0
|
433 |
|
|
} msg] $msg
|
434 |
|
|
} {1 {unknown option "-bogus"}}
|
435 |
|
|
|
436 |
|
|
test frame-4.1 {TkCreateFrame procedure} {
|
437 |
|
|
catch {destroy .f}
|
438 |
|
|
catch {frame .f -gorp glob}
|
439 |
|
|
winfo exists .f
|
440 |
|
|
} 0
|
441 |
|
|
test frame-4.2 {TkCreateFrame procedure} {
|
442 |
|
|
catch {destroy .f}
|
443 |
|
|
list [frame .f -width 200 -height 100] [winfo exists .f]
|
444 |
|
|
} {.f 1}
|
445 |
|
|
|
446 |
|
|
catch {destroy .f}
|
447 |
|
|
frame .f -highlightcolor black
|
448 |
|
|
test frame-5.1 {FrameWidgetCommand procedure} {
|
449 |
|
|
list [catch .f msg] $msg
|
450 |
|
|
} {1 {wrong # args: should be ".f option ?arg arg ...?"}}
|
451 |
|
|
test scale-5.2 {FrameWidgetCommand procedure, cget option} {
|
452 |
|
|
list [catch {.f cget} msg] $msg
|
453 |
|
|
} {1 {wrong # args: should be ".f cget option"}}
|
454 |
|
|
test scale-5.3 {FrameWidgetCommand procedure, cget option} {
|
455 |
|
|
list [catch {.f cget a b} msg] $msg
|
456 |
|
|
} {1 {wrong # args: should be ".f cget option"}}
|
457 |
|
|
test scale-5.4 {FrameWidgetCommand procedure, cget option} {
|
458 |
|
|
list [catch {.f cget -gorp} msg] $msg
|
459 |
|
|
} {1 {unknown option "-gorp"}}
|
460 |
|
|
test scale-5.5 {FrameWidgetCommand procedure, cget option} {
|
461 |
|
|
.f cget -highlightcolor
|
462 |
|
|
} {black}
|
463 |
|
|
test scale-5.6 {FrameWidgetCommand procedure, cget option} {
|
464 |
|
|
list [catch {.f cget -screen} msg] $msg
|
465 |
|
|
} {1 {unknown option "-screen"}}
|
466 |
|
|
test scale-5.7 {FrameWidgetCommand procedure, cget option} {
|
467 |
|
|
catch {destroy .t}
|
468 |
|
|
toplevel .t
|
469 |
|
|
catch {.t cget -screen}
|
470 |
|
|
} {0}
|
471 |
|
|
catch {destroy .t}
|
472 |
|
|
test frame-5.8 {FrameWidgetCommand procedure, configure option} {
|
473 |
|
|
llength [.f configure]
|
474 |
|
|
} {16}
|
475 |
|
|
test frame-5.9 {FrameWidgetCommand procedure, configure option} {
|
476 |
|
|
list [catch {.f configure -gorp} msg] $msg
|
477 |
|
|
} {1 {unknown option "-gorp"}}
|
478 |
|
|
test frame-5.10 {FrameWidgetCommand procedure, configure option} {
|
479 |
|
|
list [catch {.f configure -gorp bogus} msg] $msg
|
480 |
|
|
} {1 {unknown option "-gorp"}}
|
481 |
|
|
test frame-5.11 {FrameWidgetCommand procedure, configure option} {
|
482 |
|
|
list [catch {.f configure -width 200 -height} msg] $msg
|
483 |
|
|
} {1 {value for "-height" missing}}
|
484 |
|
|
test frame-5.12 {FrameWidgetCommand procedure} {
|
485 |
|
|
list [catch {.f swizzle} msg] $msg
|
486 |
|
|
} {1 {bad option "swizzle": must be cget or configure}}
|
487 |
|
|
|
488 |
|
|
test frame-6.1 {ConfigureFrame procedure} {
|
489 |
|
|
catch {destroy .f}
|
490 |
|
|
frame .f -width 150
|
491 |
|
|
list [winfo reqwidth .f] [winfo reqheight .f]
|
492 |
|
|
} {150 1}
|
493 |
|
|
test frame-6.2 {ConfigureFrame procedure} {
|
494 |
|
|
catch {destroy .f}
|
495 |
|
|
frame .f -height 97
|
496 |
|
|
list [winfo reqwidth .f] [winfo reqheight .f]
|
497 |
|
|
} {1 97}
|
498 |
|
|
test frame-6.3 {ConfigureFrame procedure} {
|
499 |
|
|
catch {destroy .f}
|
500 |
|
|
frame .f
|
501 |
|
|
set result {}
|
502 |
|
|
lappend result [winfo reqwidth .f] [winfo reqheight .f]
|
503 |
|
|
.f configure -width 100 -height 180
|
504 |
|
|
lappend result [winfo reqwidth .f] [winfo reqheight .f]
|
505 |
|
|
.f configure -width 0 -height 0
|
506 |
|
|
lappend result [winfo reqwidth .f] [winfo reqheight .f]
|
507 |
|
|
} {1 1 100 180 100 180}
|
508 |
|
|
|
509 |
|
|
test frame-7.1 {FrameEventProc procedure} {
|
510 |
|
|
frame .frame2
|
511 |
|
|
set result [info commands .frame2]
|
512 |
|
|
destroy .frame2
|
513 |
|
|
lappend result [info commands .frame2]
|
514 |
|
|
} {.frame2 {}}
|
515 |
|
|
test frame-7.2 {FrameEventProc procedure} {
|
516 |
|
|
eval destroy [winfo children .]
|
517 |
|
|
frame .f1 -bg #543210
|
518 |
|
|
rename .f1 .f2
|
519 |
|
|
set x {}
|
520 |
|
|
lappend x [winfo children .]
|
521 |
|
|
lappend x [.f2 cget -bg]
|
522 |
|
|
destroy .f1
|
523 |
|
|
lappend x [info command .f*] [winfo children .]
|
524 |
|
|
} {.f1 #543210 {} {}}
|
525 |
|
|
|
526 |
|
|
test frame-8.1 {FrameCmdDeletedProc procedure} {
|
527 |
|
|
eval destroy [winfo children .]
|
528 |
|
|
frame .f1
|
529 |
|
|
rename .f1 {}
|
530 |
|
|
list [info command .f*] [winfo children .]
|
531 |
|
|
} {{} {}}
|
532 |
|
|
test frame-8.2 {FrameCmdDeletedProc procedure} {
|
533 |
|
|
eval destroy [winfo children .]
|
534 |
|
|
toplevel .f1 -menu .m
|
535 |
|
|
wm geometry .f1 +0+0
|
536 |
|
|
update
|
537 |
|
|
rename .f1 {}
|
538 |
|
|
update
|
539 |
|
|
list [info command .f*] [winfo children .]
|
540 |
|
|
} {{} {}}
|
541 |
|
|
test frame-8.3 {FrameCmdDeletedProc procedure} {
|
542 |
|
|
eval destroy [winfo children .]
|
543 |
|
|
toplevel .f1 -menu .m
|
544 |
|
|
wm geometry .f1 +0+0
|
545 |
|
|
menu .m
|
546 |
|
|
update
|
547 |
|
|
rename .f1 {}
|
548 |
|
|
update
|
549 |
|
|
set result [list [info command .f*] [winfo children .]]
|
550 |
|
|
eval destroy [winfo children .]
|
551 |
|
|
set result
|
552 |
|
|
} {{} .m}
|
553 |
|
|
|
554 |
|
|
test frame-9.1 {MapFrame procedure} {
|
555 |
|
|
catch {destroy .t}
|
556 |
|
|
toplevel .t -width 100 -height 400
|
557 |
|
|
wm geometry .t +0+0
|
558 |
|
|
set result [winfo ismapped .t]
|
559 |
|
|
update idletasks
|
560 |
|
|
lappend result [winfo ismapped .t]
|
561 |
|
|
} {0 1}
|
562 |
|
|
test frame-9.2 {MapFrame procedure} {
|
563 |
|
|
catch {destroy .t}
|
564 |
|
|
toplevel .t -width 100 -height 400
|
565 |
|
|
wm geometry .t +0+0
|
566 |
|
|
destroy .t
|
567 |
|
|
update
|
568 |
|
|
winfo exists .t
|
569 |
|
|
} {0}
|
570 |
|
|
test frame-9.3 {MapFrame procedure, window deleted while mapping} {
|
571 |
|
|
toplevel .t2 -width 200 -height 200
|
572 |
|
|
wm geometry .t2 +0+0
|
573 |
|
|
tkwait visibility .t2
|
574 |
|
|
catch {destroy .t}
|
575 |
|
|
toplevel .t -width 100 -height 400
|
576 |
|
|
wm geometry .t +0+0
|
577 |
|
|
frame .t2.f -width 50 -height 50
|
578 |
|
|
bind .t2.f {destroy .t}
|
579 |
|
|
pack .t2.f -side top
|
580 |
|
|
update idletasks
|
581 |
|
|
winfo exists .t
|
582 |
|
|
} {0}
|
583 |
|
|
|
584 |
|
|
set l [interp hidden]
|
585 |
|
|
eval destroy [winfo children .]
|
586 |
|
|
|
587 |
|
|
test frame-10.1 {frame widget vs hidden commands} {
|
588 |
|
|
catch {destroy .t}
|
589 |
|
|
frame .t
|
590 |
|
|
interp hide {} .t
|
591 |
|
|
destroy .t
|
592 |
|
|
list [winfo children .] [interp hidden]
|
593 |
|
|
} [list {} $l]
|
594 |
|
|
|
595 |
|
|
test frame-11.1 {TkInstallFrameMenu} {
|
596 |
|
|
catch {destroy .t}
|
597 |
|
|
menu .m1
|
598 |
|
|
.m1 add cascade -menu .m1.system
|
599 |
|
|
menu .m1.system -tearoff 0
|
600 |
|
|
.m1.system add command -label foo
|
601 |
|
|
list [toplevel .t -menu .m1] [destroy .m1] [destroy .t]
|
602 |
|
|
} {.t {} {}}
|
603 |
|
|
test frame-11.2 {TkInstallFrameMenu - frame renamed} {
|
604 |
|
|
catch {destroy .t}
|
605 |
|
|
catch {rename foo {}}
|
606 |
|
|
menu .m1
|
607 |
|
|
.m1 add cascade -menu .m1.system
|
608 |
|
|
menu .m1.system -tearoff 0
|
609 |
|
|
.m1.system add command -label foo
|
610 |
|
|
toplevel .t
|
611 |
|
|
list [rename .t foo] [destroy .t] [destroy foo] [destroy .m1]
|
612 |
|
|
} {{} {} {} {}}
|
613 |
|
|
|
614 |
|
|
|
615 |
|
|
catch {destroy .f}
|
616 |
|
|
rename eatColors {}
|
617 |
|
|
rename colorsFree {}
|