Skip to content

Commit

Permalink
Tests mostly working after merge
Browse files Browse the repository at this point in the history
* multiple session problem solved - tests use resource login method

* remove events from JadePresenter before purging debugger test windows.

* preference accessors need to be in 'must not strip' category

* other minor refactorings
  • Loading branch information
Eric Winger authored and Eric Winger committed Jul 8, 2022
1 parent d3d45b1 commit 1d1d59b
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 68 deletions.
10 changes: 1 addition & 9 deletions sources/JadeiteAbstractTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,7 @@ logoutOtherSession
(UserGlobals at: #otherSession) ifNotNil: [:sess | sess logout]'!

logoutThenLoginAs: theUser
TestMessageBox enableJadeiteTestMessageBox.
TestMessageBox plannedResult: #no. "closing the transcript will logout the session. don't commit"
transcript := JadeiteTranscript allInstances detect: [:tran | tran gciSession == GciSession current]
ifNone: [].
[transcript view close] ensure: [TestMessageBox disableJadeiteTestMessageBox].
JadeiteLoginShell allInstances do: [:shell | shell view close]. "should save to the remote JadeDefaultConnection.gss file"
jadeiteShell := JadeiteLoginShell show.
jadeiteShell userIDPresenter value: theUser.
self loginWithRetry: jadeiteShell!
^JadeiteTestResource current logoutThenLoginAs: theUser!

methodListPresenter
^self projectsPresenter methodListPresenter!
Expand Down
11 changes: 10 additions & 1 deletion sources/JadeiteBrowserPresenter.cls
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ abortTransaction
super abortTransaction.
self autoCommit: (autoCommit value == #failed ifTrue: [true] ifFalse: [autoCommit value])!

aboutToChange: aSelectionChangingEvent
aSelectionChangingEvent value ifTrue: [
aSelectionChangingEvent value: self isOkayToChange.
self resetCategoryText.
].

!

addDictionary
| newDictionaryName |
(newDictionaryName := Prompter prompt: 'Enter new dictionary name:') isNil ifTrue: [^self].
Expand Down Expand Up @@ -1333,7 +1341,7 @@ queryCommand: aCommandQuery
ifTrue:
[aCommandQuery isEnabled: true.
^true].
aCommandQuery commandSymbol = #beginTransaction
command = #beginTransaction
ifTrue:
[aCommandQuery isEnabled: self isBeginTransactionEnabled.
^true].
Expand Down Expand Up @@ -2071,6 +2079,7 @@ writeProject
!JadeiteBrowserPresenter categoriesForMethods!
abortedTransaction!public! !
abortTransaction!public!transaction management! !
aboutToChange:!event handlers!public! !
addDictionary!menu handlers!public! !
additionalAccelerators!constants!public! !
addNoneProject!public!updating! !
Expand Down
5 changes: 4 additions & 1 deletion sources/JadeiteDebuggerDataCuratorTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ purgeInstances: aClass
SessionManager inputState pumpMessages.
(Delay forMilliseconds: 50) wait.
aClass allInstances isEmpty ifTrue: [^self]]].
aClass allInstances do: [:each | each become: Object new].
aClass allInstances do:
[:each |
JadePresenter removeEventsTriggeredFor: each.
each become: Object new].
^count!

removeMethodNamed: aSymbol
Expand Down
6 changes: 3 additions & 3 deletions sources/JadeitePreferences.cls
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ openSUnitBrowserOnPackage:!must not strip!preferences!public! !
openWorkspace:!must not strip!preferences!public! !
performCommand:allowSpacesInArgs:!accessing!must not strip!public! !
session:!accessing!private! !
sigAbortProcessInterval:!public! !
sigAbortsProcessEnabled:!public! !
transactionMode:!public! !
sigAbortProcessInterval:!must not strip!public! !
sigAbortsProcessEnabled:!must not strip!public! !
transactionMode:!must not strip!public! !
transcriptEnabled:!must not strip!preferences!public! !
!

Expand Down
10 changes: 5 additions & 5 deletions sources/JadeiteProjectBrowserLowerTabsTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -880,11 +880,11 @@ test_reformatSourceAppliesOnlyToCurrentBrowser
self methodSourcePresenter value: nil.
self methodSourcePresenter isModified: false.
self
saveMethod: 'reformatSourceTemporaryMethod ^#test'
saveMethod: 'reformatSourceTemporaryMethod ^#test2'
in: 'RowanSample1'
category: 'other'.
self selectMethodNamed: #reformatSourceTemporaryMethod.
self assert: self methodSourcePresenter value equals: 'reformatSourceTemporaryMethod ^#test'.
self assert: self methodSourcePresenter value equals: 'reformatSourceTemporaryMethod ^#test2'.
self openSecondBrowser.
self selectServiceNamed: 'RowanSample1' in: secondPresenter projectListPresenter.
self selectServiceNamed: 'RowanSample1-Core' in: secondPresenter packageListPresenter.
Expand All @@ -893,14 +893,14 @@ test_reformatSourceAppliesOnlyToCurrentBrowser
collect: [:selector | secondPresenter methodListPresenter list detect: [:svc | svc selector = selector]].
secondPresenter methodListPresenter selections: methodServices.
self assert: secondPresenter methodSourcePresenter value
equals: 'reformatSourceTemporaryMethod ^#test'.
equals: 'reformatSourceTemporaryMethod ^#test2'.
self projectsPresenter reformatSource.
self assert: self methodSourcePresenter view isModified.
self assert: self methodSourcePresenter value
equals: 'reformatSourceTemporaryMethod
^ #''test''' replaceCrLfWithLf.
^ #''test2''' replaceCrLfWithLf.
self assert: secondPresenter methodSourcePresenter value
equals: 'reformatSourceTemporaryMethod ^#test'.
equals: 'reformatSourceTemporaryMethod ^#test2'.
self methodSourcePresenter isModified: false.
self projectsPresenter removeMethods: self classListPresenter selections!

Expand Down
7 changes: 3 additions & 4 deletions sources/JadeiteProjectBrowserTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -915,18 +915,18 @@ test_browseSameClassCategoriesCorrect
self selectServiceNamed: 'Rowan-Definitions' in: self packageListPresenter.
self selectServiceNamed: 'RwClassExtensionDefinition' in: self classListPresenter.
self selectCategoryNamed: 'comparing'.
self assert: self methodListPresenter list size equals: 2.
self assert: self methodListPresenter list size equals: 1.
self selectMethodNamed: #compareDictionary:againstBaseDictionary:into:elementClass:isMeta:.
methodListBrowser := self projectsPresenter browseImplementors.
self assert: self methodListPresenter list size equals: 2. "original browser method list doesn't change"
self assert: self methodListPresenter list size equals: 1. "original browser method list doesn't change"
methodInSameClass := methodListBrowser primaryPresenter methodListPresenter methodListPresenter
list detect: [:methodService | methodService className = 'RwClassExtensionDefinition'] ifNone: [].
self denyIsNil: methodInSameClass.
methodListBrowser primaryPresenter methodListPresenter methodListPresenter
selection: methodInSameClass.
newBrowser := methodListBrowser primaryPresenter methodListPresenter browseClass.

[self assert: self methodListPresenter list size equals: 2. "original browser method list doesn't change"
[self assert: self methodListPresenter list size equals: 1. "original browser method list doesn't change"
self assert: newBrowser currentCard categoryListPresenter list notEmpty.
self assert: self projectsPresenter categoryListPresenter list notEmpty.
self assert: newBrowser currentCard categoryListPresenter list
Expand Down Expand Up @@ -3393,7 +3393,6 @@ test_verifyValidCategory

waitForPresenter: presenter
[presenter list isEmpty] whileTrue: [(Delay forMilliseconds: 50) wait]! !

!JadeiteProjectBrowserTestCase categoriesForMethods!
addSampleMethodGoo!dirty project!private! !
addSampleMethodHoo!dirty project!private! !
Expand Down
44 changes: 0 additions & 44 deletions sources/JadeiteProjectsBrowserPresenter.cls
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ In packages pane, show projects & packages. Remove class categories.
!JadeiteProjectsBrowserPresenter categoriesForClass!Unclassified! !
!JadeiteProjectsBrowserPresenter methodsFor!

aboutToChange: aSelectionChangingEvent
aSelectionChangingEvent value ifTrue: [
aSelectionChangingEvent value: self isOkayToChange.
self resetCategoryText.
].

!

addNoneProject

"ignore in this browser"!
Expand Down Expand Up @@ -1687,9 +1679,7 @@ updateSUnitTab
updateSUnitTab: service
service ifNil: [sunitPresenter testClassService: nil] ifNotNil: [self setTestClass: service]! !
!JadeiteProjectsBrowserPresenter categoriesForMethods!
aboutToChange:!event handlers!public! !
addNoneProject!private! !
addPackage!menu handlers!public! !
addPackageDictionaryInfoTo:!private! !
Expand Down Expand Up @@ -1862,37 +1852,3 @@ updateSUnitTab!event handlers!public!updating! !
updateSUnitTab:!event handlers!public!updating! !
!
updateSystemTab
| projectTabLabel |
projectTabLabel := self projectTabLabel.
self topShell cardsPresenter view currentCard arrangement: projectTabLabel.
self parentPresenter view updateTabs!
updateTabLabel
self updateSystemTab!
writeProject
| projectServices ws |
projectServices := projectListPresenter selections.
ws := WriteStream on: String new.
projectServices do:
[:service |
ws
nextPutAll: service name;
space].
(MessageBox confirm: 'Write projects - ' , ws contents , '- to disk without committing?')
ifFalse: [^false].
projectServices do: [:service | service command: #write].
self issueCommand: projectServices.
MessageBox notify: 'Projects ' , ws contents , ' written to disk'.
self refreshFromServer. ! !
!JadeiteProjectsBrowserPresenter class methodsFor!
downArrowIcon
^Icon fromFile: 'icons\DownArrow.ico'
! !
!JadeiteProjectsBrowserPresenter class categoriesForMethods!
downArrowIcon!public! !
!
2 changes: 1 addition & 1 deletion sources/JadeiteTestResource.cls
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ logoutThenLoginAs: userName
do: [:shell | shell view close "should save to the remote JadeDefaultConnection.gss file"].
jadeiteShell := JadeiteLoginShell show.
jadeiteShell userIDPresenter value: userName.
jadeiteShell loginWithoutErrorHandling!
jadeiteShell loginWithoutErrorHandling.!

openProjectsBrowser
(projectsBrowser isNil or: [projectsBrowser isOpen not])
Expand Down

0 comments on commit 1d1d59b

Please sign in to comment.