Skip to content

Commit

Permalink
Merge a3e38f5
Browse files Browse the repository at this point in the history
  • Loading branch information
anquetil committed Dec 11, 2024
2 parents 846086a + a3e38f5 commit fcaf78c
Show file tree
Hide file tree
Showing 10 changed files with 214 additions and 361 deletions.
66 changes: 57 additions & 9 deletions src/MooseIDE-CoUsageMap-Tests/MiCoUsageMapBrowserTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,63 @@ MiCoUsageMapBrowserTest >> receiveEntityToSelect [
]

{ #category : #tests }
MiCoUsageMapBrowserTest >> testCanOpenSettings [

browser hasSettings ifFalse: [ self skip ].
"this should not raise an error"
browser settings.
"tear down"
[ browser closeSettings ]
on: Error
do: [ "nothing -- ensuring settings window is closed" ]
MiCoUsageMapBrowserTest >> testBlockSettingsChangeValue [

| settings |

settings := MiCoUsageMapBlockSettingsPresenter new
settings: MiCoUsageMapSettings ;
yourself.

[
settings sortInnerBoxTextInput text: '[ ]'.
settings applyButton click.

self assert: MiCoUsageMapSettings innerBoxSortBlockText equals: '[ ]'.
]
ensure: [
"tearDown"
settings delete ]
]

{ #category : #tests }
MiCoUsageMapBrowserTest >> testBlockSettingsDefaultValues [

| settings |
settings := MiCoUsageMapBlockSettingsPresenter new
settings: MiCoUsageMapSettings ;
yourself.

[
self assert: settings childrenTextInput text isNotEmpty.
self assert: settings sortInnerBoxTextInput text isNotEmpty.
self assert: settings sortOuterBoxTextInput text isNotEmpty.
]
ensure: [
"tearDown"
settings delete ]
]

{ #category : #tests }
MiCoUsageMapBrowserTest >> testBlockSettingsResetValues [

| settings |
MiCoUsageMapSettings childrenBlockText: 'Blah'.
self assert: MiCoUsageMapSettings childrenBlockText equals: 'Blah'.

settings := MiCoUsageMapBlockSettingsPresenter new
settings: MiCoUsageMapSettings ;
yourself.

[
settings resetButton click.

self deny: MiCoUsageMapSettings childrenBlockText equals: 'Blah'.
self deny: MiCoUsageMapSettings childrenBlockText isEmpty.
]
ensure: [
"tearDown"
settings delete ]
]

{ #category : #tests }
Expand Down
79 changes: 67 additions & 12 deletions src/MooseIDE-CoUsageMap-Tests/MiCoUsageModelTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ MiCoUsageModelTest >> setUp [

]

{ #category : #initialization }
MiCoUsageModelTest >> tearDown [

MiCoUsageMapSettings reset.

super tearDown
]

{ #category : #tests }
MiCoUsageModelTest >> test01Basic [

Expand Down Expand Up @@ -48,24 +56,21 @@ MiCoUsageModelTest >> test02MethodsAttributes [
{ #category : #tests }
MiCoUsageModelTest >> test03AttributeWidth [

| method attribute shapes |
attribute := model getInnerBoxNamed: #var1.
| method |
method := model containerBoxNamed: #method1.
self assert: (attribute numberOfUsesOn: method) equals: 3.
self assert: ((model getInnerBoxNamed: #var1) numberOfUsesOn: method) equals: 3.

attribute := model getInnerBoxNamed: #var4.
method := model containerBoxNamed: #method3.
self assert: (attribute numberOfUsesOn: method) equals: 1
self assert: ((model getInnerBoxNamed: #var4) numberOfUsesOn: method) equals: 1
]

{ #category : #tests }
MiCoUsageModelTest >> testAutomaticColorOfContainerBox [
MiCoUsageModelTest >> testAutomaticColorOneTaggedInnerBox [

| attribute tag |
| tag |

attribute := model getInnerBoxNamed: #var6.
tag := model currentMooseModel tagNamed: 'aTag'.
model setTag: tag onInnerBox: attribute.
model setTag: tag onInnerBox: (model getInnerBoxNamed: #var6).

model automaticColor.

Expand All @@ -78,6 +83,57 @@ MiCoUsageModelTest >> testAutomaticColorOfContainerBox [

]

{ #category : #tests }
MiCoUsageModelTest >> testAutomaticColorSeveralInnerBoxAllTagged [

| tag |

tag := model currentMooseModel tagNamed: 'aTag'.
model setTag: tag onInnerBox: (model getInnerBoxNamed: #var2).
model setTag: tag onInnerBox: (model getInnerBoxNamed: #var3).
model setTag: tag onInnerBox: (model getInnerBoxNamed: #var4).

model automaticColor.

self
assertCollection: (model containerBoxNamed: #method3) mooseEntity allTags
hasSameElements: {tag}.

]

{ #category : #tests }
MiCoUsageModelTest >> testAutomaticColorSeveralInnerBoxAndAboveThreshold [

| tag |

tag := model currentMooseModel tagNamed: 'aTag'.
model setTag: tag onInnerBox: (model getInnerBoxNamed: #var2).
model setTag: tag onInnerBox: (model getInnerBoxNamed: #var3).

model settings threshold75PercentGroup: 65.
model automaticColor.

self
assertCollection: (model containerBoxNamed: #method3) mooseEntity allTags
hasSameElements: {tag}.

]

{ #category : #tests }
MiCoUsageModelTest >> testAutomaticColorSeveralInnerBoxAndBelowThreshold [

| tag |

tag := model currentMooseModel tagNamed: 'aTag'.
model setTag: tag onInnerBox: (model getInnerBoxNamed: #var2).
model setTag: tag onInnerBox: (model getInnerBoxNamed: #var3).

model automaticColor.

self assert: (model containerBoxNamed: #method3) mooseEntity allTags isEmpty

]

{ #category : #tests }
MiCoUsageModelTest >> testLastTagInitialization [

Expand All @@ -88,11 +144,10 @@ MiCoUsageModelTest >> testLastTagInitialization [
{ #category : #tests }
MiCoUsageModelTest >> testLastTagWithTag [

| attribute tag |
attribute := model getInnerBoxNamed: #var2.
| tag |
tag := model currentMooseModel tagNamed: 'aTag'.

model setTag: tag onInnerBox: attribute.
model setTag: tag onInnerBox: (model getInnerBoxNamed: #var2).

self assert: model selectedTag equals: tag.

Expand Down
48 changes: 0 additions & 48 deletions src/MooseIDE-CoUsageMap/MiCo75PercentageMarkStrategy.class.st

This file was deleted.

47 changes: 0 additions & 47 deletions src/MooseIDE-CoUsageMap/MiCoMarkStrategy.class.st

This file was deleted.

20 changes: 0 additions & 20 deletions src/MooseIDE-CoUsageMap/MiCoOneGroupMarkStrategy.class.st

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Class {
'childrenTextInput',
'sortOuterBoxTextInput',
'sortInnerBoxTextInput',
'button',
'resetButton'
'resetButton',
'applyButton'
],
#category : #'MooseIDE-CoUsageMap-Settings'
}
Expand All @@ -36,6 +36,18 @@ MiCoUsageMapBlockSettingsPresenter class >> defaultLayout [
yourself
]

{ #category : #'accessing - private tests' }
MiCoUsageMapBlockSettingsPresenter >> applyButton [

^applyButton
]

{ #category : #'accessing - private tests' }
MiCoUsageMapBlockSettingsPresenter >> childrenTextInput [

^childrenTextInput
]

{ #category : #initialization }
MiCoUsageMapBlockSettingsPresenter >> connectPresenters [
| set |
Expand All @@ -48,7 +60,7 @@ MiCoUsageMapBlockSettingsPresenter >> connectPresenters [

{ #category : #initialization }
MiCoUsageMapBlockSettingsPresenter >> initializeButtons [
button := self newButton
applyButton := self newButton
label: 'Apply all';
action: [
childrenTextInput triggerSubmitAction.
Expand All @@ -69,13 +81,17 @@ MiCoUsageMapBlockSettingsPresenter >> initializeButtons [

{ #category : #initialization }
MiCoUsageMapBlockSettingsPresenter >> initializePresenters [

childrenTextInput := self newCode
text: MiCoUsageMapSettings childrenBlockText ;
whenSubmitDo: [ :text | self settings childrenBlockText: text ];
yourself.
sortOuterBoxTextInput := self newCode
text: MiCoUsageMapSettings outerBoxSortBlockText ;
whenSubmitDo: [ :text | self settings outerBoxSortBlockText: text ];
yourself.
sortInnerBoxTextInput := self newCode
text: MiCoUsageMapSettings innerBoxSortBlockText ;
whenSubmitDo: [ :text | self settings innerBoxSortBlockText: text ];
yourself.
self initializeButtons
Expand All @@ -87,3 +103,21 @@ MiCoUsageMapBlockSettingsPresenter >> initializeWindow: aWindowPresenter [
initialExtent: 500@700;
title: 'Blocks Settings - Co Usage Map'
]

{ #category : #'accessing - private tests' }
MiCoUsageMapBlockSettingsPresenter >> resetButton [

^resetButton
]

{ #category : #'accessing - private tests' }
MiCoUsageMapBlockSettingsPresenter >> sortInnerBoxTextInput [

^sortInnerBoxTextInput
]

{ #category : #'accessing - private tests' }
MiCoUsageMapBlockSettingsPresenter >> sortOuterBoxTextInput [

^sortOuterBoxTextInput
]
Loading

0 comments on commit fcaf78c

Please sign in to comment.