Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/NewTools-MethodBrowsers/StMethodBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,13 @@ StMethodBrowser >> initializePresenters [
self initializeDropList
]

{ #category : 'initialization' }
StMethodBrowser >> initializeWindow: aWindowPresenter [

super initializeWindow: aWindowPresenter.
aWindowPresenter whenClosedDo: [ TestCase historyAnnouncer unsubscribe: methodList ]
]

{ #category : 'private' }
StMethodBrowser >> installIconStylerFor: anItem [
"icons styler are only supported for method definitions (not nil / not for comment definitions
Expand Down
34 changes: 13 additions & 21 deletions src/NewTools-MethodBrowsers/StMethodListPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,19 @@ StMethodListPresenter >> executeTestFor: aMethod [
listPresenter updateItemsKeepingSelection: listPresenter items
]

{ #category : 'initialization' }
StMethodListPresenter >> handleTestResultChanged: anAnnouncement [

self defer: [ listPresenter updateItemsKeepingSelection: listPresenter items ]
]

{ #category : 'initialization' }
StMethodListPresenter >> initialize [

super initialize.
topologySort := true.
allMessages := Set empty.
self registerToTestAnnouncements
]

{ #category : 'initialization' }
Expand Down Expand Up @@ -390,6 +397,12 @@ StMethodListPresenter >> protocolNameForItem: anItem [
^ anItem protocolName ifNil: [ '' ]
]

{ #category : 'initialization' }
StMethodListPresenter >> registerToTestAnnouncements [

TestCase historyAnnouncer weak when: TestSuiteEnded send: #handleTestResultChanged: to: self
]

{ #category : 'private - scopes' }
StMethodListPresenter >> scopes [
"Answer a <Collection> of the receiver's message list scopes"
Expand Down Expand Up @@ -459,27 +472,6 @@ StMethodListPresenter >> switchScopeTo: aRBBrowserEnvironment [

]

{ #category : 'tests' }
StMethodListPresenter >> testIconFor: aMethod [

| allCount successCount failureCount errorCount |
(aMethod selector isTestSelector and: [ aMethod isInstanceSide ]) ifFalse: [ ^ nil ].
allCount := 0.
successCount := 0.
failureCount := 0.
errorCount := 0.
allCount := allCount + 1.
successCount := successCount + (aMethod methodClass methodPassed: aMethod selector) asBit.
failureCount := failureCount + (aMethod methodClass methodFailed: aMethod selector) asBit.
errorCount := errorCount + (aMethod methodClass methodRaisedError: aMethod selector) asBit.

allCount = 0 ifTrue: [ ^ self iconNamed: #testNotRun ].
allCount = successCount ifTrue: [ ^ self iconNamed: #testGreen ].
errorCount = 0 & (failureCount > 0) ifTrue: [ ^ self iconNamed: #testYellow ].
errorCount > 0 ifTrue: [ ^ self iconNamed: #testRed ].
^ self iconNamed: #testNotRun
]

{ #category : 'accessing' }
StMethodListPresenter >> topologicSort [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ StRunMethodTestCommand >> canBeExecuted [
| method |
method := context selectedMethod.
method ifNil: [ ^ false ].
^ method selector isTestSelector and: [ method isInstanceSide ]
^ method isTestMethod
]

{ #category : 'executing' }
Expand Down
3 changes: 2 additions & 1 deletion src/NewTools-MethodBrowsers/StTestIconCellPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ StTestIconCellPresenter >> testIconFor: aMethod [
StTestIconCellPresenter >> updatePresenter [

| method |

method := self model.

method ifNil: [
buttonPresenter icon: nil.
buttonPresenter enabled: false.
^ self ].

(method selector isTestSelector and: [ method isInstanceSide ])
method isTestMethod
ifTrue: [
buttonPresenter
icon: (self testIconFor: method);
Expand Down
Loading