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 23d34ea commit 923970b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 142 deletions.
17 changes: 1 addition & 16 deletions repository/OpenPonk-FSM/OPControllerOfFsmTest.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : 'OPControllerOfFsmTest',
#superclass : 'OPElementControllerTest',
#superclass : 'OPAbstractElementControllerTest',
#category : 'OpenPonk-FSM-Tests',
#package : 'OpenPonk-FSM',
#tag : 'Tests'
Expand All @@ -14,11 +14,6 @@ OPControllerOfFsmTest class >> isAbstract [
^ self name = #OPControllerOfFsmTest
]

{ #category : 'accessing' }
OPControllerOfFsmTest >> controllerClass [
^ self subclassResponsibility
]

{ #category : 'accessing' }
OPControllerOfFsmTest >> diagramControllerClass [

Expand All @@ -29,13 +24,3 @@ OPControllerOfFsmTest >> diagramControllerClass [
OPControllerOfFsmTest >> diagramModelClass [
^ OPFsm
]

{ #category : 'accessing' }
OPControllerOfFsmTest >> modelClass [
^ self subclassResponsibility
]

{ #category : 'tests' }
OPControllerOfFsmTest >> testModelClass [
self assert: controller modelClass equals: self modelClass
]
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ OPFsmInitialStateControllerTest >> modelClass [
]

{ #category : 'tests' }
OPFsmInitialStateControllerTest >> testCreateFigure [
OPFsmInitialStateControllerTest >> testCreateUsingAddAsTarget [

super testCreateFigure.
super testCreateUsingAddAsTarget.
self assert: (controller roassalShape isKindOf: RSCircularShape).
self assert: controller roassalShape color equals: Color black.
self assert: controller roassalShape extent equals: 14 @ 14
Expand Down
11 changes: 2 additions & 9 deletions repository/OpenPonk-FSM/OPFsmStateControllerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,9 @@ OPFsmStateControllerTest >> modelClass [
]

{ #category : 'tests' }
OPFsmStateControllerTest >> testCreateFigure [
OPFsmStateControllerTest >> testCreateUsingAddAsTarget [

controller createModelIn: diagramController model.
diagramController addController: controller.
self assert: diagramController canvas nodes isEmpty.
controller
createDiagramElement;
renderDiagramElement.
self assert: diagramController canvas nodes isNotEmpty.
self assert: controller diagramElement class equals: OPFsmStateShape.
super testCreateUsingAddAsTarget.
self assert: (controller roassalShape isKindOf: RSCircularShape).
self assert: controller roassalShape color equals: Color white.
self assert: controller roassalShape extent >= (50 @ 50)
Expand Down
103 changes: 19 additions & 84 deletions repository/OpenPonk-FSM/OPFsmTransitionControllerTest.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Class {
#name : 'OPFsmTransitionControllerTest',
#superclass : 'OPControllerOfFsmTest',
#instVars : [
'fromCtrl',
'toCtrl'
],
#superclass : 'OPAbstractDirectionalRelationshipControllerTest',
#category : 'OpenPonk-FSM-Tests',
#package : 'OpenPonk-FSM',
#tag : 'Tests'
Expand All @@ -15,12 +11,24 @@ OPFsmTransitionControllerTest >> controllerClass [
^ OPFsmTransitionController
]

{ #category : 'accessing' }
OPFsmTransitionControllerTest >> diagramControllerClass [

^ OPFsmController
]

{ #category : 'construction' }
OPFsmTransitionControllerTest >> diagramElementClass [

^ OPFsmTransitionShape
]

{ #category : 'accessing' }
OPFsmTransitionControllerTest >> diagramModelClass [

^ OPFsm
]

{ #category : 'running' }
OPFsmTransitionControllerTest >> fromClass [
^ OPFsmInitialStateController
Expand All @@ -31,89 +39,16 @@ OPFsmTransitionControllerTest >> modelClass [
^ OPFsmTransition
]

{ #category : 'running' }
OPFsmTransitionControllerTest >> setUp [
{ #category : 'as yet unclassified' }
OPFsmTransitionControllerTest >> sourceControllerClass [

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 model beFinal.
toCtrl
createDiagramElement;
renderDiagramElement
^ OPFsmStateController
]

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

controller model: model.
controller model source: fromCtrl model.
controller model target: toCtrl model.

super testCreateDiagramElement
]

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

| figure |
controller
source: fromCtrl;
target: toCtrl;
model: model.
diagramController addController: controller.
figure := controller
createDiagramElement;
renderDiagramElement;
roassalShape.
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: 5.
self assert: figure class equals: OPRSPolyline.
self assert: figure color equals: Color black.
self assert: figure markerEnd shape class equals: RSPolygon.
self assert: figure border dashArray isNil
]

{ #category : 'tests' }
OPFsmTransitionControllerTest >> 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 : 'tests' }
OPFsmTransitionControllerTest >> testFigureRefresh [
{ #category : 'accessing' }
OPFsmTransitionControllerTest >> sourceModelClass [

| label |
controller
source: fromCtrl;
target: toCtrl.
diagramController addController: controller.
controller createModelIn: diagramController model.
controller
createDiagramElement;
renderDiagramElement.
self assert: controller diagramElement ownedElements size equals: 1.
label := controller diagramElement ownedElements anyOne.
self assert: label text equals: ''.
controller model name: 'new name'.
controller diagramElement modelChanged.
self assert: label text equals: 'new name'
^ OPFsmState
]

{ #category : 'running' }
Expand Down
5 changes: 0 additions & 5 deletions repository/OpenPonk-FSM/OPFsmVertexController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ OPFsmVertexController >> isHideable [
^ true
]

{ #category : 'adding' }
OPFsmVertexController >> modelAsParent [
^ self model owner
]

{ #category : 'destruction' }
OPFsmVertexController >> removeModel [
self model announcer unsubscribe: self.
Expand Down
26 changes: 0 additions & 26 deletions repository/OpenPonk-FSM/OPFsmVertexControllerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,3 @@ Class {
OPFsmVertexControllerTest class >> isAbstract [
^ self = OPFsmVertexControllerTest
]

{ #category : 'testing - instance creation' }
OPFsmVertexControllerTest >> createController [
^ super createController
model: self modelClass new;
yourself
]

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

controller createModelIn: diagramController model.
diagramController addController: controller.
controller
createDiagramElement;
renderDiagramElement.
self assert: diagramController canvas nodes size equals: 1.
self
assert: controller diagramElement class
equals: OPFsmInitialStateShape
]

{ #category : 'tests' }
OPFsmVertexControllerTest >> testCreateModel [
self assert: (controller createModelIn: diagramController model) class equals: self modelClass
]

0 comments on commit 923970b

Please sign in to comment.