Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: Context menu item ‘Revert to selected version’ in recent versions of a method does not revert #710

Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions src/BaselineOfNewTools/BaselineOfNewTools.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) ];
Expand Down
Original file line number Diff line number Diff line change
@@ -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.


]
1 change: 1 addition & 0 deletions src/NewTools-MethodBrowsers-Tests/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : 'NewTools-MethodBrowsers-Tests' }
10 changes: 8 additions & 2 deletions src/NewTools-MethodBrowsers/StVersionBrowserPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ StVersionBrowserPresenter >> doCompareToOtherVersion [

{ #category : 'actions' }
StVersionBrowserPresenter >> doRevert [

self revert: self selectedMessage
]

{ #category : 'initialization' }
Expand Down Expand Up @@ -296,7 +296,7 @@ StVersionBrowserPresenter >> newMessageList [
StVersionBrowserPresenter >> newMessageToolbar [

^ (self instantiate: StMethodHistoryToolbarPresenter on: rgMethod)
whenRevertDo: [ self revert: self selectedMessage ];
whenRevertDo: [ self doRevert ];
yourself
]

Expand Down Expand Up @@ -345,6 +345,12 @@ StVersionBrowserPresenter >> revert: aChangeRecord [
selectIndex: 1
]

{ #category : 'test support' }
StVersionBrowserPresenter >> selectIndex: index [

messageList selectIndex: index
]

{ #category : 'private' }
StVersionBrowserPresenter >> selectItem: item [

Expand Down
Loading