From e3dad6ea1580634ba178e96306d1169f664b8af8 Mon Sep 17 00:00:00 2001 From: bouraqadi <435343+bouraqadi@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:44:23 +0100 Subject: [PATCH 1/5] Bug fix: Provide implementation for message #doRevert sent by context menu --- src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st b/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st index 35b925ed..e5b13212 100644 --- a/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st +++ b/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st @@ -197,7 +197,7 @@ StVersionBrowserPresenter >> doCompareToOtherVersion [ { #category : 'actions' } StVersionBrowserPresenter >> doRevert [ - + self revert: self selectedMessage ] { #category : 'initialization' } From e96e4ee04b86b36806b05f55349d46942a6f3d81 Mon Sep 17 00:00:00 2001 From: bouraqadi <435343+bouraqadi@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:45:40 +0100 Subject: [PATCH 2/5] Cleanup: toolbar action block for revert selected method now relies on the same message #doRevert sent by the context menu --- src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st b/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st index e5b13212..69eea18a 100644 --- a/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st +++ b/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st @@ -296,7 +296,7 @@ StVersionBrowserPresenter >> newMessageList [ StVersionBrowserPresenter >> newMessageToolbar [ ^ (self instantiate: StMethodHistoryToolbarPresenter on: rgMethod) - whenRevertDo: [ self revert: self selectedMessage ]; + whenRevertDo: [ self doRevert ]; yourself ] From 55a8d1bc99691dea4f2533d4fcde7f7e52dd3b9f Mon Sep 17 00:00:00 2001 From: bouraqadi <435343+bouraqadi@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:17:04 +0100 Subject: [PATCH 3/5] Test reverting method with the version browser --- .../StVersionBrowserPresenterTest.class.st | 41 +++++++++++++++++++ src/NewTools-MethodBrowsers-Tests/package.st | 1 + .../StVersionBrowserPresenter.class.st | 6 +++ 3 files changed, 48 insertions(+) create mode 100644 src/NewTools-MethodBrowsers-Tests/StVersionBrowserPresenterTest.class.st create mode 100644 src/NewTools-MethodBrowsers-Tests/package.st diff --git a/src/NewTools-MethodBrowsers-Tests/StVersionBrowserPresenterTest.class.st b/src/NewTools-MethodBrowsers-Tests/StVersionBrowserPresenterTest.class.st new file mode 100644 index 00000000..f9caabe0 --- /dev/null +++ b/src/NewTools-MethodBrowsers-Tests/StVersionBrowserPresenterTest.class.st @@ -0,0 +1,41 @@ +Class { + #name : 'StVersionBrowserPresenterTest', + #superclass : 'TestCase', + #instVars : [ + 'class', + 'factory' + ], + #category : 'NewTools-MethodBrowsers-Tests', + #package : 'NewTools-MethodBrowsers-Tests' +} + +{ #category : 'running' } +StVersionBrowserPresenterTest >> setUp [ + super setUp. + factory := ClassFactoryForTestCase new. + class := factory newClass + +] + +{ #category : 'running' } +StVersionBrowserPresenterTest >> tearDown [ + factory cleanUp. + super tearDown +] + +{ #category : 'running' } +StVersionBrowserPresenterTest >> testRevertOldMethod [ + | browser | + class compile: 'm + ^1'. + self assert: class new m equals: 1. + class compile: 'm + ^2'. + self assert: class new m equals: 2. + browser := StVersionBrowserPresenter on: class >> #m. + browser selectIndex: browser changeList size. + browser doRevert. + self assert: class new m equals: 1. + + +] diff --git a/src/NewTools-MethodBrowsers-Tests/package.st b/src/NewTools-MethodBrowsers-Tests/package.st new file mode 100644 index 00000000..c11286f8 --- /dev/null +++ b/src/NewTools-MethodBrowsers-Tests/package.st @@ -0,0 +1 @@ +Package { #name : 'NewTools-MethodBrowsers-Tests' } diff --git a/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st b/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st index 69eea18a..6c04d10e 100644 --- a/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st +++ b/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st @@ -345,6 +345,12 @@ StVersionBrowserPresenter >> revert: aChangeRecord [ selectIndex: 1 ] +{ #category : 'test support' } +StVersionBrowserPresenter >> selectIndex: index [ + + messageList selectIndex: index +] + { #category : 'private' } StVersionBrowserPresenter >> selectItem: item [ From 8044d91ed78154aaee25797082187ce6ecc1b4eb Mon Sep 17 00:00:00 2001 From: bouraqadi <435343+bouraqadi@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:20:01 +0100 Subject: [PATCH 4/5] Fixed baseline to load package NewTools-MethodBrowsers-Tests --- src/BaselineOfNewTools/BaselineOfNewTools.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BaselineOfNewTools/BaselineOfNewTools.class.st b/src/BaselineOfNewTools/BaselineOfNewTools.class.st index d8452d56..ca6ec0d7 100644 --- a/src/BaselineOfNewTools/BaselineOfNewTools.class.st +++ b/src/BaselineOfNewTools/BaselineOfNewTools.class.st @@ -26,6 +26,7 @@ BaselineOfNewTools >> baseline: spec [ package: 'NewTools-Gtk'; "Basic tools (inherited from Spec)" package: 'NewTools-MethodBrowsers' with: [ spec requires: #( 'NewTools-SpTextPresenterDecorators' ) ]; + package: 'NewTools-MethodBrowsers-Tests' with: [ spec requires: #( 'NewTools-MethodBrowsers' ) ]; package: 'NewTools-KeymapBrowser'; "inspector" package: 'NewTools-Inspector' with: [ spec requires: #( 'NewTools-Inspector-Extensions' ) ]; From 04affb69c34815aca0cb29426b5ec53a6d330cba Mon Sep 17 00:00:00 2001 From: bouraqadi <435343+bouraqadi@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:54:30 +0100 Subject: [PATCH 5/5] Moved test support method as an exension defined in the test package --- .../StVersionBrowserPresenter.extension.st | 7 +++++++ .../StVersionBrowserPresenter.class.st | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 src/NewTools-MethodBrowsers-Tests/StVersionBrowserPresenter.extension.st diff --git a/src/NewTools-MethodBrowsers-Tests/StVersionBrowserPresenter.extension.st b/src/NewTools-MethodBrowsers-Tests/StVersionBrowserPresenter.extension.st new file mode 100644 index 00000000..ecae8179 --- /dev/null +++ b/src/NewTools-MethodBrowsers-Tests/StVersionBrowserPresenter.extension.st @@ -0,0 +1,7 @@ +Extension { #name : 'StVersionBrowserPresenter' } + +{ #category : '*NewTools-MethodBrowsers-Tests' } +StVersionBrowserPresenter >> selectIndex: index [ + + messageList selectIndex: index +] diff --git a/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st b/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st index 6c04d10e..69eea18a 100644 --- a/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st +++ b/src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st @@ -345,12 +345,6 @@ StVersionBrowserPresenter >> revert: aChangeRecord [ selectIndex: 1 ] -{ #category : 'test support' } -StVersionBrowserPresenter >> selectIndex: index [ - - messageList selectIndex: index -] - { #category : 'private' } StVersionBrowserPresenter >> selectItem: item [