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