-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Baseline to include the new setting browser and color picker d…
…ependency. New settings browser based in Spec 2. Add setting browser first set of tests.
- Loading branch information
Hernán Morales Durand
committed
Feb 2, 2024
1 parent
f3c3fb7
commit 456dbed
Showing
44 changed files
with
1,932 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
171 changes: 171 additions & 0 deletions
171
src/NewTools-SettingsBrowser-Tests/StSettingsBrowserTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
Class { | ||
#name : 'StSettingsBrowserTest', | ||
#superclass : 'SpBasePresenterTest', | ||
#instVars : [ | ||
'categoriesPresenter', | ||
'toolbarPresenter', | ||
'detailsPresenter' | ||
], | ||
#category : 'NewTools-SettingsBrowser-Tests', | ||
#package : 'NewTools-SettingsBrowser-Tests' | ||
} | ||
|
||
{ #category : 'running' } | ||
StSettingsBrowserTest >> application [ | ||
|
||
^ StSettingsApplication new | ||
useBackend: #Morphic; | ||
yourself | ||
] | ||
|
||
{ #category : 'accessing' } | ||
StSettingsBrowserTest >> classToTest [ | ||
^ StSettingsMainPresenter | ||
] | ||
|
||
{ #category : 'running' } | ||
StSettingsBrowserTest >> setUp [ | ||
|
||
super setUp. | ||
categoriesPresenter := presenter presenterAt: #mainCategoriesPresenter. | ||
toolbarPresenter := presenter presenterAt: #toolbarPresenter. | ||
detailsPresenter := presenter presenterAt: #detailsPresenter. | ||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testCategoriesHasIcon [ | ||
|
||
| categoryList | | ||
categoryList := categoriesPresenter categoryListPresenter. | ||
self | ||
assert: (categoryList presenters allSatisfy: [ : p | p iconPresenter isForm ]) | ||
description: 'It tests that categories in the component list has an icon'. | ||
|
||
|
||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testCategoriesHasSystemSettingsPragma [ | ||
|
||
self | ||
assert: (categoriesPresenter settingsCategories allSatisfy: [ : node | node pragma key = #systemsettings ]) | ||
description: 'It tests that there setting categories have a pragma named systemsettings' | ||
|
||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testCategoriesHasText [ | ||
|
||
| categoryList | | ||
categoryList := categoriesPresenter categoryListPresenter. | ||
self | ||
assert: (categoryList presenters allSatisfy: [ : p | p labelPresenter label notEmpty ]) | ||
description: 'It tests that categories in the component list has text'. | ||
|
||
|
||
|
||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testCategoriesRootParentsAreNotSet [ | ||
|
||
self | ||
assert: (categoriesPresenter settingsCategories allSatisfy: [ : node | node parentNode isNil ]) | ||
description: 'It tests that all categories are root nodes' | ||
|
||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testDescriptionsAreString [ | ||
|
||
self | ||
assert: (categoriesPresenter settingsCategories allSatisfy: [ : node | node description isString ]) | ||
description: 'It tests that categories are described by a String instance' | ||
|
||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testDetailsPresenterNotActivatedByDefault [ | ||
|
||
self | ||
assert: (detailsPresenter presenterAt: #pageTitle) label isEmpty | ||
description: 'It tests that after the window is opened, there is no autoselection of a setting category by default' | ||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testHasCategories [ | ||
|
||
self assert: categoriesPresenter isPresenter. | ||
|
||
self deny: categoriesPresenter settingsCategories isEmpty. | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testNonEmptyCategories [ | ||
|
||
self assert: (categoriesPresenter settingsCategories allSatisfy: #hasChildren). | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testNonEmptyCategoryLabels [ | ||
|
||
self | ||
assert: (categoriesPresenter settingsCategories allSatisfy: [ : node | node label notEmpty ]) | ||
description: 'It tests that there are no setting categories without an assigned name' | ||
|
||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testNonEmptyCategoryNames [ | ||
|
||
self | ||
assert: (categoriesPresenter settingsCategories allSatisfy: [ : node | node name notEmpty ]) | ||
description: 'It tests that there are no setting nodes without an assigned name' | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testSimulateCategoryPopulation [ | ||
|
||
| childSettingsLayout | | ||
|
||
self skip. | ||
categoriesPresenter categoryListPresenter clickItem: 1. | ||
childSettingsLayout := detailsPresenter presenterAt: #settingsBox. | ||
|
||
"(Delay forSeconds: 5) wait." | ||
self | ||
assert: childSettingsLayout children notEmpty | ||
description: 'It tests that after a category selection has been made, the details presenter contains a title' | ||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testSimulateCategorySelection [ | ||
|
||
categoriesPresenter categoryListPresenter clickItem: 1. | ||
self | ||
assert: categoriesPresenter categoryListPresenter selection selectedIndex | ||
equals: 1. | ||
|
||
self | ||
assert: (detailsPresenter presenterAt: #pageTitle) label notEmpty | ||
description: 'It tests that after a category selection has been made, the details presenter contains a title' | ||
] | ||
|
||
{ #category : 'tests' } | ||
StSettingsBrowserTest >> testVisibleOpen [ | ||
|
||
self assert: presenter isPresenter. | ||
self | ||
assert: presenter isVisible | ||
description: 'It test that when the window is opened, it should be visible' | ||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Package { #name : 'NewTools-SettingsBrowser-Tests' } |
9 changes: 9 additions & 0 deletions
9
src/NewTools-SettingsBrowser/AbstractFileReference.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Extension { #name : 'AbstractFileReference' } | ||
|
||
{ #category : '*NewTools-SettingsBrowser' } | ||
AbstractFileReference >> asSettingPresenter: aSettingDeclaration [ | ||
|
||
^ (StSettingTextPresenterItem on: aSettingDeclaration) | ||
value: self; | ||
yourself | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Extension { #name : 'Boolean' } | ||
|
||
{ #category : '*NewTools-SettingsBrowser' } | ||
Boolean >> asSettingPresenter: aSettingDeclaration [ | ||
|
||
^ (StSettingBooleanPresenterItem on: aSettingDeclaration) | ||
value: self; | ||
yourself | ||
] |
9 changes: 9 additions & 0 deletions
9
src/NewTools-SettingsBrowser/CmdShortcutActivation.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Extension { #name : 'CmdShortcutActivation' } | ||
|
||
{ #category : '*NewTools-SettingsBrowser' } | ||
CmdShortcutActivation >> asSettingPresenter: aDeclaration [ | ||
|
||
^ (StSettingTextPresenterItem on: aDeclaration) | ||
value: self keyCombination asString; | ||
yourself | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Extension { #name : 'Color' } | ||
|
||
{ #category : '*NewTools-SettingsBrowser' } | ||
Color >> asSettingPresenter: aSettingDeclaration [ | ||
|
||
^ (StSettingSHStyleButtonColorPresenterItem on: aSettingDeclaration) | ||
buttonAction: [ aSettingDeclaration getColor ]; | ||
whenColorChangedDo: [ self updateColor: aSettingDeclaration color ]; | ||
yourself. | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Extension { #name : 'Float' } | ||
|
||
{ #category : '*NewTools-SettingsBrowser' } | ||
Float >> asSettingPresenter: aSettingDeclaration [ | ||
|
||
^ (StSettingNumberPresenterItem on: aSettingDeclaration) | ||
beFloat; | ||
value: self; | ||
yourself | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Extension { #name : 'Integer' } | ||
|
||
{ #category : '*NewTools-SettingsBrowser' } | ||
Integer >> asSettingPresenter: aSettingDeclaration [ | ||
|
||
^ (StSettingNumberPresenterItem on: aSettingDeclaration) | ||
beInteger; | ||
value: self; | ||
yourself | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Extension { #name : 'LogicalFont' } | ||
|
||
{ #category : '*NewTools-SettingsBrowser' } | ||
LogicalFont >> asSettingPresenter: aSettingDeclaration [ | ||
|
||
| info | | ||
|
||
info := String streamContents: [ : stream | | ||
stream | ||
<< self realFont textStyleName; | ||
<< ' ('; | ||
<< self realFont pointSize asString; | ||
<< ')' ]. | ||
|
||
^ (StSettingSHStyleButtonPresenterItem on: aSettingDeclaration) | ||
buttonLabel: info; | ||
buttonFont: self realFont; | ||
buttonAction: [ aSettingDeclaration getFont ]; | ||
yourself. | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
Extension { #name : 'NECPreferences' } | ||
|
||
{ #category : '*NewTools-SettingsBrowser' } | ||
NECPreferences class >> settingsOn: aBuilder [ | ||
<systemsettings> | ||
(aBuilder setting: #'Code Completion') | ||
target: self; | ||
parentName: #codeBrowsing; | ||
selector: #enabled; | ||
default: true; | ||
iconName: #smallConfiguration; | ||
description: 'Enable or disable code completion in browsers, debuggers and workspaces.'; | ||
with: [ | ||
| availableControllers availableSorters | | ||
availableControllers := self availableEngines. | ||
availableControllers size > 1 | ||
ifTrue: [ | ||
(aBuilder pickOne: #completionEngineClass) | ||
order: -1; | ||
label: 'CompletionEngine'; | ||
target: RubSmalltalkEditor; | ||
getSelector: #completionEngineClass; | ||
setSelector: #completionEngineClass:; | ||
default: (Smalltalk at: #CoCompletionEngine); | ||
domainValues: availableControllers ]. | ||
availableSorters := self availableSorters. | ||
availableSorters size > 1 | ||
ifTrue: [ | ||
(aBuilder pickOne: #completionSorter) | ||
order: -1; | ||
label: 'Sorter'; | ||
target: CompletionContext; | ||
getSelector: #sorterClass; | ||
setSelector: #sorterClass:; | ||
domainValues: availableSorters ]. | ||
(aBuilder setting: #backgroundColor) | ||
default: (Color | ||
r: 0.823069403714565 | ||
g: 0.823069403714565 | ||
b: 0.823069403714565 alpha: 1.0); | ||
label: 'Background Color'. | ||
(aBuilder setting: #useEnterToAccept) | ||
label: 'Use ENTER to accept a suggested completion'; | ||
default: self defaultUseEnterToAccept. | ||
(aBuilder setting: #showCompletionDetails) | ||
label: 'Show completion details'; | ||
description: 'Show detailed information about completion entries'; | ||
default: self defaultShowCompletionDetails. | ||
(aBuilder setting: #caseSensitive) | ||
label: 'Case Sensitive'; | ||
default: true; | ||
description: 'Decide if you want eCompletion to be case sensitive or not.'. | ||
(aBuilder setting: #smartCharacters) | ||
label: 'Smart Characters'; | ||
default: true; | ||
description: 'Decide if you want eCompletion to use smart characters, e.g, to automatically close brackets.'. | ||
(aBuilder setting: #smartCharactersWithSingleSpace) | ||
label: 'Smart Characters with Single Space'; | ||
default: ''; | ||
description: 'Enumerate the characters which are automatically inserted with a single space in between.'. | ||
(aBuilder setting: #smartCharactersWithDoubleSpace) | ||
label: 'Smart Characters with Double Space'; | ||
default: '[]{}'; | ||
description: 'Enumerate the characters which are automatically inserted with a two spaces in between.'. | ||
(aBuilder setting: #popupShowAutomatic) | ||
default: self defaultPopupShowAutomatic; | ||
label: 'Popup is automatic'. | ||
(aBuilder setting: #popupAutomaticDelay) | ||
default: self defaultPopupDelay; | ||
label: 'Popup appearance delay'. | ||
(aBuilder pickOne: #popupShowWithShortcut) | ||
target: self; | ||
default: self defaultPopupShortcut; | ||
label: 'Popup appears with this shortcut'; | ||
domainValues: self availablePopupShortcuts. | ||
(aBuilder setting: #spaceAfterCompletion) | ||
target: NECEntry; | ||
default: self defaultSpaceAfterCompletion; | ||
label: 'Put a space after completion' | ||
] | ||
] |
9 changes: 9 additions & 0 deletions
9
src/NewTools-SettingsBrowser/PickOneSettingDeclaration.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Extension { #name : 'PickOneSettingDeclaration' } | ||
|
||
{ #category : '*NewTools-SettingsBrowser' } | ||
PickOneSettingDeclaration >> asSettingPresenter [ | ||
"Answer an appropriate <SpPresenter> container for the receiver's value" | ||
|
||
^ StSettingDropListPresenterItem on: self | ||
|
||
] |
Oops, something went wrong.