1447
|
1 |
"{ Package: 'stx:goodies/regression' }"
|
340
|
2 |
|
|
3 |
"{ NameSpace: RegressionTests }"
|
|
4 |
|
|
5 |
ApplicationModel subclass:#LabelResizingTest
|
|
6 |
instanceVariableNames:'labelView'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'tests-Regression'
|
|
10 |
!
|
|
11 |
|
|
12 |
!LabelResizingTest class methodsFor:'documentation'!
|
|
13 |
|
|
14 |
documentation
|
|
15 |
"
|
|
16 |
documentation to be added.
|
|
17 |
|
|
18 |
[author:]
|
1447
|
19 |
ca (ca@IDEFIX)
|
340
|
20 |
|
|
21 |
[instance variables:]
|
|
22 |
|
|
23 |
[class variables:]
|
|
24 |
|
|
25 |
[see also:]
|
|
26 |
|
|
27 |
"
|
|
28 |
!
|
|
29 |
|
|
30 |
examples
|
|
31 |
"
|
|
32 |
Starting the application:
|
1447
|
33 |
[exBegin]
|
340
|
34 |
Claus open
|
|
35 |
|
1447
|
36 |
[exEnd]
|
340
|
37 |
|
|
38 |
more examples to be added:
|
1447
|
39 |
[exBegin]
|
|
40 |
... add code fragment for
|
340
|
41 |
... executable example here ...
|
1447
|
42 |
[exEnd]
|
340
|
43 |
"
|
|
44 |
!
|
|
45 |
|
|
46 |
history
|
|
47 |
"Created: / 08-10-2007 / 17:39:33 / ca"
|
|
48 |
! !
|
|
49 |
|
|
50 |
!LabelResizingTest class methodsFor:'interface specs'!
|
|
51 |
|
|
52 |
windowSpec
|
|
53 |
"This resource specification was automatically generated
|
|
54 |
by the UIPainter of ST/X."
|
|
55 |
|
|
56 |
"Do not manually edit this!! If it is corrupted,
|
|
57 |
the UIPainter may not be able to read the specification."
|
|
58 |
|
|
59 |
"
|
|
60 |
UIPainter new openOnClass:Claus andSelector:#windowSpec
|
|
61 |
Claus new openInterface:#windowSpec
|
|
62 |
Claus open
|
|
63 |
"
|
|
64 |
|
|
65 |
<resource: #canvas>
|
|
66 |
|
1447
|
67 |
^
|
340
|
68 |
#(FullSpec
|
1447
|
69 |
name: windowSpec
|
|
70 |
window:
|
340
|
71 |
(WindowSpec
|
1447
|
72 |
label: 'Claus'
|
|
73 |
name: 'Claus'
|
|
74 |
min: (Point 10 10)
|
|
75 |
max: (Point 1024 768)
|
|
76 |
bounds: (Rectangle 0 0 518 496)
|
|
77 |
menu: mainMenu
|
|
78 |
)
|
|
79 |
component:
|
340
|
80 |
(SpecCollection
|
1447
|
81 |
collection: (
|
|
82 |
(ViewSpec
|
|
83 |
name: 'Box'
|
|
84 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
85 |
backgroundColor: (Color 86.999313344015 86.999313344015 86.999313344015)
|
|
86 |
component:
|
|
87 |
(SpecCollection
|
|
88 |
collection: (
|
|
89 |
(LabelSpec
|
|
90 |
label: 'Label'
|
|
91 |
name: 'Label'
|
|
92 |
layout: (AlignmentOrigin -5 1.0 5 0 1 0)
|
|
93 |
visibilityChannel: visibleHolder
|
|
94 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
95 |
translateLabel: true
|
|
96 |
labelChannel: lableHolder
|
|
97 |
resizeForLabel: true
|
|
98 |
adjust: left
|
|
99 |
postBuildCallback: postBuildLabel:
|
|
100 |
)
|
|
101 |
(ActionButtonSpec
|
|
102 |
label: 'Button'
|
|
103 |
name: 'Button'
|
|
104 |
layout: (AlignmentOrigin -5 1.0 40 0 1 0)
|
|
105 |
visibilityChannel: visibleHolder
|
|
106 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
107 |
translateLabel: true
|
|
108 |
labelChannel: lableHolder
|
|
109 |
resizeForLabel: true
|
|
110 |
)
|
|
111 |
(LabelSpec
|
|
112 |
label: 'Point'
|
|
113 |
name: 'Point'
|
|
114 |
layout: (Point 5 5)
|
|
115 |
translateLabel: true
|
|
116 |
labelChannel: lableHolder
|
|
117 |
resizeForLabel: true
|
|
118 |
)
|
|
119 |
(LabelSpec
|
|
120 |
label: 'Alignment Origin TopLeft'
|
|
121 |
name: 'Alignment Origin TopLeft'
|
|
122 |
layout: (AlignmentOrigin 5 0 30 0 0 0)
|
|
123 |
translateLabel: true
|
|
124 |
labelChannel: lableHolder
|
|
125 |
resizeForLabel: true
|
|
126 |
)
|
|
127 |
(LabelSpec
|
|
128 |
label: 'Origin'
|
|
129 |
name: 'Origin'
|
|
130 |
layout: (LayoutOrigin 5 0 55 0)
|
|
131 |
translateLabel: true
|
|
132 |
labelChannel: lableHolder
|
|
133 |
resizeForLabel: true
|
|
134 |
)
|
|
135 |
)
|
|
136 |
|
|
137 |
)
|
|
138 |
)
|
|
139 |
(LabelSpec
|
|
140 |
label: 'Variable Horizontal Panel'
|
|
141 |
name: 'Variable Horizontal Panel'
|
|
142 |
layout: (LayoutFrame 0 0.0 90 0 0 1.0 120 0)
|
|
143 |
backgroundColor: (Color 49.999237048905 49.999237048905 100.0)
|
|
144 |
translateLabel: true
|
|
145 |
resizeForLabel: true
|
|
146 |
)
|
|
147 |
(VariableHorizontalPanelSpec
|
|
148 |
name: 'VariableHorizontalPanel'
|
|
149 |
layout: (LayoutFrame 0 0.0 120 0 0 1.0 170 0)
|
|
150 |
snapMode: both
|
|
151 |
component:
|
|
152 |
(SpecCollection
|
|
153 |
collection: (
|
|
154 |
(LabelSpec
|
|
155 |
label: 'Label'
|
|
156 |
name: 'Label1'
|
|
157 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
158 |
translateLabel: true
|
|
159 |
labelChannel: lableHolder
|
|
160 |
resizeForLabel: true
|
|
161 |
)
|
|
162 |
(ActionButtonSpec
|
|
163 |
label: 'Button'
|
|
164 |
name: 'Button1'
|
|
165 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
166 |
translateLabel: true
|
|
167 |
labelChannel: lableHolder
|
|
168 |
resizeForLabel: true
|
|
169 |
)
|
|
170 |
(LabelSpec
|
|
171 |
label: 'Label'
|
|
172 |
name: 'Label2'
|
|
173 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
174 |
translateLabel: true
|
|
175 |
labelChannel: lableHolder
|
|
176 |
resizeForLabel: true
|
|
177 |
)
|
|
178 |
)
|
|
179 |
|
|
180 |
)
|
|
181 |
handles: (Any 0.33333333333333 0.66666666666667 1.0)
|
|
182 |
)
|
|
183 |
(LabelSpec
|
|
184 |
label: 'Horizontal Panel'
|
|
185 |
name: 'Horizontal Panel'
|
|
186 |
layout: (LayoutFrame 0 0.0 170 0 0 1.0 200 0)
|
|
187 |
backgroundColor: (Color 49.999237048905 49.999237048905 100.0)
|
|
188 |
translateLabel: true
|
|
189 |
resizeForLabel: true
|
|
190 |
)
|
|
191 |
(HorizontalPanelViewSpec
|
|
192 |
name: 'HorizontalPanel'
|
|
193 |
layout: (LayoutFrame 0 0.0 200 0 0 1.0 250 0)
|
|
194 |
horizontalLayout: center
|
|
195 |
verticalLayout: center
|
|
196 |
horizontalSpace: 3
|
|
197 |
verticalSpace: 3
|
|
198 |
elementsChangeSize: true
|
|
199 |
component:
|
|
200 |
(SpecCollection
|
|
201 |
collection: (
|
|
202 |
(LabelSpec
|
|
203 |
label: 'Label'
|
|
204 |
name: 'Label3'
|
|
205 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
206 |
translateLabel: true
|
|
207 |
labelChannel: lableHolder
|
|
208 |
resizeForLabel: true
|
|
209 |
extent: (Point 74 20)
|
|
210 |
)
|
|
211 |
(ActionButtonSpec
|
|
212 |
label: 'Button'
|
|
213 |
name: 'Button2'
|
|
214 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
215 |
translateLabel: true
|
|
216 |
labelChannel: lableHolder
|
|
217 |
resizeForLabel: true
|
|
218 |
extent: (Point 78 24)
|
|
219 |
)
|
|
220 |
(LabelSpec
|
|
221 |
label: 'Label'
|
|
222 |
name: 'Label4'
|
|
223 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
224 |
translateLabel: true
|
|
225 |
labelChannel: lableHolder
|
|
226 |
resizeForLabel: true
|
|
227 |
extent: (Point 74 20)
|
|
228 |
)
|
|
229 |
)
|
|
230 |
|
|
231 |
)
|
|
232 |
)
|
|
233 |
(LabelSpec
|
|
234 |
label: 'Vertical Panels'
|
|
235 |
name: 'Vertical Panels'
|
|
236 |
layout: (LayoutFrame 0 0.0 250 0 0 1.0 280 0)
|
|
237 |
backgroundColor: (Color 49.999237048905 49.999237048905 100.0)
|
|
238 |
translateLabel: true
|
|
239 |
)
|
|
240 |
(HorizontalPanelViewSpec
|
|
241 |
name: 'All Panels'
|
|
242 |
layout: (LayoutFrame 0 0.0 280 0 0 1.0 -5 1.0)
|
|
243 |
horizontalLayout: fitSpace
|
|
244 |
verticalLayout: fitSpace
|
|
245 |
horizontalSpace: 3
|
|
246 |
verticalSpace: 3
|
|
247 |
component:
|
|
248 |
(SpecCollection
|
|
249 |
collection: (
|
|
250 |
(ViewSpec
|
|
251 |
name: 'VerticalPanelView'
|
|
252 |
component:
|
|
253 |
(SpecCollection
|
|
254 |
collection: (
|
|
255 |
(LabelSpec
|
|
256 |
label: 'Vertical Panel'
|
|
257 |
name: 'Vertical Panel'
|
|
258 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 30 0)
|
|
259 |
backgroundColor: (Color 49.999237048905 49.999237048905 100.0)
|
|
260 |
translateLabel: true
|
|
261 |
)
|
|
262 |
(VerticalPanelViewSpec
|
|
263 |
name: 'VerticalPanel'
|
|
264 |
layout: (LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0)
|
|
265 |
horizontalLayout: center
|
|
266 |
verticalLayout: center
|
|
267 |
horizontalSpace: 3
|
|
268 |
verticalSpace: 3
|
|
269 |
elementsChangeSize: true
|
|
270 |
component:
|
|
271 |
(SpecCollection
|
|
272 |
collection: (
|
|
273 |
(LabelSpec
|
|
274 |
label: 'Label'
|
|
275 |
name: 'Label5'
|
|
276 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
277 |
translateLabel: true
|
|
278 |
labelChannel: lableHolder
|
|
279 |
resizeForLabel: true
|
|
280 |
extent: (Point 74 20)
|
|
281 |
)
|
|
282 |
(ActionButtonSpec
|
|
283 |
label: 'Button'
|
|
284 |
name: 'Button3'
|
|
285 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
286 |
translateLabel: true
|
|
287 |
labelChannel: lableHolder
|
|
288 |
resizeForLabel: true
|
|
289 |
extent: (Point 78 24)
|
|
290 |
)
|
|
291 |
(LabelSpec
|
|
292 |
label: 'Label'
|
|
293 |
name: 'Label6'
|
|
294 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
295 |
translateLabel: true
|
|
296 |
labelChannel: lableHolder
|
|
297 |
resizeForLabel: true
|
|
298 |
extent: (Point 74 20)
|
|
299 |
)
|
|
300 |
)
|
|
301 |
|
|
302 |
)
|
|
303 |
)
|
|
304 |
)
|
|
305 |
|
|
306 |
)
|
|
307 |
extent: (Point 168 205)
|
|
308 |
)
|
|
309 |
(ViewSpec
|
|
310 |
name: 'PanelView'
|
|
311 |
component:
|
|
312 |
(SpecCollection
|
|
313 |
collection: (
|
|
314 |
(LabelSpec
|
|
315 |
label: 'Panel'
|
|
316 |
name: 'PanelLabel'
|
|
317 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 30 0)
|
|
318 |
backgroundColor: (Color 49.999237048905 49.999237048905 100.0)
|
|
319 |
translateLabel: true
|
|
320 |
)
|
|
321 |
(PanelViewSpec
|
|
322 |
name: 'Panel'
|
|
323 |
layout: (LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0)
|
|
324 |
horizontalLayout: fitSpace
|
|
325 |
verticalLayout: fitSpace
|
|
326 |
horizontalSpace: 3
|
|
327 |
verticalSpace: 3
|
|
328 |
elementsChangeSize: true
|
|
329 |
component:
|
|
330 |
(SpecCollection
|
|
331 |
collection: (
|
|
332 |
(LabelSpec
|
|
333 |
label: 'Label'
|
|
334 |
name: 'Label7'
|
|
335 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
336 |
translateLabel: true
|
|
337 |
labelChannel: lableHolder
|
|
338 |
resizeForLabel: true
|
|
339 |
extent: (Point 74 20)
|
|
340 |
)
|
|
341 |
(ActionButtonSpec
|
|
342 |
label: 'Button'
|
|
343 |
name: 'Button4'
|
|
344 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
345 |
translateLabel: true
|
|
346 |
labelChannel: lableHolder
|
|
347 |
resizeForLabel: true
|
|
348 |
extent: (Point 78 24)
|
|
349 |
)
|
|
350 |
(LabelSpec
|
|
351 |
label: 'Label'
|
|
352 |
name: 'Label9'
|
|
353 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
354 |
translateLabel: true
|
|
355 |
labelChannel: lableHolder
|
|
356 |
resizeForLabel: true
|
|
357 |
extent: (Point 74 20)
|
|
358 |
)
|
|
359 |
)
|
|
360 |
|
|
361 |
)
|
|
362 |
)
|
|
363 |
)
|
|
364 |
|
|
365 |
)
|
|
366 |
extent: (Point 169 205)
|
|
367 |
)
|
|
368 |
(ViewSpec
|
|
369 |
name: 'VariableVerticalPanelView'
|
|
370 |
component:
|
|
371 |
(SpecCollection
|
|
372 |
collection: (
|
|
373 |
(LabelSpec
|
|
374 |
label: 'Variable Vertical Panel'
|
|
375 |
name: 'Variable Vertical Panel'
|
|
376 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 30 0)
|
|
377 |
backgroundColor: (Color 49.999237048905 49.999237048905 100.0)
|
|
378 |
translateLabel: true
|
|
379 |
)
|
|
380 |
(VariableVerticalPanelSpec
|
|
381 |
name: 'VariableVerticalPanel'
|
|
382 |
layout: (LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0)
|
|
383 |
snapMode: both
|
|
384 |
component:
|
|
385 |
(SpecCollection
|
|
386 |
collection: (
|
|
387 |
(LabelSpec
|
|
388 |
label: 'Label'
|
|
389 |
name: 'Label8'
|
|
390 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
391 |
translateLabel: true
|
|
392 |
labelChannel: lableHolder
|
|
393 |
resizeForLabel: true
|
|
394 |
)
|
|
395 |
(ActionButtonSpec
|
|
396 |
label: 'Button'
|
|
397 |
name: 'Button5'
|
|
398 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
399 |
translateLabel: true
|
|
400 |
labelChannel: lableHolder
|
|
401 |
resizeForLabel: true
|
|
402 |
)
|
|
403 |
(LabelSpec
|
|
404 |
label: 'Label'
|
|
405 |
name: 'Label10'
|
|
406 |
backgroundColor: (Color 49.999237048905 100.0 49.999237048905)
|
|
407 |
translateLabel: true
|
|
408 |
labelChannel: lableHolder
|
|
409 |
resizeForLabel: true
|
|
410 |
)
|
|
411 |
)
|
|
412 |
|
|
413 |
)
|
|
414 |
handles: (Any 0.33333333333333 0.66666666666667 1.0)
|
|
415 |
)
|
|
416 |
)
|
|
417 |
|
|
418 |
)
|
|
419 |
extent: (Point 169 205)
|
|
420 |
)
|
|
421 |
)
|
|
422 |
|
|
423 |
)
|
|
424 |
)
|
|
425 |
)
|
|
426 |
|
|
427 |
)
|
340
|
428 |
)
|
|
429 |
! !
|
|
430 |
|
|
431 |
!LabelResizingTest class methodsFor:'menu specs'!
|
|
432 |
|
|
433 |
mainMenu
|
|
434 |
"This resource specification was automatically generated
|
|
435 |
by the MenuEditor of ST/X."
|
|
436 |
|
|
437 |
"Do not manually edit this!! If it is corrupted,
|
|
438 |
the MenuEditor may not be able to read the specification."
|
|
439 |
|
|
440 |
"
|
|
441 |
MenuEditor new openOnClass:Claus andSelector:#mainMenu
|
|
442 |
(Menu new fromLiteralArrayEncoding:(Claus mainMenu)) startUp
|
|
443 |
"
|
|
444 |
|
|
445 |
<resource: #menu>
|
|
446 |
|
1447
|
447 |
^
|
340
|
448 |
#(Menu
|
1447
|
449 |
(
|
|
450 |
(MenuItem
|
|
451 |
label: 'Label(smaller)'
|
|
452 |
itemValue: doChangeLabel:
|
|
453 |
translateLabel: true
|
|
454 |
argument: smaller
|
|
455 |
)
|
|
456 |
(MenuItem
|
|
457 |
label: 'Label(larger)'
|
|
458 |
itemValue: doChangeLabel:
|
|
459 |
translateLabel: true
|
|
460 |
argument: larger
|
|
461 |
)
|
|
462 |
(MenuItem
|
|
463 |
label: 'Label(null)'
|
|
464 |
itemValue: doChangeLabel:
|
|
465 |
translateLabel: true
|
|
466 |
argument: null
|
|
467 |
)
|
|
468 |
(MenuItem
|
|
469 |
label: 'Visibility'
|
|
470 |
itemValue: doToggleVisibility
|
|
471 |
translateLabel: true
|
|
472 |
isButton: true
|
|
473 |
startGroup: right
|
|
474 |
)
|
|
475 |
(MenuItem
|
|
476 |
label: 'Inspect'
|
|
477 |
translateLabel: true
|
|
478 |
startGroup: right
|
|
479 |
submenu:
|
|
480 |
(Menu
|
|
481 |
(
|
|
482 |
(MenuItem
|
|
483 |
label: 'Label(View)'
|
|
484 |
itemValue: doInspectLabelView
|
|
485 |
translateLabel: true
|
|
486 |
)
|
|
487 |
)
|
|
488 |
nil
|
|
489 |
nil
|
|
490 |
)
|
|
491 |
)
|
|
492 |
)
|
|
493 |
nil
|
|
494 |
nil
|
340
|
495 |
)
|
|
496 |
! !
|
|
497 |
|
|
498 |
!LabelResizingTest methodsFor:'action'!
|
|
499 |
|
|
500 |
doChangeLabel:how
|
|
501 |
|label size|
|
|
502 |
|
|
503 |
how == #null ifTrue:[
|
1447
|
504 |
size := 0.
|
340
|
505 |
] ifFalse:[
|
1447
|
506 |
size := self lableHolder value size.
|
340
|
507 |
|
1447
|
508 |
how == #smaller ifTrue:[
|
|
509 |
size := (size - 2) max:2.
|
|
510 |
] ifFalse:[
|
|
511 |
size == 0 ifTrue:[ size := 8 ]
|
|
512 |
ifFalse:[ size := size + 2 ].
|
|
513 |
]
|
340
|
514 |
].
|
|
515 |
label := String new:size.
|
|
516 |
1 to:size do:[:i| |c|
|
1447
|
517 |
c := i \\ 10.
|
|
518 |
c == 0 ifTrue:[ label at:i put:$- ]
|
|
519 |
ifFalse:[ label at:i put:(Character digitValue:c) ].
|
340
|
520 |
].
|
|
521 |
self lableHolder value:label.
|
|
522 |
!
|
|
523 |
|
|
524 |
doInspectLabelView
|
|
525 |
labelView inspect.
|
|
526 |
!
|
|
527 |
|
|
528 |
doToggleVisibility
|
|
529 |
self visibleHolder value:(self visibleHolder value not).
|
|
530 |
! !
|
|
531 |
|
|
532 |
!LabelResizingTest methodsFor:'aspects'!
|
|
533 |
|
|
534 |
lableHolder
|
|
535 |
|holder|
|
|
536 |
|
|
537 |
(holder := builder bindingAt:#lableHolder) isNil ifTrue:[
|
1447
|
538 |
builder aspectAt:#lableHolder put:(holder := '' asValue).
|
340
|
539 |
].
|
|
540 |
^ holder
|
|
541 |
!
|
|
542 |
|
|
543 |
visibleHolder
|
|
544 |
|holder|
|
|
545 |
|
|
546 |
(holder := builder bindingAt:#visibleHolder) isNil ifTrue:[
|
1447
|
547 |
builder aspectAt:#visibleHolder put:(holder := false asValue).
|
340
|
548 |
].
|
|
549 |
^ holder
|
|
550 |
! !
|
|
551 |
|
|
552 |
!LabelResizingTest methodsFor:'initialize & release'!
|
|
553 |
|
|
554 |
postBuildLabel:aLabelView
|
|
555 |
labelView := aLabelView.
|
|
556 |
! !
|
|
557 |
|
|
558 |
!LabelResizingTest class methodsFor:'documentation'!
|
|
559 |
|
|
560 |
version
|
|
561 |
^ '$Header$'
|
|
562 |
! !
|