From 1d1d59b812d4d056e6f51d4211f146937e1f202f Mon Sep 17 00:00:00 2001 From: Eric Winger Date: Fri, 8 Jul 2022 11:43:08 -0700 Subject: [PATCH] Tests mostly working after merge * 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 --- sources/JadeiteAbstractTestCase.cls | 10 +---- sources/JadeiteBrowserPresenter.cls | 11 ++++- .../JadeiteDebuggerDataCuratorTestCase.cls | 5 ++- sources/JadeitePreferences.cls | 6 +-- ...JadeiteProjectBrowserLowerTabsTestCase.cls | 10 ++--- sources/JadeiteProjectBrowserTestCase.cls | 7 ++- sources/JadeiteProjectsBrowserPresenter.cls | 44 ------------------- sources/JadeiteTestResource.cls | 2 +- 8 files changed, 27 insertions(+), 68 deletions(-) diff --git a/sources/JadeiteAbstractTestCase.cls b/sources/JadeiteAbstractTestCase.cls index f77e6735..ebfdcb15 100755 --- a/sources/JadeiteAbstractTestCase.cls +++ b/sources/JadeiteAbstractTestCase.cls @@ -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! diff --git a/sources/JadeiteBrowserPresenter.cls b/sources/JadeiteBrowserPresenter.cls index 46054e1a..1be1f1ce 100644 --- a/sources/JadeiteBrowserPresenter.cls +++ b/sources/JadeiteBrowserPresenter.cls @@ -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]. @@ -1333,7 +1341,7 @@ queryCommand: aCommandQuery ifTrue: [aCommandQuery isEnabled: true. ^true]. - aCommandQuery commandSymbol = #beginTransaction + command = #beginTransaction ifTrue: [aCommandQuery isEnabled: self isBeginTransactionEnabled. ^true]. @@ -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! ! diff --git a/sources/JadeiteDebuggerDataCuratorTestCase.cls b/sources/JadeiteDebuggerDataCuratorTestCase.cls index db2b9aa2..17965d44 100644 --- a/sources/JadeiteDebuggerDataCuratorTestCase.cls +++ b/sources/JadeiteDebuggerDataCuratorTestCase.cls @@ -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 diff --git a/sources/JadeitePreferences.cls b/sources/JadeitePreferences.cls index 41784008..ddce4a9e 100644 --- a/sources/JadeitePreferences.cls +++ b/sources/JadeitePreferences.cls @@ -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! ! ! diff --git a/sources/JadeiteProjectBrowserLowerTabsTestCase.cls b/sources/JadeiteProjectBrowserLowerTabsTestCase.cls index 71fefe89..894ce24f 100644 --- a/sources/JadeiteProjectBrowserLowerTabsTestCase.cls +++ b/sources/JadeiteProjectBrowserLowerTabsTestCase.cls @@ -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. @@ -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! diff --git a/sources/JadeiteProjectBrowserTestCase.cls b/sources/JadeiteProjectBrowserTestCase.cls index a69139da..a7d3cb50 100644 --- a/sources/JadeiteProjectBrowserTestCase.cls +++ b/sources/JadeiteProjectBrowserTestCase.cls @@ -915,10 +915,10 @@ 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. @@ -926,7 +926,7 @@ test_browseSameClassCategoriesCorrect 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 @@ -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! ! diff --git a/sources/JadeiteProjectsBrowserPresenter.cls b/sources/JadeiteProjectsBrowserPresenter.cls index 9d93ea3c..f61b0199 100644 --- a/sources/JadeiteProjectsBrowserPresenter.cls +++ b/sources/JadeiteProjectsBrowserPresenter.cls @@ -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"! @@ -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! ! @@ -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! ! -! - diff --git a/sources/JadeiteTestResource.cls b/sources/JadeiteTestResource.cls index 8481f8f0..a499f5b2 100644 --- a/sources/JadeiteTestResource.cls +++ b/sources/JadeiteTestResource.cls @@ -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])