1 |
578 |
markom |
# This file is a Tcl script to test out the old syntax of Tk's
|
2 |
|
|
# "pack" command (before release 3.3). It is organized in the
|
3 |
|
|
# standard fashion for Tcl tests.
|
4 |
|
|
#
|
5 |
|
|
# Copyright (c) 1991-1994 The Regents of the University of California.
|
6 |
|
|
# Copyright (c) 1994 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: oldpack.test,v 1.1.1.1 2002-01-16 10:25:59 markom Exp $
|
12 |
|
|
|
13 |
|
|
if {[string compare test [info procs test]] == 1} then \
|
14 |
|
|
{source defs}
|
15 |
|
|
|
16 |
|
|
# First, test a single window packed in various ways in a parent
|
17 |
|
|
|
18 |
|
|
catch {destroy .pack}
|
19 |
|
|
frame .pack
|
20 |
|
|
place .pack -width 100 -height 100
|
21 |
|
|
frame .pack.red -width 10 -height 20
|
22 |
|
|
label .pack.red.l -text R -bd 2 -relief raised
|
23 |
|
|
place .pack.red.l -relwidth 1.0 -relheight 1.0
|
24 |
|
|
frame .pack.green -width 30 -height 40
|
25 |
|
|
label .pack.green.l -text G -bd 2 -relief raised
|
26 |
|
|
place .pack.green.l -relwidth 1.0 -relheight 1.0
|
27 |
|
|
frame .pack.blue -width 40 -height 40
|
28 |
|
|
label .pack.blue.l -text B -bd 2 -relief raised
|
29 |
|
|
place .pack.blue.l -relwidth 1.0 -relheight 1.0
|
30 |
|
|
frame .pack.violet -width 80 -height 20
|
31 |
|
|
label .pack.violet.l -text P -bd 2 -relief raised
|
32 |
|
|
place .pack.violet.l -relwidth 1.0 -relheight 1.0
|
33 |
|
|
|
34 |
|
|
test pack-1.1 {basic positioning} {
|
35 |
|
|
pack ap .pack .pack.red top
|
36 |
|
|
update
|
37 |
|
|
winfo geometry .pack.red
|
38 |
|
|
} 10x20+45+0
|
39 |
|
|
test pack-1.2 {basic positioning} {
|
40 |
|
|
pack append .pack .pack.red bottom
|
41 |
|
|
update
|
42 |
|
|
winfo geometry .pack.red
|
43 |
|
|
} 10x20+45+80
|
44 |
|
|
test pack-1.3 {basic positioning} {
|
45 |
|
|
pack append .pack .pack.red left
|
46 |
|
|
update
|
47 |
|
|
winfo geometry .pack.red
|
48 |
|
|
} 10x20+0+40
|
49 |
|
|
test pack-1.4 {basic positioning} {
|
50 |
|
|
pack append .pack .pack.red right
|
51 |
|
|
update
|
52 |
|
|
winfo geometry .pack.red
|
53 |
|
|
} 10x20+90+40
|
54 |
|
|
|
55 |
|
|
# Try adding padding around the window and make sure that the
|
56 |
|
|
# window gets a larger frame.
|
57 |
|
|
|
58 |
|
|
test pack-2.1 {padding} {
|
59 |
|
|
pack append .pack .pack.red {t padx 20}
|
60 |
|
|
update
|
61 |
|
|
winfo geometry .pack.red
|
62 |
|
|
} 10x20+45+0
|
63 |
|
|
test pack-2.2 {padding} {
|
64 |
|
|
pack append .pack .pack.red {top pady 20}
|
65 |
|
|
update
|
66 |
|
|
winfo geometry .pack.red
|
67 |
|
|
} 10x20+45+10
|
68 |
|
|
test pack-2.3 {padding} {
|
69 |
|
|
pack append .pack .pack.red {l padx 20}
|
70 |
|
|
update
|
71 |
|
|
winfo geometry .pack.red
|
72 |
|
|
} 10x20+10+40
|
73 |
|
|
test pack-2.4 {padding} {
|
74 |
|
|
pack append .pack .pack.red {left pady 20}
|
75 |
|
|
update
|
76 |
|
|
winfo geometry .pack.red
|
77 |
|
|
} 10x20+0+40
|
78 |
|
|
|
79 |
|
|
# Position the window at different positions in its frame to
|
80 |
|
|
# make sure they all work. Try two differenet frame locations,
|
81 |
|
|
# to make sure that frame offsets are being added in correctly.
|
82 |
|
|
|
83 |
|
|
test pack-3.1 {framing} {
|
84 |
|
|
pack append .pack .pack.red {b padx 20 pady 30}
|
85 |
|
|
update
|
86 |
|
|
winfo geometry .pack.red
|
87 |
|
|
} 10x20+45+65
|
88 |
|
|
test pack-3.2 {framing} {
|
89 |
|
|
pack append .pack .pack.red {bottom padx 20 pady 30 fr n}
|
90 |
|
|
update
|
91 |
|
|
winfo geometry .pack.red
|
92 |
|
|
} 10x20+45+50
|
93 |
|
|
test pack-3.3 {framing} {
|
94 |
|
|
pack append .pack .pack.red {bottom padx 20 pady 30 frame ne}
|
95 |
|
|
update
|
96 |
|
|
winfo geometry .pack.red
|
97 |
|
|
} 10x20+90+50
|
98 |
|
|
test pack-3.4 {framing} {
|
99 |
|
|
pack append .pack .pack.red {bottom padx 20 pady 30 frame e}
|
100 |
|
|
update
|
101 |
|
|
winfo geometry .pack.red
|
102 |
|
|
} 10x20+90+65
|
103 |
|
|
test pack-3.5 {framing} {
|
104 |
|
|
pack append .pack .pack.red {bottom padx 20 pady 30 frame se}
|
105 |
|
|
update
|
106 |
|
|
winfo geometry .pack.red
|
107 |
|
|
} 10x20+90+80
|
108 |
|
|
test pack-3.6 {framing} {
|
109 |
|
|
pack append .pack .pack.red {bottom padx 20 pady 30 frame s}
|
110 |
|
|
update
|
111 |
|
|
winfo geometry .pack.red
|
112 |
|
|
} 10x20+45+80
|
113 |
|
|
test pack-3.7 {framing} {
|
114 |
|
|
pack append .pack .pack.red {bottom padx 20 pady 30 frame sw}
|
115 |
|
|
update
|
116 |
|
|
winfo geometry .pack.red
|
117 |
|
|
} 10x20+0+80
|
118 |
|
|
test pack-3.8 {framing} {
|
119 |
|
|
pack append .pack .pack.red {bottom padx 20 pady 30 frame w}
|
120 |
|
|
update
|
121 |
|
|
winfo geometry .pack.red
|
122 |
|
|
} 10x20+0+65
|
123 |
|
|
test pack-3.9 {framing} {
|
124 |
|
|
pack append .pack .pack.red {bottom padx 20 pady 30 frame nw}
|
125 |
|
|
update
|
126 |
|
|
winfo geometry .pack.red
|
127 |
|
|
} 10x20+0+50
|
128 |
|
|
test pack-3.10 {framing} {
|
129 |
|
|
pack append .pack .pack.red {bottom padx 20 pady 30 frame c}
|
130 |
|
|
update
|
131 |
|
|
winfo geometry .pack.red
|
132 |
|
|
} 10x20+45+65
|
133 |
|
|
test pack-3.11 {framing} {
|
134 |
|
|
pack append .pack .pack.red {r padx 20 pady 30}
|
135 |
|
|
update
|
136 |
|
|
winfo geometry .pack.red
|
137 |
|
|
} 10x20+80+40
|
138 |
|
|
test pack-3.12 {framing} {
|
139 |
|
|
pack append .pack .pack.red {right padx 20 pady 30 frame n}
|
140 |
|
|
update
|
141 |
|
|
winfo geometry .pack.red
|
142 |
|
|
} 10x20+80+0
|
143 |
|
|
test pack-3.13 {framing} {
|
144 |
|
|
pack append .pack .pack.red {right padx 20 pady 30 frame ne}
|
145 |
|
|
update
|
146 |
|
|
winfo geometry .pack.red
|
147 |
|
|
} 10x20+90+0
|
148 |
|
|
test pack-3.14 {framing} {
|
149 |
|
|
pack append .pack .pack.red {right padx 20 pady 30 frame e}
|
150 |
|
|
update
|
151 |
|
|
winfo geometry .pack.red
|
152 |
|
|
} 10x20+90+40
|
153 |
|
|
test pack-3.15 {framing} {
|
154 |
|
|
pack append .pack .pack.red {right padx 20 pady 30 frame se}
|
155 |
|
|
update
|
156 |
|
|
winfo geometry .pack.red
|
157 |
|
|
} 10x20+90+80
|
158 |
|
|
test pack-3.16 {framing} {
|
159 |
|
|
pack append .pack .pack.red {right padx 20 pady 30 frame s}
|
160 |
|
|
update
|
161 |
|
|
winfo geometry .pack.red
|
162 |
|
|
} 10x20+80+80
|
163 |
|
|
test pack-3.17 {framing} {
|
164 |
|
|
pack append .pack .pack.red {right padx 20 pady 30 frame sw}
|
165 |
|
|
update
|
166 |
|
|
winfo geometry .pack.red
|
167 |
|
|
} 10x20+70+80
|
168 |
|
|
test pack-3.18 {framing} {
|
169 |
|
|
pack append .pack .pack.red {right padx 20 pady 30 frame w}
|
170 |
|
|
update
|
171 |
|
|
winfo geometry .pack.red
|
172 |
|
|
} 10x20+70+40
|
173 |
|
|
test pack-3.19 {framing} {
|
174 |
|
|
pack append .pack .pack.red {right padx 20 pady 30 frame nw}
|
175 |
|
|
update
|
176 |
|
|
winfo geometry .pack.red
|
177 |
|
|
} 10x20+70+0
|
178 |
|
|
test pack-3.20 {framing} {
|
179 |
|
|
pack append .pack .pack.red {right padx 20 pady 30 frame center}
|
180 |
|
|
update
|
181 |
|
|
winfo geometry .pack.red
|
182 |
|
|
} 10x20+80+40
|
183 |
|
|
|
184 |
|
|
# Try out various filling combinations in a couple of different
|
185 |
|
|
# frame locations.
|
186 |
|
|
|
187 |
|
|
test pack-4.1 {filling} {
|
188 |
|
|
pack append .pack .pack.red {bottom padx 20 pady 30 fillx}
|
189 |
|
|
update
|
190 |
|
|
winfo geometry .pack.red
|
191 |
|
|
} 100x20+0+65
|
192 |
|
|
test pack-4.2 {filling} {
|
193 |
|
|
pack append .pack .pack.red {bottom padx 20 pady 30 filly}
|
194 |
|
|
update
|
195 |
|
|
winfo geometry .pack.red
|
196 |
|
|
} 10x50+45+50
|
197 |
|
|
test pack-4.3 {filling} {
|
198 |
|
|
pack append .pack .pack.red {bottom padx 20 pady 30 fill}
|
199 |
|
|
update
|
200 |
|
|
winfo geometry .pack.red
|
201 |
|
|
} 100x50+0+50
|
202 |
|
|
test pack-4.4 {filling} {
|
203 |
|
|
pack append .pack .pack.red {right padx 20 pady 30 fillx}
|
204 |
|
|
update
|
205 |
|
|
winfo geometry .pack.red
|
206 |
|
|
} 30x20+70+40
|
207 |
|
|
test pack-4.5 {filling} {
|
208 |
|
|
pack append .pack .pack.red {right padx 20 pady 30 filly}
|
209 |
|
|
update
|
210 |
|
|
winfo geometry .pack.red
|
211 |
|
|
} 10x100+80+0
|
212 |
|
|
test pack-4.6 {filling} {
|
213 |
|
|
pack append .pack .pack.red {right padx 20 pady 30 fill}
|
214 |
|
|
update
|
215 |
|
|
winfo geometry .pack.red
|
216 |
|
|
} 30x100+70+0
|
217 |
|
|
|
218 |
|
|
# Multiple windows: make sure that space is properly subtracted
|
219 |
|
|
# from the cavity as windows are positioned inwards from all
|
220 |
|
|
# different sides. Also make sure that windows get unmapped if
|
221 |
|
|
# there isn't enough space for them.
|
222 |
|
|
|
223 |
|
|
pack append .pack .pack.red top .pack.green top .pack.blue top \
|
224 |
|
|
.pack.violet top
|
225 |
|
|
update
|
226 |
|
|
test pack-5.1 {multiple windows} {winfo geometry .pack.red} 10x20+45+0
|
227 |
|
|
test pack-5.2 {multiple windows} {winfo geometry .pack.green} 30x40+35+20
|
228 |
|
|
test pack-5.3 {multiple windows} {winfo geometry .pack.blue} 40x40+30+60
|
229 |
|
|
test pack-5.4 {multiple windows} {winfo ismapped .pack.violet} 0
|
230 |
|
|
pack b .pack.blue .pack.violet top
|
231 |
|
|
update
|
232 |
|
|
test pack-5.5 {multiple windows} {winfo ismapped .pack.violet} 1
|
233 |
|
|
test pack-5.6 {multiple windows} {winfo geometry .pack.violet} 80x20+10+60
|
234 |
|
|
test pack-5.7 {multiple windows} {winfo geometry .pack.blue} 40x20+30+80
|
235 |
|
|
pack after .pack.blue .pack.red top
|
236 |
|
|
update
|
237 |
|
|
test pack-5.8 {multiple windows} {winfo geometry .pack.green} 30x40+35+0
|
238 |
|
|
test pack-5.9 {multiple windows} {winfo geometry .pack.violet} 80x20+10+40
|
239 |
|
|
test pack-5.10 {multiple windows} {winfo geometry .pack.blue} 40x40+30+60
|
240 |
|
|
test pack-5.11 {multiple windows} {winfo ismapped .pack.red} 0
|
241 |
|
|
pack before .pack.green .pack.red right .pack.blue left
|
242 |
|
|
update
|
243 |
|
|
test pack-5.12 {multiple windows} {winfo ismapped .pack.red} 1
|
244 |
|
|
test pack-5.13 {multiple windows} {winfo geometry .pack.red} 10x20+90+40
|
245 |
|
|
test pack-5.14 {multiple windows} {winfo geometry .pack.blue} 40x40+0+30
|
246 |
|
|
test pack-5.15 {multiple windows} {winfo geometry .pack.green} 30x40+50+0
|
247 |
|
|
test pack-5.16 {multiple windows} {winfo geometry .pack.violet} 50x20+40+40
|
248 |
|
|
pack append .pack .pack.violet left .pack.green bottom .pack.red bottom \
|
249 |
|
|
.pack.blue bottom
|
250 |
|
|
update
|
251 |
|
|
test pack-5.17 {multiple windows} {winfo geometry .pack.violet} 80x20+0+40
|
252 |
|
|
test pack-5.18 {multiple windows} {winfo geometry .pack.green} 20x40+80+60
|
253 |
|
|
test pack-5.19 {multiple windows} {winfo geometry .pack.red} 10x20+85+40
|
254 |
|
|
test pack-5.20 {multiple windows} {winfo geometry .pack.blue} 20x40+80+0
|
255 |
|
|
pack after .pack.blue .pack.blue top .pack.red right .pack.green right \
|
256 |
|
|
.pack.violet right
|
257 |
|
|
update
|
258 |
|
|
test pack-5.21 {multiple windows} {winfo geometry .pack.blue} 40x40+30+0
|
259 |
|
|
test pack-5.22 {multiple windows} {winfo geometry .pack.red} 10x20+90+60
|
260 |
|
|
test pack-5.23 {multiple windows} {winfo geometry .pack.green} 30x40+60+50
|
261 |
|
|
test pack-5.24 {multiple windows} {winfo geometry .pack.violet} 60x20+0+60
|
262 |
|
|
pack after .pack.blue .pack.red left .pack.green left .pack.violet left
|
263 |
|
|
update
|
264 |
|
|
test pack-5.25 {multiple windows} {winfo geometry .pack.blue} 40x40+30+0
|
265 |
|
|
test pack-5.26 {multiple windows} {winfo geometry .pack.red} 10x20+0+60
|
266 |
|
|
test pack-5.27 {multiple windows} {winfo geometry .pack.green} 30x40+10+50
|
267 |
|
|
test pack-5.28 {multiple windows} {winfo geometry .pack.violet} 60x20+40+60
|
268 |
|
|
pack append .pack .pack.violet left .pack.green left .pack.blue left \
|
269 |
|
|
.pack.red left
|
270 |
|
|
update
|
271 |
|
|
test pack-5.29 {multiple windows} {winfo geometry .pack.violet} 80x20+0+40
|
272 |
|
|
test pack-5.30 {multiple windows} {winfo geometry .pack.green} 20x40+80+30
|
273 |
|
|
test pack-5.31 {multiple windows} {winfo ismapped .pack.blue} 0
|
274 |
|
|
test pack-5.32 {multiple windows} {winfo ismapped .pack.red} 0
|
275 |
|
|
|
276 |
|
|
|
277 |
|
|
# Test the ability of the packer to propagate geometry information
|
278 |
|
|
# to its parent. Make sure it computes the parent's needs both in
|
279 |
|
|
# the direction of packing (width for "left" and "right" windows,
|
280 |
|
|
# for example), and perpendicular to the pack direction (height for
|
281 |
|
|
# "left" and "right" windows).
|
282 |
|
|
|
283 |
|
|
pack append .pack .pack.red top .pack.green top .pack.blue top \
|
284 |
|
|
.pack.violet top
|
285 |
|
|
update
|
286 |
|
|
test pack-6.1 {geometry propagation} {winfo reqwidth .pack} 80
|
287 |
|
|
test pack-6.2 {geometry propagation} {winfo reqheight .pack} 120
|
288 |
|
|
destroy .pack.violet
|
289 |
|
|
update
|
290 |
|
|
test pack-6.3 {geometry propagation} {winfo reqwidth .pack} 40
|
291 |
|
|
test pack-6.4 {geometry propagation} {winfo reqheight .pack} 100
|
292 |
|
|
frame .pack.violet -width 80 -height 20 -bg violet
|
293 |
|
|
label .pack.violet.l -text P -bd 2 -relief raised
|
294 |
|
|
place .pack.violet.l -relwidth 1.0 -relheight 1.0
|
295 |
|
|
pack append .pack .pack.red left .pack.green right .pack.blue bottom \
|
296 |
|
|
.pack.violet top
|
297 |
|
|
update
|
298 |
|
|
test pack-6.5 {geometry propagation} {winfo reqwidth .pack} 120
|
299 |
|
|
test pack-6.6 {geometry propagation} {winfo reqheight .pack} 60
|
300 |
|
|
pack append .pack .pack.violet top .pack.green top .pack.blue left \
|
301 |
|
|
.pack.red left
|
302 |
|
|
update
|
303 |
|
|
test pack-6.7 {geometry propagation} {winfo reqwidth .pack} 80
|
304 |
|
|
test pack-6.8 {geometry propagation} {winfo reqheight .pack} 100
|
305 |
|
|
|
306 |
|
|
# Test the "expand" option, and make sure space is evenly divided
|
307 |
|
|
# when several windows request expansion.
|
308 |
|
|
|
309 |
|
|
pack append .pack .pack.violet top .pack.green {left e} \
|
310 |
|
|
.pack.blue {left expand} .pack.red {left expand}
|
311 |
|
|
update
|
312 |
|
|
test pack-7.1 {multiple expanded windows} {
|
313 |
|
|
pack append .pack .pack.violet top .pack.green {left e} \
|
314 |
|
|
.pack.blue {left expand} .pack.red {left expand}
|
315 |
|
|
update
|
316 |
|
|
list [winfo geometry .pack.green] [winfo geometry .pack.blue] \
|
317 |
|
|
[winfo geometry .pack.red]
|
318 |
|
|
} {30x40+3+40 40x40+39+40 10x20+86+50}
|
319 |
|
|
test pack-7.2 {multiple expanded windows} {
|
320 |
|
|
pack append .pack .pack.green left .pack.violet {bottom expand} \
|
321 |
|
|
.pack.blue {bottom expand} .pack.red {bottom expand}
|
322 |
|
|
update
|
323 |
|
|
list [winfo geometry .pack.violet] [winfo geometry .pack.blue] \
|
324 |
|
|
[winfo geometry .pack.red]
|
325 |
|
|
} {70x20+30+77 40x40+45+30 10x20+60+3}
|
326 |
|
|
test pack-7.3 {multiple expanded windows} {
|
327 |
|
|
foreach i [winfo child .pack] {
|
328 |
|
|
pack unpack $i
|
329 |
|
|
}
|
330 |
|
|
pack append .pack .pack.green {left e fill} .pack.red {left expand fill} \
|
331 |
|
|
.pack.blue {top fill}
|
332 |
|
|
update
|
333 |
|
|
list [winfo geometry .pack.green] [winfo geometry .pack.red] \
|
334 |
|
|
[winfo geometry .pack.blue]
|
335 |
|
|
} {40x100+0+0 20x100+40+0 40x40+60+0}
|
336 |
|
|
test pack-7.4 {multiple expanded windows} {
|
337 |
|
|
foreach i [winfo child .pack] {
|
338 |
|
|
pack unpack $i
|
339 |
|
|
}
|
340 |
|
|
pack append .pack .pack.red {top expand} .pack.violet {top expand} \
|
341 |
|
|
.pack.blue {right fill}
|
342 |
|
|
update
|
343 |
|
|
list [winfo geometry .pack.red] [winfo geometry .pack.violet] \
|
344 |
|
|
[winfo geometry .pack.blue]
|
345 |
|
|
} {10x20+45+5 80x20+10+35 40x40+60+60}
|
346 |
|
|
test pack-7.5 {multiple expanded windows} {
|
347 |
|
|
foreach i [winfo child .pack] {
|
348 |
|
|
pack unpack $i
|
349 |
|
|
}
|
350 |
|
|
pack append .pack .pack.green {right frame s} .pack.red {top expand}
|
351 |
|
|
update
|
352 |
|
|
list [winfo geometry .pack.green] [winfo geometry .pack.red]
|
353 |
|
|
} {30x40+70+60 10x20+30+40}
|
354 |
|
|
test pack-7.6 {multiple expanded windows} {
|
355 |
|
|
foreach i [winfo child .pack] {
|
356 |
|
|
pack unpack $i
|
357 |
|
|
}
|
358 |
|
|
pack append .pack .pack.violet {bottom frame e} .pack.red {right expand}
|
359 |
|
|
update
|
360 |
|
|
list [winfo geometry .pack.violet] [winfo geometry .pack.red]
|
361 |
|
|
} {80x20+20+80 10x20+45+30}
|
362 |
|
|
|
363 |
|
|
# Need more bizarre tests with combinations of expanded windows and
|
364 |
|
|
# windows in opposing directions! Also, include padding in expanded
|
365 |
|
|
# (and unexpanded) windows.
|
366 |
|
|
|
367 |
|
|
# Syntax errors on pack commands
|
368 |
|
|
|
369 |
|
|
test pack-8.1 {syntax errors} {
|
370 |
|
|
set msg ""
|
371 |
|
|
set result [catch {pack} msg]
|
372 |
|
|
concat $result $msg
|
373 |
|
|
} {1 wrong # args: should be "pack option arg ?arg ...?"}
|
374 |
|
|
test pack-8.2 {syntax errors} {
|
375 |
|
|
set msg ""
|
376 |
|
|
set result [catch {pack append} msg]
|
377 |
|
|
concat $result $msg
|
378 |
|
|
} {1 wrong # args: should be "pack option arg ?arg ...?"}
|
379 |
|
|
test pack-8.3 {syntax errors} {
|
380 |
|
|
set msg ""
|
381 |
|
|
set result [catch {pack gorp foo} msg]
|
382 |
|
|
concat $result $msg
|
383 |
|
|
} {1 bad option "gorp": must be configure, forget, info, propagate, or slaves}
|
384 |
|
|
test pack-8.4 {syntax errors} {
|
385 |
|
|
set msg ""
|
386 |
|
|
set result [catch {pack a .pack} msg]
|
387 |
|
|
concat $result $msg
|
388 |
|
|
} {1 bad option "a": must be configure, forget, info, propagate, or slaves}
|
389 |
|
|
test pack-8.5 {syntax errors} {
|
390 |
|
|
set msg ""
|
391 |
|
|
set result [catch {pack after foobar} msg]
|
392 |
|
|
concat $result $msg
|
393 |
|
|
} {1 bad window path name "foobar"}
|
394 |
|
|
test pack-8.6 {syntax errors} {
|
395 |
|
|
frame .pack.yellow -bg yellow
|
396 |
|
|
set msg ""
|
397 |
|
|
set result [catch {pack after .pack.yellow} msg]
|
398 |
|
|
destroy .pack.yellow
|
399 |
|
|
concat $result $msg
|
400 |
|
|
} {1 window ".pack.yellow" isn't packed}
|
401 |
|
|
test pack-8.7 {syntax errors} {
|
402 |
|
|
set msg ""
|
403 |
|
|
set result [catch {pack append foobar} msg]
|
404 |
|
|
concat $result $msg
|
405 |
|
|
} {1 bad window path name "foobar"}
|
406 |
|
|
test pack-8.8 {syntax errors} {
|
407 |
|
|
set msg ""
|
408 |
|
|
set result [catch {pack before foobar} msg]
|
409 |
|
|
concat $result $msg
|
410 |
|
|
} {1 bad window path name "foobar"}
|
411 |
|
|
test pack-8.9 {syntax errors} {
|
412 |
|
|
frame .pack.yellow -bg yellow
|
413 |
|
|
set msg ""
|
414 |
|
|
set result [catch {pack before .pack.yellow} msg]
|
415 |
|
|
destroy .pack.yellow
|
416 |
|
|
concat $result $msg
|
417 |
|
|
} {1 window ".pack.yellow" isn't packed}
|
418 |
|
|
test pack-8.10 {syntax errors} {
|
419 |
|
|
set msg ""
|
420 |
|
|
set result [catch {pack info .pack help} msg]
|
421 |
|
|
concat $result $msg
|
422 |
|
|
} {1 wrong # args: should be "pack info window"}
|
423 |
|
|
test pack-8.11 {syntax errors} {
|
424 |
|
|
set msg ""
|
425 |
|
|
set result [catch {pack info foobar} msg]
|
426 |
|
|
concat $result $msg
|
427 |
|
|
} {1 bad window path name "foobar"}
|
428 |
|
|
test pack-8.12 {syntax errors} {
|
429 |
|
|
set msg ""
|
430 |
|
|
set result [catch {pack append .pack .pack.blue} msg]
|
431 |
|
|
concat $result $msg
|
432 |
|
|
} {1 wrong # args: window ".pack.blue" should be followed by options}
|
433 |
|
|
test pack-8.13 {syntax errors} {
|
434 |
|
|
set msg ""
|
435 |
|
|
set result [catch {pack append . .pack.blue top} msg]
|
436 |
|
|
concat $result $msg
|
437 |
|
|
} {1 can't pack .pack.blue inside .}
|
438 |
|
|
test pack-8.14 {syntax errors} {
|
439 |
|
|
set msg ""
|
440 |
|
|
set result [catch {pack append .pack .pack.blue f} msg]
|
441 |
|
|
concat $result $msg
|
442 |
|
|
} {1 bad option "f": should be top, bottom, left, right, expand, fill, fillx, filly, padx, pady, or frame}
|
443 |
|
|
test pack-8.15 {syntax errors} {
|
444 |
|
|
set msg ""
|
445 |
|
|
set result [catch {pack append .pack .pack.blue pad} msg]
|
446 |
|
|
concat $result $msg
|
447 |
|
|
} {1 bad option "pad": should be top, bottom, left, right, expand, fill, fillx, filly, padx, pady, or frame}
|
448 |
|
|
test pack-8.16 {syntax errors} {
|
449 |
|
|
set msg ""
|
450 |
|
|
set result [catch {pack append .pack .pack.blue {frame south}} msg]
|
451 |
|
|
concat $result $msg
|
452 |
|
|
} {1 bad anchor position "south": must be n, ne, e, se, s, sw, w, nw, or center}
|
453 |
|
|
test pack-8.17 {syntax errors} {
|
454 |
|
|
set msg ""
|
455 |
|
|
set result [catch {pack append .pack .pack.blue {padx -2}} msg]
|
456 |
|
|
concat $result $msg
|
457 |
|
|
} {1 bad pad value "-2": must be positive screen distance}
|
458 |
|
|
test pack-8.18 {syntax errors} {
|
459 |
|
|
set msg ""
|
460 |
|
|
set result [catch {pack append .pack .pack.blue {padx}} msg]
|
461 |
|
|
concat $result $msg
|
462 |
|
|
} {1 wrong # args: "padx" option must be followed by screen distance}
|
463 |
|
|
test pack-8.19 {syntax errors} {
|
464 |
|
|
set msg ""
|
465 |
|
|
set result [catch {pack append .pack .pack.blue {pady -2}} msg]
|
466 |
|
|
concat $result $msg
|
467 |
|
|
} {1 bad pad value "-2": must be positive screen distance}
|
468 |
|
|
test pack-8.20 {syntax errors} {
|
469 |
|
|
set msg ""
|
470 |
|
|
set result [catch {pack append .pack .pack.blue {pady}} msg]
|
471 |
|
|
concat $result $msg
|
472 |
|
|
} {1 wrong # args: "pady" option must be followed by screen distance}
|
473 |
|
|
test pack-8.21 {syntax errors} {
|
474 |
|
|
set msg ""
|
475 |
|
|
set result [catch {pack append .pack .pack.blue "\{abc"} msg]
|
476 |
|
|
concat $result $msg
|
477 |
|
|
} {1 unmatched open brace in list}
|
478 |
|
|
test pack-8.22 {syntax errors} {
|
479 |
|
|
set msg ""
|
480 |
|
|
set result [catch {pack append .pack .pack.blue frame} msg]
|
481 |
|
|
concat $result $msg
|
482 |
|
|
} {1 wrong # args: "frame" option must be followed by anchor point}
|
483 |
|
|
|
484 |
|
|
# Test "pack info" command output.
|
485 |
|
|
|
486 |
|
|
test pack-9.1 {information output} {
|
487 |
|
|
pack append .pack .pack.blue {top fillx frame n} \
|
488 |
|
|
.pack.red {bottom filly frame s} .pack.green {left fill frame w} \
|
489 |
|
|
.pack.violet {right expand frame e}
|
490 |
|
|
list [pack slaves .pack] [pack info .pack.blue] [pack info .pack.red] \
|
491 |
|
|
[pack info .pack.green] [pack info .pack.violet]
|
492 |
|
|
} {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor n -expand 0 -fill x -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor s -expand 0 -fill y -ipadx 0 -ipady 0 -padx 0 -pady 0 -side bottom} {-in .pack -anchor w -expand 0 -fill both -ipadx 0 -ipady 0 -padx 0 -pady 0 -side left} {-in .pack -anchor e -expand 1 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side right}}
|
493 |
|
|
test pack-9.2 {information output} {
|
494 |
|
|
pack append .pack .pack.blue {padx 10 frame nw} \
|
495 |
|
|
.pack.red {pady 20 frame ne} .pack.green {frame se} \
|
496 |
|
|
.pack.violet {frame sw}
|
497 |
|
|
list [pack slaves .pack] [pack info .pack.blue] [pack info .pack.red] \
|
498 |
|
|
[pack info .pack.green] [pack info .pack.violet]
|
499 |
|
|
} {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor nw -expand 0 -fill none -ipadx 0 -ipady 0 -padx 5 -pady 0 -side top} {-in .pack -anchor ne -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 10 -side top} {-in .pack -anchor se -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor sw -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top}}
|
500 |
|
|
test pack-9.3 {information output} {
|
501 |
|
|
pack append .pack .pack.blue {frame center} .pack.red {frame center} \
|
502 |
|
|
.pack.green {frame c} .pack.violet {frame c}
|
503 |
|
|
list [pack slaves .pack] [pack info .pack.blue] [pack info .pack.red] \
|
504 |
|
|
[pack info .pack.green] [pack info .pack.violet]
|
505 |
|
|
} {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top}}
|
506 |
|
|
|
507 |
|
|
catch {destroy .pack}
|
508 |
|
|
concat {}
|