The Trunk: MorphicTests-mt.68.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: MorphicTests-mt.68.mcz

commits-2
Marcel Taeumel uploaded a new version of MorphicTests to project The Trunk:
http://source.squeak.org/trunk/MorphicTests-mt.68.mcz

==================== Summary ====================

Name: MorphicTests-mt.68
Author: mt
Time: 25 January 2021, 4:17:01.036158 pm
UUID: e250ac43-cfde-8d47-9c60-87045f7c0061
Ancestors: MorphicTests-mt.67

Adds tests for check-box group layout and a #shrinkWrap issue.

=============== Diff against MorphicTests-mt.67 ===============

Item was added:
+ ----- Method: TableLayoutTest>>testCheckBoxGroup (in category 'tests - example layouts') -----
+ testCheckBoxGroup
+
+ | group groupContents labels |
+ labels := Dictionary new.
+ group := self newContainer
+ hResizing: #shrinkWrap;
+ vResizing: #shrinkWrap;
+ layoutPolicy: TableLayout new;
+ listDirection: #topToBottom;
+ layoutInset: 0;
+ cellPositioning: #topLeft;
+ borderStyle: (SimpleBorder color: Color black width: 2);
+ yourself.
+ group addMorphBack: (labels at: #groupLabel put: 'Favorite Ice Cream' asMorph).
+
+ groupContents := self newContainer
+ hResizing: #shrinkWrap;
+ vResizing: #shrinkWrap;
+ layoutPolicy: TableLayout new;
+ listDirection: #topToBottom;
+ cellGap: 0;
+ cellPositioning: #topLeft;
+ yourself.
+ group addMorphBack: groupContents.
+
+ #('Vanilla' 'Chocolate') withIndexDo: [:label :index |
+ | checkBox |
+ checkBox := self newContainer
+ hResizing: #shrinkWrap;
+ vResizing: #shrinkWrap;
+ layoutPolicy: TableLayout new;
+ listDirection: #rightToLeft;
+ yourself.
+ checkBox
+ addMorphBack: (labels at: (#box, index asString) asSymbol put: label asMorph);
+ addMorphBack: (self newMorph extent: 16@16; borderColor: Color black; borderWidth: 2).
+ groupContents addMorphBack: checkBox].
+
+ self ensureLayout: group.
+ self
+ assert: (labels at: #groupLabel) width + (group borderWidth * 2)
+ equals: group width.
+ self
+ assert: (labels at: #groupLabel) height
+ + (labels at: #box1) height
+ + (labels at: #box2) height
+ + (group borderWidth * 2)
+ equals: group height.!

Item was added:
+ ----- Method: TableLayoutTest>>testShrinkWrapIssue (in category 'tests') -----
+ testShrinkWrapIssue
+ "A container that has no layout policy does MUST trigger layout computation for its submorphs in time."
+
+ | container inner item1 item2 |
+ container := Morph new
+ hResizing: #shrinkWrap;
+ vResizing: #shrinkWrap;
+ yourself.
+ inner := self newContainer
+ listDirection: #topToBottom;
+ yourself.
+ container addMorphBack: inner.
+
+ inner
+ addMorphBack: (item1 := self newMorph extent: 50@50; yourself);
+ addMorphBack: (item2 := self newMorph extent: 50@50; yourself).
+
+ self ensureLayout: container.
+ self assert: 50@100 equals: container extent.
+
+ item1 width: 100.
+ item2 width: 200.
+ self ensureLayout: container.
+ self assert: 200@100 equals: container extent.!