From 6dafec5ab28e28243dac933f9d600c904d63aa2b Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Sat, 5 Oct 2019 19:41:55 +0200 Subject: [PATCH] Do some cleanings needed for Pharo integration --- .../SpStyleTest.class.st | 2 +- .../SpDropListAdapterTest.class.st | 68 ++++++++----------- .../SpAbstractWidgetPresenter.class.st | 5 +- src/Spec2-Core/SpCodePresenter.class.st | 3 - src/Spec2-Core/SpContainerPresenter.class.st | 14 ---- src/Spec2-Core/SpDropListItem.class.st | 4 +- src/Spec2-Core/SpImagePresenter.class.st | 2 - src/Spec2-Core/SpNotebookPresenter.class.st | 4 +- src/Spec2-Core/SpPresenter.class.st | 1 - .../SpVersatileDialogPresenter.class.st | 7 +- .../SpSplitterHorizontal.class.st | 5 +- src/Spec2-Layout/SpSplitterVertical.class.st | 5 +- 12 files changed, 38 insertions(+), 82 deletions(-) diff --git a/src/Spec2-Adapters-Morphic-Tests/SpStyleTest.class.st b/src/Spec2-Adapters-Morphic-Tests/SpStyleTest.class.st index 33af9e67e..49ac8dd53 100644 --- a/src/Spec2-Adapters-Morphic-Tests/SpStyleTest.class.st +++ b/src/Spec2-Adapters-Morphic-Tests/SpStyleTest.class.st @@ -7,7 +7,7 @@ Class { #category : #'Spec2-Adapters-Morphic-Tests' } -{ #category : #tests } +{ #category : #running } SpStyleTest >> tearDown [ aClass ifNotNil: [ :e | e removeFromSystem ]. diff --git a/src/Spec2-Backend-Tests/SpDropListAdapterTest.class.st b/src/Spec2-Backend-Tests/SpDropListAdapterTest.class.st index 91025d4d7..97533528f 100644 --- a/src/Spec2-Backend-Tests/SpDropListAdapterTest.class.st +++ b/src/Spec2-Backend-Tests/SpDropListAdapterTest.class.st @@ -19,14 +19,12 @@ SpDropListAdapterTest >> initializeTestedInstance [ { #category : #accessing } SpDropListAdapterTest >> testAddingIconsShowTheIcon [ + #(pharo add book) do: [ :each | self presenter addItemLabeled: each do: [ ] icon: (self iconNamed: each) ]. - #(pharo add book) do: [ :each | - self presenter addItemLabeled: each do: [] icon: (self iconNamed: each)]. - - self presenter selectedItem: #pharo. + self presenter selectItem: #pharo. self assert: self adapter selectedIndexes equals: #(4). - backendForTest assertIcon: self adapter displayedIcon equals: (self iconNamed: #pharo). + backendForTest assertIcon: self adapter displayedIcon equals: (self iconNamed: #pharo) ] { #category : #accessing } @@ -37,41 +35,34 @@ SpDropListAdapterTest >> testDoesNotShowIcons [ { #category : #accessing } SpDropListAdapterTest >> testRemovingIconsAfterAddingThem [ + #(pharo add book) do: [ :each | self presenter addItemLabeled: each do: [ ] icon: (self iconNamed: each) ]. - #(pharo add book) do: [ :each | - self presenter addItemLabeled: each do: [] icon: (self iconNamed: each)]. - - self presenter selectedItem: nil. + self presenter selectItem: nil. self presenter model removeAll. - #(pharo add book) do: [ :each | - self presenter addItemLabeled: each do: [] icon: nil]. + #(pharo add book) do: [ :each | self presenter addItemLabeled: each do: [ ] icon: nil ]. self assert: self adapter selectedIndexes equals: #(1). - backendForTest assertIcon: self adapter displayedIcon equals: nil. + backendForTest assertIcon: self adapter displayedIcon equals: nil ] { #category : #accessing } SpDropListAdapterTest >> testResetingSelectionResetsSelection [ + self presenter selectItem: 10. - self presenter selectedItem: 10. - self presenter resetSelection. self assert: self presenter selectedItem equals: nil. - self assert: self adapter selectedIndexes isEmpty. - + self assert: self adapter selectedIndexes isEmpty ] { #category : #accessing } SpDropListAdapterTest >> testSelectingASecondElementSelectsIt [ - - self presenter selectedItem: 10. - self presenter selectedItem: 20. + self presenter selectItem: 10. + self presenter selectItem: 20. self assert: self presenter selectedItem equals: 20. - self assert: self adapter selectedIndexes equals: #(2). - + self assert: self adapter selectedIndexes equals: #(2) ] { #category : #accessing } @@ -86,24 +77,25 @@ SpDropListAdapterTest >> testSelectingAnElementInWidgetUpdatePresenter [ { #category : #accessing } SpDropListAdapterTest >> testSelectingAnElementSelectsIt [ - - self presenter selectedItem: 10. + self presenter selectItem: 10. self assert: self presenter selectedItem equals: 10. - self assert: self adapter selectedIndexes equals: #(1). - + self assert: self adapter selectedIndexes equals: #(1) ] { #category : #accessing } SpDropListAdapterTest >> testSelectionExecutesBlock [ - | selected | - - self presenter dropListItems: (#(10 20 30) - collect: [ :e | SpDropListItem on: e do: [ selected := e ] ]). - - self presenter selectedItem: 20. - self assert: selected equals: 20 + self presenter + dropListItems: + (#(10 20 30) + collect: [ :e | + SpDropListItem + on: e + do: [ selected := e ] ]). + + self presenter selectItem: 20. + self assert: selected equals: 20 ] { #category : #accessing } @@ -117,19 +109,17 @@ SpDropListAdapterTest >> testSelectionStartsSelectingFirst [ { #category : #accessing } SpDropListAdapterTest >> testSettingNilResetsGeneratesEvent [ | changed | - self presenter selectedItem: 10. + self presenter selectItem: 10. self presenter whenSelectionChangedDo: [ changed := true ]. - self presenter selectedItem: nil. + self presenter selectItem: nil. self assert: changed ] { #category : #accessing } SpDropListAdapterTest >> testSettingNilResetsSelection [ - - self presenter selectedItem: 10. - self presenter selectedItem: nil. + self presenter selectItem: 10. + self presenter selectItem: nil. self assert: self presenter selectedItem equals: nil. - self assert: self adapter selectedIndexes isEmpty. - + self assert: self adapter selectedIndexes isEmpty ] diff --git a/src/Spec2-Core/SpAbstractWidgetPresenter.class.st b/src/Spec2-Core/SpAbstractWidgetPresenter.class.st index 538705a8b..65b452023 100644 --- a/src/Spec2-Core/SpAbstractWidgetPresenter.class.st +++ b/src/Spec2-Core/SpAbstractWidgetPresenter.class.st @@ -219,7 +219,6 @@ SpAbstractWidgetPresenter >> help: aString [ SpAbstractWidgetPresenter >> initialize [ super initialize. - help := nil. borderWidth := 0. borderColor := Color transparent. enabled := true. @@ -237,8 +236,8 @@ SpAbstractWidgetPresenter >> initialize [ self whenEnabledChangedDo: [ :b | self withAdapterDo: [ :w | w update: #enabled: with: {b} ] ]. self property: #dragEnabled whenChangedDo: [ :b | self withWidgetDo: [ :w | w update: #dragEnabled: with: {b} ] ]. self property: #dropEnabled whenChangedDo: [ :b | self withWidgetDo: [ :w | w update: #dropEnabled: with: {b} ] ]. - - styles := #(). + + styles := #() ] { #category : #initialization } diff --git a/src/Spec2-Core/SpCodePresenter.class.st b/src/Spec2-Core/SpCodePresenter.class.st index c44eede45..6604f58c0 100644 --- a/src/Spec2-Core/SpCodePresenter.class.st +++ b/src/Spec2-Core/SpCodePresenter.class.st @@ -126,9 +126,6 @@ SpCodePresenter >> initialize [ super initialize. - behavior := nil. - doItContext := nil. - doItReceiver := nil. self withSyntaxHighlight. self registerEventsForStyling. diff --git a/src/Spec2-Core/SpContainerPresenter.class.st b/src/Spec2-Core/SpContainerPresenter.class.st index 4598e410b..25a61bd2c 100644 --- a/src/Spec2-Core/SpContainerPresenter.class.st +++ b/src/Spec2-Core/SpContainerPresenter.class.st @@ -15,17 +15,3 @@ SpContainerPresenter class >> adapterName [ ^ #ContainerAdapter ] - -{ #category : #'api-focus' } -SpContainerPresenter >> eventKeyStrokesForNextFocus [ - "String describing the keystroke to perform to jump to the next widget" - - ^ keyStrokesForNextFocus -] - -{ #category : #'api-focus' } -SpContainerPresenter >> eventKeyStrokesForPreviousFocus [ - "String describing the keystroke to perform to jump to the previous widget" - - ^ keyStrokesForPreviousFocus -] diff --git a/src/Spec2-Core/SpDropListItem.class.st b/src/Spec2-Core/SpDropListItem.class.st index faa6a7cc1..0965a3eb6 100644 --- a/src/Spec2-Core/SpDropListItem.class.st +++ b/src/Spec2-Core/SpDropListItem.class.st @@ -78,10 +78,8 @@ SpDropListItem >> icon: anObject [ { #category : #initialization } SpDropListItem >> initialize [ super initialize. - action := [ ]. - displayBlock := [ :e | e asString ]. - icon := nil + displayBlock := [ :e | e asString ] ] { #category : #accessing } diff --git a/src/Spec2-Core/SpImagePresenter.class.st b/src/Spec2-Core/SpImagePresenter.class.st index ddedac16e..a093e0f77 100644 --- a/src/Spec2-Core/SpImagePresenter.class.st +++ b/src/Spec2-Core/SpImagePresenter.class.st @@ -60,8 +60,6 @@ SpImagePresenter >> image: aForm [ { #category : #initialization } SpImagePresenter >> initialize [ super initialize. - - image := nil. action := [ ]. autoScale := false ] diff --git a/src/Spec2-Core/SpNotebookPresenter.class.st b/src/Spec2-Core/SpNotebookPresenter.class.st index 7b010b30a..8ed8222e6 100644 --- a/src/Spec2-Core/SpNotebookPresenter.class.st +++ b/src/Spec2-Core/SpNotebookPresenter.class.st @@ -26,11 +26,9 @@ SpNotebookPresenter >> addPage: aPage [ { #category : #initialization } SpNotebookPresenter >> initialize [ - super initialize. pagesHolder := OrderedCollection new asValueHolder. - selectedPage := nil. - + pagesHolder whenChangedDo: [ self pagesChanged ] ] diff --git a/src/Spec2-Core/SpPresenter.class.st b/src/Spec2-Core/SpPresenter.class.st index cec4913b3..a0f38812e 100644 --- a/src/Spec2-Core/SpPresenter.class.st +++ b/src/Spec2-Core/SpPresenter.class.st @@ -512,7 +512,6 @@ SpPresenter >> initialize [ super initialize. visible := true. - additionalSubpresentersMap := nil. self initializePrivateAnnouncer. self initializePrivateValueHolders. diff --git a/src/Spec2-Core/SpVersatileDialogPresenter.class.st b/src/Spec2-Core/SpVersatileDialogPresenter.class.st index 43940ef47..28c6e2dfe 100644 --- a/src/Spec2-Core/SpVersatileDialogPresenter.class.st +++ b/src/Spec2-Core/SpVersatileDialogPresenter.class.st @@ -235,13 +235,10 @@ SpVersatileDialogPresenter >> footnoteIcon: aForm [ { #category : #initialization } SpVersatileDialogPresenter >> initialize [ - super initialize. - - moreOptionsVisible := false. - buttons := OrderedDictionary new. - result := nil. + moreOptionsVisible := false. + buttons := OrderedDictionary new ] { #category : #initialization } diff --git a/src/Spec2-Layout/SpSplitterHorizontal.class.st b/src/Spec2-Layout/SpSplitterHorizontal.class.st index 64b4a760d..e90863c4f 100644 --- a/src/Spec2-Layout/SpSplitterHorizontal.class.st +++ b/src/Spec2-Layout/SpSplitterHorizontal.class.st @@ -37,13 +37,10 @@ SpSplitterHorizontal >> commands: anObject [ { #category : #initialization } SpSplitterHorizontal >> initialize [ - super initialize. selector := #newHSplitterAt:. - layoutFrame := (0@0 corner: 0@0) asSpLayoutFrame - bottomOffset: 1. - commands := nil. + layoutFrame := (0 @ 0 corner: 0 @ 0) asSpLayoutFrame bottomOffset: 1 ] { #category : #testing } diff --git a/src/Spec2-Layout/SpSplitterVertical.class.st b/src/Spec2-Layout/SpSplitterVertical.class.st index 35d97fd1d..54836133d 100644 --- a/src/Spec2-Layout/SpSplitterVertical.class.st +++ b/src/Spec2-Layout/SpSplitterVertical.class.st @@ -37,13 +37,10 @@ SpSplitterVertical >> commands: anObject [ { #category : #initialization } SpSplitterVertical >> initialize [ - super initialize. selector := #newVSplitterAt:. - layoutFrame := ((0@0 corner: 0@0) asSpLayoutFrame - rightOffset: 1). - commands := nil. + layoutFrame := (0 @ 0 corner: 0 @ 0) asSpLayoutFrame rightOffset: 1 ] { #category : #testing }