Skip to content

Commit

Permalink
Merge pull request #2 from nkinesis/master
Browse files Browse the repository at this point in the history
Add RSOvalLayout
  • Loading branch information
akevalion committed Dec 29, 2023
2 parents 6c86983 + 02a3255 commit e1a268b
Show file tree
Hide file tree
Showing 84 changed files with 993 additions and 1,058 deletions.
Expand Up @@ -2,9 +2,7 @@
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
"
Class {
#name : 'ManifestRoassalLayoutsTests',
#superclass : 'PackageManifest',
#category : 'Roassal-Layouts-Tests-Manifest',
#package : 'Roassal-Layouts-Tests',
#tag : 'Manifest'
#name : #ManifestRoassalLayoutsTests,
#superclass : #PackageManifest,
#category : 'Roassal-Layouts-Tests-Manifest'
}
29 changes: 14 additions & 15 deletions src/Roassal-Layouts-Tests/RSAlignmentTest.class.st
@@ -1,20 +1,19 @@
Class {
#name : 'RSAlignmentTest',
#superclass : 'TestCase',
#name : #RSAlignmentTest,
#superclass : #TestCase,
#instVars : [
'align'
],
#category : 'Roassal-Layouts-Tests',
#package : 'Roassal-Layouts-Tests'
#category : 'Roassal-Layouts-Tests'
}

{ #category : 'running' }
{ #category : #running }
RSAlignmentTest >> setUp [
super setUp.
align := RSAlignment new
]

{ #category : 'tests' }
{ #category : #tests }
RSAlignmentTest >> testCenter [
| es |
es := (1 to: 5) collect: [ :v | RSLayoutNode new size: 10 ] as: RSGroup.
Expand All @@ -24,7 +23,7 @@ RSAlignmentTest >> testCenter [
self assert: es encompassingRectangle equals: ((0.0@0.0) corner: (70.0@10.0))
]

{ #category : 'tests' }
{ #category : #tests }
RSAlignmentTest >> testFromBottom [
| es |
es := (10 to: 100 by: 10) collect: [ :n | RSLayoutNode new size: n; yourself ].
Expand All @@ -37,7 +36,7 @@ RSAlignmentTest >> testFromBottom [
self assert: (es collect: [ :e | e encompassingRectangle bottom ]) asArray equals: #(170.0 170.0 170.0 170.0 170.0 170.0 170.0 170.0 170.0 170.0)
]

{ #category : 'tests' }
{ #category : #tests }
RSAlignmentTest >> testFromLeft [
| es |
es := (10 to: 100 by: 10) collect: [ :n | RSLayoutNode new size: n; yourself ].
Expand All @@ -50,7 +49,7 @@ RSAlignmentTest >> testFromLeft [
self assert: (es collect: [ :e | e encompassingRectangle left ]) asArray equals: #(-150.0 -150.0 -150.0 -150.0 -150.0 -150.0 -150.0 -150.0 -150.0 -150.0)
]

{ #category : 'tests' }
{ #category : #tests }
RSAlignmentTest >> testFromLeftWithAFixShape [
| es |
es := (10 to: 100 by: 10) collect: [ :n | RSLayoutNode new size: n; yourself ].
Expand All @@ -62,7 +61,7 @@ RSAlignmentTest >> testFromLeftWithAFixShape [
self assert: (es collect: [ :e | e encompassingRectangle left ]) asArray equals: #(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)
]

{ #category : 'tests' }
{ #category : #tests }
RSAlignmentTest >> testFromLeftWithFixedShape [
| es c |
es := (10 to: 100 by: 10) collect: [ :n | RSLayoutNode new size: n; yourself ].
Expand All @@ -80,7 +79,7 @@ RSAlignmentTest >> testFromLeftWithFixedShape [
self assert: (es collect: [ :e | e encompassingRectangle left ]) asArray equals: #(-150.0 -150.0 -150.0 -150.0 -150.0 -150.0 -150.0 -150.0 -150.0 -150.0)
]

{ #category : 'tests' }
{ #category : #tests }
RSAlignmentTest >> testFromRight [
| es |
es := (10 to: 100 by: 10) collect: [ :n | RSLayoutNode new size: n; yourself ].
Expand All @@ -93,7 +92,7 @@ RSAlignmentTest >> testFromRight [
self assert: (es collect: [ :e | e encompassingRectangle right ]) asArray equals: #(170.0 170.0 170.0 170.0 170.0 170.0 170.0 170.0 170.0 170.0)
]

{ #category : 'tests' }
{ #category : #tests }
RSAlignmentTest >> testFromTop [
| es |
es := (10 to: 100 by: 10) collect: [ :n | RSLayoutNode new size: n; yourself ].
Expand All @@ -106,7 +105,7 @@ RSAlignmentTest >> testFromTop [
self assert: (es collect: [ :e | e encompassingRectangle top ]) asArray equals: #(-50.0 -50.0 -50.0 -50.0 -50.0 -50.0 -50.0 -50.0 -50.0 -50.0)
]

{ #category : 'tests' }
{ #category : #tests }
RSAlignmentTest >> testFromTopWithAFixShape [
| es |
es := (10 to: 100 by: 10) collect: [ :n | RSLayoutNode new size: n; yourself ].
Expand All @@ -121,7 +120,7 @@ RSAlignmentTest >> testFromTopWithAFixShape [
self assert: (es collect: [ :e | e encompassingRectangle top ]) asArray equals: #(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)
]

{ #category : 'tests' }
{ #category : #tests }
RSAlignmentTest >> testHasElement [
self deny: align hasShape.
align shapes: (Array with: RSLayoutNode new).
Expand All @@ -130,7 +129,7 @@ RSAlignmentTest >> testHasElement [
self deny: align hasShape
]

{ #category : 'tests' }
{ #category : #tests }
RSAlignmentTest >> testNoErrorOnDefault [

RSAlignment new left; right; top; bottom
Expand Down
17 changes: 8 additions & 9 deletions src/Roassal-Layouts-Tests/RSAngleLineLayoutTest.class.st
@@ -1,11 +1,10 @@
Class {
#name : 'RSAngleLineLayoutTest',
#superclass : 'RSLayoutTest',
#category : 'Roassal-Layouts-Tests',
#package : 'Roassal-Layouts-Tests'
#name : #RSAngleLineLayoutTest,
#superclass : #RSLayoutTest,
#category : 'Roassal-Layouts-Tests'
}

{ #category : 'tests' }
{ #category : #tests }
RSAngleLineLayoutTest >> testBasic [

| layout angle |
Expand All @@ -16,7 +15,7 @@ RSAngleLineLayoutTest >> testBasic [
self assert: layout angle equals: angle
]

{ #category : 'tests' }
{ #category : #tests }
RSAngleLineLayoutTest >> testGapSize [

| layout var1st var2nd |
Expand All @@ -28,7 +27,7 @@ RSAngleLineLayoutTest >> testGapSize [
self assert: var2nd position closeTo: 107.5 @ 2.5
]

{ #category : 'tests' }
{ #category : #tests }
RSAngleLineLayoutTest >> testLayoutWith0Angle [

| layout x gap |
Expand All @@ -41,7 +40,7 @@ RSAngleLineLayoutTest >> testLayoutWith0Angle [
x := x + each width + gap ]
]

{ #category : 'tests' }
{ #category : #tests }
RSAngleLineLayoutTest >> testLayoutWith90Angle [

| layout y gap |
Expand All @@ -55,7 +54,7 @@ RSAngleLineLayoutTest >> testLayoutWith90Angle [
y := y + each height + gap ]
]

{ #category : 'tests' }
{ #category : #tests }
RSAngleLineLayoutTest >> testLayoutWithThreeElements [
| layout gap extent |
layout := RSAngleLineLayout new.
Expand Down
Expand Up @@ -2,13 +2,12 @@
A RSCircularAroundAVertexLayoutTest is a test class for testing the behavior of RSCircularAroundAVertexLayout
"
Class {
#name : 'RSCircularAroundAVertexLayoutTest',
#superclass : 'RSLayoutTest',
#category : 'Roassal-Layouts-Tests',
#package : 'Roassal-Layouts-Tests'
#name : #RSCircularAroundAVertexLayoutTest,
#superclass : #RSLayoutTest,
#category : 'Roassal-Layouts-Tests'
}

{ #category : 'tests' }
{ #category : #tests }
RSCircularAroundAVertexLayoutTest >> testApplyDefaultLayoutOverlapsShapes [
| layout first second |
layout := RSCircularAroundAVertexLayout new.
Expand All @@ -19,7 +18,7 @@ RSCircularAroundAVertexLayoutTest >> testApplyDefaultLayoutOverlapsShapes [
self deny: first position equals: second position
]

{ #category : 'tests' }
{ #category : #tests }
RSCircularAroundAVertexLayoutTest >> testApplyLayoutShouldChangeOldPositions [
| layout oldPositions |
layout := RSCircularAroundAVertexLayout new.
Expand All @@ -28,7 +27,7 @@ RSCircularAroundAVertexLayoutTest >> testApplyLayoutShouldChangeOldPositions [
self deny: (canvas nodes collect: #position) equals: oldPositions
]

{ #category : 'tests' }
{ #category : #tests }
RSCircularAroundAVertexLayoutTest >> testRadius [
| layout boundingBox |
layout := RSCircularAroundAVertexLayout new.
Expand Down
15 changes: 7 additions & 8 deletions src/Roassal-Layouts-Tests/RSClusteringLayoutTest.class.st
@@ -1,11 +1,10 @@
Class {
#name : 'RSClusteringLayoutTest',
#superclass : 'RSLayoutTestCase',
#category : 'Roassal-Layouts-Tests',
#package : 'Roassal-Layouts-Tests'
#name : #RSClusteringLayoutTest,
#superclass : #RSLayoutTestCase,
#category : 'Roassal-Layouts-Tests'
}

{ #category : 'tests' }
{ #category : #tests }
RSClusteringLayoutTest >> testBasic [

| c shapes lb nodes |
Expand Down Expand Up @@ -71,7 +70,7 @@ RSClusteringLayoutTest >> testBasic [
144 @ 65.}
]

{ #category : 'tests' }
{ #category : #tests }
RSClusteringLayoutTest >> testBasic2 [

| shapes c lb nodes clusters |
Expand All @@ -91,7 +90,7 @@ RSClusteringLayoutTest >> testBasic2 [
self assert: clusters size equals: 10
]

{ #category : 'tests' }
{ #category : #tests }
RSClusteringLayoutTest >> testBasic3 [

| c shapes lb nodes clusters |
Expand All @@ -111,7 +110,7 @@ RSClusteringLayoutTest >> testBasic3 [
self assert: clusters size equals: 1
]

{ #category : 'tests' }
{ #category : #tests }
RSClusteringLayoutTest >> testCycles [
| chars canvas shapes |
canvas := RSLayoutNode new.
Expand Down
11 changes: 5 additions & 6 deletions src/Roassal-Layouts-Tests/RSFlowLayoutTest.class.st
@@ -1,11 +1,10 @@
Class {
#name : 'RSFlowLayoutTest',
#superclass : 'RSLayoutTest',
#category : 'Roassal-Layouts-Tests',
#package : 'Roassal-Layouts-Tests'
#name : #RSFlowLayoutTest,
#superclass : #RSLayoutTest,
#category : 'Roassal-Layouts-Tests'
}

{ #category : 'tests' }
{ #category : #tests }
RSFlowLayoutTest >> testLinesEven [
| layout lines line n |
layout := RSFlowLayout new.
Expand All @@ -21,7 +20,7 @@ RSFlowLayoutTest >> testLinesEven [
equals: (layout gapSize* n)+(shapes first height * (n-1.5))
]

{ #category : 'tests' }
{ #category : #tests }
RSFlowLayoutTest >> testLinesOdd [
| layout lines line n |
layout := RSFlowLayout new.
Expand Down
17 changes: 8 additions & 9 deletions src/Roassal-Layouts-Tests/RSGridLayoutTest.class.st
@@ -1,25 +1,24 @@
Class {
#name : 'RSGridLayoutTest',
#superclass : 'RSLayoutTest',
#category : 'Roassal-Layouts-Tests',
#package : 'Roassal-Layouts-Tests'
#name : #RSGridLayoutTest,
#superclass : #RSLayoutTest,
#category : 'Roassal-Layouts-Tests'
}

{ #category : 'tests' }
{ #category : #tests }
RSGridLayoutTest >> testBasicCustomizedGapSizeGridLayout [

RSGridLayout new gapSize:15; on: canvas nodes.
self assert: (shapes collect: #position) asArray equals: {(2.5@2.5). (22.5@2.5). (42.5@2.5). (62.5@2.5). (2.5@22.5). (22.5@22.5). (42.5@22.5). (62.5@22.5). (2.5@42.5). (22.5@42.5)}
]

{ #category : 'tests' }
{ #category : #tests }
RSGridLayoutTest >> testBasicDefaultGapSizeGridLayout [

RSGridLayout new gapSize:5; on: canvas nodes.
self assert: (shapes collect: #position) asArray equals: {(2.5@2.5). (12.5@2.5). (22.5@2.5). (32.5@2.5). (2.5@12.5). (12.5@12.5). (22.5@12.5). (32.5@12.5). (2.5@22.5). (12.5@22.5)}
]

{ #category : 'tests' }
{ #category : #tests }
RSGridLayoutTest >> testFixedPositionsAfterApplyingTheLayout [

RSGridLayout on: canvas nodes.
Expand All @@ -35,7 +34,7 @@ RSGridLayoutTest >> testFixedPositionsAfterApplyingTheLayout [
12 @ 22}
]

{ #category : 'tests' }
{ #category : #tests }
RSGridLayoutTest >> testLineItemsCount [

| shapesInLine |
Expand All @@ -46,7 +45,7 @@ RSGridLayoutTest >> testLineItemsCount [
self assert: (shapesInLine allSatisfy: [:group | group size between: 1 and: 3 ])
]

{ #category : 'tests' }
{ #category : #tests }
RSGridLayoutTest >> testLineItemsCountForASingleLineOfShapes [
canvas := RSLayoutNode new.
shapes := (1 to: 3) collect: [ :each | RSLayoutNode new size: 20 ].
Expand Down
19 changes: 9 additions & 10 deletions src/Roassal-Layouts-Tests/RSHorizontalTreeLayoutTest.class.st
@@ -1,23 +1,22 @@
Class {
#name : 'RSHorizontalTreeLayoutTest',
#superclass : 'RSLayoutTest',
#category : 'Roassal-Layouts-Tests',
#package : 'Roassal-Layouts-Tests'
#name : #RSHorizontalTreeLayoutTest,
#superclass : #RSLayoutTest,
#category : 'Roassal-Layouts-Tests'
}

{ #category : 'tests' }
{ #category : #tests }
RSHorizontalTreeLayoutTest >> testBasic [
RSHorizontalTreeLayout on: canvas nodes.
self assert: (shapes collect: #position) asArray equals: {(7.5@23.5). (32.5@15.5). (32.5@35.5). (57.5@11.5). (57.5@23.5). (57.5@31.5). (57.5@39.5). (82.5@7.5). (82.5@15.5). (82.5@23.5)}
]

{ #category : 'tests' }
{ #category : #tests }
RSHorizontalTreeLayoutTest >> testBasicWithHorizontalGap [
RSHorizontalTreeLayout new horizontalGap: 50; on: canvas nodes.
self assert: (shapes collect: #position) asArray equals: {(7.5@23.5). (62.5@15.5). (62.5@35.5). (117.5@11.5). (117.5@23.5). (117.5@31.5). (117.5@39.5). (172.5@7.5). (172.5@15.5). (172.5@23.5)}
]

{ #category : 'tests' }
{ #category : #tests }
RSHorizontalTreeLayoutTest >> testBasicWithLeftGap [
| withNoGap withGap |
RSHorizontalTreeLayout new leftGap: 15; on: canvas nodes.
Expand All @@ -26,7 +25,7 @@ RSHorizontalTreeLayoutTest >> testBasicWithLeftGap [
self assert: (shapes collect: #position) asArray equals: withGap
]

{ #category : 'tests' }
{ #category : #tests }
RSHorizontalTreeLayoutTest >> testBasicWithTopGap [
| withNoGap withGap |
RSHorizontalTreeLayout new topGap: 15; on: canvas nodes.
Expand All @@ -35,13 +34,13 @@ RSHorizontalTreeLayoutTest >> testBasicWithTopGap [
self assert: (shapes collect: #position) asArray equals: withGap
]

{ #category : 'tests' }
{ #category : #tests }
RSHorizontalTreeLayoutTest >> testBasicWithVerticalGap [
RSHorizontalTreeLayout new verticalGap: 50; on: canvas nodes.
self assert: (shapes collect: #position) asArray equals: {(7.5@117.5). (32.5@62.5). (32.5@200.0). (57.5@35.0). (57.5@117.5). (57.5@172.5). (57.5@227.5). (82.5@7.5). (82.5@62.5). (82.5@117.5)}
]

{ #category : 'tests' }
{ #category : #tests }
RSHorizontalTreeLayoutTest >> testCycles [
| chars |
canvas := RSLayoutNode new.
Expand Down

0 comments on commit e1a268b

Please sign in to comment.