Skip to content

Commit

Permalink
Fixed shapes moving after a new shape is created
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Nov 12, 2024
1 parent 0ffc207 commit 8565259
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Class {
#name : 'OPUmlCompartmentableShapeTest',
#name : 'OPAbstractUmlCompartmentableShapeTest',
#superclass : 'OPAbstractUmlShapeTest',
#category : 'OpenPonk-ClassEditor-Tests - Shapes',
#package : 'OpenPonk-ClassEditor',
#tag : 'Tests - Shapes'
}

{ #category : 'hooks' }
OPUmlCompartmentableShapeTest >> shapeClass [
OPAbstractUmlCompartmentableShapeTest >> shapeClass [
^ OPUmlCompartmentableShape
]

{ #category : 'tests' }
OPUmlCompartmentableShapeTest >> testEmptyRoassalShape [
OPAbstractUmlCompartmentableShapeTest >> testEmptyRoassalShape [

| roassalShape |
shape renderIn: RSCanvas new.
Expand All @@ -21,15 +21,15 @@ OPUmlCompartmentableShapeTest >> testEmptyRoassalShape [
]

{ #category : 'tests' }
OPUmlCompartmentableShapeTest >> testFigures [
OPAbstractUmlCompartmentableShapeTest >> testFigures [

shape renderIn: RSCanvas new.

self assert: shape canvas nodes isNotEmpty
]

{ #category : 'tests' }
OPUmlCompartmentableShapeTest >> testFigures1 [
OPAbstractUmlCompartmentableShapeTest >> testFigures1 [

| lbl |
(lbl := OPUmlLabel new) owningElement: shape.
Expand All @@ -38,7 +38,7 @@ OPUmlCompartmentableShapeTest >> testFigures1 [
]

{ #category : 'tests' }
OPUmlCompartmentableShapeTest >> testFigures2 [
OPAbstractUmlCompartmentableShapeTest >> testFigures2 [

| lbl comp1 |
(lbl := OPUmlLabel new) owningElement: shape.
Expand All @@ -52,7 +52,7 @@ OPUmlCompartmentableShapeTest >> testFigures2 [
]

{ #category : 'tests' }
OPUmlCompartmentableShapeTest >> testFigures3 [
OPAbstractUmlCompartmentableShapeTest >> testFigures3 [

| lbl comp compLbl |
(lbl := OPUmlLabel new) owningElement: shape.
Expand All @@ -65,18 +65,16 @@ OPUmlCompartmentableShapeTest >> testFigures3 [
]

{ #category : 'tests' }
OPUmlCompartmentableShapeTest >> testRemoveExtentChanged [
OPAbstractUmlCompartmentableShapeTest >> testRemoveExtentChanged [

| compartment compLbl canvas fullExtent labelContainer |
shape modelElement: OPTestEntityModel new.
| compartment compLbl fullExtent labelContainer |
labelContainer := OPUmlCompartmentableLabel in: shape.
OPUmlNameLabel in: labelContainer.
compartment := OPUmlCompartment in: shape.
5 timesRepeat: [
compLbl := (OPUmlLabel in: compartment)
text: 'testx';
yourself ].
canvas := RSCanvas new.
shape renderIn: canvas.
fullExtent := shape extent.
compLbl remove.
Expand All @@ -85,7 +83,7 @@ OPUmlCompartmentableShapeTest >> testRemoveExtentChanged [
]

{ #category : 'tests' }
OPUmlCompartmentableShapeTest >> testRemoveFromOwnership [
OPAbstractUmlCompartmentableShapeTest >> testRemoveFromOwnership [

| lbl |
(lbl := OPUmlLabel new) owningElement: shape.
Expand All @@ -97,7 +95,7 @@ OPUmlCompartmentableShapeTest >> testRemoveFromOwnership [
]

{ #category : 'tests' }
OPUmlCompartmentableShapeTest >> testRemoveFromViewEmpty [
OPAbstractUmlCompartmentableShapeTest >> testRemoveFromViewEmpty [

| canvas |
canvas := RSCanvas new.
Expand All @@ -107,7 +105,7 @@ OPUmlCompartmentableShapeTest >> testRemoveFromViewEmpty [
]

{ #category : 'tests' }
OPUmlCompartmentableShapeTest >> testRemoveOwnedElement [
OPAbstractUmlCompartmentableShapeTest >> testRemoveOwnedElement [

| lbl |
(lbl := OPUmlLabel new) owningElement: shape.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Class {
#name : 'OPUmlEdgeTest',
#name : 'OPAbstractUmlEdgeTest',
#superclass : 'OPAbstractEdgeTest',
#category : 'OpenPonk-ClassEditor-Tests - Shapes',
#package : 'OpenPonk-ClassEditor',
#tag : 'Tests - Shapes'
}

{ #category : 'running' }
OPUmlEdgeTest >> setUp [
OPAbstractUmlEdgeTest >> setUp [
| source target |
super setUp.
source := OPUmlLabel new.
Expand All @@ -19,12 +19,12 @@ OPUmlEdgeTest >> setUp [
]

{ #category : 'hooks' }
OPUmlEdgeTest >> shapeClass [
OPAbstractUmlEdgeTest >> shapeClass [
^ OPUmlEdge
]

{ #category : 'tests' }
OPUmlEdgeTest >> testRemove [
OPAbstractUmlEdgeTest >> testRemove [

| lbl |
(lbl := OPUmlLabel new) owningElement: shape.
Expand All @@ -34,7 +34,7 @@ OPUmlEdgeTest >> testRemove [
]

{ #category : 'tests' }
OPUmlEdgeTest >> testRemoveDetachFromEnds [
OPAbstractUmlEdgeTest >> testRemoveDetachFromEnds [

| source target |
source := OPUmlLabel new.
Expand All @@ -47,9 +47,10 @@ OPUmlEdgeTest >> testRemoveDetachFromEnds [
]

{ #category : 'tests' }
OPUmlEdgeTest >> testRemoveFromView [
OPAbstractUmlEdgeTest >> testRemoveFromView [

| lbl |
shape modelElement: model.
(lbl := OPUmlLabel new)
text: 'x';
owningElement: shape.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : 'OPAbstractUmlShapeTest',
#superclass : 'OPAbstractShapeTest',
#superclass : 'OPAbstractNodeTest',
#category : 'OpenPonk-ClassEditor-Tests - Shapes',
#package : 'OpenPonk-ClassEditor',
#tag : 'Tests - Shapes'
Expand Down Expand Up @@ -48,7 +48,7 @@ OPAbstractUmlShapeTest >> testAddSelfEdge [

{ #category : 'tests' }
OPAbstractUmlShapeTest >> testEmpty [
self assert: shape modelElement isNil.
super testEmpty.
self assert: shape owningElement doesNotExist.
self assert: shape ownedElements isEmpty.
self assert: shape sourceEdges isEmpty.
Expand Down
25 changes: 13 additions & 12 deletions repository/OpenPonk-ClassEditor/OPUmlAssociationShapeTest.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
Class {
#name : 'OPUmlAssociationShapeTest',
#superclass : 'OPUmlEdgeTest',
#superclass : 'OPAbstractUmlEdgeTest',
#instVars : [
'element',
'comment',
'association',
'ownedComment',
'owningElement'
],
Expand All @@ -13,17 +12,19 @@ Class {
#tag : 'Tests - Shapes'
}

{ #category : 'running' }
OPUmlAssociationShapeTest >> setUp [
super setUp.
self setUpAssociation
{ #category : 'instance creation' }
OPUmlAssociationShapeTest >> modelClass [

^ OPUMLAssociation
]

{ #category : 'running' }
OPUmlAssociationShapeTest >> setUpAssociation [
OPUmlAssociationShapeTest >> newModelInstance [

| association |
element := OPUMLClass new name: 'Element'.
comment := OPUMLClass new name: 'Comment'.
association := OPUMLAssociation new.
association := self modelClass new.
(ownedComment := OPUMLProperty new)
name: 'ownedComment';
owningClass: element;
Expand All @@ -32,10 +33,10 @@ OPUmlAssociationShapeTest >> setUpAssociation [
name: 'owningElement';
owningAssociation: association;
type: element.
association
memberEnds:
{ownedComment.
owningElement}
association memberEnds: {
ownedComment.
owningElement }.
^ association
]

{ #category : 'hooks' }
Expand Down
9 changes: 8 additions & 1 deletion repository/OpenPonk-ClassEditor/OPUmlClassShapeTest.class.st
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
Class {
#name : 'OPUmlClassShapeTest',
#superclass : 'OPUmlCompartmentableShapeTest',
#superclass : 'OPAbstractUmlCompartmentableShapeTest',
#category : 'OpenPonk-ClassEditor-Tests - Shapes',
#package : 'OpenPonk-ClassEditor',
#tag : 'Tests - Shapes'
}

{ #category : 'instance creation' }
OPUmlClassShapeTest >> modelClass [

^ OPUMLClass
]

{ #category : 'hooks' }
OPUmlClassShapeTest >> shapeClass [

^ OPUmlClassShape
]

Expand Down

0 comments on commit 8565259

Please sign in to comment.