Skip to content

Commit

Permalink
reworking tests - wip
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Jun 30, 2024
1 parent 5a93037 commit 5775fd7
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 19 deletions.
20 changes: 20 additions & 0 deletions repository/OpenPonk-ClassEditor/OPUmlAttributeController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ OPUmlAttributeController >> createModelIn: aClass [
^ model
]

{ #category : 'construction' }
OPUmlAttributeController >> dependingOnElements [

| asSetOrEmpty |
asSetOrEmpty := [ :nullableElement |
nullableElement
ifNil: [ Set empty ]
ifNotNil: [ :element | Set with: element ] ].
^ super dependingOnElements
, (asSetOrEmpty value: model owningAssociation)
]

{ #category : 'forms' }
OPUmlAttributeController >> descriptionDefaultValue [

Expand Down Expand Up @@ -171,6 +183,14 @@ OPUmlAttributeController >> removeDiagramElement [
diagramElement := nil
]

{ #category : 'removing' }
OPUmlAttributeController >> removeModel [
"could be any of those, so just nil all of them"

super removeModel.
model owningAssociation: nil
]

{ #category : 'accessing' }
OPUmlAttributeController >> typeNamed: aName [
OPUMLXMISpecsStorage primitivesMap at: aName ifPresent: [ :prim | ^ prim ].
Expand Down
17 changes: 15 additions & 2 deletions repository/OpenPonk-ClassEditor/OPUmlClassItemController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ Class {
#tag : 'Controllers'
}

{ #category : 'construction' }
OPUmlClassItemController >> dependingOnElements [

| asSetOrEmpty |
asSetOrEmpty := [ :nullableElement |
nullableElement
ifNil: [ Set empty ]
ifNotNil: [ :element | Set with: element ] ].
^ super dependingOnElements , (asSetOrEmpty value: model owningClass)
, (asSetOrEmpty value: model interface)
, (asSetOrEmpty value: model datatype)
]

{ #category : 'forms' }
OPUmlClassItemController >> descriptionIsStatic [
<magritteDescription>
Expand All @@ -21,6 +34,6 @@ OPUmlClassItemController >> removeModel [
"could be any of those, so just nil all of them"

model owningClass: nil.
model datatype: nil.
model interface: nil
model interface: nil.
model datatype: nil
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : 'OPUmlElementControllerTest',
#superclass : 'OPElementControllerTest',
#superclass : 'OPAbstractElementControllerTest',
#category : 'OpenPonk-ClassEditor-Tests - Controllers',
#package : 'OpenPonk-ClassEditor',
#tag : 'Tests - Controllers'
Expand All @@ -22,8 +22,3 @@ OPUmlElementControllerTest >> diagramModelClass [

^ OPUMLPackage
]

{ #category : 'tests - model' }
OPUmlElementControllerTest >> testModelClass [
self assert: controller modelClass equals: self modelClass
]
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ OPUmlEnumLiteralControllerTest >> testEnumerationBeTarget [
equals: {controller model}
]

{ #category : 'tests - accessing' }
OPUmlEnumLiteralControllerTest >> testModelClass [
self assert: controller modelClass equals: self modelClass
]

{ #category : 'tests - removing' }
OPUmlEnumLiteralControllerTest >> testRemoveFromView [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ OPUmlEnumerationLiteralController >> createModelIn: aParentModel [
^ model
]

{ #category : 'construction' }
OPUmlEnumerationLiteralController >> dependingOnElements [

^ super dependingOnElements , (Set with: model enumeration)
]

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ OPUmlExtensionController >> createModelIn: aParentModel [
^ model
]

{ #category : 'accessing' }
OPUmlExtensionController >> dependentElements [
^ {model memberEnds first}
]

{ #category : 'figures' }
OPUmlExtensionController >> diagramElementClass [

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : 'OPUmlRelationshipControllerTest',
#superclass : 'OPUmlElementControllerTest',
#superclass : 'OPAbstractDirectionalRelationshipControllerTest',
#category : 'OpenPonk-ClassEditor-Tests - Controllers',
#package : 'OpenPonk-ClassEditor',
#tag : 'Tests - Controllers'
Expand All @@ -11,6 +11,18 @@ OPUmlRelationshipControllerTest class >> isAbstract [
^ self = OPUmlRelationshipControllerTest
]

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

^ OPUmlPackageDiagramController
]

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

^ OPUMLPackage
]

{ #category : 'as yet unclassified' }
OPUmlRelationshipControllerTest >> sourceClass [

Expand Down

0 comments on commit 5775fd7

Please sign in to comment.