Skip to content

Commit

Permalink
Fix MiModelNavigationBrowserTest
Browse files Browse the repository at this point in the history
Change the test. Do not open the inspector browser, test only widget.
Remove the test class from test exclusions in .smalltalk.ston
  • Loading branch information
ClotildeToullec authored Sep 5, 2024
1 parent 2c42153 commit af05576
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .smalltalk.ston
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SmalltalkCISpec {
],
#testing : {
#exclude : {
#classes : [ #MiInspectorBrowserTest, #MiModelNavigationBrowserTest ]
#classes : [ #MiInspectorBrowserTest ]
},
#coverage : {
#packages : [ 'MooseIDE.*' ],
Expand Down

This file was deleted.

43 changes: 22 additions & 21 deletions src/MooseIDE-NewTools-Tests/MiModelNavigationBrowserTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,47 @@ Class {
#name : #MiModelNavigationBrowserTest,
#superclass : #TestCase,
#instVars : [
'miInspectorBrowser'
'browser',
'inspectedModel'
],
#category : #'MooseIDE-NewTools-Tests'
}

{ #category : #tests }
MiModelNavigationBrowserTest >> clickOnAllClasses [

| navigationTable |
navigationTable := browser presenterAt: #navigation.

navigationTable selectItem:
(navigationTable items detect: [ :item | item key = 'All classes' ])
]

{ #category : #running }
MiModelNavigationBrowserTest >> setUp [

super setUp.

miInspectorBrowser := MiInspectorBrowser openForTests:
MiTestApplication current
inspectedModel := FamixStModel new
newClassNamed: #C1;
newClassNamed: #C2;
yourself.

browser := MiModelNavigationBrowser on: inspectedModel
]

{ #category : #running }
MiModelNavigationBrowserTest >> tearDown [

miInspectorBrowser window close.
browser withWindowDo: [ :window | window close ].

super tearDown
]

{ #category : #tests }
MiModelNavigationBrowserTest >> testClickingOpensMooseGroup [

"This test passes locally but fails on SmalltalkCI because MiModelNavigationBrowser fails to be implemented.
The error is a primitive failure in #inspectorPerform:"
| inspectedModel |

inspectedModel := FamixStModel new
newClassNamed: #C1;
newClassNamed: #C2;
yourself.
miInspectorBrowser followEntity: inspectedModel.

self assert: miInspectorBrowser miSelectedItem equals: inspectedModel.

miInspectorBrowser miInspector firstPagePresenter navigation
clickAtIndex: 8.
self clickOnAllClasses.

self
assert: miInspectorBrowser miSelectedItem
equals: inspectedModel allClasses
self assert: browser selectedObject equals: inspectedModel allClasses
]
30 changes: 8 additions & 22 deletions src/MooseIDE-NewTools/MiInspector.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,17 @@ Class {
#category : #'MooseIDE-NewTools-Inspector'
}

{ #category : #initialization }
MiInspector >> initializePresenters [
super initializePresenters.
{ #category : #'inspector compatibility' }
MiInspector >> defaultObjectInspectorClass [

millerList millerListPresenter
whenColumnsChangedDo: [self owner updateToolbar].
^ MiObjectInspectorPresenter
]

{ #category : #'private - factory' }
MiInspector >> newInspectorFor: aModel [

| newInspector |
newInspector := self
instantiate: MiObjectInspectorPresenter
on: aModel asInspectorModel.
self class inspectorDiveOnSingleClick ifTrue: [
newInspector activateOnSingleClick ].
{ #category : #initialization }
MiInspector >> initializePresenters [

millerList pages ifNotEmpty: [ :pages |
newInspector
whenClosedDo: [ millerList removeAllFrom: newInspector ];
"select last shown page (or default)"trySelectAnyPageWithName: {
lastPageSelectedTabName.
pages last selectedPageName }
"prepare to close" ].
super initializePresenters.

^ newInspector
millerList millerListPresenter whenColumnsChangedDo: [
self owner updateToolbar ]
]
3 changes: 1 addition & 2 deletions src/MooseIDE-NewTools/MiInspectorModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ MiInspectorModel >> entity: anObject [
MiInspectorModel >> miSelectedItem [
"the inspector keeps its own model"

^browser miSelectedItem

^ browser miSelectedItem
]
11 changes: 1 addition & 10 deletions src/MooseIDE-NewTools/MiModelNavigationBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,8 @@ MiModelNavigationBrowser >> itemsFor: anEntity [
^ anEntity navigationItemsFromPragmas
]

{ #category : #accessing }
MiModelNavigationBrowser >> selectedItem [

^ ([
self model mooseInterestingEntity perform:
navigation selection selectedItem value ] onErrorDo: [ nil ])
mooseInterestingEntity
]

{ #category : #initialization }
MiModelNavigationBrowser >> selectedObject [

^ self entitiesForActivationOf: navigation selection
^ navigation selectedItem value value: self model
]
6 changes: 4 additions & 2 deletions src/MooseIDE-NewTools/MiNavigationBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ MiNavigationBrowser >> model: anObject [

{ #category : #initialization }
MiNavigationBrowser >> outputActivationPort [
^ (SpActivationPort newPresenter: self)
yourself

^ (SpActivationPort newPresenter: self) yourself
]

{ #category : #accessing }
Expand All @@ -164,6 +164,7 @@ MiNavigationBrowser >> selectedItem [

{ #category : #initialization }
MiNavigationBrowser >> selectedObject [

^ navigation selection selectedItem value
]

Expand All @@ -175,5 +176,6 @@ MiNavigationBrowser >> setModelBeforeInitialization: anInspectionModel [

{ #category : #initialization }
MiNavigationBrowser >> whenActivatedDo: aBlock [

activationBlock := aBlock
]
4 changes: 2 additions & 2 deletions src/MooseIDE-NewTools/MiObjectInspectorPresenter.class.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"
I am a subclass of `StObjectInspectorPresenter`.
I rewrite `newInspectionForContext:` method only to return an instance of `MiObjectContextPresenter` instead of `StObjectContextPresenter`. It is the only difference. This is to remove the evaluator of the inspector (the evaluator is the code presenter in the below part of the inspector).
I rewrite `newInspectionForContext:` method only to return an instance of `MiObjectContextPresenter` instead of `StObjectContextPresenter`. This is to remove the evaluator of the inspector (the evaluator is the code presenter in the below part of the inspector).
(See `StObjectInspectorPresenter>>#newInspectionForContext:`)
"
Class {
Expand All @@ -15,7 +15,7 @@ MiObjectInspectorPresenter >> allPages [

| allPagesWithoutBreakpointsPage |
"Remove the Breakpoints page in the inspector because is not useful in the Moose Inspector"
allPagesWithoutBreakpointsPage := super allPages reject: [ :aPage |
allPagesWithoutBreakpointsPage := super allPages reject: [ :aPage |
aPage title = 'Breakpoints' ].
^ allPagesWithoutBreakpointsPage
]
Expand Down

0 comments on commit af05576

Please sign in to comment.