Skip to content

Commit

Permalink
reworked dependency showing and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Jul 4, 2024
1 parent 12a90b6 commit 7e56d46
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 149 deletions.
90 changes: 8 additions & 82 deletions repository/OpenPonk-PetriNets/OPPetriNetArcControllerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ A DCPetriNetArcControllerTest is a test class for testing the behavior of DCPetr
"
Class {
#name : 'OPPetriNetArcControllerTest',
#superclass : 'OPPetriNetsControllerTest',
#instVars : [
'fromCtrl',
'toCtrl'
],
#superclass : 'OPAbstractDirectionalRelationshipControllerTest',
#category : 'OpenPonk-PetriNets-Tests',
#package : 'OpenPonk-PetriNets',
#tag : 'Tests'
Expand All @@ -26,95 +22,25 @@ OPPetriNetArcControllerTest >> amountOfLabels [
^ 1
]

{ #category : 'hooks' }
OPPetriNetArcControllerTest >> fromClass [
^ self subclassResponsibility
]

{ #category : 'running' }
OPPetriNetArcControllerTest >> setUp [

super setUp.
fromCtrl := self fromClass new.
diagramController addController: fromCtrl.
fromCtrl createModelIn: diagramController model.
fromCtrl
createDiagramElement;
renderDiagramElement.
toCtrl := self toClass new.
diagramController addController: toCtrl.
toCtrl createModelIn: diagramController model.
toCtrl
createDiagramElement;
renderDiagramElement
]

{ #category : 'tests' }
OPPetriNetArcControllerTest >> testCreateDiagramElement [

controller model: model.
controller model source: fromCtrl model.
controller model target: toCtrl model.
{ #category : 'accessing' }
OPPetriNetArcControllerTest >> diagramControllerClass [

super testCreateDiagramElement
^ OPPetriNetController
]

{ #category : 'tests' }
OPPetriNetArcControllerTest >> testCreateFigure [

| figure previousElementsSize |
controller
source: fromCtrl;
target: toCtrl;
model: model.
diagramController addController: controller.
previousElementsSize := diagramController canvas nodes size.
figure := controller
createDiagramElement;
renderDiagramElement.
self assert: figure class equals: OPRSPolyline.
self assert: figure from equals: fromCtrl roassalShape.
self assert: figure to equals: toCtrl roassalShape.
self
assert: diagramController canvas nodes size
equals: previousElementsSize + self amountOfLabels.
self assert: figure shape color equals: Color black.
self assert: figure shape markerEnd isNotNil
]

{ #category : 'tests' }
OPPetriNetArcControllerTest >> testCreateModel [
| createdModel |
controller source: fromCtrl.
controller target: toCtrl.
fromCtrl createModelIn: diagramController model.
toCtrl createModelIn: diagramController model.
createdModel := controller createModelIn: diagramController model.
self assert: createdModel class equals: self modelClass.
self assert: createdModel source equals: fromCtrl model.
self assert: createdModel target equals: toCtrl model
{ #category : 'accessing' }
OPPetriNetArcControllerTest >> diagramModelClass [
^ OPPetriNet
]

{ #category : 'tests' }
OPPetriNetArcControllerTest >> testFigureRefresh [

| label |
controller
source: fromCtrl;
target: toCtrl.
diagramController addController: controller.
controller createModelIn: diagramController model.
controller
createDiagramElement;
renderDiagramElement.
self showInDiagram.
label := controller diagramElement ownedElements first.
self assert: label roassalShape text equals: ''.
controller model name: 'new name'.
controller diagramElement modelChanged.
self assert: label roassalShape text equals: 'new name'
]

{ #category : 'hooks' }
OPPetriNetArcControllerTest >> toClass [
^ self subclassResponsibility
]
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,25 @@ OPPetriNetInputArcControllerTest class >> isAbstract [
]

{ #category : 'hooks' }
OPPetriNetInputArcControllerTest >> fromClass [
OPPetriNetInputArcControllerTest >> sourceControllerClass [

^ OPPetriNetPTPlaceController
]

{ #category : 'hooks' }
OPPetriNetInputArcControllerTest >> toClass [
OPPetriNetInputArcControllerTest >> sourceModelClass [

^ OPPetriNetPTPlace
]

{ #category : 'hooks' }
OPPetriNetInputArcControllerTest >> targetControllerClass [

^ OPPetriNetTransitionController
]

{ #category : 'hooks' }
OPPetriNetInputArcControllerTest >> targetModelClass [

^ OPPetriNetTransition
]
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ OPPetriNetNodeController >> isHideable [
^ true
]

{ #category : 'connecting' }
OPPetriNetNodeController >> modelAsParent [
^ self model owner
]

{ #category : 'removing' }
OPPetriNetNodeController >> removeModel [
self model announcer unsubscribe: self.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A DCPetriNetNodeControllerTest is a test class for testing the behavior of DCPet
"
Class {
#name : 'OPPetriNetNodeControllerTest',
#superclass : 'OPPetriNetsControllerTest',
#superclass : 'OPAbstractElementControllerTest',
#category : 'OpenPonk-PetriNets-Tests',
#package : 'OpenPonk-PetriNets',
#tag : 'Tests'
Expand All @@ -17,22 +17,15 @@ OPPetriNetNodeControllerTest class >> isAbstract [
^ self name = #OPPetriNetNodeControllerTest
]

{ #category : 'tests' }
OPPetriNetNodeControllerTest >> testCreateFigure [
{ #category : 'accessing' }
OPPetriNetNodeControllerTest >> diagramControllerClass [

controller createModelIn: diagramController model.
diagramController addController: controller.
controller
createDiagramElement;
renderDiagramElement.
self assert: (controller roassalShape isKindOf: RSBoundingShape)
^ OPPetriNetController
]

{ #category : 'tests' }
OPPetriNetNodeControllerTest >> testCreateModel [
self
assert: (controller createModelIn: diagramController model) class
equals: self modelClass
{ #category : 'accessing' }
OPPetriNetNodeControllerTest >> diagramModelClass [
^ OPPetriNet
]

{ #category : 'tests' }
Expand Down
46 changes: 0 additions & 46 deletions repository/OpenPonk-PetriNets/OPPetriNetsControllerTest.class.st

This file was deleted.

0 comments on commit 7e56d46

Please sign in to comment.