diff --git a/src/BaselineOfBlocSerialization/BaselineOfBlocSerialization.class.st b/src/BaselineOfBlocSerialization/BaselineOfBlocSerialization.class.st index 33eaffe..c88af66 100644 --- a/src/BaselineOfBlocSerialization/BaselineOfBlocSerialization.class.st +++ b/src/BaselineOfBlocSerialization/BaselineOfBlocSerialization.class.st @@ -9,24 +9,31 @@ BaselineOfBlocSerialization >> baseline: spec [ spec for: #common do: [ "dependencies" - spec - baseline: 'Ston' - with: [ spec repository: 'github://svenvc/ston/repository' ]. - - spec - baseline: 'StashSerialization' - with: [ spec repository: 'github://Nyan11/Stash/src' ]. - - spec - baseline: 'Bloc' - with: [ spec repository: 'github://pharo-graphics/Bloc:master/src' ]. - + self dependency: spec. + "project packages" spec package: 'Bloc-Serialization-STON'. + spec package: 'Bloc-Serialization-Stash'. spec package: 'Bloc-Serialization' with: [ - spec requires: #( 'Bloc' 'Bloc-Serialization-STON' + spec requires: #( 'Bloc' 'Bloc-Serialization-STON' 'Bloc-Serialization-Stash' 'Ston' 'StashSerialization' ) ]. spec package: 'Bloc-Serialization-Tests' with: [ spec requires: #( 'Bloc-Serialization' ) ] ] ] + +{ #category : #accessing } +BaselineOfBlocSerialization >> dependency: spec [ + + spec + baseline: 'Ston' + with: [ spec repository: 'github://svenvc/ston/repository' ]. + + spec + baseline: 'StashSerialization' + with: [ spec repository: 'github://Nyan11/Stash/src' ]. + + spec + baseline: 'Bloc' + with: [ spec repository: 'github://pharo-graphics/Bloc:master/src' ]. +] diff --git a/src/Bloc-Serialization-Stash/BlAffineCompositeTransformation.extension.st b/src/Bloc-Serialization-Stash/BlAffineCompositeTransformation.extension.st new file mode 100644 index 0000000..8f80e5d --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlAffineCompositeTransformation.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlAffineCompositeTransformation } + +{ #category : #'*Bloc-Serialization-Stash' } +BlAffineCompositeTransformation >> allSetterAndGettersForMyStash [ + + ^ self transformations flatCollect: [ :each | each allSetterAndGettersForMyStash ] +] diff --git a/src/Bloc-Serialization-Stash/BlAffineTransformationCenterOrigin.extension.st b/src/Bloc-Serialization-Stash/BlAffineTransformationCenterOrigin.extension.st new file mode 100644 index 0000000..6116aa0 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlAffineTransformationCenterOrigin.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlAffineTransformationCenterOrigin } + +{ #category : #'*Bloc-Serialization-Stash' } +BlAffineTransformationCenterOrigin >> asStashMethodForTransformationBloc [ + + ^ #centerOrigin +] diff --git a/src/Bloc-Serialization-Stash/BlAffineTransformationLeftCenterOrigin.extension.st b/src/Bloc-Serialization-Stash/BlAffineTransformationLeftCenterOrigin.extension.st new file mode 100644 index 0000000..a50b103 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlAffineTransformationLeftCenterOrigin.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlAffineTransformationLeftCenterOrigin } + +{ #category : #'*Bloc-Serialization-Stash' } +BlAffineTransformationLeftCenterOrigin >> asStashMethodForTransformationBloc [ + + ^ 'origin: <1s> new' expandMacrosWith: self class printString. +] diff --git a/src/Bloc-Serialization-Stash/BlAffineTransformationNormalizedPositionOrigin.extension.st b/src/Bloc-Serialization-Stash/BlAffineTransformationNormalizedPositionOrigin.extension.st new file mode 100644 index 0000000..d06c691 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlAffineTransformationNormalizedPositionOrigin.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlAffineTransformationNormalizedPositionOrigin } + +{ #category : #'*Bloc-Serialization-Stash' } +BlAffineTransformationNormalizedPositionOrigin >> asStashMethodForTransformationBloc [ + + ^ 'normalizedOrigin: <1p> @ <2p>' expandMacrosWith: self position x with: self position y +] diff --git a/src/Bloc-Serialization-Stash/BlAffineTransformationPositionOrigin.extension.st b/src/Bloc-Serialization-Stash/BlAffineTransformationPositionOrigin.extension.st new file mode 100644 index 0000000..3b1d4c0 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlAffineTransformationPositionOrigin.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlAffineTransformationPositionOrigin } + +{ #category : #'*Bloc-Serialization-Stash' } +BlAffineTransformationPositionOrigin >> asStashMethodForTransformationBloc [ + + ^ 'origin: (<1s> new position: <2s> @ <3s>; yourself)' expandMacrosWith: self class printString with: self position x with: self position y +] diff --git a/src/Bloc-Serialization-Stash/BlAffineTransformationRightCenterOrigin.extension.st b/src/Bloc-Serialization-Stash/BlAffineTransformationRightCenterOrigin.extension.st new file mode 100644 index 0000000..632775d --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlAffineTransformationRightCenterOrigin.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlAffineTransformationRightCenterOrigin } + +{ #category : #'*Bloc-Serialization-Stash' } +BlAffineTransformationRightCenterOrigin >> asStashMethodForTransformationBloc [ + + ^ #rightCenterOrigin +] diff --git a/src/Bloc-Serialization-Stash/BlAffineTransformationTopLeftOrigin.extension.st b/src/Bloc-Serialization-Stash/BlAffineTransformationTopLeftOrigin.extension.st new file mode 100644 index 0000000..8a2b17a --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlAffineTransformationTopLeftOrigin.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #BlAffineTransformationTopLeftOrigin } + +{ #category : #'*Bloc-Serialization-Stash' } +BlAffineTransformationTopLeftOrigin >> asStashMethodForTransformationBloc [ + ^ #topLeftOrigin +] diff --git a/src/Bloc-Serialization-Stash/BlAnnulusSectorGeometry.extension.st b/src/Bloc-Serialization-Stash/BlAnnulusSectorGeometry.extension.st new file mode 100644 index 0000000..9cd6bbf --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlAnnulusSectorGeometry.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlAnnulusSectorGeometry } + +{ #category : #'*Bloc-Serialization-Stash' } +BlAnnulusSectorGeometry >> stashAccessors [ + + + ^ {#startAngle .#endAngle .#innerRadius .#outerRadius} +] diff --git a/src/Bloc-Serialization-Stash/BlAttributeRope.extension.st b/src/Bloc-Serialization-Stash/BlAttributeRope.extension.st new file mode 100644 index 0000000..d4c7523 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlAttributeRope.extension.st @@ -0,0 +1,26 @@ +Extension { #name : #BlAttributeRope } + +{ #category : #'*Bloc-Serialization-Stash' } +BlAttributeRope >> asStashContructor [ + + ^ self class printString +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlAttributeRope >> asStashObject [ + + ^ StashBlAttributeRope new + object: self; + rope: self rope; + attributes: self attributes; + yourself +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlAttributeRope >> stashAccessors [ + + + ^ { + #attributes. + #rope } +] diff --git a/src/Bloc-Serialization-Stash/BlBackground.extension.st b/src/Bloc-Serialization-Stash/BlBackground.extension.st new file mode 100644 index 0000000..acab6e2 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlBackground.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlBackground } + +{ #category : #'*Bloc-Serialization-Stash' } +BlBackground >> stashBackgroundOpacity [ + + + ^ { (#opacity) } +] diff --git a/src/Bloc-Serialization-Stash/BlBasicLayout.extension.st b/src/Bloc-Serialization-Stash/BlBasicLayout.extension.st new file mode 100644 index 0000000..911a174 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlBasicLayout.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #BlBasicLayout } + +{ #category : #'*Bloc-Serialization-Stash' } +BlBasicLayout >> asStashContructor [ + + ^ 'BlBasicLayout uniqueInstance' +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlBasicLayout >> shouldBeTagged [ + + ^ false +] diff --git a/src/Bloc-Serialization-Stash/BlBezierCurveGeometry.extension.st b/src/Bloc-Serialization-Stash/BlBezierCurveGeometry.extension.st new file mode 100644 index 0000000..40f12d7 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlBezierCurveGeometry.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlBezierCurveGeometry } + +{ #category : #'*Bloc-Serialization-Stash' } +BlBezierCurveGeometry >> stashAccessors [ + + + ^ { #controlPoints } +] diff --git a/src/Bloc-Serialization-Stash/BlBorder.extension.st b/src/Bloc-Serialization-Stash/BlBorder.extension.st new file mode 100644 index 0000000..dbc7d70 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlBorder.extension.st @@ -0,0 +1,43 @@ +Extension { #name : #BlBorder } + +{ #category : #'*Bloc-Serialization-Stash' } +BlBorder >> asStashObject [ + + ^ StashObjectWithBuilder new + builder: BlBorderBuilder new; + methodToBuild: #build; + object: self; + yourself +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlBorder >> stashAccessors [ + + + | defaults settersAndGetters | + settersAndGetters := OrderedCollection new. + defaults := BlBorderBuilder new. + self paint = defaults defaultPaint ifFalse: [ + settersAndGetters add: #paint ]. + self width = defaults defaultWidth ifFalse: [ + settersAndGetters add: #width ]. + self style lineCap = defaults defaultLineCap ifFalse: [ + settersAndGetters add: + #lineCap: -> [ :border | border style lineCap ] ]. + self style lineJoin = defaults defaultLineJoin ifFalse: [ + settersAndGetters add: #lineJoin: -> + [ :border | border style lineJoin ] ]. + self style miterLimit = defaults defaultMiterLimit ifFalse: [ + settersAndGetters add: + #miterLimit: -> [ :border | border style miterLimit ] ]. + self style dashArray = defaults defaultDashArray ifFalse: [ + settersAndGetters add: + #dashArray: -> [ :border | border style dashArray ] ]. + self style dashOffset = defaults defaultDashOffset ifFalse: [ + settersAndGetters add: + #dashOffset: -> [ :border | border style dashOffset ] ]. + self opacity = defaults defaultOpacity ifFalse: [ + settersAndGetters add: #opacity ]. + + ^ settersAndGetters +] diff --git a/src/Bloc-Serialization-Stash/BlBottomAlignment.extension.st b/src/Bloc-Serialization-Stash/BlBottomAlignment.extension.st new file mode 100644 index 0000000..85d2f04 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlBottomAlignment.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlBottomAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlBottomAlignment >> asStashSelector [ + + ^ #alignBottom +] diff --git a/src/Bloc-Serialization-Stash/BlCollectionRope.extension.st b/src/Bloc-Serialization-Stash/BlCollectionRope.extension.st new file mode 100644 index 0000000..317a2b2 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlCollectionRope.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlCollectionRope } + +{ #category : #'*Bloc-Serialization-Stash' } +BlCollectionRope >> stashAccessors [ + + + ^ { #collection } +] diff --git a/src/Bloc-Serialization-Stash/BlColorPaint.extension.st b/src/Bloc-Serialization-Stash/BlColorPaint.extension.st new file mode 100644 index 0000000..fe6fb69 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlColorPaint.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlColorPaint } + +{ #category : #'*Bloc-Serialization-Stash' } +BlColorPaint >> stashAccessors [ + + + ^ { #color } +] diff --git a/src/Bloc-Serialization-Stash/BlCornerRadii.extension.st b/src/Bloc-Serialization-Stash/BlCornerRadii.extension.st new file mode 100644 index 0000000..3ec782e --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlCornerRadii.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlCornerRadii } + +{ #category : #'*Bloc-Serialization-Stash' } +BlCornerRadii >> stashAccessors [ + + + ^ { #topLeft .#topRight .#bottomLeft .#bottomRight } +] diff --git a/src/Bloc-Serialization-Stash/BlElement.extension.st b/src/Bloc-Serialization-Stash/BlElement.extension.st new file mode 100644 index 0000000..8a1b454 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlElement.extension.st @@ -0,0 +1,90 @@ +Extension { #name : #BlElement } + +{ #category : #'*Bloc-Serialization-Stash' } +BlElement >> allSetterAndGettersForMyStashChildren [ + + + self shouldSerializedChildren ifFalse: [ ^ { } ]. + self children ifNotEmpty: [ + ^ { #addChildren: -> #children } ]. + ^ { } +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlElement >> allSetterAndGettersForMyStashConstraints [ + + + (constraints allSetterAndGettersForMyStash) ifNotEmpty: [ + ^ { #constraintsDo: -> #constraints } ]. + ^ { } +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlElement >> allSetterAndGettersForMyStashIdentifier [ + + + | elementId | + self userData at: #elementId ifAbsent: [ ^ { } ]. + elementId := self userData at: #elementId. + elementId class = BlElementNoId ifTrue: [ ^ { } ]. + elementId class = BlElementNamedId ifTrue: [ ^ { #id } ]. + ^ { #elementId } + +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlElement >> allSetterAndGettersForMyStashLayout [ + + + self layout == self defaultLayout ifFalse: [ + ^ { #layout } ]. + ^ { } + +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlElement >> allSetterAndGettersForMyStashTransformation [ + + + self transformation isIdentity ifFalse: [ + ^ { #transformDo: -> #transformation } ]. + ^ { } +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlElement >> allSetterAndGettersForMyStashVisuals [ + + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + self background == BlElementVisuals defaultBackground ifFalse: [ + settersAndGetters add: #background ]. + self border == BlElementVisuals defaultBorder ifFalse: [ + settersAndGetters add: #border ]. + self geometry == BlElementVisuals defaultGeometry ifFalse: [ + settersAndGetters add: #geometry ]. + self effect == (BlElementVisuals classPool at: #DefaultEffect) + ifFalse: [ settersAndGetters add: #effect ]. + self opacity == (BlElementVisuals classPool at: #DefaultOpacity) + ifFalse: [ settersAndGetters add: #opacity ]. + self visibility + == (BlElementVisuals classPool at: #DefaultVisibility) ifFalse: [ + settersAndGetters add: #visibility ]. + self outskirts == (BlElementVisuals classPool at: #DefaultOutskirts) + ifFalse: [ settersAndGetters add: #outskirts ]. + self clipChildren + == (BlElementVisuals classPool at: #DefaultClipChildren) ifFalse: [ + settersAndGetters add: #clipChildren ]. + self focusability + == (BlElementVisuals classPool at: #DefaultFocusability) ifFalse: [ + settersAndGetters add: #focusability ]. + self elevation == (BlElementVisuals classPool at: #DefaultElevation) + ifFalse: [ settersAndGetters add: #elevation ]. + self focused == (BlElementVisuals classPool at: #DefaultFocused) + ifFalse: [ settersAndGetters add: #focused ]. + self mouseCursor + == (BlElementVisuals classPool at: #DefaultMouseCursor) ifFalse: [ + settersAndGetters add: #mouseCursor ]. + ^ settersAndGetters + +] diff --git a/src/Bloc-Serialization-Stash/BlElementCachedTransformation.extension.st b/src/Bloc-Serialization-Stash/BlElementCachedTransformation.extension.st new file mode 100644 index 0000000..bdb1507 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlElementCachedTransformation.extension.st @@ -0,0 +1,16 @@ +Extension { #name : #BlElementCachedTransformation } + +{ #category : #'*Bloc-Serialization-Stash' } +BlElementCachedTransformation >> asStashObject [ + + ^ StashBlTransformation new + object: self; + yourself +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlElementCachedTransformation >> stashAccessors [ + + + ^ self asElementTransformation allSetterAndGettersForMyStash +] diff --git a/src/Bloc-Serialization-Stash/BlElementGeometry.extension.st b/src/Bloc-Serialization-Stash/BlElementGeometry.extension.st new file mode 100644 index 0000000..e105b70 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlElementGeometry.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlElementGeometry } + +{ #category : #'*Bloc-Serialization-Stash' } +BlElementGeometry >> shouldBeTagged [ + + ^ false +] diff --git a/src/Bloc-Serialization-Stash/BlElementIndexedId.extension.st b/src/Bloc-Serialization-Stash/BlElementIndexedId.extension.st new file mode 100644 index 0000000..1f8a098 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlElementIndexedId.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlElementIndexedId } + +{ #category : #'*Bloc-Serialization-Stash' } +BlElementIndexedId >> stashAccessors [ + + + ^ { #index . #prefixId } +] diff --git a/src/Bloc-Serialization-Stash/BlElementLocalTransformation.extension.st b/src/Bloc-Serialization-Stash/BlElementLocalTransformation.extension.st new file mode 100644 index 0000000..805dab9 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlElementLocalTransformation.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlElementLocalTransformation } + +{ #category : #'*Bloc-Serialization-Stash' } +BlElementLocalTransformation >> stashAccessors [ + + + ^ self affineTransformation allSetterAndGettersForMyStash +] diff --git a/src/Bloc-Serialization-Stash/BlElementNamedId.extension.st b/src/Bloc-Serialization-Stash/BlElementNamedId.extension.st new file mode 100644 index 0000000..08c58b1 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlElementNamedId.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlElementNamedId } + +{ #category : #'*Bloc-Serialization-Stash' } +BlElementNamedId >> stashAccessors [ + + + ^ { #identifier } +] diff --git a/src/Bloc-Serialization-Stash/BlElevation.extension.st b/src/Bloc-Serialization-Stash/BlElevation.extension.st new file mode 100644 index 0000000..cbb3451 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlElevation.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlElevation } + +{ #category : #'*Bloc-Serialization-Stash' } +BlElevation >> asStashContructor [ + + ^ self class printString , ' elevation: ' , self elevation printString +] diff --git a/src/Bloc-Serialization-Stash/BlFlowLayout.extension.st b/src/Bloc-Serialization-Stash/BlFlowLayout.extension.st new file mode 100644 index 0000000..61e9982 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFlowLayout.extension.st @@ -0,0 +1,23 @@ +Extension { #name : #BlFlowLayout } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFlowLayout >> allSetterAndGettersForMyStash [ + + "We ovverride this method to take into account the default value of alignment" + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + (verticalAlignment == self defaultVerticalAlignment and: [ + horizontalAlignment == self defaultHorizontalAlignment ]) ifFalse: [ + settersAndGetters addAll: self allSetterAndGettersForMyStashForMyTraits ]. + self direction == self defaultDirection ifFalse: [ + settersAndGetters add: #direction ]. + ^ settersAndGetters +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlFlowLayout >> asStashContructor [ + + self orientation isVertical ifTrue: [ ^ 'BlFlowLayout vertical' ]. + ^ 'BlFlowLayout horizontal' +] diff --git a/src/Bloc-Serialization-Stash/BlFlowLayoutConstraints.extension.st b/src/Bloc-Serialization-Stash/BlFlowLayoutConstraints.extension.st new file mode 100644 index 0000000..cd8fc8d --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFlowLayoutConstraints.extension.st @@ -0,0 +1,19 @@ +Extension { #name : #BlFlowLayoutConstraints } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFlowLayoutConstraints >> stashAccessorsNewLine [ + + + newLine ifTrue: [ ^ { #newLine: -> #isNewLine } ]. + ^ { } + +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlFlowLayoutConstraints >> stashAccessorsWeight [ + + + weight == 0 ifFalse: [ ^ { #weight } ]. + ^ { } + +] diff --git a/src/Bloc-Serialization-Stash/BlFlowLayoutConstraintsHorizontal.extension.st b/src/Bloc-Serialization-Stash/BlFlowLayoutConstraintsHorizontal.extension.st new file mode 100644 index 0000000..8e60caa --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFlowLayoutConstraintsHorizontal.extension.st @@ -0,0 +1,14 @@ +Extension { #name : #BlFlowLayoutConstraintsHorizontal } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFlowLayoutConstraintsHorizontal >> stashAccessors [ + + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + self alignment = BlElementAlignment start horizontal ifFalse: [ + settersAndGetters add: [ :n | + self alignment asStashSelector ] onlySetOnStash ]. + + ^ settersAndGetters +] diff --git a/src/Bloc-Serialization-Stash/BlFlowLayoutConstraintsVertical.extension.st b/src/Bloc-Serialization-Stash/BlFlowLayoutConstraintsVertical.extension.st new file mode 100644 index 0000000..0e84d99 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFlowLayoutConstraintsVertical.extension.st @@ -0,0 +1,14 @@ +Extension { #name : #BlFlowLayoutConstraintsVertical } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFlowLayoutConstraintsVertical >> stashAccessors [ + + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + self alignment = BlElementAlignment start vertical ifFalse: [ + settersAndGetters add: + [ :n | self alignment asStashSelector ] onlySetOnStash ]. + + ^ settersAndGetters +] diff --git a/src/Bloc-Serialization-Stash/BlFocusability.extension.st b/src/Bloc-Serialization-Stash/BlFocusability.extension.st new file mode 100644 index 0000000..87c561a --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFocusability.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlFocusability } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFocusability >> shouldBeTagged [ + + ^ false +] diff --git a/src/Bloc-Serialization-Stash/BlFocusabilityAfter.extension.st b/src/Bloc-Serialization-Stash/BlFocusabilityAfter.extension.st new file mode 100644 index 0000000..eb4c7fb --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFocusabilityAfter.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlFocusabilityAfter } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFocusabilityAfter >> asStashContructor [ + + ^ 'BlFocusability after' +] diff --git a/src/Bloc-Serialization-Stash/BlFocusabilityBefore.extension.st b/src/Bloc-Serialization-Stash/BlFocusabilityBefore.extension.st new file mode 100644 index 0000000..b91bb8b --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFocusabilityBefore.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlFocusabilityBefore } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFocusabilityBefore >> asStashContructor [ + + ^ 'BlFocusability before' +] diff --git a/src/Bloc-Serialization-Stash/BlFocusabilityBlock.extension.st b/src/Bloc-Serialization-Stash/BlFocusabilityBlock.extension.st new file mode 100644 index 0000000..78602d0 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFocusabilityBlock.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlFocusabilityBlock } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFocusabilityBlock >> asStashContructor [ + + ^ 'BlFocusability block' +] diff --git a/src/Bloc-Serialization-Stash/BlFocusabilityIgnore.extension.st b/src/Bloc-Serialization-Stash/BlFocusabilityIgnore.extension.st new file mode 100644 index 0000000..2f68473 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFocusabilityIgnore.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlFocusabilityIgnore } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFocusabilityIgnore >> asStashContructor [ + + ^ 'BlFocusability ignore' +] diff --git a/src/Bloc-Serialization-Stash/BlFocusabilityNone.extension.st b/src/Bloc-Serialization-Stash/BlFocusabilityNone.extension.st new file mode 100644 index 0000000..dd2bd22 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFocusabilityNone.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlFocusabilityNone } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFocusabilityNone >> asStashContructor [ + + ^ 'BlFocusability none' +] diff --git a/src/Bloc-Serialization-Stash/BlFontFamilyAttribute.extension.st b/src/Bloc-Serialization-Stash/BlFontFamilyAttribute.extension.st new file mode 100644 index 0000000..ca2236c --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFontFamilyAttribute.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlFontFamilyAttribute } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFontFamilyAttribute >> stashAccessors [ + + + ^ { #name } +] diff --git a/src/Bloc-Serialization-Stash/BlFontFamilyDefaultAttribute.extension.st b/src/Bloc-Serialization-Stash/BlFontFamilyDefaultAttribute.extension.st new file mode 100644 index 0000000..a57d155 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFontFamilyDefaultAttribute.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlFontFamilyDefaultAttribute } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFontFamilyDefaultAttribute >> stashAccessors [ + + + ^ { #name } +] diff --git a/src/Bloc-Serialization-Stash/BlFontSizeAttribute.extension.st b/src/Bloc-Serialization-Stash/BlFontSizeAttribute.extension.st new file mode 100644 index 0000000..1f90cba --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFontSizeAttribute.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlFontSizeAttribute } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFontSizeAttribute >> stashAccessors [ + + + ^ { #size } +] diff --git a/src/Bloc-Serialization-Stash/BlFontSizeDefaultAttribute.extension.st b/src/Bloc-Serialization-Stash/BlFontSizeDefaultAttribute.extension.st new file mode 100644 index 0000000..65fe838 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFontSizeDefaultAttribute.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlFontSizeDefaultAttribute } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFontSizeDefaultAttribute >> stashAccessors [ + + + ^ { #size } +] diff --git a/src/Bloc-Serialization-Stash/BlFontWeightAttribute.extension.st b/src/Bloc-Serialization-Stash/BlFontWeightAttribute.extension.st new file mode 100644 index 0000000..fb53400 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFontWeightAttribute.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlFontWeightAttribute } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFontWeightAttribute >> stashAccessors [ + + + ^ { #weight } +] diff --git a/src/Bloc-Serialization-Stash/BlFrameLayoutConstraintsHorizontal.extension.st b/src/Bloc-Serialization-Stash/BlFrameLayoutConstraintsHorizontal.extension.st new file mode 100644 index 0000000..35fdc90 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFrameLayoutConstraintsHorizontal.extension.st @@ -0,0 +1,17 @@ +Extension { #name : #BlFrameLayoutConstraintsHorizontal } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFrameLayoutConstraintsHorizontal >> stashAccessors [ + + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + + self alignment = BlElementAlignment start horizontal ifFalse: [ + settersAndGetters add: + [ :e | self alignment asStashSelector ] onlySetOnStash ]. + + self weight == 1.0 ifFalse: [ settersAndGetters add: [ :e | 'weight: ' , self weight printString ] onlySetOnStash ]. + + ^ settersAndGetters +] diff --git a/src/Bloc-Serialization-Stash/BlFrameLayoutConstraintsVertical.extension.st b/src/Bloc-Serialization-Stash/BlFrameLayoutConstraintsVertical.extension.st new file mode 100644 index 0000000..5d8a853 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlFrameLayoutConstraintsVertical.extension.st @@ -0,0 +1,19 @@ +Extension { #name : #BlFrameLayoutConstraintsVertical } + +{ #category : #'*Bloc-Serialization-Stash' } +BlFrameLayoutConstraintsVertical >> stashAccessors [ + + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + + self alignment = BlElementAlignment start vertical ifFalse: [ + settersAndGetters add: + [ :e | self alignment asStashSelector ] onlySetOnStash ]. + + self weight == 1.0 ifFalse: [ + settersAndGetters add: + [ :e | 'weight: ' , self weight printString ] onlySetOnStash ]. + + ^ settersAndGetters +] diff --git a/src/Bloc-Serialization-Stash/BlGaussianShadowEffect.extension.st b/src/Bloc-Serialization-Stash/BlGaussianShadowEffect.extension.st new file mode 100644 index 0000000..26bb3fe --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlGaussianShadowEffect.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #BlGaussianShadowEffect } + +{ #category : #'*Bloc-Serialization-Stash' } +BlGaussianShadowEffect >> asStashContructor [ + + self flag: #ToFix. "Not correct". + ^ 'BlGaussianShadowEffect color: (' , self color asStashContructor + , ') width: (' , self width printString , ') offset: ((' + , self offset x printString , ')@(' , self offset y printString + , '))' +] diff --git a/src/Bloc-Serialization-Stash/BlGradientPaint.extension.st b/src/Bloc-Serialization-Stash/BlGradientPaint.extension.st new file mode 100644 index 0000000..ad5ee34 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlGradientPaint.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlGradientPaint } + +{ #category : #'*Bloc-Serialization-Stash' } +BlGradientPaint >> stashBlGradientPaintAccessors [ + + + ^ { #stops }. +] diff --git a/src/Bloc-Serialization-Stash/BlHorizontalCenterAlignment.extension.st b/src/Bloc-Serialization-Stash/BlHorizontalCenterAlignment.extension.st new file mode 100644 index 0000000..1e6fb27 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlHorizontalCenterAlignment.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlHorizontalCenterAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlHorizontalCenterAlignment >> asStashSelector [ + + ^ #alignCenter +] diff --git a/src/Bloc-Serialization-Stash/BlHorizontalCoordinateLeftAlignment.extension.st b/src/Bloc-Serialization-Stash/BlHorizontalCoordinateLeftAlignment.extension.st new file mode 100644 index 0000000..4b8d54b --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlHorizontalCoordinateLeftAlignment.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlHorizontalCoordinateLeftAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlHorizontalCoordinateLeftAlignment >> asStashSelector [ + + ^ 'alignLeftAt: ' , self coordinate printString +] diff --git a/src/Bloc-Serialization-Stash/BlHorizontalCoordinateRightAlignment.extension.st b/src/Bloc-Serialization-Stash/BlHorizontalCoordinateRightAlignment.extension.st new file mode 100644 index 0000000..51571ba --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlHorizontalCoordinateRightAlignment.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlHorizontalCoordinateRightAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlHorizontalCoordinateRightAlignment >> asStashSelector [ + + ^ 'alignRightAt: ' + , self coordinate printString +] diff --git a/src/Bloc-Serialization-Stash/BlHorizontalCoordinateStartAlignment.extension.st b/src/Bloc-Serialization-Stash/BlHorizontalCoordinateStartAlignment.extension.st new file mode 100644 index 0000000..eb374d7 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlHorizontalCoordinateStartAlignment.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlHorizontalCoordinateStartAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlHorizontalCoordinateStartAlignment >> asStashSelector [ + + ^ 'alignCenterAt: ' + , self coordinate printString +] diff --git a/src/Bloc-Serialization-Stash/BlHorizontalEndAlignment.extension.st b/src/Bloc-Serialization-Stash/BlHorizontalEndAlignment.extension.st new file mode 100644 index 0000000..db6fc5a --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlHorizontalEndAlignment.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlHorizontalEndAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlHorizontalEndAlignment >> asStashSelector [ + + ^ #alignRight +] diff --git a/src/Bloc-Serialization-Stash/BlHorizontalStartAlignment.extension.st b/src/Bloc-Serialization-Stash/BlHorizontalStartAlignment.extension.st new file mode 100644 index 0000000..b38a82e --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlHorizontalStartAlignment.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlHorizontalStartAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlHorizontalStartAlignment >> asStashSelector [ + + ^ #alignLeft +] diff --git a/src/Bloc-Serialization-Stash/BlImageBackground.extension.st b/src/Bloc-Serialization-Stash/BlImageBackground.extension.st new file mode 100644 index 0000000..fd0e66f --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlImageBackground.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlImageBackground } + +{ #category : #'*Bloc-Serialization-Stash' } +BlImageBackground >> stashBackgroundImage [ + + + ^ { (#image) } +] diff --git a/src/Bloc-Serialization-Stash/BlInsets.extension.st b/src/Bloc-Serialization-Stash/BlInsets.extension.st new file mode 100644 index 0000000..4d592b4 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlInsets.extension.st @@ -0,0 +1,15 @@ +Extension { #name : #BlInsets } + +{ #category : #'*Bloc-Serialization-Stash' } +BlInsets >> asStashContructor [ + + self isUniform ifTrue: [ + self left = 0 + ifTrue: [ ^ 'BlInsets empty' ] + ifFalse: [ ^ 'BlInsets all: ' , self left printString ] ]. + ^ 'BlInsets top: <1p> right: <2p> bottom: <3p> left: <4p>' + expandMacrosWith: self top + with: self right + with: self bottom + with: self left +] diff --git a/src/Bloc-Serialization-Stash/BlLayout.extension.st b/src/Bloc-Serialization-Stash/BlLayout.extension.st new file mode 100644 index 0000000..94cbccd --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlLayout.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlLayout } + +{ #category : #'*Bloc-Serialization-Stash' } +BlLayout >> shouldBeTagged [ + + ^ false +] diff --git a/src/Bloc-Serialization-Stash/BlLayoutCommonConstraints.extension.st b/src/Bloc-Serialization-Stash/BlLayoutCommonConstraints.extension.st new file mode 100644 index 0000000..c502ae4 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlLayoutCommonConstraints.extension.st @@ -0,0 +1,42 @@ +Extension { #name : #BlLayoutCommonConstraints } + +{ #category : #'*Bloc-Serialization-Stash' } +BlLayoutCommonConstraints >> stashAccessorsForCommonConstraints [ + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + + self flow allSetterAndGettersForMyStash ifNotEmpty: [ + settersAndGetters add: #flow onlyGetOnStash ]. + self frame allSetterAndGettersForMyStash ifNotEmpty: [ + settersAndGetters add: #frame onlyGetOnStash ]. + self grid allSetterAndGettersForMyStash ifNotEmpty: [ + settersAndGetters add: #grid onlyGetOnStash ]. + self linear allSetterAndGettersForMyStash ifNotEmpty: [ + settersAndGetters add: #linear onlyGetOnStash ]. + self proportional allSetterAndGettersForMyStash ifNotEmpty: [ + settersAndGetters add: #proportional onlyGetOnStash ]. + self relative allSetterAndGettersForMyStash ifNotEmpty: [ + settersAndGetters add: #relative onlyGetOnStash ]. + self zoomable allSetterAndGettersForMyStash ifNotEmpty: [ + settersAndGetters add: #zoomable onlyGetOnStash ]. + + self position = (0 @ 0) ifFalse: [ settersAndGetters add: #position ]. + self padding = BlInsets empty ifFalse: [ + settersAndGetters add: #padding ]. + self margin = BlInsets empty ifFalse: [ + settersAndGetters add: #margin ]. + + self maxHeight = Float infinity ifFalse: [ + settersAndGetters add: #maxHeight ]. + self maxWidth = Float infinity ifFalse: [ + settersAndGetters add: #maxWidth ]. + self minHeight = 0 ifFalse: [ settersAndGetters add: #minHeight ]. + self minWidth = 0 ifFalse: [ settersAndGetters add: #minWidth ]. + + accountTransformation ifTrue: [ + settersAndGetters add: + ([ :c | #accountTransformation ] -> self) onlySetOnStash ]. + + ^ settersAndGetters +] diff --git a/src/Bloc-Serialization-Stash/BlLayoutCommonConstraintsAxis.extension.st b/src/Bloc-Serialization-Stash/BlLayoutCommonConstraintsAxis.extension.st new file mode 100644 index 0000000..c541fc7 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlLayoutCommonConstraintsAxis.extension.st @@ -0,0 +1,19 @@ +Extension { #name : #BlLayoutCommonConstraintsAxis } + +{ #category : #'*Bloc-Serialization-Stash' } +BlLayoutCommonConstraintsAxis >> stashAccessors [ + + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + self resizer isMatchParent ifTrue: [ + settersAndGetters add: #matchParent onlySetOnStash ]. + self resizer isFitContent ifTrue: [ + self resizer isFitContentLimited + ifTrue: [ settersAndGetters add: #fitContentLimited onlySetOnStash ] + ifFalse: [ + settersAndGetters add: #fitContent onlySetOnStash ] ]. + (self resizer isExact and: [ self resizer size ~= 50.0 ]) ifTrue: [ + settersAndGetters add: #exact: -> [ :c | self resizer size ] ]. + ^ settersAndGetters +] diff --git a/src/Bloc-Serialization-Stash/BlLayoutConstraints.extension.st b/src/Bloc-Serialization-Stash/BlLayoutConstraints.extension.st new file mode 100644 index 0000000..4b56c64 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlLayoutConstraints.extension.st @@ -0,0 +1,20 @@ +Extension { #name : #BlLayoutConstraints } + +{ #category : #'*Bloc-Serialization-Stash' } +BlLayoutConstraints >> asStashObject [ + + ^ StashBlLayoutConstraints new + object: self; + yourself +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlLayoutConstraints >> stashAccessors [ + + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + self horizontal allSetterAndGettersForMyStash ifNotEmpty: [ settersAndGetters add: #horizontal onlyGetOnStash ]. + self vertical allSetterAndGettersForMyStash ifNotEmpty: [ settersAndGetters add: #vertical onlyGetOnStash ]. + ^ settersAndGetters +] diff --git a/src/Bloc-Serialization-Stash/BlLayoutConstraintsAxis.extension.st b/src/Bloc-Serialization-Stash/BlLayoutConstraintsAxis.extension.st new file mode 100644 index 0000000..e54514b --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlLayoutConstraintsAxis.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlLayoutConstraintsAxis } + +{ #category : #'*Bloc-Serialization-Stash' } +BlLayoutConstraintsAxis >> shouldBeTagged [ + + ^ false +] diff --git a/src/Bloc-Serialization-Stash/BlLineGeometry.extension.st b/src/Bloc-Serialization-Stash/BlLineGeometry.extension.st new file mode 100644 index 0000000..d378f74 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlLineGeometry.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlLineGeometry } + +{ #category : #'*Bloc-Serialization-Stash' } +BlLineGeometry >> stashAccessors [ + + + ^ { #from . #to } +] diff --git a/src/Bloc-Serialization-Stash/BlLinearGradientPaint.extension.st b/src/Bloc-Serialization-Stash/BlLinearGradientPaint.extension.st new file mode 100644 index 0000000..99851f8 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlLinearGradientPaint.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #BlLinearGradientPaint } + +{ #category : #'*Bloc-Serialization-Stash' } +BlLinearGradientPaint >> stashBlLinearGradientPaintAccessors [ + + + ^ { + (#start). + (#end) } +] diff --git a/src/Bloc-Serialization-Stash/BlLinearLayout.extension.st b/src/Bloc-Serialization-Stash/BlLinearLayout.extension.st new file mode 100644 index 0000000..48beb64 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlLinearLayout.extension.st @@ -0,0 +1,32 @@ +Extension { #name : #BlLinearLayout } + +{ #category : #'*Bloc-Serialization-Stash' } +BlLinearLayout >> allSetterAndGettersForMyStash [ + + "We ovverride this method to take into account the default value of alignment" + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + (verticalAlignment == self defaultVerticalAlignment and: [ + horizontalAlignment == self defaultHorizontalAlignment ]) ifFalse: [ + settersAndGetters addAll: self allSetterAndGettersForMyStashForMyTraits ]. + cellSpacing == 0.0 ifFalse: [ settersAndGetters add: #cellSpacing ]. + interspace == 0.0 ifFalse: [ settersAndGetters add: #interspace ]. + self direction == self defaultDirection ifFalse: [ + settersAndGetters add: #direction ]. + shouldUseLargestChild ifTrue: [ + settersAndGetters add: ([ :linearLayout | + linearLayout shouldUseLargestChild + ifTrue: [ #withSpaceEqualization ] + ifFalse: [ #withoutSpaceEqualization ] ] -> self) onlySetOnStash ]. + weightSum == self defaultWeightSum ifFalse: [ + settersAndGetters add: #weightSum ]. + ^ settersAndGetters +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlLinearLayout >> asStashContructor [ + + self isVertical ifTrue: [ ^ 'BlLinearLayout vertical' ]. + ^ 'BlLinearLayout horizontal' +] diff --git a/src/Bloc-Serialization-Stash/BlLinearLayoutConstraints.extension.st b/src/Bloc-Serialization-Stash/BlLinearLayoutConstraints.extension.st new file mode 100644 index 0000000..79b2e34 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlLinearLayoutConstraints.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #BlLinearLayoutConstraints } + +{ #category : #'*Bloc-Serialization-Stash' } +BlLinearLayoutConstraints >> stashAccessorsWeight [ + + + weight = 1 ifFalse: [ ^ { #weight } ]. + ^ { } + +] diff --git a/src/Bloc-Serialization-Stash/BlLinearLayoutConstraintsHorizontal.extension.st b/src/Bloc-Serialization-Stash/BlLinearLayoutConstraintsHorizontal.extension.st new file mode 100644 index 0000000..aeab624 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlLinearLayoutConstraintsHorizontal.extension.st @@ -0,0 +1,14 @@ +Extension { #name : #BlLinearLayoutConstraintsHorizontal } + +{ #category : #'*Bloc-Serialization-Stash' } +BlLinearLayoutConstraintsHorizontal >> stashAccessors [ + + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + self alignment = BlElementAlignment start horizontal ifFalse: [ + settersAndGetters add: + [ :n | self alignment asStashSelector ] onlySetOnStash ]. + + ^ settersAndGetters +] diff --git a/src/Bloc-Serialization-Stash/BlLinearLayoutConstraintsVertical.extension.st b/src/Bloc-Serialization-Stash/BlLinearLayoutConstraintsVertical.extension.st new file mode 100644 index 0000000..c4811f8 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlLinearLayoutConstraintsVertical.extension.st @@ -0,0 +1,14 @@ +Extension { #name : #BlLinearLayoutConstraintsVertical } + +{ #category : #'*Bloc-Serialization-Stash' } +BlLinearLayoutConstraintsVertical >> stashAccessors [ + + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + self alignment = BlElementAlignment start vertical ifFalse: [ + settersAndGetters add: + [ :n | self alignment asStashSelector ] onlySetOnStash ]. + + ^ settersAndGetters +] diff --git a/src/Bloc-Serialization-Stash/BlMatrix2D.extension.st b/src/Bloc-Serialization-Stash/BlMatrix2D.extension.st new file mode 100644 index 0000000..aec69fe --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlMatrix2D.extension.st @@ -0,0 +1,15 @@ +Extension { #name : #BlMatrix2D } + +{ #category : #'*Bloc-Serialization-Stash' } +BlMatrix2D >> asStashContructor [ + + self isIdentity ifTrue: [ ^ 'BlMatrix2D new' ]. + ^ 'BlMatrix2D new x: <1p>; y: <2p>; shx: <3p>; shy: <4p>; sx: <5p>; sy: <6p>; yourself' + expandMacrosWithArguments: { + self x. + self y. + self shx. + self shy. + self sx. + self sy } +] diff --git a/src/Bloc-Serialization-Stash/BlMatrixTransformation.extension.st b/src/Bloc-Serialization-Stash/BlMatrixTransformation.extension.st new file mode 100644 index 0000000..ea66033 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlMatrixTransformation.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #BlMatrixTransformation } + +{ #category : #'*Bloc-Serialization-Stash' } +BlMatrixTransformation >> stashAccessors [ + + + ^ { ([ :transform | + 'matrix: (<1s>)' expandMacrosWith: + transform matrix asStashContructor ] -> self) onlySetOnStash } +] diff --git a/src/Bloc-Serialization-Stash/BlNullAlignment.extension.st b/src/Bloc-Serialization-Stash/BlNullAlignment.extension.st new file mode 100644 index 0000000..6adb2af --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlNullAlignment.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlNullAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlNullAlignment >> asStashSelector [ + + ^ #alignNone +] diff --git a/src/Bloc-Serialization-Stash/BlNullHorizontalAlignment.extension.st b/src/Bloc-Serialization-Stash/BlNullHorizontalAlignment.extension.st new file mode 100644 index 0000000..f647e86 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlNullHorizontalAlignment.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlNullHorizontalAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlNullHorizontalAlignment >> asStashSelector [ + + ^ #alignNone +] diff --git a/src/Bloc-Serialization-Stash/BlOutskirts.extension.st b/src/Bloc-Serialization-Stash/BlOutskirts.extension.st new file mode 100644 index 0000000..d88ff8d --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlOutskirts.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlOutskirts } + +{ #category : #'*Bloc-Serialization-Stash' } +BlOutskirts >> shouldBeTagged [ + + ^ false +] diff --git a/src/Bloc-Serialization-Stash/BlOutskirtsCentered.extension.st b/src/Bloc-Serialization-Stash/BlOutskirtsCentered.extension.st new file mode 100644 index 0000000..2f5dadb --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlOutskirtsCentered.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlOutskirtsCentered } + +{ #category : #'*Bloc-Serialization-Stash' } +BlOutskirtsCentered >> asStashContructor [ + + ^ 'BlOutskirts centered' +] diff --git a/src/Bloc-Serialization-Stash/BlOutskirtsInside.extension.st b/src/Bloc-Serialization-Stash/BlOutskirtsInside.extension.st new file mode 100644 index 0000000..95daaf0 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlOutskirtsInside.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlOutskirtsInside } + +{ #category : #'*Bloc-Serialization-Stash' } +BlOutskirtsInside >> asStashContructor [ + + ^ 'BlOutskirts inside' +] diff --git a/src/Bloc-Serialization-Stash/BlOutskirtsOutside.extension.st b/src/Bloc-Serialization-Stash/BlOutskirtsOutside.extension.st new file mode 100644 index 0000000..30b37c1 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlOutskirtsOutside.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlOutskirtsOutside } + +{ #category : #'*Bloc-Serialization-Stash' } +BlOutskirtsOutside >> asStashContructor [ + + ^ 'BlOutskirts outside' +] diff --git a/src/Bloc-Serialization-Stash/BlPaintBackground.extension.st b/src/Bloc-Serialization-Stash/BlPaintBackground.extension.st new file mode 100644 index 0000000..bf208fa --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlPaintBackground.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlPaintBackground } + +{ #category : #'*Bloc-Serialization-Stash' } +BlPaintBackground >> stashBackgroundPaint [ + + + ^ { (#paint) } +] diff --git a/src/Bloc-Serialization-Stash/BlPolygonGeometry.extension.st b/src/Bloc-Serialization-Stash/BlPolygonGeometry.extension.st new file mode 100644 index 0000000..0a01cc3 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlPolygonGeometry.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlPolygonGeometry } + +{ #category : #'*Bloc-Serialization-Stash' } +BlPolygonGeometry >> stashAccessors [ + + + ^ { #vertices } +] diff --git a/src/Bloc-Serialization-Stash/BlPolylineGeometry.extension.st b/src/Bloc-Serialization-Stash/BlPolylineGeometry.extension.st new file mode 100644 index 0000000..296bc3c --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlPolylineGeometry.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlPolylineGeometry } + +{ #category : #'*Bloc-Serialization-Stash' } +BlPolylineGeometry >> stashAccessors [ + + + ^ { #vertices } +] diff --git a/src/Bloc-Serialization-Stash/BlProportionalLayoutConstraintsHorizontal.extension.st b/src/Bloc-Serialization-Stash/BlProportionalLayoutConstraintsHorizontal.extension.st new file mode 100644 index 0000000..9d2d61c --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlProportionalLayoutConstraintsHorizontal.extension.st @@ -0,0 +1,18 @@ +Extension { #name : #BlProportionalLayoutConstraintsHorizontal } + +{ #category : #'*Bloc-Serialization-Stash' } +BlProportionalLayoutConstraintsHorizontal >> stashAccessors [ + + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + + self left = 0 ifFalse: [ + settersAndGetters add: + [ :e | 'left: ' , self left printString ] onlySetOnStash ]. + self right = 1 ifFalse: [ + settersAndGetters add: + [ :e | 'right: ' , self right printString ] onlySetOnStash ]. + + ^ settersAndGetters +] diff --git a/src/Bloc-Serialization-Stash/BlProportionalLayoutConstraintsVertical.extension.st b/src/Bloc-Serialization-Stash/BlProportionalLayoutConstraintsVertical.extension.st new file mode 100644 index 0000000..f1bfbe2 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlProportionalLayoutConstraintsVertical.extension.st @@ -0,0 +1,18 @@ +Extension { #name : #BlProportionalLayoutConstraintsVertical } + +{ #category : #'*Bloc-Serialization-Stash' } +BlProportionalLayoutConstraintsVertical >> stashAccessors [ + + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + + self top = 0 ifFalse: [ + settersAndGetters add: + [ :e | 'top: ' , self top printString ] onlySetOnStash ]. + self bottom = 1 ifFalse: [ + settersAndGetters add: + [ :e | 'bottom: ' , self bottom printString ] onlySetOnStash ]. + + ^ settersAndGetters +] diff --git a/src/Bloc-Serialization-Stash/BlRadialGradientPaint.extension.st b/src/Bloc-Serialization-Stash/BlRadialGradientPaint.extension.st new file mode 100644 index 0000000..9e528b4 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlRadialGradientPaint.extension.st @@ -0,0 +1,12 @@ +Extension { #name : #BlRadialGradientPaint } + +{ #category : #'*Bloc-Serialization-Stash' } +BlRadialGradientPaint >> stashBlRadialGradientPaintAccessors [ + + + ^ { + (#innerCenter). + (#innerRadius). + (#outerCenter). + (#outerRadius) } +] diff --git a/src/Bloc-Serialization-Stash/BlReflectionTransformation.extension.st b/src/Bloc-Serialization-Stash/BlReflectionTransformation.extension.st new file mode 100644 index 0000000..f5ac0b5 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlReflectionTransformation.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #BlReflectionTransformation } + +{ #category : #'*Bloc-Serialization-Stash' } +BlReflectionTransformation >> stashAccessors [ + + + self reflection = (BlVector x: -1 y: 1) ifTrue: [ + ^ { (#flipY -> self) onlySetOnStash } ]. + self reflection = (BlVector x: 1 y: -1) ifTrue: [ + ^ { (#flipX -> self) onlySetOnStash } ] +] diff --git a/src/Bloc-Serialization-Stash/BlRopedText.extension.st b/src/Bloc-Serialization-Stash/BlRopedText.extension.st new file mode 100644 index 0000000..b665865 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlRopedText.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlRopedText } + +{ #category : #'*Bloc-Serialization-Stash' } +BlRopedText >> stashAccessors [ + + + ^ { #rope } +] diff --git a/src/Bloc-Serialization-Stash/BlRotationTransformation.extension.st b/src/Bloc-Serialization-Stash/BlRotationTransformation.extension.st new file mode 100644 index 0000000..f3414a7 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlRotationTransformation.extension.st @@ -0,0 +1,21 @@ +Extension { #name : #BlRotationTransformation } + +{ #category : #'*Bloc-Serialization-Stash' } +BlRotationTransformation >> stashAccessors [ + + + | allSetterAndGettersForMyStash | + allSetterAndGettersForMyStash := OrderedCollection new. + allSetterAndGettersForMyStash add: ([ :e | self angle ]) onlyGetOnStash. + allSetterAndGettersForMyStash add: ([ :e | self axis ]) onlyGetOnStash. + self axis = BlVector zAxis + ifFalse: [ + allSetterAndGettersForMyStash add: ([ :transform | + 'rotateBy: ' , transform angle asStashContructor , 'around:' + , transform axis asStashContructor ] -> self) onlySetOnStash ] + ifTrue: [ + allSetterAndGettersForMyStash add: + ([ :transform | 'rotateBy: ' , transform angle asStashContructor ] + -> self) onlySetOnStash ]. + ^ allSetterAndGettersForMyStash +] diff --git a/src/Bloc-Serialization-Stash/BlRoundedRectangleGeometry.extension.st b/src/Bloc-Serialization-Stash/BlRoundedRectangleGeometry.extension.st new file mode 100644 index 0000000..97fce84 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlRoundedRectangleGeometry.extension.st @@ -0,0 +1,36 @@ +Extension { #name : #BlRoundedRectangleGeometry } + +{ #category : #'*Bloc-Serialization-Stash' } +BlRoundedRectangleGeometry >> asStashContructor [ + + (self cornerRadii topLeft = self cornerRadii bottomRight and: [ + self cornerRadii topLeft = self cornerRadii topRight and: [ + self cornerRadii topLeft = self cornerRadii bottomLeft ] ]) + ifTrue: [ + ^ 'BlRoundedRectangleGeometry cornerRadius: ' + , self cornerRadii topLeft printString ]. + + ^ 'BlRoundedRectangleGeometry' +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlRoundedRectangleGeometry >> asStashObject [ + + ^ StashObjectWithBuilder new + builder: self; + methodToBuild: nil; + object: self; + yourself +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlRoundedRectangleGeometry >> stashAccessors [ + + + (self cornerRadii topLeft = self cornerRadii bottomRight and: [ + self cornerRadii topLeft = self cornerRadii topRight and: [ + self cornerRadii topLeft = self cornerRadii bottomLeft ] ]) + ifTrue: [ ^ { } ]. + + ^ { #cornerRadii } +] diff --git a/src/Bloc-Serialization-Stash/BlScalingTransformation.extension.st b/src/Bloc-Serialization-Stash/BlScalingTransformation.extension.st new file mode 100644 index 0000000..0208a4c --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlScalingTransformation.extension.st @@ -0,0 +1,15 @@ +Extension { #name : #BlScalingTransformation } + +{ #category : #'*Bloc-Serialization-Stash' } +BlScalingTransformation >> stashAccessors [ + + + self scale x = self scale y ifTrue: [ + ^ { ([ :transform | + 'scaleBy: <1s>' expandMacrosWith: transform scale x asStashContructor ] -> self) + onlySetOnStash } ]. + ^ { ([ :transform | + 'scaleBy: <1s> @ <2s>' + expandMacrosWith: transform scale x asStashContructor + with: transform scale y asStashContructor ] -> self) onlySetOnStash } +] diff --git a/src/Bloc-Serialization-Stash/BlShearTransformation.extension.st b/src/Bloc-Serialization-Stash/BlShearTransformation.extension.st new file mode 100644 index 0000000..d256bbc --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlShearTransformation.extension.st @@ -0,0 +1,23 @@ +Extension { #name : #BlShearTransformation } + +{ #category : #'*Bloc-Serialization-Stash' } +BlShearTransformation >> stashAccessors [ + + + self coefficient = (0 @ 0) ifTrue: [ + ^ { ([ :transform | 'shearBy: 0 @ 0' ] -> self) onlySetOnStash } ]. + self coefficient x = 0 ifTrue: [ + ^ { ([ :transform | + 'skewY: <1p>' expandMacrosWith: + transform coefficient y negated arcTan radiansToDegrees ] + -> self) onlySetOnStash } ]. + self coefficient y = 0 ifTrue: [ + ^ { ([ :transform | + 'skewX: <1p>' expandMacrosWith: + transform coefficient x negated arcTan radiansToDegrees ] + -> self) onlySetOnStash } ]. + ^ { ([ :transform | + 'shearBy: <1p> @ <2p>' + expandMacrosWith: transform coefficient x + with: transform coefficient y ] -> self) onlySetOnStash } +] diff --git a/src/Bloc-Serialization-Stash/BlSimpleShadowEffect.extension.st b/src/Bloc-Serialization-Stash/BlSimpleShadowEffect.extension.st new file mode 100644 index 0000000..b926d07 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlSimpleShadowEffect.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #BlSimpleShadowEffect } + +{ #category : #'*Bloc-Serialization-Stash' } +BlSimpleShadowEffect >> asStashContructor [ + + self flag: #ToFix. "Not correct" + ^ 'BlSimpleShadowEffect color: (' , self color asStashContructor + , ') offset: ((' , self offset x printString , ')@(' + , self offset y printString , '))' +] diff --git a/src/Bloc-Serialization-Stash/BlStrokeLineBevelJoin.extension.st b/src/Bloc-Serialization-Stash/BlStrokeLineBevelJoin.extension.st new file mode 100644 index 0000000..bffc0de --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlStrokeLineBevelJoin.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlStrokeLineBevelJoin } + +{ #category : #'*Bloc-Serialization-Stash' } +BlStrokeLineBevelJoin >> asStashContructor [ + + ^ 'BlStrokeLineJoin bevel' +] diff --git a/src/Bloc-Serialization-Stash/BlStrokeLineButtCap.extension.st b/src/Bloc-Serialization-Stash/BlStrokeLineButtCap.extension.st new file mode 100644 index 0000000..14bbe79 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlStrokeLineButtCap.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlStrokeLineButtCap } + +{ #category : #'*Bloc-Serialization-Stash' } +BlStrokeLineButtCap >> asStashContructor [ + + ^ 'BlStrokeLineCap butt' +] diff --git a/src/Bloc-Serialization-Stash/BlStrokeLineCap.extension.st b/src/Bloc-Serialization-Stash/BlStrokeLineCap.extension.st new file mode 100644 index 0000000..b3a1f31 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlStrokeLineCap.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlStrokeLineCap } + +{ #category : #'*Bloc-Serialization-Stash' } +BlStrokeLineCap >> shouldBeTagged [ + + ^ false +] diff --git a/src/Bloc-Serialization-Stash/BlStrokeLineJoin.extension.st b/src/Bloc-Serialization-Stash/BlStrokeLineJoin.extension.st new file mode 100644 index 0000000..8c67cd7 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlStrokeLineJoin.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlStrokeLineJoin } + +{ #category : #'*Bloc-Serialization-Stash' } +BlStrokeLineJoin >> shouldBeTagged [ + + ^ false +] diff --git a/src/Bloc-Serialization-Stash/BlStrokeLineMiterJoin.extension.st b/src/Bloc-Serialization-Stash/BlStrokeLineMiterJoin.extension.st new file mode 100644 index 0000000..4e4c5da --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlStrokeLineMiterJoin.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlStrokeLineMiterJoin } + +{ #category : #'*Bloc-Serialization-Stash' } +BlStrokeLineMiterJoin >> asStashContructor [ + + ^ 'BlStrokeLineJoin miter' +] diff --git a/src/Bloc-Serialization-Stash/BlStrokeLineRoundCap.extension.st b/src/Bloc-Serialization-Stash/BlStrokeLineRoundCap.extension.st new file mode 100644 index 0000000..90ae6f5 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlStrokeLineRoundCap.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlStrokeLineRoundCap } + +{ #category : #'*Bloc-Serialization-Stash' } +BlStrokeLineRoundCap >> asStashContructor [ + + ^ 'BlStrokeLineCap round' +] diff --git a/src/Bloc-Serialization-Stash/BlStrokeLineRoundJoin.extension.st b/src/Bloc-Serialization-Stash/BlStrokeLineRoundJoin.extension.st new file mode 100644 index 0000000..ef850b3 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlStrokeLineRoundJoin.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlStrokeLineRoundJoin } + +{ #category : #'*Bloc-Serialization-Stash' } +BlStrokeLineRoundJoin >> asStashContructor [ + + ^ 'BlStrokeLineJoin round' +] diff --git a/src/Bloc-Serialization-Stash/BlStrokeLineSquareCap.extension.st b/src/Bloc-Serialization-Stash/BlStrokeLineSquareCap.extension.st new file mode 100644 index 0000000..38d4912 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlStrokeLineSquareCap.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlStrokeLineSquareCap } + +{ #category : #'*Bloc-Serialization-Stash' } +BlStrokeLineSquareCap >> asStashContructor [ + + ^ 'BlStrokeLineCap square' +] diff --git a/src/Bloc-Serialization-Stash/BlTextBackgroundAttribute.extension.st b/src/Bloc-Serialization-Stash/BlTextBackgroundAttribute.extension.st new file mode 100644 index 0000000..20a96c2 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlTextBackgroundAttribute.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlTextBackgroundAttribute } + +{ #category : #'*Bloc-Serialization-Stash' } +BlTextBackgroundAttribute >> stashAccessors [ + + + ^ { #paint } +] diff --git a/src/Bloc-Serialization-Stash/BlTextDecorationAttribute.extension.st b/src/Bloc-Serialization-Stash/BlTextDecorationAttribute.extension.st new file mode 100644 index 0000000..12c2f6b --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlTextDecorationAttribute.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlTextDecorationAttribute } + +{ #category : #'*Bloc-Serialization-Stash' } +BlTextDecorationAttribute >> stashAccessors [ + + + ^ { #decoration } +] diff --git a/src/Bloc-Serialization-Stash/BlTextElement.extension.st b/src/Bloc-Serialization-Stash/BlTextElement.extension.st new file mode 100644 index 0000000..c8fd333 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlTextElement.extension.st @@ -0,0 +1,14 @@ +Extension { #name : #BlTextElement } + +{ #category : #'*Bloc-Serialization-Stash' } +BlTextElement >> allSetterAndGettersForMyStash [ + + ^ super allSetterAndGettersForMyStash , { #text } +] + +{ #category : #'*Bloc-Serialization-Stash' } +BlTextElement >> stashAccessors [ + + + ^ { #text } +] diff --git a/src/Bloc-Serialization-Stash/BlTextForegroundAttribute.extension.st b/src/Bloc-Serialization-Stash/BlTextForegroundAttribute.extension.st new file mode 100644 index 0000000..5dd9932 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlTextForegroundAttribute.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlTextForegroundAttribute } + +{ #category : #'*Bloc-Serialization-Stash' } +BlTextForegroundAttribute >> stashAccessors [ + + + ^ { #paint } +] diff --git a/src/Bloc-Serialization-Stash/BlTextSpacingAttribute.extension.st b/src/Bloc-Serialization-Stash/BlTextSpacingAttribute.extension.st new file mode 100644 index 0000000..34a5baf --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlTextSpacingAttribute.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlTextSpacingAttribute } + +{ #category : #'*Bloc-Serialization-Stash' } +BlTextSpacingAttribute >> stashAccessors [ + + + ^ { #spacing } +] diff --git a/src/Bloc-Serialization-Stash/BlTopAlignment.extension.st b/src/Bloc-Serialization-Stash/BlTopAlignment.extension.st new file mode 100644 index 0000000..37d16ab --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlTopAlignment.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlTopAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlTopAlignment >> asStashSelector [ + + ^ #alignTop +] diff --git a/src/Bloc-Serialization-Stash/BlTranslationTransformation.extension.st b/src/Bloc-Serialization-Stash/BlTranslationTransformation.extension.st new file mode 100644 index 0000000..db29b39 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlTranslationTransformation.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #BlTranslationTransformation } + +{ #category : #'*Bloc-Serialization-Stash' } +BlTranslationTransformation >> stashAccessors [ + + + ^ { ([ :transform | + 'translateBy: <1s> @ <2s>' + expandMacrosWith: transform translation x asStashContructor + with: transform translation y asStashContructor ] -> self) onlySetOnStash } +] diff --git a/src/Bloc-Serialization-Stash/BlTransparentPaint.extension.st b/src/Bloc-Serialization-Stash/BlTransparentPaint.extension.st new file mode 100644 index 0000000..7e0a7f5 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlTransparentPaint.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlTransparentPaint } + +{ #category : #'*Bloc-Serialization-Stash' } +BlTransparentPaint >> allSetterAndGettersForMyStash [ + + "We return nothing because color is immutable" + ^ { } +] diff --git a/src/Bloc-Serialization-Stash/BlTriangleGeometry.extension.st b/src/Bloc-Serialization-Stash/BlTriangleGeometry.extension.st new file mode 100644 index 0000000..1759851 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlTriangleGeometry.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #BlTriangleGeometry } + +{ #category : #'*Bloc-Serialization-Stash' } +BlTriangleGeometry >> asStashContructor [ + + self isTop ifTrue: [ ^ 'BlTriangleGeometry new beTop' ]. + self isBottom ifTrue: [ ^ 'BlTriangleGeometry new beBottom' ]. + self isLeft ifTrue: [ ^ 'BlTriangleGeometry new beLeft' ]. + ^ 'BlTriangleGeometry new beRight' +] diff --git a/src/Bloc-Serialization-Stash/BlVector.extension.st b/src/Bloc-Serialization-Stash/BlVector.extension.st new file mode 100644 index 0000000..0f47f98 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlVector.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlVector } + +{ #category : #'*Bloc-Serialization-Stash' } +BlVector >> shouldBeTagged [ + + ^ false +] diff --git a/src/Bloc-Serialization-Stash/BlVector2D.extension.st b/src/Bloc-Serialization-Stash/BlVector2D.extension.st new file mode 100644 index 0000000..df96899 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlVector2D.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #BlVector2D } + +{ #category : #'*Bloc-Serialization-Stash' } +BlVector2D >> asStashContructor [ + + self = BlVector xAxis ifTrue: [ ^ 'BlVector xAxis' ]. + self = BlVector yAxis ifTrue: [ ^ 'BlVector yAxis' ]. + self = BlVector zAxis ifTrue: [ ^ 'BlVector zAxis' ]. + ^ 'BlVector x: <1p> y: <2p>' expandMacrosWith: self x with: self y +] diff --git a/src/Bloc-Serialization-Stash/BlVector3D.extension.st b/src/Bloc-Serialization-Stash/BlVector3D.extension.st new file mode 100644 index 0000000..e898537 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlVector3D.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #BlVector3D } + +{ #category : #'*Bloc-Serialization-Stash' } +BlVector3D >> asStashContructor [ + + self = BlVector xAxis ifTrue: [ ^ 'BlVector xAxis' ]. + self = BlVector yAxis ifTrue: [ ^ 'BlVector yAxis' ]. + self = BlVector zAxis ifTrue: [ ^ 'BlVector zAxis' ]. + ^ 'BlVector x: <1p> y: <2p> z: <3p>' expandMacrosWith: self x with: self y with: self z +] diff --git a/src/Bloc-Serialization-Stash/BlVerticalCenterAlignment.extension.st b/src/Bloc-Serialization-Stash/BlVerticalCenterAlignment.extension.st new file mode 100644 index 0000000..b154210 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlVerticalCenterAlignment.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlVerticalCenterAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlVerticalCenterAlignment >> asStashSelector [ + + ^ #alignCenter +] diff --git a/src/Bloc-Serialization-Stash/BlVerticalCoordinateBottomAlignment.extension.st b/src/Bloc-Serialization-Stash/BlVerticalCoordinateBottomAlignment.extension.st new file mode 100644 index 0000000..fbd87d3 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlVerticalCoordinateBottomAlignment.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlVerticalCoordinateBottomAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlVerticalCoordinateBottomAlignment >> asStashSelector [ + + ^ 'alignBottomAt: ', (self coordinate printString) +] diff --git a/src/Bloc-Serialization-Stash/BlVerticalCoordinateTopAlignment.extension.st b/src/Bloc-Serialization-Stash/BlVerticalCoordinateTopAlignment.extension.st new file mode 100644 index 0000000..70667a7 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlVerticalCoordinateTopAlignment.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlVerticalCoordinateTopAlignment } + +{ #category : #'*Bloc-Serialization-Stash' } +BlVerticalCoordinateTopAlignment >> asStashSelector [ + + + ^ self relativeAlignment asStashSelector, 'At: ' , self coordinate printString +] diff --git a/src/Bloc-Serialization-Stash/BlVisibility.extension.st b/src/Bloc-Serialization-Stash/BlVisibility.extension.st new file mode 100644 index 0000000..6a5733e --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlVisibility.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlVisibility } + +{ #category : #'*Bloc-Serialization-Stash' } +BlVisibility >> shouldBeTagged [ + + ^ false. +] diff --git a/src/Bloc-Serialization-Stash/BlVisibilityGone.extension.st b/src/Bloc-Serialization-Stash/BlVisibilityGone.extension.st new file mode 100644 index 0000000..e607895 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlVisibilityGone.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlVisibilityGone } + +{ #category : #'*Bloc-Serialization-Stash' } +BlVisibilityGone >> asStashContructor [ + + ^ 'BlVisibility gone' +] diff --git a/src/Bloc-Serialization-Stash/BlVisibilityHidden.extension.st b/src/Bloc-Serialization-Stash/BlVisibilityHidden.extension.st new file mode 100644 index 0000000..9fbf21e --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlVisibilityHidden.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlVisibilityHidden } + +{ #category : #'*Bloc-Serialization-Stash' } +BlVisibilityHidden >> asStashContructor [ + + ^ 'BlVisibility hidden' +] diff --git a/src/Bloc-Serialization-Stash/BlVisibilityVisible.extension.st b/src/Bloc-Serialization-Stash/BlVisibilityVisible.extension.st new file mode 100644 index 0000000..7b06564 --- /dev/null +++ b/src/Bloc-Serialization-Stash/BlVisibilityVisible.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlVisibilityVisible } + +{ #category : #'*Bloc-Serialization-Stash' } +BlVisibilityVisible >> asStashContructor [ + + ^ 'BlVisibility visible' +] diff --git a/src/Bloc-Serialization-Stash/StashBlAttributeRope.class.st b/src/Bloc-Serialization-Stash/StashBlAttributeRope.class.st new file mode 100644 index 0000000..add5fef --- /dev/null +++ b/src/Bloc-Serialization-Stash/StashBlAttributeRope.class.st @@ -0,0 +1,41 @@ +Class { + #name : #StashBlAttributeRope, + #superclass : #StashObject, + #instVars : [ + 'rope', + 'attributes' + ], + #category : #'Bloc-Serialization-Stash-stash-objects' +} + +{ #category : #accessing } +StashBlAttributeRope >> attributes [ + + ^ attributes +] + +{ #category : #accessing } +StashBlAttributeRope >> attributes: anObject [ + + attributes := anObject +] + +{ #category : #'stash - step' } +StashBlAttributeRope >> constructForGeneralObjectStep: aStashContructGeneralObjectsStep on: aStash [ + + aStashContructGeneralObjectsStep + constructBlAttributeRope: self + on: aStash +] + +{ #category : #accessing } +StashBlAttributeRope >> rope [ + + ^ rope +] + +{ #category : #accessing } +StashBlAttributeRope >> rope: anObject [ + + rope := anObject +] diff --git a/src/Bloc-Serialization-Stash/StashBlLayoutConstraints.class.st b/src/Bloc-Serialization-Stash/StashBlLayoutConstraints.class.st new file mode 100644 index 0000000..f4b3cef --- /dev/null +++ b/src/Bloc-Serialization-Stash/StashBlLayoutConstraints.class.st @@ -0,0 +1,91 @@ +Class { + #name : #StashBlLayoutConstraints, + #superclass : #StashObject, + #category : #'Bloc-Serialization-Stash-stash-objects' +} + +{ #category : #'as yet unclassified' } +StashBlLayoutConstraints >> allHorizontalSetters [ + + ^ self object horizontal allSetterAndGettersForMyStash collect: [ :each | each asStashProperty ] thenSelect: [ :each | + each isStashSetter ] +] + +{ #category : #'as yet unclassified' } +StashBlLayoutConstraints >> allHorizontalSettersFor: aLayoutConstraints [ + + ^ aLayoutConstraints horizontal allSetterAndGettersForMyStash + collect: [ :each | each asStashProperty ] + thenSelect: [ :each | each isStashSetter ] +] + +{ #category : #'as yet unclassified' } +StashBlLayoutConstraints >> allLayoutSettersAndNames [ + + | layouts | + layouts := { #flow. #frame. #grid. #linear. #proportional . #relative. #zoomable }. + ^ layouts collect: [ :layout | + layout + -> ((self object perform: layout) allSetterAndGettersForMyStash + collect: [ :each | each asStashProperty ] + thenSelect: [ :each | each isStashSetter ]) ] +] + +{ #category : #'as yet unclassified' } +StashBlLayoutConstraints >> allVerticalSetters [ + + ^ self object vertical allSetterAndGettersForMyStash + collect: [ :each | each asStashProperty ] + thenSelect: [ :each | each isStashSetter ] +] + +{ #category : #'as yet unclassified' } +StashBlLayoutConstraints >> allVerticalSettersFor: aLayoutConstraints [ + + ^ aLayoutConstraints vertical allSetterAndGettersForMyStash + collect: [ :each | each asStashProperty ] + thenSelect: [ :each | each isStashSetter ] +] + +{ #category : #'as yet unclassified' } +StashBlLayoutConstraints >> constructForGeneralObjectStep: aStashContructGeneralObjectsStep on: aStash [ + + aStashContructGeneralObjectsStep + constructBlLayoutConstraints: self + on: aStash +] + +{ #category : #'as yet unclassified' } +StashBlLayoutConstraints >> getInstanceForHorizontalWith: anObject [ + + anObject setter isBlock + ifTrue: [ ^ anObject setter value: self object horizontal ] + ifFalse: [ ^ anObject setter ] +] + +{ #category : #'as yet unclassified' } +StashBlLayoutConstraints >> getInstanceForVerticalWith: anObject [ + + anObject setter isBlock + ifTrue: [ ^ anObject setter value: self object vertical ] + ifFalse: [ ^ anObject setter ] +] + +{ #category : #'as yet unclassified' } +StashBlLayoutConstraints >> nextInstances [ + + ^ super nextInstances, { self object horizontal . self object vertical } +] + +{ #category : #accessing } +StashBlLayoutConstraints >> object: anObject [ + + object := anObject. + (anObject allSetterAndGettersForMyStash isEmpty and: [ anObject horizontal allSetterAndGettersForMyStash isEmpty and: [anObject vertical allSetterAndGettersForMyStash isEmpty ] ]) ifTrue: [ self propertiesAreSet ] +] + +{ #category : #asserting } +StashBlLayoutConstraints >> shouldBeTagged [ + + ^ false +] diff --git a/src/Bloc-Serialization-Stash/StashBlTransformation.class.st b/src/Bloc-Serialization-Stash/StashBlTransformation.class.st new file mode 100644 index 0000000..37dc7b3 --- /dev/null +++ b/src/Bloc-Serialization-Stash/StashBlTransformation.class.st @@ -0,0 +1,40 @@ +Class { + #name : #StashBlTransformation, + #superclass : #StashObject, + #category : #'Bloc-Serialization-Stash-stash-objects' +} + +{ #category : #'as yet unclassified' } +StashBlTransformation >> allSettersFor: aBlAffineTransformationOrigin [ + + ^ self allSetters select: [ :each | each context value origin = aBlAffineTransformationOrigin ] +] + +{ #category : #'as yet unclassified' } +StashBlTransformation >> allSettersOriginsExceptDefault: aFullBlockClosure [ + + | origins currentOrigin | + origins := Set new. + + self allSetters do: [ :each | + currentOrigin := each context value origin. + currentOrigin = self defaultOrigin ifFalse: [ + (origins includes: currentOrigin) ifFalse: [ + origins add: currentOrigin. + aFullBlockClosure value: currentOrigin ] ] ]. + origins +] + +{ #category : #'stash - step' } +StashBlTransformation >> constructForGeneralObjectStep: aStashContructGeneralObjectsStep on: aStash [ + + aStashContructGeneralObjectsStep + constructBlTransformation: self + on: aStash +] + +{ #category : #'as yet unclassified' } +StashBlTransformation >> defaultOrigin [ + + ^ BlAffineTransformationCenterOrigin defaultInstance +] diff --git a/src/Bloc-Serialization-Stash/StashBlocChildrenTest.class.st b/src/Bloc-Serialization-Stash/StashBlocChildrenTest.class.st new file mode 100644 index 0000000..158929c --- /dev/null +++ b/src/Bloc-Serialization-Stash/StashBlocChildrenTest.class.st @@ -0,0 +1,67 @@ +Class { + #name : #StashBlocChildrenTest, + #superclass : #TestCase, + #category : #'Bloc-Serialization-Stash-test-cases' +} + +{ #category : #tests } +StashBlocChildrenTest >> testBlElementChildren1 [ + + | object source | + object := BlElement new. + source := Stash new serialize: object. + self + assert: source + equals: 'BlElement new' +] + +{ #category : #tests } +StashBlocChildrenTest >> testBlElementChildren2 [ + + | object source | + object := BlElement new + addChild: BlElement new; + yourself. + source := Stash new serialize: object. + self + assert: source + equals: 'BlElement new + addChildren: {BlElement new}; + yourself' +] + +{ #category : #tests } +StashBlocChildrenTest >> testBlElementChildren3 [ + + | object source | + object := BlElement new + addChild: BlElement new; + addChild: BlElement new; + addChild: BlElement new; + yourself. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + addChildren: {BlElement new . + BlElement new . + BlElement new}; + yourself' +] + +{ #category : #tests } +StashBlocChildrenTest >> testBlElementChildren4 [ + + | object source | + object := BlElement new + addChild: BlElement new; + addChild: (BlElement new addChild: BlElement new; yourself); + addChild: BlElement new; + yourself. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + addChildren: {BlElement new . + (BlElement new + addChildren: {BlElement new}; + yourself) . + BlElement new}; + yourself' +] diff --git a/src/Bloc-Serialization-Stash/StashBlocConstraintsTest.class.st b/src/Bloc-Serialization-Stash/StashBlocConstraintsTest.class.st new file mode 100644 index 0000000..e5ded37 --- /dev/null +++ b/src/Bloc-Serialization-Stash/StashBlocConstraintsTest.class.st @@ -0,0 +1,446 @@ +Class { + #name : #StashBlocConstraintsTest, + #superclass : #TestCase, + #category : #'Bloc-Serialization-Stash-test-cases' +} + +{ #category : #tests } +StashBlocConstraintsTest >> testAccountTransformation [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c accountTransformation ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints accountTransformation ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints shouldAccountTransformation +] + +{ #category : #tests } +StashBlocConstraintsTest >> testHorizontal1 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c horizontal matchParent ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints horizontal matchParent ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints horizontal resizer isMatchParent +] + +{ #category : #tests } +StashBlocConstraintsTest >> testHorizontal2 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c horizontal fitContent ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints horizontal fitContent ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints horizontal resizer isFitContent +] + +{ #category : #tests } +StashBlocConstraintsTest >> testHorizontal3 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c horizontal exact: 50.0 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints horizontal resizer isExact. + self assert: newObject constraints horizontal resizer size equals: 50.0. +] + +{ #category : #tests } +StashBlocConstraintsTest >> testHorizontal4 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c horizontal exact: 500.0 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints horizontal exact: 500.0 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints horizontal resizer isExact. + self + assert: newObject constraints horizontal resizer size + equals: 500.0 +] + +{ #category : #tests } +StashBlocConstraintsTest >> testMargin1 [ + + + | object source newObject | + object := BlElement new margin: BlInsets empty. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject margin equals: BlInsets empty +] + +{ #category : #tests } +StashBlocConstraintsTest >> testMargin2 [ + + | object source newObject | + object := BlElement new margin:( BlInsets all: 5). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints margin: (BlInsets all: 5.0) ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject margin equals: (BlInsets all: 5) +] + +{ #category : #tests } +StashBlocConstraintsTest >> testMargin3 [ + + | object source newObject | + object := BlElement new margin: (BlInsets + top: 1 + right: 4 + bottom: 3 + left: 2). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints margin: (BlInsets top: 1.0 right: 4.0 bottom: 3.0 left: 2.0) ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject margin equals: (BlInsets + top: 1 + right: 4 + bottom: 3 + left: 2) +] + +{ #category : #tests } +StashBlocConstraintsTest >> testMarginAndPadding [ + + | object source newObject | + object := BlElement new padding: (BlInsets + top: 1 + right: 4 + bottom: 3 + left: 2); margin: (BlInsets + top: 1 + right: 4 + bottom: 3 + left: 2). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints padding: (BlInsets top: 1.0 right: 4.0 bottom: 3.0 left: 2.0). + constraints margin: (BlInsets top: 1.0 right: 4.0 bottom: 3.0 left: 2.0) ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject margin equals: (BlInsets + top: 1 + right: 4 + bottom: 3 + left: 2). + self assert: newObject padding equals: (BlInsets + top: 1 + right: 4 + bottom: 3 + left: 2) +] + +{ #category : #tests } +StashBlocConstraintsTest >> testMaxHeight1 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | c maxHeight: Float infinity ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints maxHeight equals: Float infinity +] + +{ #category : #tests } +StashBlocConstraintsTest >> testMaxHeight2 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c maxHeight: 500 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints maxHeight: 500.0 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints maxHeight equals: 500 +] + +{ #category : #tests } +StashBlocConstraintsTest >> testMaxWidth1 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c maxWidth: Float infinity ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints maxWidth equals: Float infinity +] + +{ #category : #tests } +StashBlocConstraintsTest >> testMaxWidth2 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | c maxWidth: 500 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints maxWidth: 500.0 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints maxWidth equals: 500 +] + +{ #category : #tests } +StashBlocConstraintsTest >> testMinHeight1 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | c minHeight: 0 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints minHeight equals: 0 +] + +{ #category : #tests } +StashBlocConstraintsTest >> testMinHeight2 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | c minHeight: 10 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints minHeight: 10.0 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints minHeight equals: 10 +] + +{ #category : #tests } +StashBlocConstraintsTest >> testMinWidth1 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | c minWidth: 0 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints minWidth equals: 0 +] + +{ #category : #tests } +StashBlocConstraintsTest >> testMinWidth2 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | c minWidth: 10 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints minWidth: 10.0 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints minWidth equals: 10 +] + +{ #category : #tests } +StashBlocConstraintsTest >> testPadding1 [ + + | object source newObject | + object := BlElement new padding: BlInsets empty. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject padding equals: BlInsets empty +] + +{ #category : #tests } +StashBlocConstraintsTest >> testPadding2 [ + + | object source newObject | + object := BlElement new padding: (BlInsets all: 5). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints padding: (BlInsets all: 5.0) ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject padding equals: (BlInsets all: 5) +] + +{ #category : #tests } +StashBlocConstraintsTest >> testPadding3 [ + + | object source newObject | + object := BlElement new padding: (BlInsets + top: 1 + right: 4 + bottom: 3 + left: 2). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints padding: (BlInsets top: 1.0 right: 4.0 bottom: 3.0 left: 2.0) ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject padding equals: (BlInsets + top: 1 + right: 4 + bottom: 3 + left: 2) +] + +{ #category : #tests } +StashBlocConstraintsTest >> testPosition1 [ + + | object source newObject | + object := BlElement new. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints position equals: 0 @ 0 +] + +{ #category : #tests } +StashBlocConstraintsTest >> testPosition2 [ + + | object source newObject | + object := BlElement new position: 0 @ 0. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints position equals: 0 @ 0 +] + +{ #category : #tests } +StashBlocConstraintsTest >> testPosition3 [ + + | object source newObject | + object := BlElement new position: 10 @ 10. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints position: 10 @ 10 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints position equals: 10 @ 10 +] + +{ #category : #tests } +StashBlocConstraintsTest >> testVertical1 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c vertical matchParent ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints vertical matchParent ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints vertical resizer isMatchParent +] + +{ #category : #tests } +StashBlocConstraintsTest >> testVertical2 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c vertical fitContent ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints vertical fitContent ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints vertical resizer isFitContent +] + +{ #category : #tests } +StashBlocConstraintsTest >> testVertical3 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c vertical exact: 50.0 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints vertical resizer isExact. + self + assert: newObject constraints vertical resizer size + equals: 50.0 +] + +{ #category : #tests } +StashBlocConstraintsTest >> testVertical4 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c vertical exact: 500.0 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints vertical exact: 500.0 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints vertical resizer isExact. + self + assert: newObject constraints vertical resizer size + equals: 500.0 +] diff --git a/src/Bloc-Serialization-Stash/StashBlocLayoutConstraintsTest.class.st b/src/Bloc-Serialization-Stash/StashBlocLayoutConstraintsTest.class.st new file mode 100644 index 0000000..e642273 --- /dev/null +++ b/src/Bloc-Serialization-Stash/StashBlocLayoutConstraintsTest.class.st @@ -0,0 +1,593 @@ +Class { + #name : #StashBlocLayoutConstraintsTest, + #superclass : #TestCase, + #category : #'Bloc-Serialization-Stash-test-cases' +} + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFlow1 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | c flow newLine: true ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints flow newLine: true ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints flow isNewLine +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFlow2 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | c flow newLine: false ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self deny: newObject constraints flow isNewLine +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFlow3 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | c flow weight: 30.0 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints flow weight: 30.0 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints flow weight equals: 30.0 +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFlow4 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c flow horizontal alignLeft ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints flow horizontal alignment + equals: BlElementAlignment horizontal start +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFlow5 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c flow horizontal alignCenter ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints flow horizontal alignCenter ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints flow horizontal alignment + equals: BlElementAlignment horizontal center +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFlow6 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c flow horizontal alignRight ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints flow horizontal alignRight ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints flow horizontal alignment + equals: BlElementAlignment horizontal end +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFlow7 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c flow vertical alignTop ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints flow vertical alignment + equals: BlElementAlignment vertical start +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFlow8 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c flow vertical alignCenter ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints flow vertical alignCenter ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints flow vertical alignment + equals: BlElementAlignment vertical center +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFlow9 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c flow vertical alignBottom ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints flow vertical alignBottom ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints flow vertical alignment + equals: BlElementAlignment vertical end +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame1 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame horizontal alignLeft ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame horizontal alignment + equals: BlElementAlignment horizontal start +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame10 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame vertical alignCenterAt: 0.5 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints frame vertical alignCenterAt: 0.5 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame vertical alignment class + equals: BlVerticalCoordinateTopAlignment. + self + assert: newObject constraints frame vertical alignment coordinate + equals: 0.5. + self + assert: + newObject constraints frame vertical alignment relativeAlignment + equals: BlElementAlignment vertical center +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame11 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame vertical alignBottom ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints frame vertical alignBottom ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame vertical alignment + equals: BlElementAlignment vertical end +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame12 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame vertical alignBottomAt: 0.5 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints frame vertical alignBottomAt: 0.5 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame vertical alignment class + equals: BlVerticalCoordinateBottomAlignment. + self + assert: newObject constraints frame vertical alignment coordinate + equals: 0.5. + self + assert: + newObject constraints frame vertical alignment relativeAlignment + equals: BlElementAlignment vertical end +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame13 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame vertical alignBottomAt: 0.5. + c frame vertical weight: 0.2 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints frame vertical alignBottomAt: 0.5. + constraints frame vertical weight: 0.2 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame vertical alignment class + equals: BlVerticalCoordinateBottomAlignment. + self + assert: newObject constraints frame vertical alignment coordinate + equals: 0.5. + self + assert: + newObject constraints frame vertical alignment relativeAlignment + equals: BlElementAlignment vertical end. + self assert: newObject constraints frame vertical weight equals: 0.2 +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame2 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame horizontal alignLeftAt: 0.5 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints frame horizontal alignLeftAt: 0.5 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame horizontal alignment class + equals: BlHorizontalCoordinateLeftAlignment. + self + assert: newObject constraints frame horizontal alignment coordinate + equals: 0.5. + self + assert: + newObject constraints frame horizontal alignment relativeAlignment + equals: BlElementAlignment horizontal start +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame3 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame horizontal alignCenter ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints frame horizontal alignCenter ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame horizontal alignment + equals: BlElementAlignment horizontal center +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame4 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame horizontal alignCenterAt: 0.5 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints frame horizontal alignCenterAt: 0.5 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame horizontal alignment class + equals: BlHorizontalCoordinateStartAlignment. + self + assert: newObject constraints frame horizontal alignment coordinate + equals: 0.5. + self + assert: + newObject constraints frame horizontal alignment relativeAlignment + equals: BlElementAlignment horizontal center +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame5 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame horizontal alignRight ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints frame horizontal alignRight ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame horizontal alignment + equals: BlElementAlignment horizontal end +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame6 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame horizontal alignRightAt: 0.5 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints frame horizontal alignRightAt: 0.5 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame horizontal alignment class + equals: BlHorizontalCoordinateRightAlignment. + self + assert: newObject constraints frame horizontal alignment coordinate + equals: 0.5. + self + assert: + newObject constraints frame horizontal alignment relativeAlignment + equals: BlElementAlignment horizontal end +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame7 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame vertical alignTop ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame vertical alignment + equals: BlElementAlignment vertical start +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame8 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame vertical alignTopAt: 0.5 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints frame vertical alignTopAt: 0.5 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame vertical alignment class + equals: BlVerticalCoordinateTopAlignment. + self + assert: newObject constraints frame vertical alignment coordinate + equals: 0.5. + self + assert: + newObject constraints frame vertical alignment relativeAlignment + equals: BlElementAlignment vertical start +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testFrame9 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c frame vertical alignCenter ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints frame vertical alignCenter ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints frame vertical alignment + equals: BlElementAlignment vertical center +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testLinear1 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | c linear weight: 30.0 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints linear weight: 30.0 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints linear weight equals: 30.0 +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testLinear2 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c linear horizontal alignLeft ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints linear horizontal alignment + equals: BlElementAlignment horizontal start +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testLinear3 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c linear horizontal alignCenter ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints linear horizontal alignCenter ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints linear horizontal alignment + equals: BlElementAlignment horizontal center +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testLinear4 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c linear horizontal alignRight ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints linear horizontal alignRight ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints linear horizontal alignment + equals: BlElementAlignment horizontal end +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testLinear5 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c linear vertical alignTop ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints linear vertical alignment + equals: BlElementAlignment vertical start +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testLinear6 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c linear vertical alignCenter ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints linear vertical alignCenter ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints linear vertical alignment + equals: BlElementAlignment vertical center +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testLinear7 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c linear vertical alignBottom ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints linear vertical alignBottom ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints linear vertical alignment + equals: BlElementAlignment vertical end +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testProportional1 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | c proportional horizontal left: 0.2. c proportional horizontal right: 0.3 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints proportional horizontal left: 0.2. + constraints proportional horizontal right: 0.3 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject constraints proportional horizontal left equals: 0.2. + self assert: newObject constraints proportional horizontal right equals: 0.3. +] + +{ #category : #tests } +StashBlocLayoutConstraintsTest >> testProportional2 [ + + | object source newObject | + object := BlElement new constraintsDo: [ :c | + c proportional vertical top: 0.2. + c proportional vertical bottom: 0.3 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + constraintsDo: [:constraints | constraints proportional vertical top: 0.2. + constraints proportional vertical bottom: 0.3 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self + assert: newObject constraints proportional vertical top + equals: 0.2. + self + assert: newObject constraints proportional vertical bottom + equals: 0.3 +] diff --git a/src/Bloc-Serialization-Stash/StashBlocLayoutTest.class.st b/src/Bloc-Serialization-Stash/StashBlocLayoutTest.class.st new file mode 100644 index 0000000..3643b44 --- /dev/null +++ b/src/Bloc-Serialization-Stash/StashBlocLayoutTest.class.st @@ -0,0 +1,406 @@ +Class { + #name : #StashBlocLayoutTest, + #superclass : #TestCase, + #category : #'Bloc-Serialization-Stash-test-cases' +} + +{ #category : #tests } +StashBlocLayoutTest >> testBlBasicLayout [ + + | object source newObject | + object := BlElement new layout: BlBasicLayout uniqueInstance. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlBasicLayout +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlFlowLayout1 [ + + | object source newObject | + object := BlElement new layout: BlFlowLayout vertical. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: BlFlowLayout vertical; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlFlowLayout. + self assert: newObject layout orientation isVertical +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlFlowLayout10 [ + + | object source newObject | + object := BlElement new layout: + BlFlowLayout horizontal alignBottomCenter. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlFlowLayout horizontal + alignBottomCenter; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlFlowLayout. + self assert: newObject layout isAlignBottomCenter +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlFlowLayout11 [ + + | object source newObject | + object := BlElement new layout: + BlFlowLayout horizontal alignBottomRight. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlFlowLayout horizontal + alignBottomRight; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlFlowLayout. + self assert: newObject layout isAlignBottomRight +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlFlowLayout2 [ + + | object source newObject | + object := BlElement new layout: BlFlowLayout horizontal. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: BlFlowLayout horizontal; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlFlowLayout. + self assert: newObject layout orientation isHorizontal +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlFlowLayout3 [ + + | object source newObject | + object := BlElement new layout: + BlFlowLayout horizontal alignTopLeft. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: BlFlowLayout horizontal; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlFlowLayout. + self assert: newObject layout isAlignTopLeft +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlFlowLayout4 [ + + | object source newObject | + object := BlElement new layout: + BlFlowLayout horizontal alignTopCenter. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlFlowLayout horizontal + alignTopCenter; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlFlowLayout. + self assert: newObject layout isAlignTopCenter +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlFlowLayout5 [ + + | object source newObject | + object := BlElement new layout: + BlFlowLayout horizontal alignTopRight. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlFlowLayout horizontal + alignTopRight; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlFlowLayout. + self assert: newObject layout isAlignTopRight +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlFlowLayout6 [ + + | object source newObject | + object := BlElement new layout: BlFlowLayout horizontal alignCenterLeft. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlFlowLayout horizontal + alignCenterLeft; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlFlowLayout. + self assert: newObject layout isAlignCenterLeft +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlFlowLayout7 [ + + | object source newObject | + object := BlElement new layout: + BlFlowLayout horizontal alignCenter. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlFlowLayout horizontal + alignCenter; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlFlowLayout. + self assert: newObject layout isAlignCenter +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlFlowLayout8 [ + + | object source newObject | + object := BlElement new layout: BlFlowLayout horizontal alignCenterRight. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlFlowLayout horizontal + alignCenterRight; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlFlowLayout. + self assert: newObject layout isAlignCenterRight +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlFlowLayout9 [ + + | object source newObject | + object := BlElement new layout: + BlFlowLayout horizontal alignBottomLeft. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlFlowLayout horizontal + alignBottomLeft; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlFlowLayout. + self assert: newObject layout isAlignBottomLeft +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlFrameLayout [ + + | object source newObject | + object := BlElement new layout: BlFrameLayout new. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: BlFrameLayout new; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlFrameLayout +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlLinearLayout1 [ + + | object source newObject | + object := BlElement new layout: BlLinearLayout vertical. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: BlLinearLayout vertical; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlLinearLayout. + self assert: newObject layout isVertical. + self assert: newObject layout cellSpacing equals: 0.0. + self assert: newObject layout interspace equals: 0.0 +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlLinearLayout2 [ + + | object source newObject | + object := BlElement new layout: BlLinearLayout horizontal. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: BlLinearLayout horizontal; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlLinearLayout. + self assert: newObject layout isHorizontal. + self assert: newObject layout cellSpacing equals: 0.0. + self assert: newObject layout interspace equals: 0.0 +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlLinearLayout3 [ + + | object source newObject | + object := BlElement new layout: + (BlLinearLayout vertical cellSpacing: 3.0). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlLinearLayout vertical + cellSpacing: 3.0; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlLinearLayout. + self assert: newObject layout isVertical. + self assert: newObject layout cellSpacing equals: 3.0. + self assert: newObject layout interspace equals: 0.0 +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlLinearLayout4 [ + + | object source newObject | + object := BlElement new layout: + (BlLinearLayout vertical interspace: 3.0). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlLinearLayout vertical + interspace: 3.0; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlLinearLayout. + self assert: newObject layout isVertical. + self assert: newObject layout cellSpacing equals: 0.0. + self assert: newObject layout interspace equals: 3.0 +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlLinearLayout5 [ + + | object source newObject | + object := BlElement new layout: BlLinearLayout vertical leftToRight. + source := Stash new serialize: object. + self assert: source equals:'BlElement new + layout: BlLinearLayout vertical; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlLinearLayout. + self assert: newObject layout isVertical. + self assert: newObject layout cellSpacing equals: 0.0. + self assert: newObject layout interspace equals: 0.0 +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlLinearLayout6 [ + + | object source newObject | + object := BlElement new layout: BlLinearLayout vertical rightToLeft. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlLinearLayout vertical + direction: BlLayoutRightToLeft new; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlLinearLayout. + self assert: newObject layout isVertical. + self assert: newObject layout cellSpacing equals: 0.0. + self assert: newObject layout interspace equals: 0.0 +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlLinearLayout7 [ + + | object source newObject | + object := BlElement new layout: + (BlLinearLayout vertical withSpaceEqualization). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlLinearLayout vertical + withSpaceEqualization; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlLinearLayout. + self assert: newObject layout isVertical. + self assert: newObject layout cellSpacing equals: 0.0. + self assert: newObject layout interspace equals: 0.0 +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlLinearLayout8 [ + + | object source newObject | + object := BlElement new layout: + (BlLinearLayout vertical weightSum: 800). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: (BlLinearLayout vertical + weightSum: 800.0; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlLinearLayout. + self assert: newObject layout isVertical. + self assert: newObject layout cellSpacing equals: 0.0. + self assert: newObject layout interspace equals: 0.0. + self assert: newObject layout weightSum equals: 800.0 +] + +{ #category : #tests } +StashBlocLayoutTest >> testBlProportionalLayout [ + + | object source newObject | + object := BlElement new layout: (BlProportionalLayout new). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + layout: BlProportionalLayout new; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject layout class equals: BlProportionalLayout +] diff --git a/src/Bloc-Serialization-Stash/StashBlocTransformationTest.class.st b/src/Bloc-Serialization-Stash/StashBlocTransformationTest.class.st new file mode 100644 index 0000000..cceeee1 --- /dev/null +++ b/src/Bloc-Serialization-Stash/StashBlocTransformationTest.class.st @@ -0,0 +1,872 @@ +Class { + #name : #StashBlocTransformationTest, + #superclass : #TestCase, + #category : #'Bloc-Serialization-Stash-test-cases' +} + +{ #category : #tests } +StashBlocTransformationTest >> testMatrix1 [ + + | matrix object source newObject | + matrix := BlMatrix2D new. + object := BlElement new transformDo: [ :t | t matrix: matrix ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation topLeftOrigin. + transformation matrix: BlMatrix2D new ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first matrix + equals: matrix +] + +{ #category : #tests } +StashBlocTransformationTest >> testMatrix2 [ + + | matrix object source newObject | + matrix := BlMatrix2D new + x: 1; + y: 2; + sx: 3; + sy: 4; + shx: 5; + shy: 6. + object := BlElement new transformDo: [ :t | t matrix: matrix ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation topLeftOrigin. + transformation matrix: (BlMatrix2D new + x: 1; + y: 2; + shx: 5; + shy: 6; + sx: 3; + sy: 4; + yourself) ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first matrix + equals: matrix +] + +{ #category : #tests } +StashBlocTransformationTest >> testOrigin1 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t rotateBy: 90 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation rotateBy: 90 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first angle + equals: 90. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first axis + equals: BlVector zAxis. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first origin + equals: BlAffineTransformationCenterOrigin defaultInstance +] + +{ #category : #tests } +StashBlocTransformationTest >> testOrigin2 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t centerOrigin. t rotateBy: 90 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation rotateBy: 90 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first angle + equals: 90. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first axis + equals: BlVector zAxis. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first origin + equals: BlAffineTransformationCenterOrigin defaultInstance +] + +{ #category : #tests } +StashBlocTransformationTest >> testOrigin3 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | + t topLeftOrigin. + t rotateBy: 90 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation topLeftOrigin. + transformation rotateBy: 90 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first angle + equals: 90. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first axis + equals: BlVector zAxis. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first origin + equals: BlAffineTransformationTopLeftOrigin new +] + +{ #category : #tests } +StashBlocTransformationTest >> testOrigin4 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | + t topLeftOrigin. + t rotateBy: 90 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation topLeftOrigin. + transformation rotateBy: 90 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first angle + equals: 90. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first axis + equals: BlVector zAxis. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first origin + equals: BlAffineTransformationTopLeftOrigin new. +] + +{ #category : #tests } +StashBlocTransformationTest >> testOrigin5 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | + t rightCenterOrigin. + t rotateBy: 90 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation rightCenterOrigin. + transformation rotateBy: 90 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first angle + equals: 90. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first axis + equals: BlVector zAxis. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first origin + equals: BlAffineTransformationRightCenterOrigin new +] + +{ #category : #tests } +StashBlocTransformationTest >> testOrigin6 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | + t normalizedOrigin: 0.5 @ 0.5. + t rotateBy: 90 ]. + source := Stash new serialize: object. + self assert: source equals:'BlElement new + transformDo: [:transformation | transformation normalizedOrigin: 0.5 @ 0.5. + transformation rotateBy: 90 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first angle + equals: 90. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first axis + equals: BlVector zAxis. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first origin class + equals: BlAffineTransformationNormalizedPositionOrigin. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first origin position + equals: 0.5 @0.5 +] + +{ #category : #tests } +StashBlocTransformationTest >> testOrigin7 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | + t normalizedOrigin: 0.5 @ 0.5. + t rotateBy: 90. + t normalizedOrigin: 0.5 @ 0. + t rotateBy: 80. + t normalizedOrigin: 0 @ 0.5. + t rotateBy: 70 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation normalizedOrigin: 0.5 @ 0.5. + transformation rotateBy: 90. + transformation normalizedOrigin: 0.5 @ 0. + transformation rotateBy: 80. + transformation normalizedOrigin: 0 @ 0.5. + transformation rotateBy: 70 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 3. + "First" + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first angle + equals: 90. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first axis + equals: BlVector zAxis. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first origin class + equals: BlAffineTransformationNormalizedPositionOrigin. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first origin position + equals: 0.5 @ 0.5. + "Second" + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations second angle + equals: 80. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations second axis + equals: BlVector zAxis. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations second origin class + equals: BlAffineTransformationNormalizedPositionOrigin. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations second origin position + equals: 0.5 @ 0. + "Third" + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations last angle + equals: 70. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations last axis + equals: BlVector zAxis. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations last origin class + equals: BlAffineTransformationNormalizedPositionOrigin. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations last origin position + equals: 0 @ 0.5. +] + +{ #category : #tests } +StashBlocTransformationTest >> testReflection1 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | + t flipX ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation flipX ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first reflection + equals: (BlVector x: 1 y: -1). + +] + +{ #category : #tests } +StashBlocTransformationTest >> testReflection2 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t flipY ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation flipY ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first reflection + equals: (BlVector x: -1 y: 1) +] + +{ #category : #tests } +StashBlocTransformationTest >> testReflection3 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t flipX . t flipY ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation flipX. + transformation flipY ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 2. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first reflection + equals: (BlVector x: 1 y: -1). + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations second reflection + equals: (BlVector x: -1 y: 1) +] + +{ #category : #tests } +StashBlocTransformationTest >> testRotation1 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t rotateBy: 90 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation rotateBy: 90 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first angle + equals: 90. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first axis + equals: BlVector zAxis +] + +{ #category : #tests } +StashBlocTransformationTest >> testRotation2 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t rotateBy: 180 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation rotateBy: 180 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first angle + equals: 180. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first axis + equals: BlVector zAxis +] + +{ #category : #tests } +StashBlocTransformationTest >> testRotation3 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | + t rotateBy: 27 around: BlVector yAxis ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation rotateBy: 27 around: BlVector yAxis ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first angle + equals: 27. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first axis + equals: BlVector yAxis +] + +{ #category : #tests } +StashBlocTransformationTest >> testScale1 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t scaleBy: 2 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation scaleBy: 2 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first scale x + equals: 2. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first scale y + equals: 2 +] + +{ #category : #tests } +StashBlocTransformationTest >> testScale2 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t scaleBy: 2 @ 3 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation scaleBy: 2 @ 3 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first scale x + equals: 2. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first scale y + equals: 3 +] + +{ #category : #tests } +StashBlocTransformationTest >> testScale3 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t scaleBy: 1 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject transformation isIdentity +] + +{ #category : #tests } +StashBlocTransformationTest >> testShear1 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t shearBy: 0 @ 0 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation shearBy: 0 @ 0 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first coefficient + equals: 0 @ 0. + +] + +{ #category : #tests } +StashBlocTransformationTest >> testShear2 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t shearBy: 0.5 @ 0.5 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation shearBy: 0.5 @ 0.5 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first coefficient + equals: 0.5 @ 0.5 +] + +{ #category : #tests } +StashBlocTransformationTest >> testShear3 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t skewX: 90 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation skewX: 90.0 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first coefficient y + equals: 0. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first coefficient x + equals: 90 degreesToRadians tan negated +] + +{ #category : #tests } +StashBlocTransformationTest >> testShear4 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t skewY: 90 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation skewY: 90.0 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first coefficient x + equals: 0. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first coefficient y + equals: 90 degreesToRadians tan negated +] + +{ #category : #tests } +StashBlocTransformationTest >> testTranslate1 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t translateBy: 200 @ 50 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation translateBy: 200 @ 50 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first translation x + equals: 200. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first translation y + equals: 50 +] + +{ #category : #tests } +StashBlocTransformationTest >> testTranslate2 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t translateBy: -200 @ 50 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + transformDo: [:transformation | transformation translateBy: -200 @ 50 ]; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation asElementTransformation + affineTransformation hasTransformations. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations size + equals: 1. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first translation x + equals: -200. + self + assert: + newObject transformation asElementTransformation + affineTransformation transformations first translation y + equals: 50 +] + +{ #category : #tests } +StashBlocTransformationTest >> testTranslate3 [ + + | object source newObject | + object := BlElement new transformDo: [ :t | t translateBy: 0 @ 0 ]. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: + newObject transformation isIdentity. + +] diff --git a/src/Bloc-Serialization-Stash/StashBlocUserDataTest.class.st b/src/Bloc-Serialization-Stash/StashBlocUserDataTest.class.st new file mode 100644 index 0000000..e1e8115 --- /dev/null +++ b/src/Bloc-Serialization-Stash/StashBlocUserDataTest.class.st @@ -0,0 +1,54 @@ +Class { + #name : #StashBlocUserDataTest, + #superclass : #TestCase, + #category : #'Bloc-Serialization-Stash-test-cases' +} + +{ #category : #tests } +StashBlocUserDataTest >> testId1 [ + + | object source newObject | + object := BlElement new id: #toto. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + id: #toto; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject id equals: #toto +] + +{ #category : #tests } +StashBlocUserDataTest >> testId2 [ + + | object source newObject | + object := BlElement new id: nil. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject id equals: nil +] + +{ #category : #tests } +StashBlocUserDataTest >> testId3 [ + + | object source newObject | + object := BlElement new elementId: + ((BlElementId named: #test) indexed: 1). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + elementId: (BlElementIndexedId new + index: 1; + prefixId: (BlElementNamedId new + identifier: #test; + yourself); + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject id equals: 'test-1' +] diff --git a/src/Bloc-Serialization-Stash/StashBlocVisualsTest.class.st b/src/Bloc-Serialization-Stash/StashBlocVisualsTest.class.st new file mode 100644 index 0000000..c2bb8e2 --- /dev/null +++ b/src/Bloc-Serialization-Stash/StashBlocVisualsTest.class.st @@ -0,0 +1,1199 @@ +Class { + #name : #StashBlocVisualsTest, + #superclass : #TestCase, + #category : #'Bloc-Serialization-Stash-test-cases' +} + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBackground1 [ + + | object source | + object := BlElement new background: BlTransparentBackground new. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new' +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBackground2 [ + + | object source newObject | + object := BlElement new + background: Color red; + yourself. + source := Stash new serialize: object. + newObject := self class compiler + source: source; + evaluate. + self assert: object background paint color equals: newObject background paint color +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBackground3 [ + + | object source newObject | + object := BlElement new + background: + (BlBackground paint: + (BlLinearGradientPaint horizontal stops: { + (0 -> Color red). + (1 -> Color blue) })); + yourself. + source := Stash new serialize: object. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject background paint stops equals: { + (0 -> Color red). + (1 -> Color blue) }. +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBackground4 [ + + | object source newObject | + object := BlElement new + background: + (BlBackground paint: + (BlRadialGradientPaint new + stops: { + (0 -> Color red). + (1 -> Color blue) }; + innerCenter: 100 @ 100; + innerRadius: 0; + outerCenter: 200 @ 200; + outerRadius: 200)); + yourself. + source := Stash new serialize: object. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject background paint stops equals: { + (0 -> Color red). + (1 -> Color blue) }. + self assert: newObject background paint innerCenter equals: 100 @ 100. + self assert: newObject background paint innerRadius equals: 0. + self assert: newObject background paint outerCenter equals: 200 @ 200. + self assert: newObject background paint outerRadius equals: 200. +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBackground5 [ + + | object source newObject | + object := BlElement new + background: Color transparent; + yourself. + source := Stash new serialize: object. + newObject := self class compiler + source: source; + evaluate. + self assert: object background paint color equals: newObject background paint color +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder1 [ + + | object source newObject | + object := BlElement new border: (BlBorder paint: Color red). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder10 [ + + | object source newObject | + object := BlElement new border: (BlBorderBuilder new + paint: (BlColorPaint new color: Color red); + width: 5; + joinMiter; + miterLimit: 2.0; + build). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + width: 5; + miterLimit: 2.0; + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red. + self assert: newObject border width equals: 5.0. + self assert: newObject border opacity equals: 1.0. + self assert: newObject border style dashArray equals: #( ). + self assert: newObject border style dashOffset equals: 0.0. + self + assert: newObject border style lineCap + equals: BlStrokeLineCap butt. + self + assert: newObject border style lineJoin + equals: BlStrokeLineJoin miter. + self assert: newObject border style miterLimit equals: 2.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder11 [ + + | object source newObject | + object := BlElement new border: (BlBorderBuilder new + paint: (BlColorPaint new color: Color red); + width: 5; + opacity: 0.5; + build). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + width: 5; + opacity: 0.5; + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red. + self assert: newObject border width equals: 5.0. + self assert: newObject border opacity equals: 0.5. + self assert: newObject border style dashArray equals: #( ). + self assert: newObject border style dashOffset equals: 0.0. + self + assert: newObject border style lineCap + equals: BlStrokeLineCap butt. + self + assert: newObject border style lineJoin + equals: BlStrokeLineJoin miter. + self assert: newObject border style miterLimit equals: 4.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder12 [ + + | object source newObject | + object := BlElement new border: (BlBorderBuilder new + paint: (BlColorPaint new color: Color red); + width: 5; + dashArray: #( 3.5 4 ); + build). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + width: 5; + dashArray: {3.5 . + 4}; + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red. + self assert: newObject border width equals: 5.0. + self assert: newObject border opacity equals: 1.0. + self assert: newObject border style dashArray equals: #( 3.5 4 ). + self assert: newObject border style dashOffset equals: 0.0. + self + assert: newObject border style lineCap + equals: BlStrokeLineCap butt. + self + assert: newObject border style lineJoin + equals: BlStrokeLineJoin miter. + self assert: newObject border style miterLimit equals: 4.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder13 [ + + | object source newObject | + object := BlElement new border: (BlBorderBuilder new + paint: (BlColorPaint new color: Color red); + width: 5; + dashArray: #( 3.5 4 ); + dashOffset: 2.0; + build). + source := Stash new serialize: object.. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + width: 5; + dashArray: {3.5 . + 4}; + dashOffset: 2.0; + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red. + self assert: newObject border width equals: 5.0. + self assert: newObject border opacity equals: 1.0. + self assert: newObject border style dashArray equals: #( 3.5 4 ). + self assert: newObject border style dashOffset equals: 2.0. + self + assert: newObject border style lineCap + equals: BlStrokeLineCap butt. + self + assert: newObject border style lineJoin + equals: BlStrokeLineJoin miter. + self assert: newObject border style miterLimit equals: 4.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder2 [ + + | object source newObject | + object := BlElement new border: (BlBorder paint: Color red width: 3). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + width: 3; + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red. + self assert: newObject border width equals: 3.0. + self assert: newObject border opacity equals: 1.0. + self assert: newObject border style dashArray equals: #( ). + self assert: newObject border style dashOffset equals: 0.0. + self + assert: newObject border style lineCap + equals: BlStrokeLineCap butt. + self + assert: newObject border style lineJoin + equals: BlStrokeLineJoin miter. + self assert: newObject border style miterLimit equals: 4.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder3 [ + + | object source newObject | + object := BlElement new border: (BlBorderBuilder new + paint: (BlColorPaint new color: Color red); + width: 5; + build). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + width: 5; + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red. + self assert: newObject border width equals: 5.0. + self assert: newObject border opacity equals: 1.0. + self assert: newObject border style dashArray equals: #( ). + self assert: newObject border style dashOffset equals: 0.0. + self + assert: newObject border style lineCap + equals: BlStrokeLineCap butt. + self + assert: newObject border style lineJoin + equals: BlStrokeLineJoin miter. + self assert: newObject border style miterLimit equals: 4.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder4 [ + + | object source newObject | + object := BlElement new border: (BlBorderBuilder new + paint: (BlColorPaint new color: Color red); + width: 5; + capButt; + build). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + width: 5; + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red. + self assert: newObject border width equals: 5.0. + self assert: newObject border opacity equals: 1.0. + self assert: newObject border style dashArray equals: #( ). + self assert: newObject border style dashOffset equals: 0.0. + self + assert: newObject border style lineCap + equals: BlStrokeLineCap butt. + self + assert: newObject border style lineJoin + equals: BlStrokeLineJoin miter. + self assert: newObject border style miterLimit equals: 4.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder5 [ + + | object source newObject | + object := BlElement new border: (BlBorderBuilder new + paint: (BlColorPaint new color: Color red); + width: 5; + capRound; + build). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + width: 5; + lineCap: BlStrokeLineCap round; + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red. + self assert: newObject border width equals: 5.0. + self assert: newObject border opacity equals: 1.0. + self assert: newObject border style dashArray equals: #( ). + self assert: newObject border style dashOffset equals: 0.0. + self + assert: newObject border style lineCap + equals: BlStrokeLineCap round. + self + assert: newObject border style lineJoin + equals: BlStrokeLineJoin miter. + self assert: newObject border style miterLimit equals: 4.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder6 [ + + | object source newObject | + object := BlElement new border: (BlBorderBuilder new + paint: (BlColorPaint new color: Color red); + width: 5; + capSquare; + build). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + width: 5; + lineCap: BlStrokeLineCap square; + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red. + self assert: newObject border width equals: 5.0. + self assert: newObject border opacity equals: 1.0. + self assert: newObject border style dashArray equals: #( ). + self assert: newObject border style dashOffset equals: 0.0. + self + assert: newObject border style lineCap + equals: BlStrokeLineCap square. + self + assert: newObject border style lineJoin + equals: BlStrokeLineJoin miter. + self assert: newObject border style miterLimit equals: 4.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder7 [ + + | object source newObject | + object := BlElement new border: (BlBorderBuilder new + paint: (BlColorPaint new color: Color red); + width: 5; + joinBevel; + build). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + width: 5; + lineJoin: BlStrokeLineJoin bevel; + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red. + self assert: newObject border width equals: 5.0. + self assert: newObject border opacity equals: 1.0. + self assert: newObject border style dashArray equals: #( ). + self assert: newObject border style dashOffset equals: 0.0. + self + assert: newObject border style lineCap + equals: BlStrokeLineCap butt. + self + assert: newObject border style lineJoin + equals: BlStrokeLineJoin bevel. + self assert: newObject border style miterLimit equals: 4.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder8 [ + + | object source newObject | + object := BlElement new border: (BlBorderBuilder new + paint: (BlColorPaint new color: Color red); + width: 5; + joinMiter; + build). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + width: 5; + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red. + self assert: newObject border width equals: 5.0. + self assert: newObject border opacity equals: 1.0. + self assert: newObject border style dashArray equals: #( ). + self assert: newObject border style dashOffset equals: 0.0. + self + assert: newObject border style lineCap + equals: BlStrokeLineCap butt. + self + assert: newObject border style lineJoin + equals: BlStrokeLineJoin miter. + self assert: newObject border style miterLimit equals: 4.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementBorder9 [ + + | object source newObject | + object := BlElement new border: (BlBorderBuilder new + paint: (BlColorPaint new color: Color red); + width: 5; + joinRound; + build). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + border: (BlBorderBuilder new + paint: (BlColorPaint new + color: (Color r: 1.0 g: 0.0 b: 0.0 alpha: 1.0); + yourself); + width: 5; + lineJoin: BlStrokeLineJoin round; + build); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject border paint color equals: Color red. + self assert: newObject border width equals: 5.0. + self assert: newObject border opacity equals: 1.0. + self assert: newObject border style dashArray equals: #( ). + self assert: newObject border style dashOffset equals: 0.0. + self + assert: newObject border style lineCap + equals: BlStrokeLineCap butt. + self + assert: newObject border style lineJoin + equals: BlStrokeLineJoin round. + self assert: newObject border style miterLimit equals: 4.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementClipChildren1 [ + + | object source newObject | + object := BlElement new clipChildren: true. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject clipChildren +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementClipChildren2 [ + + | object source newObject | + object := BlElement new clipChildren: false. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + clipChildren: false; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self deny: newObject clipChildren +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementEffect1 [ + + | object source newObject | + object := BlElement new effect: BlNullEffect new. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + effect: BlNullEffect new; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject effect class equals: BlNullEffect +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementEffect2 [ + + | object source newObject | + object := BlElement new effect: + (BlGaussianShadowEffect + color: Color black + width: 5 + offset: 10 @ 20). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + effect: (BlGaussianShadowEffect color: (Color r: 0.0 g: 0.0 b: 0.0 alpha: 1.0) width: 5 offset: 10 @ 20); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject effect class equals: BlGaussianShadowEffect. + self assert: newObject effect color equals: Color black. + self assert: newObject effect width equals: 5. + self assert: newObject effect offset equals: 10 @ 20 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementEffect3 [ + + | object source newObject | + object := BlElement new effect: + (BlSimpleShadowEffect color: Color black offset: 5 @ 41). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + effect: (BlSimpleShadowEffect color: (Color r: 0.0 g: 0.0 b: 0.0 alpha: 1.0) offset: 5 @ 41); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject effect class equals: BlSimpleShadowEffect. + self assert: newObject effect color equals: Color black. + self assert: newObject effect offset equals: 5 @ 41 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementElevation1 [ + + | object source newObject | + object := BlElement new zIndex: 1. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + elevation: (BlRelativeElevation elevation: 1); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject elevation elevation equals: 1 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementElevation2 [ + + | object source newObject | + object := BlElement new zIndex: 4. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + elevation: (BlRelativeElevation elevation: 4); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject elevation elevation equals: 4 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementFocusability1 [ + + | object source newObject | + object := BlElement new + focusability: BlFocusability after; + yourself. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + focusability: BlFocusability after; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject focusability equals: BlFocusability after +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementFocusability2 [ + + | object source newObject | + object := BlElement new + focusability: BlFocusability before; + yourself. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject focusability equals: BlFocusability before +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementFocusability3 [ + + | object source newObject | + object := BlElement new + focusability: BlFocusability block; + yourself. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + focusability: BlFocusability block; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject focusability equals: BlFocusability block +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementFocusability4 [ + + | object source newObject | + object := BlElement new + focusability: BlFocusability ignore; + yourself. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + focusability: BlFocusability ignore; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject focusability equals: BlFocusability ignore +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementFocusability5 [ + + | object source newObject | + object := BlElement new + focusability: BlFocusability none; + yourself. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + focusability: BlFocusability none; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject focusability equals: BlFocusability none +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementFocused1 [ + + | object source newObject | + object := BlElement new focused: false. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject focused equals: false +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementFocused2 [ + + | object source newObject | + object := BlElement new focused: true. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + focused: true; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject focused equals: true +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry1 [ + + | object source newObject | + object := BlElement new geometry: (BlRectangleGeometry new). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: BlRectangleGeometry new; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject geometry equals: BlRectangleGeometry new +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry10 [ + + | object source newObject | + object := BlElement new geometry: + (BlRoundedRectangleGeometry cornerRadii: + (BlCornerRadii new + topLeft: 1; + topRight: 2; + bottomRight: 3; + bottomLeft: 4; + yourself)). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: (BlRoundedRectangleGeometry cornerRadii: (BlCornerRadii new + topLeft: 1; + topRight: 2; + bottomLeft: 4; + bottomRight: 3; + yourself)); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: + (newObject geometry isKindOf: BlRoundedRectangleGeometry). + self assert: newObject geometry cornerRadii topLeft equals: 1. + self assert: newObject geometry cornerRadii topRight equals: 2. + self assert: newObject geometry cornerRadii bottomRight equals: 3. + self assert: newObject geometry cornerRadii bottomLeft equals: 4 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry11 [ + + | object source newObject | + object := BlElement new geometry: BlTriangleGeometry new beTop. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: BlTriangleGeometry new beTop; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: (newObject geometry isKindOf: BlTriangleGeometry). + self assert: newObject geometry isTop +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry12 [ + + | object source newObject | + object := BlElement new geometry: BlTriangleGeometry new beLeft. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: BlTriangleGeometry new beLeft; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: (newObject geometry isKindOf: BlTriangleGeometry). + self assert: newObject geometry isLeft +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry13 [ + + | object source newObject | + object := BlElement new geometry: BlTriangleGeometry new beRight. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: BlTriangleGeometry new beRight; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: (newObject geometry isKindOf: BlTriangleGeometry). + self assert: newObject geometry isRight +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry14 [ + + | object source newObject | + object := BlElement new geometry: BlTriangleGeometry new beBottom. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: BlTriangleGeometry new beBottom; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: (newObject geometry isKindOf: BlTriangleGeometry). + self assert: newObject geometry isBottom +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry15 [ + + | object source newObject | + object := BlElement new geometry: BlTriangleGeometry new. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: BlTriangleGeometry new beRight; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: (newObject geometry isKindOf: BlTriangleGeometry). + self assert: newObject geometry isRight +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry2 [ + + | object source newObject | + object := BlElement new geometry: (BlAnnulusSectorGeometry new + startAngle: 10; + endAngle: 50; + innerRadius: 0.2; + outerRadius: 0.7). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: (BlAnnulusSectorGeometry new + startAngle: 10; + endAngle: 50; + innerRadius: 0.2; + outerRadius: 0.7; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject geometry class equals: BlAnnulusSectorGeometry. + self assert: newObject geometry startAngle equals: 10. + self assert: newObject geometry endAngle equals: 50. + self assert: newObject geometry innerRadius equals: 0.2. + self assert: newObject geometry outerRadius equals: 0.7 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry3 [ + + | object source newObject | + object := BlElement new geometry: + (BlBezierCurveGeometry controlPoints: { + (5 @ 0). + (20 @ 35). + (35 @ 40) }). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: (BlBezierCurveGeometry new + controlPoints: {(5 @ 0) . + (20 @ 35) . + (35 @ 40)}; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject geometry class equals: BlBezierCurveGeometry. + self assert: newObject geometry controlPoints equals: { + (5 @ 0). + (20 @ 35). + (35 @ 40) } +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry4 [ + + | object source newObject | + object := BlElement new geometry: BlCircleGeometry new. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: BlCircleGeometry new; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject geometry class equals: BlCircleGeometry +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry5 [ + + | object source newObject | + object := BlElement new geometry: BlEllipseGeometry new. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: BlEllipseGeometry new; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject geometry class equals: BlEllipseGeometry +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry6 [ + + | object source newObject | + object := (BlElement new geometry: (BlLineGeometry new from: 10@ 0 to: 100 @ 100)). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: (BlLineGeometry new + from: 10 @ 0; + to: 100 @ 100; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject geometry class equals: BlLineGeometry. + self assert: newObject geometry from equals: 10 @ 0. + self assert: newObject geometry to equals: 100 @ 100 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry7 [ + + | object source newObject | + object := BlElement new geometry: (BlPolylineGeometry vertices: { + (100 @ 10). + (40 @ 198). + (190 @ 78). + (10 @ 78). + (160 @ 198) }). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: (BlPolylineGeometry new + vertices: {(100 @ 10) . + (40 @ 198) . + (190 @ 78) . + (10 @ 78) . + (160 @ 198)}; + yourself); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject geometry class equals: BlPolylineGeometry. + self assert: newObject geometry vertices equals: { + (100 @ 10). + (40 @ 198). + (190 @ 78). + (10 @ 78). + (160 @ 198) } +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry8 [ + + | object source newObject | + object := BlElement new geometry: BlSquareGeometry new. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: BlSquareGeometry new; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject geometry class equals: BlSquareGeometry +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementGeometry9 [ + + | object source newObject | + object := BlElement new geometry: + (BlRoundedRectangleGeometry cornerRadius: 4). + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + geometry: (BlRoundedRectangleGeometry cornerRadius: 4); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject geometry equals: (BlRoundedRectangleGeometry cornerRadius: 4) +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementMouseCursor1 [ + + | object source newObject | + object := BlElement new mouseCursor: nil. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject mouseCursor equals: nil +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementMouseCursor2 [ + + | object source newObject | + object := BlElement new mouseCursor: Cursor webLink. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + mouseCursor: (Cursor classPool at: #WebLinkCursor); + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject mouseCursor equals: Cursor webLink +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementOpacity1 [ + + | object source newObject | + object := BlElement new opacity: 1.0. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject opacity equals: 1.0 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementOpacity2 [ + + | object source newObject | + object := BlElement new opacity: 0.2. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + opacity: 0.2; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject opacity equals: 0.2 +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementOutskirst1 [ + + | object source newObject | + object := BlElement new outskirts: BlOutskirts inside. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject outskirts class equals: BlOutskirtsInside +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementOutskirst2 [ + + | object source newObject | + object := BlElement new outskirts: BlOutskirts centered. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + outskirts: BlOutskirts centered; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject outskirts class equals: BlOutskirtsCentered +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementOutskirst3 [ + + | object source newObject | + object := BlElement new outskirts: BlOutskirts outside. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + outskirts: BlOutskirts outside; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject outskirts class equals: BlOutskirtsOutside +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementVisibility1 [ + + | object source newObject | + object := BlElement new visibility: BlVisibility visible. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject visibility isVisible. +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementVisibility2 [ + + | object source newObject | + object := BlElement new visibility: BlVisibility hidden. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + visibility: BlVisibility hidden; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject visibility isHidden +] + +{ #category : #tests } +StashBlocVisualsTest >> testBlElementVisibility3 [ + + | object source newObject | + object := BlElement new visibility: BlVisibility gone. + source := Stash new serialize: object. + self assert: source equals: 'BlElement new + visibility: BlVisibility gone; + yourself'. + newObject := self class compiler + source: source; + evaluate. + self assert: newObject visibility isGone +] diff --git a/src/Bloc-Serialization-Stash/StashContructGeneralObjectsStep.extension.st b/src/Bloc-Serialization-Stash/StashContructGeneralObjectsStep.extension.st new file mode 100644 index 0000000..73ed2a4 --- /dev/null +++ b/src/Bloc-Serialization-Stash/StashContructGeneralObjectsStep.extension.st @@ -0,0 +1,119 @@ +Extension { #name : #StashContructGeneralObjectsStep } + +{ #category : #'*Bloc-Serialization-Stash' } +StashContructGeneralObjectsStep >> constructBlAttributeRope: aStashObject on: aStash [ + + aStash addOnSourceCode: aStashObject constructorOrTag. + aStashObject isPropertiesSet ifTrue: [ ^ self ]. + + aStashObject propertiesAreSet. + aStash addOnSourceCode: ''. + self + setProperty: #attributes asStashProperty + ofObject: aStashObject object + on: aStash. + aStash addOnSourceCode: ''. + self setProperty: #rope asStashProperty ofObject: aStashObject object on: aStash +] + +{ #category : #'*Bloc-Serialization-Stash' } +StashContructGeneralObjectsStep >> constructBlLayoutConstraints: aStashObject on: aStash [ + "horizontal - vertical" + + aStash addOnSourceCode: '[ :constraints |'. + aStashObject allHorizontalSetters + do: [ :aProperty | + aStash addOnSourceCode: 'constraints horizontal '. + self + setProperty: aProperty + ofObject: aStashObject object + on: aStash. + aStash addOnSourceCode: '.' ]. + aStashObject allVerticalSetters + do: [ :aProperty | + aStash addOnSourceCode: 'constraints vertical '. + self + setProperty: aProperty + ofObject: aStashObject object + on: aStash. + aStash addOnSourceCode: '.' ]. + + "Layout" + aStashObject allLayoutSettersAndNames do: [ :association | + | currentLayoutConstraints | + currentLayoutConstraints := aStashObject object perform: + association key. + + "Layout :: horizontal - vertical" + (aStashObject allHorizontalSettersFor: currentLayoutConstraints) + do: [ :aProperty | + aStash addOnSourceCode: 'constraints '. + aStash addOnSourceCode: association key. + aStash addOnSourceCode: ' horizontal '. + self + setProperty: aProperty + ofObject: currentLayoutConstraints + on: aStash. + aStash addOnSourceCode: '.' ]. + (aStashObject allVerticalSettersFor: currentLayoutConstraints) + do: [ :aProperty | + aStash addOnSourceCode: 'constraints '. + aStash addOnSourceCode: association key. + aStash addOnSourceCode: ' vertical '. + self + setProperty: aProperty + ofObject: currentLayoutConstraints + on: aStash. + aStash addOnSourceCode: '.' ]. + + "Layout :: Properties" + association value + do: [ :aProperty | + aStash addOnSourceCode: 'constraints '. + aStash addOnSourceCode: association key. + aStash addOnSourceCode: ' '. + self + setProperty: aProperty + ofObject: currentLayoutConstraints + on: aStash. + aStash addOnSourceCode: '.' ] ]. + + "Properties" + aStashObject allSetters + do: [ :aProperty | + aStash addOnSourceCode: 'constraints '. + self + setProperty: aProperty + ofObject: aStashObject object + on: aStash. + aStash addOnSourceCode: '.' ]. + aStash addOnSourceCode: ']' +] + +{ #category : #'*Bloc-Serialization-Stash' } +StashContructGeneralObjectsStep >> constructBlTransformation: aStashObject on: aStash [ + + aStash addOnSourceCode: '[ :transformation |'. + + "Default origin" + (aStashObject allSettersFor: aStashObject defaultOrigin + ) do: [ + :aProperty | + aStash addOnSourceCode: 'transformation '. + self setProperty: aProperty ofObject: aStashObject object on: aStash. + aStash addOnSourceCode: '.' ]. + + "Custom origin" + aStashObject allSettersOriginsExceptDefault: [ :origin | + aStash addOnSourceCode: 'transformation '. + aStash addOnSourceCode: origin asStashMethodForTransformationBloc. + aStash addOnSourceCode: '.'. + (aStashObject allSettersFor: origin) do: [ :aProperty | + aStash addOnSourceCode: 'transformation '. + self + setProperty: aProperty + ofObject: aStashObject object + on: aStash. + aStash addOnSourceCode: '.' ] ]. + aStash addOnSourceCode: ']' +] diff --git a/src/Bloc-Serialization-Stash/TBlAlignable.extension.st b/src/Bloc-Serialization-Stash/TBlAlignable.extension.st new file mode 100644 index 0000000..f4d6122 --- /dev/null +++ b/src/Bloc-Serialization-Stash/TBlAlignable.extension.st @@ -0,0 +1,20 @@ +Extension { #name : #TBlAlignable } + +{ #category : #'*Bloc-Serialization-Stash' } +TBlAlignable >> allSetterAndGettersOfTraitForMyStash: anObject [ + + ^ { ([ :alignement | + | val | + val := #alignNone. + alignement isAlignTopLeft ifTrue: [ val := #alignTopLeft ]. + alignement isAlignTopCenter ifTrue: [ val := #alignTopCenter ]. + alignement isAlignTopRight ifTrue: [ val := #alignTopRight ]. + alignement isAlignCenterLeft ifTrue: [ val := #alignCenterLeft ]. + alignement isAlignCenter ifTrue: [ val := #alignCenter ]. + alignement isAlignCenterRight ifTrue: [ val := #alignCenterRight ]. + alignement isAlignBottomLeft ifTrue: [ val := #alignBottomLeft ]. + alignement isAlignBottomCenter ifTrue: [ + val := #alignBottomCenter ]. + alignement isAlignBottomRight ifTrue: [ val := #alignBottomRight ]. + val ] -> self) onlySetOnStash } +] diff --git a/src/Bloc-Serialization-Stash/package.st b/src/Bloc-Serialization-Stash/package.st new file mode 100644 index 0000000..d888a34 --- /dev/null +++ b/src/Bloc-Serialization-Stash/package.st @@ -0,0 +1 @@ +Package { #name : #'Bloc-Serialization-Stash' }