Skip to content

Commit

Permalink
Merge branch 'master' into release_base
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Nov 15, 2024
2 parents c46404e + 99434f8 commit 5cc65f2
Show file tree
Hide file tree
Showing 134 changed files with 1,737 additions and 767 deletions.
9 changes: 4 additions & 5 deletions .smalltalk.ston
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ SmalltalkCISpec {
}
],
#testing : {
#packages : [
'OpenPonk*'
],
#coverage : {
#packages: [
'OpenPonk*'
]
},
#packages : [
'OpenPonk*',
'SynchronizedLinks*'
]
}
}
}
20 changes: 10 additions & 10 deletions repository/BaselineOfOpenPonk/BaselineOfOpenPonk.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BaselineOfOpenPonk >> baseline: spec [
package: 'OpenPonk-Morphic';
package: 'OpenPonk-Spec' with: [
spec requires:
#( 'NewTools' 'Magritte' 'SynchronizedLinks' 'OpenPonk-Morphic' ) ];
#( 'NewTools' 'Magritte' 'OpenPonkSynchronizedLinks' 'OpenPonk-Morphic' ) ];
package: 'OpenPonk-Releaser'.
spec
group: 'default'
Expand All @@ -43,7 +43,7 @@ BaselineOfOpenPonk >> externalProjectsBaseline: spec [

spec baseline: 'Magritte' with: [
spec
repository: 'github://JanBliznicenko/magritte:master';
repository: 'github://JanBliznicenko/magritte:6d92c9d';
loads: #( Core 'Magritte-Morph' ) ].

spec
Expand All @@ -63,20 +63,20 @@ BaselineOfOpenPonk >> externalProjectsBaseline: spec [
spec
baseline: 'RoassalExporters'
with: [
spec repository: 'github://pharo-graphics/RoassalExporters:v1.02' ]
spec repository: 'github://pharo-graphics/RoassalExporters:v1.02' ].

spec baseline: 'NewTools' with: [
spec
repository: 'github://pharo-spec/NewTools:Pharo12';
loads: #( FileBrowser ) ]
]

{ #category : 'baselines' }
BaselineOfOpenPonk >> internalProjectsBaseline: spec [

spec baseline: 'NewTools' with: [
spec
repository: 'github://pharo-spec/NewTools:Pharo12';
loads: #( FileBrowser ) ].
spec
baseline: 'SynchronizedLinks'
with: [
spec repository: 'github://openponk/synchronized-links:v4.0.x' ]
baseline: 'OpenPonkSynchronizedLinks'
with: [ spec repository: 'github://openponk/synchronized-links:v4.1.x' ]
]

{ #category : 'baselines' }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,62 @@
Class {
#name : 'OPAbstractShapeTest',
#name : 'OPAbstractDiagramElementTest',
#superclass : 'TestCase',
#instVars : [
'canvas',
'shape'
'shape',
'model'
],
#category : 'OpenPonk-Core-Tests',
#package : 'OpenPonk-Core',
#tag : 'Tests'
}

{ #category : 'testing' }
OPAbstractShapeTest class >> isAbstract [
OPAbstractDiagramElementTest class >> isAbstract [
^ self name includesSubstring: 'Abstract'
]

{ #category : 'instance creation' }
OPAbstractShapeTest >> newShapeInstance [
OPAbstractDiagramElementTest >> modelClass [

^ self subclassResponsibility
]

{ #category : 'instance creation' }
OPAbstractDiagramElementTest >> newModelInstance [

^ self modelClass new
]

{ #category : 'instance creation' }
OPAbstractDiagramElementTest >> newShapeInstance [
^ self shapeClass new
]

{ #category : 'running' }
OPAbstractShapeTest >> setUp [
OPAbstractDiagramElementTest >> setUp [

super setUp.
shape := self newShapeInstance.
model := self newModelInstance.
shape modelElement: model.
canvas := RSCanvas new
]

{ #category : 'hooks' }
OPAbstractShapeTest >> shapeClass [
OPAbstractDiagramElementTest >> shapeClass [
^ self subclassResponsibility
]

{ #category : 'running' }
OPAbstractDiagramElementTest >> testEmpty [

self assert: shape modelElement equals: model.
self assertCollection: shape modelElements hasSameElements: { model }
]

{ #category : 'tests' }
OPAbstractShapeTest >> testRenderSimplifiedForController [
OPAbstractDiagramElementTest >> testRenderSimplifiedForController [

| diagramController controller |
canvas := RSCanvas new.
Expand Down
2 changes: 1 addition & 1 deletion repository/OpenPonk-Core/OPAbstractEdgeTest.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : 'OPAbstractEdgeTest',
#superclass : 'OPAbstractShapeTest',
#superclass : 'OPAbstractDiagramElementTest',
#category : 'OpenPonk-Core-Tests',
#package : 'OpenPonk-Core',
#tag : 'Tests'
Expand Down
2 changes: 1 addition & 1 deletion repository/OpenPonk-Core/OPAbstractLabelTest.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : 'OPAbstractLabelTest',
#superclass : 'OPAbstractShapeTest',
#superclass : 'OPAbstractNodeTest',
#category : 'OpenPonk-Core-Tests',
#package : 'OpenPonk-Core',
#tag : 'Tests'
Expand Down
51 changes: 51 additions & 0 deletions repository/OpenPonk-Core/OPAbstractNodeTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Class {
#name : 'OPAbstractNodeTest',
#superclass : 'OPAbstractDiagramElementTest',
#category : 'OpenPonk-Core-Tests',
#package : 'OpenPonk-Core',
#tag : 'Tests'
}

{ #category : 'tests' }
OPAbstractNodeTest >> testDoesNotMoveOnShapeCreation [

| diagram originalRoassalPosition movedRoassalPosition newShape |
diagram := OPDiagram new.
diagram renderIn: canvas.
shape owningElement: diagram.
shape modelElement: model.
shape renderIn: canvas.
shape isPositionableByUser ifFalse: [ ^ self ].
originalRoassalPosition := shape roassalShape position.
shape updateFromRender.
self assert: shape bounds position equals: originalRoassalPosition.
shape roassalShape translateBy: 100 @ 50.
movedRoassalPosition := shape roassalShape position.
self
assert: movedRoassalPosition
equals: originalRoassalPosition + (100 @ 50).
self assert: shape bounds position equals: originalRoassalPosition.
newShape := OPTestLabel in: diagram.
newShape renderIn: canvas.
self assert: shape bounds position equals: originalRoassalPosition.
self assert: shape roassalShape position equals: movedRoassalPosition
]

{ #category : 'tests' }
OPAbstractNodeTest >> testUpdateFromRender [

| originalBounds movedBounds |
self assert: shape bounds equals: nil.
shape modelElement: model.
shape renderIn: canvas.
shape updateFromRender.
shape isPositionableByUser ifFalse: [ ^ self ].
originalBounds := shape bounds veryDeepCopy.
shape roassalShape translateBy: 100 @ 50.
self assert: shape bounds position equals: originalBounds position.
shape updateFromRender.
movedBounds := shape bounds veryDeepCopy.
self deny: movedBounds position equals: originalBounds position.
self assert: movedBounds position equals: originalBounds position + (100 @ 50).

]
2 changes: 1 addition & 1 deletion repository/OpenPonk-Core/OPBoundNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ OPBoundNode >> renderIn: aCanvas [
{ #category : 'as yet unclassified' }
OPBoundNode >> updateFromRender [

self isResizableByUser | self isPositionableByUser ifTrue: [
(self isResizableByUser or: [ self isPositionableByUser ]) ifTrue: [
self bounds: (OPNodeBounds new
position: roassalShape position
extent: roassalShape extent) ].
Expand Down
24 changes: 17 additions & 7 deletions repository/OpenPonk-Core/OPBoundary.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Class {
#name : 'OPBoundary',
#superclass : 'OPDiagramOnlyShapeWithText',
#traits : 'OPTColoredAsFillAndBorderColoredAsStroke',
#classTraits : 'OPTColoredAsFillAndBorderColoredAsStroke classTrait',
#instVars : [
'name'
],
Expand All @@ -24,11 +26,23 @@ OPBoundary >> addSelectionDraggableInteraction [
@ OPRSSelectionDraggableBorder thatAlsoDragsContainedShapes
]

{ #category : 'accessing' }
OPBoundary >> defaultFillColor [

^ Color transparent
]

{ #category : 'accessing' }
OPBoundary >> defaultHeight [
^ 400
]

{ #category : 'accessing' }
OPBoundary >> defaultStrokeColor [

^ Color gray slightlyDarker
]

{ #category : 'accessing' }
OPBoundary >> defaultWidth [
^ 500
Expand Down Expand Up @@ -64,21 +78,17 @@ OPBoundary >> printOn: aStream [
nextPutAll: ''')'
]

{ #category : 'creating - subelements' }
{ #category : 'rendering' }
OPBoundary >> renderBasicShape [

^ RSBox new
color: Color transparent;
width: self defaultWidth;
height: self defaultHeight;
borderDo: [ :border |
border
color: Color gray;
dashArray: #( 4 ) ];
borderDo: [ :border | border dashArray: #( 4 ) ];
yourself
]

{ #category : 'creating - subelements' }
{ #category : 'interactions' }
OPBoundary >> selectableInteraction [

^ OPRSSelectable
Expand Down
6 changes: 6 additions & 0 deletions repository/OpenPonk-Core/OPCommonElementController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ OPCommonElementController >> isCommon [
^ true
]

{ #category : 'testing' }
OPCommonElementController >> isHideable [

^ false
]

{ #category : 'accessing' }
OPCommonElementController >> model [

Expand Down
22 changes: 12 additions & 10 deletions repository/OpenPonk-Core/OPController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Class {
#name : 'OPController',
#superclass : 'Object',
#instVars : [
'model',
'diagramController',
'diagramElement'
'diagramElement',
'adapter'
],
#category : 'OpenPonk-Core-Controllers',
#package : 'OpenPonk-Core',
Expand Down Expand Up @@ -106,7 +106,7 @@ OPController >> diagramController: aDiagramController [
{ #category : 'accessing' }
OPController >> diagramElement [

^ diagramElement ifNil: [ diagramElement := OPNoShape new ]
^ diagramElement ifNil: [ OPNoShape instance ]
]

{ #category : 'accessing' }
Expand Down Expand Up @@ -163,6 +163,7 @@ OPController >> internalUnsubscribeFrom: aModel [

{ #category : 'testing' }
OPController >> isHideable [

^ false
]

Expand All @@ -186,7 +187,8 @@ OPController >> linkDiagramElementToModel [

{ #category : 'accessing' }
OPController >> model [
^ model

^ adapter ifNotNil: [ :existingAdapter | existingAdapter model ]
]

{ #category : 'accessing' }
Expand All @@ -195,9 +197,9 @@ OPController >> model: aModel [
aModel ifNotNil: [
aModel uuid ifNil: [
self error: 'All model objects must have a uuid to be used by OP' ] ].
model ifNotNil: [ :m | self internalUnsubscribeFrom: m ].
model := aModel.
model ifNotNil: [ :m | self internalSubscribeTo: m ]
self model ifNotNil: [ :m | self internalUnsubscribeFrom: m ].
adapter := OPModelAdapter forModel: aModel.
self model ifNotNil: [ :m | self internalSubscribeTo: m ]
]

{ #category : 'announcements' }
Expand Down Expand Up @@ -274,14 +276,14 @@ OPController >> removeControllerAndDiagramElement [
{ #category : 'destruction' }
OPController >> removeControllerAndModel [

self removeDependent.
self removeDependentConrollersAndModels.
self removeControllerAndDiagramElement.
self removeModel.
self model: nil
]

{ #category : 'destruction' }
OPController >> removeDependent [
OPController >> removeDependentConrollersAndModels [
self dependentControllers
do: [ :each |
self diagramController controllers
Expand Down Expand Up @@ -311,7 +313,7 @@ OPController >> removeDependentControllersAndDiagramElements [
OPController >> removeDiagramElement [

self diagramElement remove.
self diagramElement: OPNoShape new
self diagramElement: nil
]

{ #category : 'destruction' }
Expand Down
Loading

0 comments on commit 5cc65f2

Please sign in to comment.