1 |
578 |
markom |
# This file is a Tcl script to test out the "pack" command
|
2 |
|
|
# of Tk. It is organized in the standard fashion for Tcl tests.
|
3 |
|
|
#
|
4 |
|
|
# Copyright (c) 1993 The Regents of the University of California.
|
5 |
|
|
# Copyright (c) 1994 Sun Microsystems, Inc.
|
6 |
|
|
#
|
7 |
|
|
# See the file "license.terms" for information on usage and redistribution
|
8 |
|
|
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
9 |
|
|
#
|
10 |
|
|
# RCS: @(#) $Id: pack.test,v 1.1.1.1 2002-01-16 10:25:59 markom Exp $
|
11 |
|
|
|
12 |
|
|
if {[string compare test [info procs test]] == 1} then \
|
13 |
|
|
{source defs}
|
14 |
|
|
|
15 |
|
|
# Utility procedures:
|
16 |
|
|
|
17 |
|
|
proc pack1 {args} {
|
18 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
19 |
|
|
eval pack .pack.a $args
|
20 |
|
|
pack .pack.b -expand yes -fill both
|
21 |
|
|
update
|
22 |
|
|
list [winfo geometry .pack.a] [winfo geometry .pack.b]
|
23 |
|
|
}
|
24 |
|
|
proc pack2 {args} {
|
25 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
26 |
|
|
eval pack .pack.a $args
|
27 |
|
|
update
|
28 |
|
|
winfo geometry .pack.a
|
29 |
|
|
}
|
30 |
|
|
proc pack3 {args} {
|
31 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
32 |
|
|
pack .pack.a -side top
|
33 |
|
|
pack .pack.c -side left
|
34 |
|
|
eval pack .pack.b $args
|
35 |
|
|
update
|
36 |
|
|
winfo geometry .pack.b
|
37 |
|
|
}
|
38 |
|
|
proc pack4 {option value} {
|
39 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
40 |
|
|
pack .pack.a $option $value
|
41 |
|
|
set i [pack info .pack.a]
|
42 |
|
|
lindex $i [expr [lsearch -exact $i $option]+1]
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
# Create some test windows.
|
46 |
|
|
|
47 |
|
|
catch {destroy .pack}
|
48 |
|
|
toplevel .pack
|
49 |
|
|
wm geom .pack 300x200+0+0
|
50 |
|
|
wm minsize .pack 1 1
|
51 |
|
|
update idletasks
|
52 |
|
|
foreach i {a b c d} {
|
53 |
|
|
frame .pack.$i
|
54 |
|
|
label .pack.$i.label -text $i -relief raised
|
55 |
|
|
place .pack.$i.label -relwidth 1.0 -relheight 1.0
|
56 |
|
|
}
|
57 |
|
|
.pack.a config -width 20 -height 40
|
58 |
|
|
.pack.b config -width 50 -height 30
|
59 |
|
|
.pack.c config -width 80 -height 80
|
60 |
|
|
.pack.d config -width 40 -height 30
|
61 |
|
|
|
62 |
|
|
test pack-1.1 {-side option} {
|
63 |
|
|
pack1 -side top
|
64 |
|
|
} {20x40+140+0 300x160+0+40}
|
65 |
|
|
test pack-1.2 {-side option} {
|
66 |
|
|
pack1 -side bottom
|
67 |
|
|
} {20x40+140+160 300x160+0+0}
|
68 |
|
|
test pack-1.3 {-side option} {
|
69 |
|
|
pack1 -side left
|
70 |
|
|
} {20x40+0+80 280x200+20+0}
|
71 |
|
|
test pack-1.4 {-side option} {
|
72 |
|
|
pack1 -side right
|
73 |
|
|
} {20x40+280+80 280x200+0+0}
|
74 |
|
|
|
75 |
|
|
test pack-2.1 {x padding and filling} {
|
76 |
|
|
pack1 -side right -padx 20
|
77 |
|
|
} {20x40+260+80 240x200+0+0}
|
78 |
|
|
test pack-2.2 {x padding and filling} {
|
79 |
|
|
pack1 -side right -ipadx 20
|
80 |
|
|
} {60x40+240+80 240x200+0+0}
|
81 |
|
|
test pack-2.3 {x padding and filling} {
|
82 |
|
|
pack1 -side right -ipadx 5 -padx 10
|
83 |
|
|
} {30x40+260+80 250x200+0+0}
|
84 |
|
|
test pack-2.4 {x padding and filling} {
|
85 |
|
|
pack1 -side right -padx 20 -fill x
|
86 |
|
|
} {20x40+260+80 240x200+0+0}
|
87 |
|
|
test pack-2.5 {x padding and filling} {
|
88 |
|
|
pack1 -side right -ipadx 20 -fill x
|
89 |
|
|
} {60x40+240+80 240x200+0+0}
|
90 |
|
|
test pack-2.6 {x padding and filling} {
|
91 |
|
|
pack1 -side right -ipadx 5 -padx 10 -fill x
|
92 |
|
|
} {30x40+260+80 250x200+0+0}
|
93 |
|
|
test pack-2.7 {x padding and filling} {
|
94 |
|
|
pack1 -side top -padx 20
|
95 |
|
|
} {20x40+140+0 300x160+0+40}
|
96 |
|
|
test pack-2.8 {x padding and filling} {
|
97 |
|
|
pack1 -side top -ipadx 20
|
98 |
|
|
} {60x40+120+0 300x160+0+40}
|
99 |
|
|
test pack-2.9 {x padding and filling} {
|
100 |
|
|
pack1 -side top -ipadx 5 -padx 10
|
101 |
|
|
} {30x40+135+0 300x160+0+40}
|
102 |
|
|
test pack-2.10 {x padding and filling} {
|
103 |
|
|
pack1 -side top -padx 20 -fill x
|
104 |
|
|
} {260x40+20+0 300x160+0+40}
|
105 |
|
|
test pack-2.11 {x padding and filling} {
|
106 |
|
|
pack1 -side top -ipadx 20 -fill x
|
107 |
|
|
} {300x40+0+0 300x160+0+40}
|
108 |
|
|
test pack-2.12 {x padding and filling} {
|
109 |
|
|
pack1 -side top -ipadx 5 -padx 10 -fill x
|
110 |
|
|
} {280x40+10+0 300x160+0+40}
|
111 |
|
|
set pad [winfo pixels .pack 1c]
|
112 |
|
|
test pack-2.13 {x padding and filling} {
|
113 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
114 |
|
|
pack .pack.a -padx 1c
|
115 |
|
|
set x [pack info .pack.a]
|
116 |
|
|
lindex $x [expr [lsearch -exact $x -padx]+1]
|
117 |
|
|
} $pad
|
118 |
|
|
test pack-2.14 {x padding and filling} {
|
119 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
120 |
|
|
pack .pack.a -ipadx 1c
|
121 |
|
|
set x [pack info .pack.a]
|
122 |
|
|
lindex $x [expr [lsearch -exact $x -ipadx]+1]
|
123 |
|
|
} $pad
|
124 |
|
|
|
125 |
|
|
test pack-3.1 {y padding and filling} {
|
126 |
|
|
pack1 -side right -pady 20
|
127 |
|
|
} {20x40+280+80 280x200+0+0}
|
128 |
|
|
test pack-3.2 {y padding and filling} {
|
129 |
|
|
pack1 -side right -ipady 20
|
130 |
|
|
} {20x80+280+60 280x200+0+0}
|
131 |
|
|
test pack-3.3 {y padding and filling} {
|
132 |
|
|
pack1 -side right -ipady 5 -pady 10
|
133 |
|
|
} {20x50+280+75 280x200+0+0}
|
134 |
|
|
test pack-3.4 {y padding and filling} {
|
135 |
|
|
pack1 -side right -pady 20 -fill y
|
136 |
|
|
} {20x160+280+20 280x200+0+0}
|
137 |
|
|
test pack-3.5 {y padding and filling} {
|
138 |
|
|
pack1 -side right -ipady 20 -fill y
|
139 |
|
|
} {20x200+280+0 280x200+0+0}
|
140 |
|
|
test pack-3.6 {y padding and filling} {
|
141 |
|
|
pack1 -side right -ipady 5 -pady 10 -fill y
|
142 |
|
|
} {20x180+280+10 280x200+0+0}
|
143 |
|
|
test pack-3.7 {y padding and filling} {
|
144 |
|
|
pack1 -side top -pady 20
|
145 |
|
|
} {20x40+140+20 300x120+0+80}
|
146 |
|
|
test pack-3.8 {y padding and filling} {
|
147 |
|
|
pack1 -side top -ipady 20
|
148 |
|
|
} {20x80+140+0 300x120+0+80}
|
149 |
|
|
test pack-3.9 {y padding and filling} {
|
150 |
|
|
pack1 -side top -ipady 5 -pady 10
|
151 |
|
|
} {20x50+140+10 300x130+0+70}
|
152 |
|
|
test pack-3.10 {y padding and filling} {
|
153 |
|
|
pack1 -side top -pady 20 -fill y
|
154 |
|
|
} {20x40+140+20 300x120+0+80}
|
155 |
|
|
test pack-3.11 {y padding and filling} {
|
156 |
|
|
pack1 -side top -ipady 20 -fill y
|
157 |
|
|
} {20x80+140+0 300x120+0+80}
|
158 |
|
|
test pack-3.12 {y padding and filling} {
|
159 |
|
|
pack1 -side top -ipady 5 -pady 10 -fill y
|
160 |
|
|
} {20x50+140+10 300x130+0+70}
|
161 |
|
|
set pad [winfo pixels .pack 1c]
|
162 |
|
|
test pack-3.13 {y padding and filling} {
|
163 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
164 |
|
|
pack .pack.a -pady 1c
|
165 |
|
|
set x [pack info .pack.a]
|
166 |
|
|
lindex $x [expr [lsearch -exact $x -pady]+1]
|
167 |
|
|
} $pad
|
168 |
|
|
test pack-3.14 {y padding and filling} {
|
169 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
170 |
|
|
pack .pack.a -ipady 1c
|
171 |
|
|
set x [pack info .pack.a]
|
172 |
|
|
lindex $x [expr [lsearch -exact $x -ipady]+1]
|
173 |
|
|
} $pad
|
174 |
|
|
|
175 |
|
|
test pack-4.1 {anchors} {
|
176 |
|
|
pack2 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor n
|
177 |
|
|
} {30x70+135+20}
|
178 |
|
|
test pack-4.2 {anchors} {
|
179 |
|
|
pack2 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor ne
|
180 |
|
|
} {30x70+260+20}
|
181 |
|
|
test pack-4.3 {anchors} {
|
182 |
|
|
pack2 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor e
|
183 |
|
|
} {30x70+260+65}
|
184 |
|
|
test pack-4.4 {anchors} {
|
185 |
|
|
pack2 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor se
|
186 |
|
|
} {30x70+260+110}
|
187 |
|
|
test pack-4.5 {anchors} {
|
188 |
|
|
pack2 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor s
|
189 |
|
|
} {30x70+135+110}
|
190 |
|
|
test pack-4.6 {anchors} {
|
191 |
|
|
pack2 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor sw
|
192 |
|
|
} {30x70+10+110}
|
193 |
|
|
test pack-4.7 {anchors} {
|
194 |
|
|
pack2 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor w
|
195 |
|
|
} {30x70+10+65}
|
196 |
|
|
test pack-4.8 {anchors} {
|
197 |
|
|
pack2 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor nw
|
198 |
|
|
} {30x70+10+20}
|
199 |
|
|
test pack-4.9 {anchors} {
|
200 |
|
|
pack2 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor center
|
201 |
|
|
} {30x70+135+65}
|
202 |
|
|
|
203 |
|
|
# Repeat above tests, but with a frame that isn't at (0,0), so that
|
204 |
|
|
# we can be sure that the frame offset is being added in correctly.
|
205 |
|
|
|
206 |
|
|
test pack-5.1 {more anchors} {
|
207 |
|
|
pack3 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor n
|
208 |
|
|
} {60x60+160+60}
|
209 |
|
|
test pack-5.2 {more anchors} {
|
210 |
|
|
pack3 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor ne
|
211 |
|
|
} {60x60+230+60}
|
212 |
|
|
test pack-5.3 {more anchors} {
|
213 |
|
|
pack3 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor e
|
214 |
|
|
} {60x60+230+90}
|
215 |
|
|
test pack-5.4 {more anchors} {
|
216 |
|
|
pack3 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor se
|
217 |
|
|
} {60x60+230+120}
|
218 |
|
|
test pack-5.5 {more anchors} {
|
219 |
|
|
pack3 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor s
|
220 |
|
|
} {60x60+160+120}
|
221 |
|
|
test pack-5.6 {more anchors} {
|
222 |
|
|
pack3 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor sw
|
223 |
|
|
} {60x60+90+120}
|
224 |
|
|
test pack-5.7 {more anchors} {
|
225 |
|
|
pack3 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor w
|
226 |
|
|
} {60x60+90+90}
|
227 |
|
|
test pack-5.8 {more anchors} {
|
228 |
|
|
pack3 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor nw
|
229 |
|
|
} {60x60+90+60}
|
230 |
|
|
test pack-5.9 {more anchors} {
|
231 |
|
|
pack3 -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor center
|
232 |
|
|
} {60x60+160+90}
|
233 |
|
|
|
234 |
|
|
test pack-6.1 {-expand option} {
|
235 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
236 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side left
|
237 |
|
|
update
|
238 |
|
|
list [winfo geometry .pack.a] [winfo geometry .pack.b] \
|
239 |
|
|
[winfo geometry .pack.c] [winfo geometry .pack.d]
|
240 |
|
|
} {20x40+0+80 50x30+20+85 80x80+70+60 40x30+150+85}
|
241 |
|
|
test pack-6.2 {-expand option} {
|
242 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
243 |
|
|
pack .pack.a -side left -expand yes
|
244 |
|
|
pack .pack.b -side left
|
245 |
|
|
pack .pack.c .pack.d -side left -expand 1
|
246 |
|
|
update
|
247 |
|
|
list [winfo geometry .pack.a] [winfo geometry .pack.b] \
|
248 |
|
|
[winfo geometry .pack.c] [winfo geometry .pack.d]
|
249 |
|
|
} {20x40+18+80 50x30+56+85 80x80+124+60 40x30+241+85}
|
250 |
|
|
test pack-6.3 {-expand option} {
|
251 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
252 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side top
|
253 |
|
|
update
|
254 |
|
|
list [winfo geometry .pack.a] [winfo geometry .pack.b] \
|
255 |
|
|
[winfo geometry .pack.c] [winfo geometry .pack.d]
|
256 |
|
|
} {20x40+140+0 50x30+125+40 80x80+110+70 40x30+130+150}
|
257 |
|
|
test pack-6.4 {-expand option} {
|
258 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
259 |
|
|
pack .pack.a -side top -expand yes
|
260 |
|
|
pack .pack.b -side top
|
261 |
|
|
pack .pack.c .pack.d -side top -expand 1
|
262 |
|
|
update
|
263 |
|
|
list [winfo geometry .pack.a] [winfo geometry .pack.b] \
|
264 |
|
|
[winfo geometry .pack.c] [winfo geometry .pack.d]
|
265 |
|
|
} {20x40+140+3 50x30+125+46 80x80+110+79 40x30+130+166}
|
266 |
|
|
test pack-6.5 {-expand option} {
|
267 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
268 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side right
|
269 |
|
|
update
|
270 |
|
|
list [winfo geometry .pack.a] [winfo geometry .pack.b] \
|
271 |
|
|
[winfo geometry .pack.c] [winfo geometry .pack.d]
|
272 |
|
|
} {20x40+280+80 50x30+230+85 80x80+150+60 40x30+110+85}
|
273 |
|
|
test pack-6.6 {-expand option} {
|
274 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
275 |
|
|
pack .pack.a -side right -expand yes
|
276 |
|
|
pack .pack.b -side right
|
277 |
|
|
pack .pack.c .pack.d -side right -expand 1
|
278 |
|
|
update
|
279 |
|
|
list [winfo geometry .pack.a] [winfo geometry .pack.b] \
|
280 |
|
|
[winfo geometry .pack.c] [winfo geometry .pack.d]
|
281 |
|
|
} {20x40+262+80 50x30+194+85 80x80+95+60 40x30+18+85}
|
282 |
|
|
test pack-6.7 {-expand option} {
|
283 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
284 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side bottom
|
285 |
|
|
update
|
286 |
|
|
list [winfo geometry .pack.a] [winfo geometry .pack.b] \
|
287 |
|
|
[winfo geometry .pack.c] [winfo geometry .pack.d]
|
288 |
|
|
} {20x40+140+160 50x30+125+130 80x80+110+50 40x30+130+20}
|
289 |
|
|
test pack-6.8 {-expand option} {
|
290 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
291 |
|
|
pack .pack.a -side bottom -expand yes
|
292 |
|
|
pack .pack.b -side bottom
|
293 |
|
|
pack .pack.c .pack.d -side bottom -expand 1
|
294 |
|
|
update
|
295 |
|
|
list [winfo geometry .pack.a] [winfo geometry .pack.b] \
|
296 |
|
|
[winfo geometry .pack.c] [winfo geometry .pack.d]
|
297 |
|
|
} {20x40+140+157 50x30+125+124 80x80+110+40 40x30+130+3}
|
298 |
|
|
test pack-6.9 {-expand option} {
|
299 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
300 |
|
|
pack .pack.a -side bottom -expand yes -fill both
|
301 |
|
|
pack .pack.b -side right
|
302 |
|
|
pack .pack.c -side top -expand 1 -fill both
|
303 |
|
|
pack .pack.d -side left
|
304 |
|
|
update
|
305 |
|
|
list [winfo geometry .pack.a] [winfo geometry .pack.b] \
|
306 |
|
|
[winfo geometry .pack.c] [winfo geometry .pack.d]
|
307 |
|
|
} {300x65+0+135 50x30+250+52 250x105+0+0 40x30+0+105}
|
308 |
|
|
test pack-6.10 {-expand option} {
|
309 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
310 |
|
|
pack .pack.a -side left -expand yes -fill both
|
311 |
|
|
pack .pack.b -side top
|
312 |
|
|
pack .pack.c -side right -expand 1 -fill both
|
313 |
|
|
pack .pack.d -side bottom
|
314 |
|
|
update
|
315 |
|
|
list [winfo geometry .pack.a] [winfo geometry .pack.b] \
|
316 |
|
|
[winfo geometry .pack.c] [winfo geometry .pack.d]
|
317 |
|
|
} {100x200+0+0 50x30+175+0 160x170+140+30 40x30+100+170}
|
318 |
|
|
test pack-6.11 {-expand option} {
|
319 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
320 |
|
|
pack .pack.a -side left -expand yes -fill both
|
321 |
|
|
pack .pack.b -side top -expand yes -fill both
|
322 |
|
|
pack .pack.c -side right -expand 1 -fill both
|
323 |
|
|
pack .pack.d -side bottom -expand yes -fill both
|
324 |
|
|
update
|
325 |
|
|
list [winfo geometry .pack.a] [winfo geometry .pack.b] \
|
326 |
|
|
[winfo geometry .pack.c] [winfo geometry .pack.d]
|
327 |
|
|
} {100x200+0+0 200x100+100+0 160x100+140+100 40x100+100+100}
|
328 |
|
|
catch {destroy .pack2}
|
329 |
|
|
toplevel .pack2 -height 400 -width 400
|
330 |
|
|
wm geometry .pack2 +0+0
|
331 |
|
|
pack propagate .pack2 0
|
332 |
|
|
pack forget .pack2.a .pack2.b .pack2.c .pack2.d
|
333 |
|
|
foreach i {w1 w2 w3} {
|
334 |
|
|
frame .pack2.$i -width 30 -height 30 -bd 2 -relief raised
|
335 |
|
|
label .pack2.$i.l -text $i
|
336 |
|
|
place .pack2.$i.l -relwidth 1.0 -relheight 1.0
|
337 |
|
|
}
|
338 |
|
|
test pack-6.12 {-expand option} {
|
339 |
|
|
pack .pack2.w1 .pack2.w2 .pack2.w3 -padx 5 -ipadx 4 -pady 2 -ipady 6 -expand 1 -side left
|
340 |
|
|
update
|
341 |
|
|
list [winfo geometry .pack2.w1] [winfo geometry .pack2.w2] [winfo geometry .pack2.w3]
|
342 |
|
|
} {38x42+47+179 38x42+180+179 38x42+314+179}
|
343 |
|
|
test pack-6.13 {-expand option} {
|
344 |
|
|
pack forget .pack2.w1 .pack2.w2 .pack2.w3
|
345 |
|
|
pack .pack2.w1 .pack2.w2 .pack2.w3 -padx 5 -ipadx 4 -pady 2 \
|
346 |
|
|
-ipady 6 -expand 1 -side top
|
347 |
|
|
update
|
348 |
|
|
list [winfo geometry .pack2.w1] [winfo geometry .pack2.w2] [winfo geometry .pack2.w3]
|
349 |
|
|
} {38x42+181+45 38x42+181+178 38x42+181+312}
|
350 |
|
|
catch {destroy .pack2}
|
351 |
|
|
|
352 |
|
|
wm geometry .pack {}
|
353 |
|
|
test pack-7.1 {requesting size for parent} {
|
354 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
355 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side left -padx 5 -pady 10
|
356 |
|
|
update
|
357 |
|
|
list [winfo reqwidth .pack] [winfo reqheight .pack]
|
358 |
|
|
} {230 100}
|
359 |
|
|
test pack-7.2 {requesting size for parent} {
|
360 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
361 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side top -padx 5 -pady 10
|
362 |
|
|
update
|
363 |
|
|
list [winfo reqwidth .pack] [winfo reqheight .pack]
|
364 |
|
|
} {90 260}
|
365 |
|
|
test pack-7.3 {requesting size for parent} {
|
366 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
367 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side right -padx 5 -pady 10
|
368 |
|
|
update
|
369 |
|
|
list [winfo reqwidth .pack] [winfo reqheight .pack]
|
370 |
|
|
} {230 100}
|
371 |
|
|
test pack-7.4 {requesting size for parent} {
|
372 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
373 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side bottom -padx 5 -pady 10
|
374 |
|
|
update
|
375 |
|
|
list [winfo reqwidth .pack] [winfo reqheight .pack]
|
376 |
|
|
} {90 260}
|
377 |
|
|
test pack-7.5 {requesting size for parent} {
|
378 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
379 |
|
|
pack .pack.a -side top -padx 5 -pady 10
|
380 |
|
|
pack .pack.b -side right -padx 5 -pady 10
|
381 |
|
|
pack .pack.c -side bottom -padx 5 -pady 10
|
382 |
|
|
pack .pack.d -side left -padx 5 -pady 10
|
383 |
|
|
update
|
384 |
|
|
list [winfo reqwidth .pack] [winfo reqheight .pack]
|
385 |
|
|
} {150 210}
|
386 |
|
|
test pack-7.6 {requesting size for parent} {
|
387 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
388 |
|
|
pack .pack.a -side top
|
389 |
|
|
pack .pack.c -side left
|
390 |
|
|
pack .pack.d -side bottom
|
391 |
|
|
update
|
392 |
|
|
list [winfo reqwidth .pack] [winfo reqheight .pack]
|
393 |
|
|
} {120 120}
|
394 |
|
|
test pack-7.7 {requesting size for parent} {
|
395 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
396 |
|
|
pack .pack.a -side right
|
397 |
|
|
pack .pack.c -side bottom
|
398 |
|
|
pack .pack.d -side top
|
399 |
|
|
update
|
400 |
|
|
list [winfo reqwidth .pack] [winfo reqheight .pack]
|
401 |
|
|
} {100 110}
|
402 |
|
|
|
403 |
|
|
|
404 |
|
|
# For the tests below, create a couple of "pad" windows to shrink
|
405 |
|
|
# the available space for the remaining windows. The tests have to
|
406 |
|
|
# be done this way rather than shrinking the whole window, because
|
407 |
|
|
# some window managers like mwm won't let a top-level window get
|
408 |
|
|
# very small.
|
409 |
|
|
|
410 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
411 |
|
|
frame .pack.right -width 200 -height 10 -bd 2 -relief raised
|
412 |
|
|
frame .pack.bottom -width 10 -height 150 -bd 2 -relief raised
|
413 |
|
|
pack .pack.right -side right
|
414 |
|
|
pack .pack.bottom -side bottom
|
415 |
|
|
pack .pack.a .pack.b .pack.c -side top
|
416 |
|
|
update
|
417 |
|
|
test pack-8.1 {insufficient space} {
|
418 |
|
|
list [winfo geometry .pack.a] [winfo ismapped .pack.a] \
|
419 |
|
|
[winfo geometry .pack.b] [winfo ismapped .pack.b] \
|
420 |
|
|
[winfo geometry .pack.c] [winfo ismapped .pack.c]
|
421 |
|
|
} {20x40+30+0 1 50x30+15+40 1 80x80+0+70 1}
|
422 |
|
|
wm geom .pack 270x250
|
423 |
|
|
update
|
424 |
|
|
test pack-8.2 {insufficient space} {
|
425 |
|
|
list [winfo geometry .pack.a] [winfo ismapped .pack.a] \
|
426 |
|
|
[winfo geometry .pack.b] [winfo ismapped .pack.b] \
|
427 |
|
|
[winfo geometry .pack.c] [winfo ismapped .pack.c]
|
428 |
|
|
} {20x40+25+0 1 50x30+10+40 1 70x30+0+70 1}
|
429 |
|
|
wm geom .pack 240x220
|
430 |
|
|
update
|
431 |
|
|
test pack-8.3 {insufficient space} {
|
432 |
|
|
list [winfo geometry .pack.a] [winfo ismapped .pack.a] \
|
433 |
|
|
[winfo geometry .pack.b] [winfo ismapped .pack.b] \
|
434 |
|
|
[winfo geometry .pack.c] [winfo ismapped .pack.c]
|
435 |
|
|
} {20x40+10+0 1 40x30+0+40 1 70x30+0+70 0}
|
436 |
|
|
wm geom .pack 350x350
|
437 |
|
|
update
|
438 |
|
|
test pack-8.4 {insufficient space} {
|
439 |
|
|
list [winfo geometry .pack.a] [winfo ismapped .pack.a] \
|
440 |
|
|
[winfo geometry .pack.b] [winfo ismapped .pack.b] \
|
441 |
|
|
[winfo geometry .pack.c] [winfo ismapped .pack.c]
|
442 |
|
|
} {20x40+65+0 1 50x30+50+40 1 80x80+35+70 1}
|
443 |
|
|
wm geom .pack {}
|
444 |
|
|
pack .pack.a -side left
|
445 |
|
|
pack .pack.b -side right
|
446 |
|
|
pack .pack.c -side left
|
447 |
|
|
update
|
448 |
|
|
test pack-8.5 {insufficient space} {
|
449 |
|
|
list [winfo geometry .pack.a] [winfo ismapped .pack.a] \
|
450 |
|
|
[winfo geometry .pack.b] [winfo ismapped .pack.b] \
|
451 |
|
|
[winfo geometry .pack.c] [winfo ismapped .pack.c]
|
452 |
|
|
} {20x40+0+20 1 50x30+100+25 1 80x80+20+0 1}
|
453 |
|
|
wm geom .pack 320x180
|
454 |
|
|
update
|
455 |
|
|
test pack-8.6 {insufficient space} {
|
456 |
|
|
list [winfo geometry .pack.a] [winfo ismapped .pack.a] \
|
457 |
|
|
[winfo geometry .pack.b] [winfo ismapped .pack.b] \
|
458 |
|
|
[winfo geometry .pack.c] [winfo ismapped .pack.c]
|
459 |
|
|
} {20x30+0+0 1 50x30+70+0 1 50x30+20+0 1}
|
460 |
|
|
wm geom .pack 250x180
|
461 |
|
|
update
|
462 |
|
|
test pack-8.7 {insufficient space} {
|
463 |
|
|
list [winfo geometry .pack.a] [winfo ismapped .pack.a] \
|
464 |
|
|
[winfo geometry .pack.b] [winfo ismapped .pack.b] \
|
465 |
|
|
[winfo geometry .pack.c] [winfo ismapped .pack.c]
|
466 |
|
|
} {20x30+0+0 1 30x30+20+0 1 50x30+20+0 0}
|
467 |
|
|
pack forget .pack.b
|
468 |
|
|
update
|
469 |
|
|
test pack-8.8 {insufficient space} {
|
470 |
|
|
list [winfo geometry .pack.a] [winfo ismapped .pack.a] \
|
471 |
|
|
[winfo geometry .pack.b] [winfo ismapped .pack.b] \
|
472 |
|
|
[winfo geometry .pack.c] [winfo ismapped .pack.c]
|
473 |
|
|
} {20x30+0+0 1 30x30+20+0 0 30x30+20+0 1}
|
474 |
|
|
pack .pack.b -side right -after .pack.a
|
475 |
|
|
wm geom .pack {}
|
476 |
|
|
update
|
477 |
|
|
test pack-8.9 {insufficient space} {
|
478 |
|
|
list [winfo geometry .pack.a] [winfo ismapped .pack.a] \
|
479 |
|
|
[winfo geometry .pack.b] [winfo ismapped .pack.b] \
|
480 |
|
|
[winfo geometry .pack.c] [winfo ismapped .pack.c]
|
481 |
|
|
} {20x40+0+20 1 50x30+100+25 1 80x80+20+0 1}
|
482 |
|
|
pack forget .pack.right .pack.bottom
|
483 |
|
|
|
484 |
|
|
test pack-9.1 {window ordering} {
|
485 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
486 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side top
|
487 |
|
|
pack .pack.a -after .pack.b
|
488 |
|
|
pack slaves .pack
|
489 |
|
|
} {.pack.b .pack.a .pack.c .pack.d}
|
490 |
|
|
test pack-9.2 {window ordering} {
|
491 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
492 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side top
|
493 |
|
|
pack .pack.a -after .pack.a
|
494 |
|
|
pack slaves .pack
|
495 |
|
|
} {.pack.a .pack.b .pack.c .pack.d}
|
496 |
|
|
test pack-9.3 {window ordering} {
|
497 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
498 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side top
|
499 |
|
|
pack .pack.a -before .pack.d
|
500 |
|
|
pack slaves .pack
|
501 |
|
|
} {.pack.b .pack.c .pack.a .pack.d}
|
502 |
|
|
test pack-9.4 {window ordering} {
|
503 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
504 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side top
|
505 |
|
|
pack .pack.d -before .pack.a
|
506 |
|
|
pack slaves .pack
|
507 |
|
|
} {.pack.d .pack.a .pack.b .pack.c}
|
508 |
|
|
test pack-9.5 {window ordering} {
|
509 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
510 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side top
|
511 |
|
|
pack propagate .pack.c 0
|
512 |
|
|
pack .pack.a -in .pack.c
|
513 |
|
|
list [pack slaves .pack] [pack slaves .pack.c]
|
514 |
|
|
} {{.pack.b .pack.c .pack.d} .pack.a}
|
515 |
|
|
test pack-9.6 {window ordering} {
|
516 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
517 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side top
|
518 |
|
|
pack .pack.a -in .pack
|
519 |
|
|
pack slaves .pack
|
520 |
|
|
} {.pack.b .pack.c .pack.d .pack.a}
|
521 |
|
|
test pack-9.7 {window ordering} {
|
522 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
523 |
|
|
pack .pack.a .pack.b .pack.c .pack.d -side top
|
524 |
|
|
pack .pack.a -padx 0
|
525 |
|
|
pack slaves .pack
|
526 |
|
|
} {.pack.a .pack.b .pack.c .pack.d}
|
527 |
|
|
test pack-9.8 {window ordering} {
|
528 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
529 |
|
|
pack .pack.a .pack.b .pack.c
|
530 |
|
|
pack .pack.d
|
531 |
|
|
pack slaves .pack
|
532 |
|
|
} {.pack.a .pack.b .pack.c .pack.d}
|
533 |
|
|
test pack-9.9 {window ordering} {
|
534 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
535 |
|
|
pack .pack.a .pack.b .pack.c .pack.d
|
536 |
|
|
pack .pack.b .pack.d .pack.c -before .pack.a
|
537 |
|
|
pack slaves .pack
|
538 |
|
|
} {.pack.b .pack.d .pack.c .pack.a}
|
539 |
|
|
test pack-9.10 {window ordering} {
|
540 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
541 |
|
|
pack .pack.a .pack.b .pack.c .pack.d
|
542 |
|
|
pack .pack.a .pack.c .pack.d .pack.b -after .pack.a
|
543 |
|
|
pack slaves .pack
|
544 |
|
|
} {.pack.a .pack.c .pack.d .pack.b}
|
545 |
|
|
|
546 |
|
|
test pack-10.1 {retaining/clearing configuration state} {
|
547 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
548 |
|
|
pack .pack.a -side bottom -anchor n -padx 1 -pady 2 -ipadx 3 -ipady 4 \
|
549 |
|
|
-fill both -expand 1
|
550 |
|
|
pack forget .pack.a
|
551 |
|
|
pack .pack.a
|
552 |
|
|
pack info .pack.a
|
553 |
|
|
} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top}
|
554 |
|
|
test pack-10.2 {retaining/clearing configuration state} {
|
555 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
556 |
|
|
pack .pack.a -side bottom -anchor n -padx 1 -pady 2 -ipadx 3 -ipady 4 \
|
557 |
|
|
-fill both -expand 1
|
558 |
|
|
pack .pack.a -pady 14
|
559 |
|
|
pack info .pack.a
|
560 |
|
|
} {-in .pack -anchor n -expand 1 -fill both -ipadx 3 -ipady 4 -padx 1 -pady 14 -side bottom}
|
561 |
|
|
|
562 |
|
|
test pack-11.1 {info option} {
|
563 |
|
|
pack4 -in .pack
|
564 |
|
|
} .pack
|
565 |
|
|
test pack-11.2 {info option} {
|
566 |
|
|
pack4 -anchor n
|
567 |
|
|
} n
|
568 |
|
|
test pack-11.3 {info option} {
|
569 |
|
|
pack4 -anchor sw
|
570 |
|
|
} sw
|
571 |
|
|
test pack-11.4 {info option} {
|
572 |
|
|
pack4 -expand yes
|
573 |
|
|
} 1
|
574 |
|
|
test pack-11.5 {info option} {
|
575 |
|
|
pack4 -expand no
|
576 |
|
|
} 0
|
577 |
|
|
test pack-11.6 {info option} {
|
578 |
|
|
pack4 -fill x
|
579 |
|
|
} x
|
580 |
|
|
test pack-11.7 {info option} {
|
581 |
|
|
pack4 -fill y
|
582 |
|
|
} y
|
583 |
|
|
test pack-11.8 {info option} {
|
584 |
|
|
pack4 -fill both
|
585 |
|
|
} both
|
586 |
|
|
test pack-11.9 {info option} {
|
587 |
|
|
pack4 -fill none
|
588 |
|
|
} none
|
589 |
|
|
test pack-11.10 {info option} {
|
590 |
|
|
pack4 -ipadx 14
|
591 |
|
|
} 14
|
592 |
|
|
test pack-11.11 {info option} {
|
593 |
|
|
pack4 -ipady 22
|
594 |
|
|
} 22
|
595 |
|
|
test pack-11.12 {info option} {
|
596 |
|
|
pack4 -padx 2
|
597 |
|
|
} 2
|
598 |
|
|
test pack-11.13 {info option} {
|
599 |
|
|
pack4 -pady 3
|
600 |
|
|
} 3
|
601 |
|
|
test pack-11.14 {info option} {
|
602 |
|
|
pack4 -side top
|
603 |
|
|
} top
|
604 |
|
|
test pack-11.15 {info option} {
|
605 |
|
|
pack4 -side bottom
|
606 |
|
|
} bottom
|
607 |
|
|
test pack-11.16 {info option} {
|
608 |
|
|
pack4 -side left
|
609 |
|
|
} left
|
610 |
|
|
test pack-11.17 {info option} {
|
611 |
|
|
pack4 -side right
|
612 |
|
|
} right
|
613 |
|
|
|
614 |
|
|
test pack-12.1 {command options and errors} {
|
615 |
|
|
list [catch {pack} msg] $msg
|
616 |
|
|
} {1 {wrong # args: should be "pack option arg ?arg ...?"}}
|
617 |
|
|
test pack-12.2 {command options and errors} {
|
618 |
|
|
list [catch {pack foo} msg] $msg
|
619 |
|
|
} {1 {wrong # args: should be "pack option arg ?arg ...?"}}
|
620 |
|
|
test pack-12.3 {command options and errors} {
|
621 |
|
|
list [catch {pack configure x} msg] $msg
|
622 |
|
|
} {1 {bad argument "x": must be name of window}}
|
623 |
|
|
test pack-12.4 {command options and errors} {
|
624 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
625 |
|
|
pack configure .pack.b .pack.c
|
626 |
|
|
pack slaves .pack
|
627 |
|
|
} {.pack.b .pack.c}
|
628 |
|
|
test pack-12.5 {command options and errors} {
|
629 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
630 |
|
|
list [catch {pack .foo} msg] $msg
|
631 |
|
|
} {1 {bad window path name ".foo"}}
|
632 |
|
|
test pack-12.6 {command options and errors} {
|
633 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
634 |
|
|
list [catch {pack .pack} msg] $msg
|
635 |
|
|
} {1 {can't pack ".pack": it's a top-level window}}
|
636 |
|
|
test pack-12.7 {command options and errors} {
|
637 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
638 |
|
|
list [catch {pack .pack.a -after .foo} msg] $msg
|
639 |
|
|
} {1 {bad window path name ".foo"}}
|
640 |
|
|
test pack-12.8 {command options and errors} {
|
641 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
642 |
|
|
list [catch {pack .pack.a -after .pack.b} msg] $msg
|
643 |
|
|
} {1 {window ".pack.b" isn't packed}}
|
644 |
|
|
test pack-12.9 {command options and errors} {
|
645 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
646 |
|
|
list [catch {pack .pack.a -anchor gorp} msg] $msg
|
647 |
|
|
} {1 {bad anchor position "gorp": must be n, ne, e, se, s, sw, w, nw, or center}}
|
648 |
|
|
test pack-12.10 {command options and errors} {
|
649 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
650 |
|
|
list [catch {pack .pack.a -before gorp} msg] $msg
|
651 |
|
|
} {1 {bad window path name "gorp"}}
|
652 |
|
|
test pack-12.11 {command options and errors} {
|
653 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
654 |
|
|
list [catch {pack .pack.a -before .pack.b} msg] $msg
|
655 |
|
|
} {1 {window ".pack.b" isn't packed}}
|
656 |
|
|
test pack-12.12 {command options and errors} {
|
657 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
658 |
|
|
list [catch {pack .pack.a -expand "who cares?"} msg] $msg
|
659 |
|
|
} {1 {expected boolean value but got "who cares?"}}
|
660 |
|
|
test pack-12.13 {command options and errors} {
|
661 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
662 |
|
|
list [catch {pack .pack.a -fill z} msg] $msg
|
663 |
|
|
} {1 {bad fill style "z": must be none, x, y, or both}}
|
664 |
|
|
test pack-12.14 {command options and errors} {
|
665 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
666 |
|
|
list [catch {pack .pack.a -in z} msg] $msg
|
667 |
|
|
} {1 {bad window path name "z"}}
|
668 |
|
|
set pad [winfo pixels .pack 1c]
|
669 |
|
|
test pack-12.15 {command options and errors} {
|
670 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
671 |
|
|
list [catch {pack .pack.a -padx abc} msg] $msg
|
672 |
|
|
} {1 {bad pad value "abc": must be positive screen distance}}
|
673 |
|
|
test pack-12.16 {command options and errors} {
|
674 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
675 |
|
|
list [catch {pack .pack.a -padx -1} msg] $msg
|
676 |
|
|
} {1 {bad pad value "-1": must be positive screen distance}}
|
677 |
|
|
test pack-12.17 {command options and errors} {
|
678 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
679 |
|
|
list [catch {pack .pack.a -pady abc} msg] $msg
|
680 |
|
|
} {1 {bad pad value "abc": must be positive screen distance}}
|
681 |
|
|
test pack-12.18 {command options and errors} {
|
682 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
683 |
|
|
list [catch {pack .pack.a -pady -1} msg] $msg
|
684 |
|
|
} {1 {bad pad value "-1": must be positive screen distance}}
|
685 |
|
|
test pack-12.19 {command options and errors} {
|
686 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
687 |
|
|
list [catch {pack .pack.a -ipadx abc} msg] $msg
|
688 |
|
|
} {1 {bad pad value "abc": must be positive screen distance}}
|
689 |
|
|
test pack-12.20 {command options and errors} {
|
690 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
691 |
|
|
list [catch {pack .pack.a -ipadx -1} msg] $msg
|
692 |
|
|
} {1 {bad pad value "-1": must be positive screen distance}}
|
693 |
|
|
test pack-12.21 {command options and errors} {
|
694 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
695 |
|
|
list [catch {pack .pack.a -ipady abc} msg] $msg
|
696 |
|
|
} {1 {bad pad value "abc": must be positive screen distance}}
|
697 |
|
|
test pack-12.22 {command options and errors} {
|
698 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
699 |
|
|
list [catch {pack .pack.a -ipady -1} msg] $msg
|
700 |
|
|
} {1 {bad pad value "-1": must be positive screen distance}}
|
701 |
|
|
test pack-12.23 {command options and errors} {
|
702 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
703 |
|
|
list [catch {pack .pack.a -side bac} msg] $msg
|
704 |
|
|
} {1 {bad side "bac": must be top, bottom, left, or right}}
|
705 |
|
|
test pack-12.24 {command options and errors} {
|
706 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
707 |
|
|
list [catch {pack .pack.a -lousy bac} msg] $msg
|
708 |
|
|
} {1 {unknown or ambiguous option "-lousy": must be -after, -anchor, -before, -expand, -fill, -in, -ipadx, -ipady, -padx, -pady, or -side}}
|
709 |
|
|
test pack-12.25 {command options and errors} {
|
710 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
711 |
|
|
list [catch {pack .pack.a -padx} msg] $msg
|
712 |
|
|
} {1 {extra option "-padx" (option with no value?)}}
|
713 |
|
|
test pack-12.26 {command options and errors} {
|
714 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
715 |
|
|
list [catch {pack .pack.a {} 22} msg] $msg
|
716 |
|
|
} {1 {unknown or ambiguous option "": must be -after, -anchor, -before, -expand, -fill, -in, -ipadx, -ipady, -padx, -pady, or -side}}
|
717 |
|
|
test pack-12.27 {command options and errors} {
|
718 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
719 |
|
|
list [catch {pack .pack.a -in .} msg] $msg
|
720 |
|
|
} {1 {can't pack .pack.a inside .}}
|
721 |
|
|
test pack-12.28 {command options and errors} {
|
722 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
723 |
|
|
frame .pack.a.a
|
724 |
|
|
list [catch {pack .pack.a.a -in .pack.b} msg] $msg
|
725 |
|
|
} {1 {can't pack .pack.a.a inside .pack.b}}
|
726 |
|
|
test pack-12.29 {command options and errors} {
|
727 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
728 |
|
|
list [catch {pack .pack.a -in .pack.a} msg] $msg
|
729 |
|
|
} {1 {can't pack .pack.a inside itself}}
|
730 |
|
|
test pack-12.30 {command options and errors} {
|
731 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
732 |
|
|
pack .pack.a .pack.b .pack.c .pack.d
|
733 |
|
|
pack forget .pack.a .pack.d
|
734 |
|
|
pack slaves .pack
|
735 |
|
|
} {.pack.b .pack.c}
|
736 |
|
|
test pack-12.31 {command options and errors} {
|
737 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
738 |
|
|
.pack configure -width 300 -height 200
|
739 |
|
|
pack propagate .pack 0
|
740 |
|
|
pack .pack.a
|
741 |
|
|
update
|
742 |
|
|
set result [list [winfo reqwidth .pack] [winfo reqheight .pack]]
|
743 |
|
|
pack propagate .pack 1
|
744 |
|
|
update
|
745 |
|
|
lappend result [winfo reqwidth .pack] [winfo reqheight .pack]
|
746 |
|
|
set result
|
747 |
|
|
} {300 200 20 40}
|
748 |
|
|
test pack-12.32 {command options and errors} {
|
749 |
|
|
set result [pack propagate .pack.d]
|
750 |
|
|
pack propagate .pack.d 0
|
751 |
|
|
lappend result [pack propagate .pack.d]
|
752 |
|
|
pack propagate .pack.d 1
|
753 |
|
|
lappend result [pack propagate .pack.d]
|
754 |
|
|
set result
|
755 |
|
|
} {1 0 1}
|
756 |
|
|
test pack-12.33 {command options and errors} {
|
757 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
758 |
|
|
list [catch {pack propagate .dum} msg] $msg
|
759 |
|
|
} {1 {bad window path name ".dum"}}
|
760 |
|
|
test pack-12.34 {command options and errors} {
|
761 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
762 |
|
|
list [catch {pack propagate .pack foo} msg] $msg
|
763 |
|
|
} {1 {expected boolean value but got "foo"}}
|
764 |
|
|
test pack-12.35 {command options and errors} {
|
765 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
766 |
|
|
list [catch {pack propagate .pack foo bar} msg] $msg
|
767 |
|
|
} {1 {wrong # args: should be "pack propagate window ?boolean?"}}
|
768 |
|
|
test pack-12.36 {command options and errors} {
|
769 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
770 |
|
|
list [catch {pack slaves} msg] $msg
|
771 |
|
|
} {1 {wrong # args: should be "pack option arg ?arg ...?"}}
|
772 |
|
|
test pack-12.37 {command options and errors} {
|
773 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
774 |
|
|
list [catch {pack slaves a b} msg] $msg
|
775 |
|
|
} {1 {wrong # args: should be "pack slaves window"}}
|
776 |
|
|
test pack-12.38 {command options and errors} {
|
777 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
778 |
|
|
list [catch {pack slaves .x} msg] $msg
|
779 |
|
|
} {1 {bad window path name ".x"}}
|
780 |
|
|
test pack-12.39 {command options and errors} {
|
781 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
782 |
|
|
list [catch {pack slaves .pack.a} msg] $msg
|
783 |
|
|
} {0 {}}
|
784 |
|
|
test pack-12.40 {command options and errors} {
|
785 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
786 |
|
|
list [catch {pack lousy .pack} msg] $msg
|
787 |
|
|
} {1 {bad option "lousy": must be configure, forget, info, propagate, or slaves}}
|
788 |
|
|
|
789 |
|
|
pack .pack.right -side right
|
790 |
|
|
pack .pack.bottom -side bottom
|
791 |
|
|
test pack-13.1 {window deletion} {
|
792 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
793 |
|
|
pack .pack.a .pack.d .pack.b .pack.c -side top
|
794 |
|
|
update
|
795 |
|
|
destroy .pack.d
|
796 |
|
|
update
|
797 |
|
|
set result [list [pack slaves .pack] [winfo geometry .pack.a] \
|
798 |
|
|
[winfo geometry .pack.b] [winfo geometry .pack.c]]
|
799 |
|
|
} {{.pack.right .pack.bottom .pack.a .pack.b .pack.c} 20x40+30+0 50x30+15+40 80x80+0+70}
|
800 |
|
|
|
801 |
|
|
test pack-14.1 {respond to changes in expansion} {
|
802 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
803 |
|
|
wm geom .pack {}
|
804 |
|
|
pack .pack.a
|
805 |
|
|
update
|
806 |
|
|
set result [winfo geom .pack.a]
|
807 |
|
|
wm geom .pack 400x300
|
808 |
|
|
update
|
809 |
|
|
lappend result [winfo geom .pack.a]
|
810 |
|
|
pack .pack.a -expand true -fill both
|
811 |
|
|
update
|
812 |
|
|
lappend result [winfo geom .pack.a]
|
813 |
|
|
} {20x40+0+0 20x40+90+0 200x150+0+0}
|
814 |
|
|
wm geom .pack {}
|
815 |
|
|
|
816 |
|
|
test pack-15.1 {managing geometry with -in option} {
|
817 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
818 |
|
|
pack .pack.a -side top
|
819 |
|
|
frame .pack.f
|
820 |
|
|
lower .pack.f
|
821 |
|
|
pack .pack.f -side top
|
822 |
|
|
frame .pack.f.f2
|
823 |
|
|
lower .pack.f.f2
|
824 |
|
|
pack .pack.f.f2 -side top
|
825 |
|
|
pack .pack.b -in .pack.f.f2
|
826 |
|
|
update
|
827 |
|
|
set result [winfo geom .pack.b]
|
828 |
|
|
pack unpack .pack.a
|
829 |
|
|
update
|
830 |
|
|
lappend result [winfo geom .pack.b]
|
831 |
|
|
} {50x30+0+40 50x30+0+0}
|
832 |
|
|
catch {destroy .pack.f}
|
833 |
|
|
test pack-15.2 {managing geometry with -in option} {
|
834 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
835 |
|
|
frame .pack.f
|
836 |
|
|
lower .pack.f
|
837 |
|
|
pack .pack.a -in .pack.f -side top
|
838 |
|
|
update
|
839 |
|
|
set result [winfo ismapped .pack.a]
|
840 |
|
|
place .pack.f -x 30 -y 45
|
841 |
|
|
update
|
842 |
|
|
lappend result [winfo ismapped .pack.a] [winfo geometry .pack.a]
|
843 |
|
|
place forget .pack.f
|
844 |
|
|
update
|
845 |
|
|
lappend result [winfo ismapped .pack.a]
|
846 |
|
|
} {0 1 20x40+30+45 0}
|
847 |
|
|
catch {destroy .pack.f}
|
848 |
|
|
test pack-15.3 {managing geometry with -in option} {
|
849 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
850 |
|
|
pack .pack.a -side top
|
851 |
|
|
frame .pack.f
|
852 |
|
|
lower .pack.f
|
853 |
|
|
pack .pack.f -side top
|
854 |
|
|
frame .pack.f.f2
|
855 |
|
|
lower .pack.f.f2
|
856 |
|
|
pack .pack.f.f2 -side top
|
857 |
|
|
pack .pack.b -in .pack.f.f2
|
858 |
|
|
update
|
859 |
|
|
set result [winfo ismapped .pack.b]
|
860 |
|
|
pack unpack .pack.f
|
861 |
|
|
update
|
862 |
|
|
lappend result [winfo ismapped .pack.b]
|
863 |
|
|
} {1 0}
|
864 |
|
|
catch {destroy .pack.f}
|
865 |
|
|
test pack-15.4 {managing geometry with -in option} {
|
866 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
867 |
|
|
foreach i {1 2} {
|
868 |
|
|
frame .pack.f$i -width 100 -height 40 -bd 2 -relief raised
|
869 |
|
|
lower .pack.f$i
|
870 |
|
|
pack propagate .pack.f$i 0
|
871 |
|
|
pack .pack.f$i -side top
|
872 |
|
|
}
|
873 |
|
|
pack .pack.b -in .pack.f1 -side right
|
874 |
|
|
update
|
875 |
|
|
set result {}
|
876 |
|
|
lappend result [winfo geometry .pack.b] [winfo ismapped .pack.b]
|
877 |
|
|
pack .pack.b -in .pack.f2 -side bottom
|
878 |
|
|
update
|
879 |
|
|
lappend result [winfo geometry .pack.b] [winfo ismapped .pack.b]
|
880 |
|
|
.pack.f1 configure -width 50 -height 20
|
881 |
|
|
update
|
882 |
|
|
lappend result [winfo geometry .pack.b] [winfo ismapped .pack.b]
|
883 |
|
|
pack forget .pack.b
|
884 |
|
|
update
|
885 |
|
|
lappend result [winfo geometry .pack.b] [winfo ismapped .pack.b]
|
886 |
|
|
} {50x30+48+5 1 50x30+25+48 1 50x30+25+28 1 50x30+25+28 0}
|
887 |
|
|
catch {destroy .pack.f1 .pack.f2}
|
888 |
|
|
test pack-15.5 {managing geometry with -in option} {
|
889 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
890 |
|
|
foreach i {1 2} {
|
891 |
|
|
frame .pack.f$i -width 100 -height 20 -bd 2 -relief raised
|
892 |
|
|
lower .pack.f$i
|
893 |
|
|
pack propagate .pack.f$i 0
|
894 |
|
|
pack .pack.f$i -side top
|
895 |
|
|
}
|
896 |
|
|
pack .pack.b -in .pack.f2 -side top
|
897 |
|
|
update
|
898 |
|
|
set result {}
|
899 |
|
|
lappend result [winfo geometry .pack.b] [winfo ismapped .pack.b]
|
900 |
|
|
pack .pack.a -before .pack.b -side top
|
901 |
|
|
update
|
902 |
|
|
lappend result [winfo geometry .pack.b] [winfo ismapped .pack.b]
|
903 |
|
|
} {50x16+25+22 1 50x16+25+22 0}
|
904 |
|
|
catch {destroy .pack.f1 .pack.f2}
|
905 |
|
|
|
906 |
|
|
test pack-16.1 {geometry manager name} {
|
907 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
908 |
|
|
set result {}
|
909 |
|
|
lappend result [winfo manager .pack.a]
|
910 |
|
|
pack .pack.a
|
911 |
|
|
lappend result [winfo manager .pack.a]
|
912 |
|
|
pack forget .pack.a
|
913 |
|
|
lappend result [winfo manager .pack.a]
|
914 |
|
|
} {{} pack {}}
|
915 |
|
|
|
916 |
|
|
test pack-17.1 {PackLostSlaveProc procedure} {
|
917 |
|
|
pack forget .pack.a .pack.b .pack.c .pack.d
|
918 |
|
|
pack .pack.a
|
919 |
|
|
update
|
920 |
|
|
place .pack.a -x 40 -y 10
|
921 |
|
|
update
|
922 |
|
|
list [winfo manager .pack.a] [winfo geometry .pack.a] \
|
923 |
|
|
[catch {pack info .pack.a} msg] $msg
|
924 |
|
|
} {place 20x40+40+10 1 {window ".pack.a" isn't packed}}
|
925 |
|
|
|
926 |
|
|
test pack-18.1 {unmap slaves when master unmapped} {tempNotPc} {
|
927 |
|
|
# On the PC, when the width/height is configured while the window is
|
928 |
|
|
# unmapped, the changes don't take effect until the window is remapped.
|
929 |
|
|
# Who knows why?
|
930 |
|
|
|
931 |
|
|
eval destroy [winfo child .pack]
|
932 |
|
|
frame .pack.a -width 100 -height 50 -relief raised -bd 2
|
933 |
|
|
pack .pack.a
|
934 |
|
|
update
|
935 |
|
|
set result [winfo ismapped .pack.a]
|
936 |
|
|
wm iconify .pack
|
937 |
|
|
update
|
938 |
|
|
lappend result [winfo ismapped .pack.a]
|
939 |
|
|
.pack.a configure -width 200 -height 75
|
940 |
|
|
update
|
941 |
|
|
lappend result [winfo width .pack.a ] [winfo height .pack.a] \
|
942 |
|
|
[winfo ismapped .pack.a]
|
943 |
|
|
wm deiconify .pack
|
944 |
|
|
update
|
945 |
|
|
lappend result [winfo ismapped .pack.a]
|
946 |
|
|
} {1 0 200 75 0 1}
|
947 |
|
|
test pack-18.2 {unmap slaves when master unmapped} {
|
948 |
|
|
eval destroy [winfo child .pack]
|
949 |
|
|
frame .pack.a -relief raised -bd 2
|
950 |
|
|
frame .pack.b -width 70 -height 30 -relief sunken -bd 2
|
951 |
|
|
pack .pack.a
|
952 |
|
|
pack .pack.b -in .pack.a
|
953 |
|
|
update
|
954 |
|
|
set result [winfo ismapped .pack.b]
|
955 |
|
|
wm iconify .pack
|
956 |
|
|
update
|
957 |
|
|
lappend result [winfo ismapped .pack.b]
|
958 |
|
|
.pack.b configure -width 100 -height 30
|
959 |
|
|
update
|
960 |
|
|
lappend result [winfo width .pack.b ] [winfo height .pack.b] \
|
961 |
|
|
[winfo ismapped .pack.b]
|
962 |
|
|
wm deiconify .pack
|
963 |
|
|
update
|
964 |
|
|
lappend result [winfo ismapped .pack.b]
|
965 |
|
|
} {1 0 100 30 0 1}
|
966 |
|
|
destroy .pack
|
967 |
|
|
foreach i {pack1 pack2 pack3 pack4} {
|
968 |
|
|
rename $i {}
|
969 |
|
|
}
|