diff --git a/src/Bloc-Examples/BlGeometryVisualAndLayoutBoundsExamples.class.st b/src/Bloc-Examples/BlGeometryVisualAndLayoutBoundsExamples.class.st index a5f1621f4..a730ee04e 100644 --- a/src/Bloc-Examples/BlGeometryVisualAndLayoutBoundsExamples.class.st +++ b/src/Bloc-Examples/BlGeometryVisualAndLayoutBoundsExamples.class.st @@ -304,7 +304,7 @@ BlGeometryVisualAndLayoutBoundsExamples >> rectangleWithSmallerGeometryOutside [ { #category : #star } BlGeometryVisualAndLayoutBoundsExamples >> starPolygon [ - + ^ BlPolygonGeometry vertices: {(100 @ 50). @@ -322,7 +322,8 @@ BlGeometryVisualAndLayoutBoundsExamples >> starPolygon [ { #category : #star } BlGeometryVisualAndLayoutBoundsExamples >> starWithSmallerGeometry [ - + "Star element in debug mode, displaying bounds" + | aStarElement | aStarElement := BlDevElement new. aStarElement geometry: self starPolygon. diff --git a/src/Bloc-Examples/BlGeometryVisualAndLayoutBoundsTestOld.class.st b/src/Bloc-Examples/BlGeometryVisualAndLayoutBoundsTestOld.class.st new file mode 100644 index 000000000..d179e153e --- /dev/null +++ b/src/Bloc-Examples/BlGeometryVisualAndLayoutBoundsTestOld.class.st @@ -0,0 +1,360 @@ +" +I have been automatically converted and probably manually tweaked from BlGeometryVisualAndLayoutBoundsExamples. Pay attention there is an important design decision in such tests. First to let GT people execute them, the tests and helpers are tagged with do not remove them, let also the . + Finally and more important such tests should not use setup because every method should be in capacity of returning a fully working object called an example :) +" +Class { + #name : #BlGeometryVisualAndLayoutBoundsTestOld, + #superclass : #TestCase, + #traits : 'TBlExample', + #classTraits : 'TBlExample classTrait', + #category : #'Bloc-Examples' +} + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testAlignedIcon [ + + | anIconElement aLabelElement aContainerElement | + anIconElement := self testEmptyIconElement geometry: + self testTrianglePolygon. + aLabelElement := self testTextElementWithRunText. + aContainerElement := self testIconAndTextContainer. + aContainerElement addChildren: { + anIconElement. + aLabelElement }. + ^ aContainerElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testCenteredOutskirts [ + "Rectangle and star elements with centered stroke" + + | aContainer | + aContainer := self testContainer. + aContainer addChild: self testRectangleWithSmallerGeometryCentered. + aContainer addChild: self testStarWithSmallerGeometryCentered. + + ^ aContainer +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testClippedTriangle [ + + + "Clipped triangle polygon with layount bounds" + | aContainer | + aContainer := self testUnclippedTriangle. + aContainer clipChildren: true. + ^ aContainer +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testContainer [ + + + + | aContainer | + aContainer := BlElement new. + aContainer layout: (BlGridLayout horizontal cellSpacing: 20). + aContainer margin: (BlInsets all: 10). + aContainer padding: (BlInsets all: 10). + aContainer constraintsDo: [ :c | + c horizontal fitContent. + c vertical fitContent ]. + ^ aContainer +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testDebuggingAlignedIcon [ + + + | aContainerElement | + aContainerElement := self alignedIcon. + ^ aContainerElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testDebuggingMisalignedIcon [ + + + | aContainerElement | + aContainerElement := self misalignedIcon. + aContainerElement children first. + ^ aContainerElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testDebuggingMode [ + + + + | aContainer | + aContainer := self fullyVisibleTriangle. + ^ aContainer +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testEmptyIconElement [ + + + ^ BlDevElement new + size: 8 @ 12; + background: Color green muchDarker +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testFullyVisibleTriangle [ + + + + | aContainer | + aContainer := self clippedTriangle. + aContainer clipChildren: false. + aContainer position: 30 @ 30. + ^ aContainer +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testIconAndTextContainer [ + + + | aContainerElement | + aContainerElement := BlElement new + layout: BlLinearLayout horizontal alignCenter; + constraintsDo: [ :c | + c horizontal fitContent. + c vertical fitContent ]; + background: (Color gray alpha: 0.3); + padding: (BlInsets all: 3); + margin: (BlInsets left: 5). + aContainerElement transformDo: [ :t | + t origin: BlAffineTransformationTopLeftOrigin new. + t scaleBy: 5 ]. + ^ aContainerElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testInsideOutskirts [ + + + + | aContainer | + aContainer := self container. + aContainer addChild: self rectangleWithSmallerGeometryInside. + aContainer addChild: self starWithSmallerGeometryInside. + + ^ aContainer +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testMisalignedIcon [ + + + | anIconElement aLabelElement aContainerElement | + anIconElement := self emptyIconElement geometry: + self misalignedTrianglePolygon. + aLabelElement := self textElementWithRunText. + aContainerElement := self iconAndTextContainer. + aContainerElement addChildren: { + anIconElement. + aLabelElement }. + ^ aContainerElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testMisalignedTrianglePolygon [ + + + + ^ BlPolygonGeometry vertices: { + (0 @ 3). + (8 @ 7.5). + (0 @ 12) } +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testOutsideOutskirts [ + + + + | aContainer | + aContainer := self container. + aContainer addChild: self rectangleWithSmallerGeometryOutside. + aContainer addChild: self starWithSmallerGeometryOutside. + + ^ aContainer +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testRectanglePolygon [ + + + + ^ BlPolygonGeometry vertices: { + (50 @ 50). + (150 @ 50). + (150 @ 100). + (50 @ 100) } +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testRectangleWithSmallerGeometry [ + + + + | aRectangleElement | + aRectangleElement := BlDevElement new. + aRectangleElement geometry: self testRectanglePolygon. + aRectangleElement size: 200 @ 150. + aRectangleElement background: (Color gray alpha: 0.2). + aRectangleElement border: + (BlBorder paint: (Color gray alpha: 0.5) width: 10). + + ^ aRectangleElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testRectangleWithSmallerGeometryCentered [ + "Rectangle element with centered stroke" + + | aRectangleElement | + aRectangleElement := self testRectangleWithSmallerGeometry. + aRectangleElement outskirts: BlOutskirts centered. + + ^ aRectangleElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testRectangleWithSmallerGeometryInside [ + + + + | aRectangleElement | + aRectangleElement := self rectangleWithSmallerGeometry. + aRectangleElement outskirts: BlOutskirts inside. + + ^ aRectangleElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testRectangleWithSmallerGeometryOutside [ + + + + | aRectangleElement | + aRectangleElement := self rectangleWithSmallerGeometry. + aRectangleElement outskirts: BlOutskirts outside. + + ^ aRectangleElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testStarPolygon [ + + ^ BlPolygonGeometry vertices: { + (100 @ 50). + (115 @ 90). + (150 @ 90). + (125 @ 110). + (135 @ 150). + (100 @ 130). + (65 @ 150). + (75 @ 110). + (50 @ 90). + (85 @ 90) } +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testStarWithSmallerGeometry [ + "Star element in debug mode, displaying bounds" + + | aStarElement | + aStarElement := BlDevElement new. + aStarElement geometry: self testStarPolygon. + aStarElement size: 200 @ 200. + aStarElement background: (Color gray alpha: 0.2). + aStarElement border: + (BlBorder paint: (Color gray alpha: 0.5) width: 10). + ^ aStarElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testStarWithSmallerGeometryCentered [ + + + "Star element with centered stroke" + | aStarElement | + aStarElement := self testStarWithSmallerGeometry. + aStarElement outskirts: BlOutskirts centered. + + ^ aStarElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testStarWithSmallerGeometryInside [ + + + + | aStarElement | + aStarElement := self starWithSmallerGeometry. + aStarElement outskirts: BlOutskirts inside. + + ^ aStarElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testStarWithSmallerGeometryOutside [ + + + + | aStarElement | + aStarElement := self starWithSmallerGeometry. + aStarElement outskirts: BlOutskirts outside. + + ^ aStarElement +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testTextElementWithRunText [ + + ^ BlTextElement new text: 'Run' asRopedText +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testTrianglePolygon [ + + ^ BlPolygonGeometry vertices: { + (0 @ 0). + (8 @ 6). + (0 @ 12) } +] + +{ #category : #tests } +BlGeometryVisualAndLayoutBoundsTestOld >> testUnclippedTriangle [ + "Clipped triangle polygon with layount bounds" + + | aContainer aPolygonElement | + aContainer := BlElement new. + aContainer size: 8 @ 11. + aContainer position: 50 @ 50. + aContainer clipChildren: false. + aContainer transformDo: [ :t | + t origin: BlAffineTransformationTopLeftOrigin new. + t scaleBy: 10 ]. + aContainer outskirts: BlOutskirts centered. + aContainer border: + (BlBorder paint: (Color green alpha: 0.4) width: 0.2). + + aPolygonElement := BlElement new. + aPolygonElement size: 8 @ 11. + aPolygonElement geometry: (BlPolygon vertices: { + (0 @ 0). + (8 @ 5.5). + (0 @ 11) }). + aPolygonElement border: + (BlBorder paint: (Color gray alpha: 0.4) width: 2). + aPolygonElement outskirts: BlOutskirts centered. + + aContainer addChild: aPolygonElement. + + ^ aContainer +] diff --git a/src/Bloc-Infinite/BlInfiniteDataSourceManager.class.st b/src/Bloc-Infinite/BlInfiniteDataSourceManager.class.st index a53c72d55..ae80f9346 100644 --- a/src/Bloc-Infinite/BlInfiniteDataSourceManager.class.st +++ b/src/Bloc-Infinite/BlInfiniteDataSourceManager.class.st @@ -205,7 +205,6 @@ BlInfiniteDataSourceManager >> hasAddCommand [ BlInfiniteDataSourceManager >> hasCommands [ "Return true if there are both pending and postponed commands, otherwise false" - ^ self hasPendingCommands and: [ self hasPostponedCommands ] ] diff --git a/src/Bloc-Infinite/BlInfiniteLayoutOrientation.class.st b/src/Bloc-Infinite/BlInfiniteLayoutOrientation.class.st index 87a612603..3a11a2253 100644 --- a/src/Bloc-Infinite/BlInfiniteLayoutOrientation.class.st +++ b/src/Bloc-Infinite/BlInfiniteLayoutOrientation.class.st @@ -185,7 +185,6 @@ BlInfiniteLayoutOrientation >> startWithPadding [ { #category : #geometry } BlInfiniteLayoutOrientation >> totalSpace [ "Returns the total space to layout" - ^ self endWithPadding - self startWithPadding ] diff --git a/src/Bloc-Text-Rope/BlRopedText.class.st b/src/Bloc-Text-Rope/BlRopedText.class.st index f98497280..88a265d3f 100644 --- a/src/Bloc-Text-Rope/BlRopedText.class.st +++ b/src/Bloc-Text-Rope/BlRopedText.class.st @@ -285,7 +285,6 @@ BlRopedText >> internalRepresentation [ { #category : #'text - testing' } BlRopedText >> isEmpty [ - ^ self rope size = 0 ] diff --git a/src/Bloc-Text-Rope/BlRopedTextIterator.class.st b/src/Bloc-Text-Rope/BlRopedTextIterator.class.st index c64afd52c..8f4618862 100644 --- a/src/Bloc-Text-Rope/BlRopedTextIterator.class.st +++ b/src/Bloc-Text-Rope/BlRopedTextIterator.class.st @@ -67,7 +67,6 @@ BlRopedTextIterator >> hasPrevious [ { #category : #'iterator - enumeration' } BlRopedTextIterator >> next [ "Return an item (character) at current position and move one to the right" - ^ iterator next ] diff --git a/src/Bloc-Text/BlEmptyText.class.st b/src/Bloc-Text/BlEmptyText.class.st index 2b311cb65..bea7ed9e5 100644 --- a/src/Bloc-Text/BlEmptyText.class.st +++ b/src/Bloc-Text/BlEmptyText.class.st @@ -103,7 +103,6 @@ BlEmptyText >> insertText: aString at: anIndex [ { #category : #'text - testing' } BlEmptyText >> isEmpty [ - ^ true ] diff --git a/src/Bloc-Text/BlSubTextIterator.class.st b/src/Bloc-Text/BlSubTextIterator.class.st index 6bad1f4f5..4f64cfc55 100644 --- a/src/Bloc-Text/BlSubTextIterator.class.st +++ b/src/Bloc-Text/BlSubTextIterator.class.st @@ -74,7 +74,6 @@ BlSubTextIterator >> hasPrevious [ { #category : #'iterator - enumeration' } BlSubTextIterator >> next [ "Return an item (character) at current position and move one to the right" - ^ iterator next ] diff --git a/src/Bloc-Text/BlText.class.st b/src/Bloc-Text/BlText.class.st index f7df4c376..965252719 100644 --- a/src/Bloc-Text/BlText.class.st +++ b/src/Bloc-Text/BlText.class.st @@ -463,7 +463,6 @@ BlText >> internalRepresentation [ BlText >> isEmpty [ "Return true if this text is empty, false otherwise. Note: Override me to provide performance optimized implementation" - ^ self subclassResponsibility ] diff --git a/src/Bloc-Text/BlTextIterator.class.st b/src/Bloc-Text/BlTextIterator.class.st index 621a17990..8e626908b 100644 --- a/src/Bloc-Text/BlTextIterator.class.st +++ b/src/Bloc-Text/BlTextIterator.class.st @@ -70,7 +70,6 @@ BlTextIterator >> hasPrevious [ { #category : #'iterator - enumeration' } BlTextIterator >> next [ "Return an item (character) at current position and move one to the right" - ^ self subclassResponsibility ] diff --git a/src/Bloc-Text/BlTextReadStream.class.st b/src/Bloc-Text/BlTextReadStream.class.st index e4fe2f38f..78120fd6d 100644 --- a/src/Bloc-Text/BlTextReadStream.class.st +++ b/src/Bloc-Text/BlTextReadStream.class.st @@ -42,7 +42,7 @@ BlTextReadStream >> iterator: aBlTextIterator [ { #category : #'stream - enumeration' } BlTextReadStream >> next [ "Return an item (character) at current position and move one to the right" - + ^ self iterator next ] diff --git a/src/Bloc/BlAttributeRope.class.st b/src/Bloc/BlAttributeRope.class.st index d122fe059..fe7ef3e6f 100644 --- a/src/Bloc/BlAttributeRope.class.st +++ b/src/Bloc/BlAttributeRope.class.st @@ -207,8 +207,7 @@ BlAttributeRope >> isAttributed [ { #category : #'rope - testing' } BlAttributeRope >> isEmpty [ "Attribute rope is empty then and only then when attributes and underlying rope are empty" - - + ^ self attributes isEmpty and: [ self rope isEmpty ] ] diff --git a/src/Bloc/BlBitflags.class.st b/src/Bloc/BlBitflags.class.st index 880900a2c..993a20206 100644 --- a/src/Bloc/BlBitflags.class.st +++ b/src/Bloc/BlBitflags.class.st @@ -237,7 +237,6 @@ BlBitflags >> initializeWith: aValue [ { #category : #testing } BlBitflags >> isEmpty [ - ^ self value isZero ] diff --git a/src/Bloc/BlChildren.class.st b/src/Bloc/BlChildren.class.st index 1fa50372f..82c400501 100644 --- a/src/Bloc/BlChildren.class.st +++ b/src/Bloc/BlChildren.class.st @@ -248,7 +248,6 @@ BlChildren >> isCollection [ { #category : #'children - testing' } BlChildren >> isEmpty [ - ^ self size isZero ] diff --git a/src/Bloc/BlHandlerRegistry.class.st b/src/Bloc/BlHandlerRegistry.class.st index c336c8c0f..c80f8ef67 100644 --- a/src/Bloc/BlHandlerRegistry.class.st +++ b/src/Bloc/BlHandlerRegistry.class.st @@ -137,7 +137,7 @@ BlHandlerRegistry >> hasHandler: anEventHandler [ { #category : #'api - testing' } BlHandlerRegistry >> isEmpty [ "Return true if registry is empty (there are no handlers), false otherwise" - + ^ self numberOfHandlers isZero ] diff --git a/src/Bloc/BlLayoutChildNode.class.st b/src/Bloc/BlLayoutChildNode.class.st index 76adeed7d..7deb71a92 100644 --- a/src/Bloc/BlLayoutChildNode.class.st +++ b/src/Bloc/BlLayoutChildNode.class.st @@ -96,7 +96,6 @@ BlLayoutChildNode >> position [ { #category : #'api - geometry' } BlLayoutChildNode >> position: aPoint [ "Set position of the top left corner in the parent coordinate system" - measurement position: aPoint ] diff --git a/src/Bloc/BlLayoutChildNodeWithEdges.class.st b/src/Bloc/BlLayoutChildNodeWithEdges.class.st index d254c794b..c547cea95 100644 --- a/src/Bloc/BlLayoutChildNodeWithEdges.class.st +++ b/src/Bloc/BlLayoutChildNodeWithEdges.class.st @@ -153,7 +153,6 @@ BlLayoutChildNodeWithEdges >> position [ { #category : #'api - geometry' } BlLayoutChildNodeWithEdges >> position: aPoint [ "Set position of the top left corner in the parent coordinate system" - childNode position: aPoint ] diff --git a/src/Bloc/BlLayoutChildNodeWithElement.class.st b/src/Bloc/BlLayoutChildNodeWithElement.class.st index a0e0362d1..76a384b7b 100644 --- a/src/Bloc/BlLayoutChildNodeWithElement.class.st +++ b/src/Bloc/BlLayoutChildNodeWithElement.class.st @@ -100,7 +100,6 @@ BlLayoutChildNodeWithElement >> position [ { #category : #'api - geometry' } BlLayoutChildNodeWithElement >> position: aPoint [ "Set position of the top left corner in the parent coordinate system" - childNode position: aPoint ] diff --git a/src/Bloc/BlLayoutGraphIterator.class.st b/src/Bloc/BlLayoutGraphIterator.class.st index 9146bd5de..31988cb65 100644 --- a/src/Bloc/BlLayoutGraphIterator.class.st +++ b/src/Bloc/BlLayoutGraphIterator.class.st @@ -54,7 +54,6 @@ BlLayoutGraphIterator >> hasNone [ { #category : #'api - testing' } BlLayoutGraphIterator >> isEmpty [ - ^ self hasNone ] diff --git a/src/Bloc/BlMonotoneSelection.class.st b/src/Bloc/BlMonotoneSelection.class.st index 212bf8f5c..8e9a8cef1 100644 --- a/src/Bloc/BlMonotoneSelection.class.st +++ b/src/Bloc/BlMonotoneSelection.class.st @@ -223,7 +223,6 @@ BlMonotoneSelection >> invariant [ { #category : #testing } BlMonotoneSelection >> isEmpty [ "Return true if selection is empty, false otherwise" - ^ self to <= self from ] diff --git a/src/Bloc/BlRope.class.st b/src/Bloc/BlRope.class.st index ffbafdf4e..17fba8c20 100644 --- a/src/Bloc/BlRope.class.st +++ b/src/Bloc/BlRope.class.st @@ -299,8 +299,7 @@ BlRope >> isConcatenation [ { #category : #'rope - testing' } BlRope >> isEmpty [ "Return true if rope is empty, false otherwise" - - + ^ self size isZero ] diff --git a/src/Bloc/BlVector.class.st b/src/Bloc/BlVector.class.st index c7fe7f3f3..e47d5df63 100644 --- a/src/Bloc/BlVector.class.st +++ b/src/Bloc/BlVector.class.st @@ -93,7 +93,6 @@ BlVector class >> zAxis [ { #category : #'instance creation' } BlVector class >> zero [ "Return a vector of zero length." - ^ Zero ifNil: [ Zero := self x: 0 y: 0 z: 0 ] ] diff --git a/src/Bloc/TBlLayoutChildNode.trait.st b/src/Bloc/TBlLayoutChildNode.trait.st index b3135e0e8..4971fff6e 100644 --- a/src/Bloc/TBlLayoutChildNode.trait.st +++ b/src/Bloc/TBlLayoutChildNode.trait.st @@ -93,7 +93,6 @@ TBlLayoutChildNode >> position [ { #category : #'api - geometry' } TBlLayoutChildNode >> position: aPoint [ "Set position of the top left corner in the parent coordinate system" - self explicitRequirement ]