diff --git a/src/BaselineOfNewTools/BaselineOfNewTools.class.st b/src/BaselineOfNewTools/BaselineOfNewTools.class.st index 844ae94ea..844b6cf4e 100644 --- a/src/BaselineOfNewTools/BaselineOfNewTools.class.st +++ b/src/BaselineOfNewTools/BaselineOfNewTools.class.st @@ -22,6 +22,7 @@ BaselineOfNewTools >> baseline: spec [ spec package: 'NewTools-Core'; + package: 'NewTools-Core-Tests' with: [ spec requires: #('NewTools-Core') ]; package: 'NewTools-Morphic'; package: 'NewTools-Gtk'; "Basic tools (inherited from Spec)" @@ -81,7 +82,6 @@ BaselineOfNewTools >> baseline: spec [ "Fuel" package: 'NewTools-Debugger-Fuel'; package: 'NewTools-Debugger-Fuel-Tests' with: [ spec requires: #( 'NewTools-Debugger-Fuel' ) ]; - package: 'NewTools-Fuel'; "Rewriter Tools" package: 'NewTools-RewriterTools-Backend'; package: 'NewTools-RewriterTools' with: [ spec requires: #('NewTools-RewriterTools-Backend') ]; @@ -104,10 +104,10 @@ BaselineOfNewTools >> baseline: spec [ package: 'NewTools-SettingsBrowser' with: [ spec requires: #('ColorPicker') ]; package: 'NewTools-SettingsBrowser-Tests' with: [ spec requires: #('NewTools-SettingsBrowser') ]; - package: 'NewTools-Compression-Utils' with: [ spec requires: #('NewTools-FileBrowser') ]. + package: 'NewTools-Utils' with: [ spec requires: #('NewTools-FileBrowser') ]. spec - group: 'Core' with: #( 'NewTools-Core' 'NewTools-Morphic' ); + group: 'Core' with: #( 'NewTools-Core' 'NewTools-Core-Tests' 'NewTools-Morphic' ); group: 'Playground' with: #( 'Core' 'NewTools-Playground' 'NewTools-Playground-Tests' ); group: 'Inspector' with: #( 'Core' 'NewTools-Inspector' 'NewTools-Inspector-Tests' ); group: 'Debugger' with: #( @@ -124,7 +124,7 @@ BaselineOfNewTools >> baseline: spec [ 'NewTools-Debugger-Tests' 'NewTools-Debugger-Fuel' 'NewTools-Debugger-Fuel-Tests' - 'NewTools-Fuel' + 'NewTools-Utils' 'NewTools-DebugPointsBrowser' 'NewTools-ObjectCentricDebugPoints' ); group: 'Spotter' with: #( @@ -172,9 +172,6 @@ BaselineOfNewTools >> baseline: spec [ group: 'SettingsBrowser' with: #( 'NewTools-SettingsBrowser' 'NewTools-SettingsBrowser-Tests'); - "Compression Utilities" - group: 'CompressionUtilities' with: #( - 'NewTools-Compression-Utils'); group: 'default' with: #( 'Playground' @@ -190,8 +187,7 @@ BaselineOfNewTools >> baseline: spec [ 'FileBrowser' 'Finder' 'Profiler' - 'SettingsBrowser' - 'CompressionUtilities') ] + 'SettingsBrowser' ) ] ] { #category : 'external projects' } diff --git a/src/NewTools-Compression-Utils/package.st b/src/NewTools-Compression-Utils/package.st deleted file mode 100644 index 6f8533202..000000000 --- a/src/NewTools-Compression-Utils/package.st +++ /dev/null @@ -1 +0,0 @@ -Package { #name : 'NewTools-Compression-Utils' } diff --git a/src/NewTools-Core-Tests/StProtocolNameChooserPresenterTest.class.st b/src/NewTools-Core-Tests/StProtocolNameChooserPresenterTest.class.st new file mode 100644 index 000000000..685bda2d8 --- /dev/null +++ b/src/NewTools-Core-Tests/StProtocolNameChooserPresenterTest.class.st @@ -0,0 +1,75 @@ +" +A StProtocolNameChooserPresenterTest is a test class for testing the behavior of StProtocolNameChooserPresenter +" +Class { + #name : 'StProtocolNameChooserPresenterTest', + #superclass : 'TestCase', + #instVars : [ + 'presenter' + ], + #category : 'NewTools-Core-Tests-ProtocolChooser', + #package : 'NewTools-Core-Tests', + #tag : 'ProtocolChooser' +} + +{ #category : 'running' } +StProtocolNameChooserPresenterTest >> setUp [ + super setUp. + presenter := StProtocolNameChooserPresenter new +] + +{ #category : 'tests' } +StProtocolNameChooserPresenterTest >> testSmokeTest [ + + | window | + [ self shouldnt: [ window := presenter open ] raise: Error ] ensure: [ window close ]. + + [ self shouldnt: [ window := presenter openDialog ] raise: Error ] ensure: [ window close ]. + + presenter concernedClass: self class. + presenter protocolName: 'test'. + + [ self shouldnt: [ window := presenter open ] raise: Error ] ensure: [ window close ] +] + +{ #category : 'tests' } +StProtocolNameChooserPresenterTest >> testSuggestedProtocolsAreOrderedByPriority [ + "I'm not sure how to test this without using the sae code as #protocolsToSuggest so I'm hardcoding 3 of the most used protocols in the system" + + self assert: ((presenter protocolsToSuggest first: 5) includesAll: #( accessing initialization testing )) +] + +{ #category : 'tests' } +StProtocolNameChooserPresenterTest >> testSuggestedProtocolsDependOnInstanceOrClassSide [ + + | protocolName classProtocolName | + protocolName := UUID new asString36. + classProtocolName := UUID new asString36. + + [ + self class addProtocol: protocolName. + self class class addProtocol: classProtocolName. + + presenter concernedClass: self class. + self assert: (presenter protocolsToSuggest includes: protocolName). + self deny: (presenter protocolsToSuggest includes: classProtocolName). + + presenter concernedClass: self class class. + self deny: (presenter protocolsToSuggest includes: protocolName). + self assert: (presenter protocolsToSuggest includes: classProtocolName) ] ensure: [ + self class removeProtocol: protocolName. + self class class removeProtocol: classProtocolName ] +] + +{ #category : 'tests' } +StProtocolNameChooserPresenterTest >> testSuggestedProtocolsIncludesProtocolsOfTheImage [ + + | protocolName | + protocolName := UUID new asString36. + + self deny: (presenter protocolsToSuggest includes: protocolName). + [ + self class addProtocol: protocolName. + + self assert: (presenter protocolsToSuggest includes: protocolName) ] ensure: [ self class removeProtocol: protocolName ] +] diff --git a/src/NewTools-Core-Tests/package.st b/src/NewTools-Core-Tests/package.st new file mode 100644 index 000000000..f4dd22321 --- /dev/null +++ b/src/NewTools-Core-Tests/package.st @@ -0,0 +1 @@ +Package { #name : 'NewTools-Core-Tests' } diff --git a/src/NewTools-Core/StProtocolNameChooserPresenter.class.st b/src/NewTools-Core/StProtocolNameChooserPresenter.class.st new file mode 100644 index 000000000..d69e4b7a0 --- /dev/null +++ b/src/NewTools-Core/StProtocolNameChooserPresenter.class.st @@ -0,0 +1,165 @@ +" +I am a little interface to let the user choose the name of a protocol. + +This interface will suggest the name of the protocol as the user types the beginning of the name. + +I can be configured with a concerned class to refine the UI such as proposing instance or class side protocols in the suggestion list. + +See my class side for an example of usage and some helpers. + +Idea of improvements for the future: +- Suggest protocols from super classes first? +- Add tests +" +Class { + #name : 'StProtocolNameChooserPresenter', + #superclass : 'StPresenter', + #instVars : [ + 'suggestionList', + 'protocolNameField', + 'concernedClass' + ], + #category : 'NewTools-Core-ProtocolChooser', + #package : 'NewTools-Core', + #tag : 'ProtocolChooser' +} + +{ #category : 'examples' } +StProtocolNameChooserPresenter class >> exampleConfiguringPresenter [ + + + self requestProtocolNameConfiguring: [ :presenter :dialog | + presenter + concernedClass: self class; "Giving the concerned class can allow some customizations such as knowing if we should suggest instance or class side protocols" + protocolName: 'ac'. + dialog title: 'Updated title' ] +] + +{ #category : 'instance creation' } +StProtocolNameChooserPresenter class >> open [ + +