From f80a48042e4ffa8e750fb94c043072605c0030cb Mon Sep 17 00:00:00 2001 From: Esteban Lorenzano Date: Tue, 19 Nov 2024 11:56:11 +0100 Subject: [PATCH] add tests for column view and easy column view. As with easy lists, this may not work completely on gtk but for now we put it in the todo. --- src/Spec2-Core/SpTablePresenter.class.st | 2 +- .../SpColumnViewPresenterTest.class.st | 27 +++++++++++++ .../SpEasyColumnViewPresenterTest.class.st | 40 +++++++++++++++++++ .../SpEasyColumnViewPresenter.class.st | 38 +++++++++++++++++- 4 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 src/Spec2-ListView-Tests/SpColumnViewPresenterTest.class.st create mode 100644 src/Spec2-ListView-Tests/SpEasyColumnViewPresenterTest.class.st diff --git a/src/Spec2-Core/SpTablePresenter.class.st b/src/Spec2-Core/SpTablePresenter.class.st index 7eaea72d..dde8e674 100644 --- a/src/Spec2-Core/SpTablePresenter.class.st +++ b/src/Spec2-Core/SpTablePresenter.class.st @@ -77,7 +77,7 @@ SpTablePresenter >> beResizable [ self isResizable: true ] -{ #category : 'emulating' } +{ #category : 'simulation' } SpTablePresenter >> clickOnColumnHeaderAt: anIndex [ self withAdapterDo: [ :tableAdapter | tableAdapter clickOnColumnHeaderAt: anIndex ] ] diff --git a/src/Spec2-ListView-Tests/SpColumnViewPresenterTest.class.st b/src/Spec2-ListView-Tests/SpColumnViewPresenterTest.class.st new file mode 100644 index 00000000..6a279c4e --- /dev/null +++ b/src/Spec2-ListView-Tests/SpColumnViewPresenterTest.class.st @@ -0,0 +1,27 @@ +Class { + #name : 'SpColumnViewPresenterTest', + #superclass : 'SpAbstractListPresenterTest', + #category : 'Spec2-ListView-Tests', + #package : 'Spec2-ListView-Tests' +} + +{ #category : 'testing' } +SpColumnViewPresenterTest class >> shouldInheritSelectors [ + + ^ true +] + +{ #category : 'accessing' } +SpColumnViewPresenterTest >> classToTest [ + + ^ SpColumnViewPresenter +] + +{ #category : 'initialization' } +SpColumnViewPresenterTest >> initializeTestedInstance [ + + presenter + addColumnTitle: 'Test' + setup: [ :aPresenter | aPresenter newLabel ] + bind: [ :aPresenter :anObject | aPresenter label: anObject asString ] +] diff --git a/src/Spec2-ListView-Tests/SpEasyColumnViewPresenterTest.class.st b/src/Spec2-ListView-Tests/SpEasyColumnViewPresenterTest.class.st new file mode 100644 index 00000000..22f519be --- /dev/null +++ b/src/Spec2-ListView-Tests/SpEasyColumnViewPresenterTest.class.st @@ -0,0 +1,40 @@ +Class { + #name : 'SpEasyColumnViewPresenterTest', + #superclass : 'SpColumnViewPresenterTest', + #category : 'Spec2-ListView-Tests', + #package : 'Spec2-ListView-Tests' +} + +{ #category : 'accessing' } +SpEasyColumnViewPresenterTest >> classToTest [ + + ^ SpEasyColumnViewPresenter +] + +{ #category : 'initialization' } +SpEasyColumnViewPresenterTest >> initializeTestedInstance [ + + presenter addColumn: (SpStringTableColumn + title: 'Test' + evaluated: [ :anObject | anObject asString ]) +] + +{ #category : 'tests' } +SpEasyColumnViewPresenterTest >> testDisableActivationDuring [ + + self skip +] + +{ #category : 'tests - smoke' } +SpEasyColumnViewPresenterTest >> testSetSortingBlockBeforeItems [ + + "this does not has sense in a column (or table) view." + self skip +] + +{ #category : 'tests - smoke' } +SpEasyColumnViewPresenterTest >> testSortingBlock [ + + "this does not has sense in a column (or table) view." + self skip +] diff --git a/src/Spec2-ListView/SpEasyColumnViewPresenter.class.st b/src/Spec2-ListView/SpEasyColumnViewPresenter.class.st index 06258b10..7d6301ad 100644 --- a/src/Spec2-ListView/SpEasyColumnViewPresenter.class.st +++ b/src/Spec2-ListView/SpEasyColumnViewPresenter.class.st @@ -62,6 +62,12 @@ SpEasyColumnViewPresenter >> beResizable [ contentView beResizable ] +{ #category : 'simulation' } +SpEasyColumnViewPresenter >> clickAtIndex: aNumber [ + + contentView clickAtIndex: aNumber +] + { #category : 'api' } SpEasyColumnViewPresenter >> columns: aCollection [ @@ -69,10 +75,16 @@ SpEasyColumnViewPresenter >> columns: aCollection [ ] +{ #category : 'api' } +SpEasyColumnViewPresenter >> contextMenu [ + + ^ contentView contextMenu +] + { #category : 'api' } SpEasyColumnViewPresenter >> contextMenu: aBlock [ - self flag: #TODO. "ignored, as this is deprecated" + contentView contextMenu: aBlock ] { #category : 'private' } @@ -81,6 +93,12 @@ SpEasyColumnViewPresenter >> displayValueFor: aImage [ ^ contentView displayValueFor: aImage ] +{ #category : 'simulation' } +SpEasyColumnViewPresenter >> doubleClickAtIndex: aNumber [ + + contentView doubleClickAtIndex: aNumber +] + { #category : 'api' } SpEasyColumnViewPresenter >> hideColumnHeaders [ @@ -101,6 +119,12 @@ SpEasyColumnViewPresenter >> isShowingColumnHeaders [ ^ contentView isShowingColumnHeaders ] +{ #category : 'api - selection' } +SpEasyColumnViewPresenter >> selectAll [ + + contentView selectAll +] + { #category : 'api' } SpEasyColumnViewPresenter >> showColumnHeaders [ @@ -113,6 +137,12 @@ SpEasyColumnViewPresenter >> unselectAll [ contentView unselectAll ] +{ #category : 'api' } +SpEasyColumnViewPresenter >> updateItemsKeepingSelection: aSequenceableCollection [ + + contentView updateItemsKeepingSelection: aSequenceableCollection +] + { #category : 'api - events' } SpEasyColumnViewPresenter >> whenIsResizableChangedDo: aBlock [ @@ -120,6 +150,12 @@ SpEasyColumnViewPresenter >> whenIsResizableChangedDo: aBlock [ ] +{ #category : 'api - events' } +SpEasyColumnViewPresenter >> whenMenuChangedDo: aBlock [ + + contentView whenMenuChangedDo: aBlock +] + { #category : 'api - events' } SpEasyColumnViewPresenter >> whenSelectedDo: aBlock [