Skip to content

Commit

Permalink
add tests for column view and easy column view. As with easy lists, t…
Browse files Browse the repository at this point in the history
…his may not work completely on gtk but for now we put it in the todo.
  • Loading branch information
estebanlm committed Nov 19, 2024
1 parent 7c2ab4e commit f80a480
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Spec2-Core/SpTablePresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ SpTablePresenter >> beResizable [
self isResizable: true
]

{ #category : 'emulating' }
{ #category : 'simulation' }
SpTablePresenter >> clickOnColumnHeaderAt: anIndex [
self withAdapterDo: [ :tableAdapter | tableAdapter clickOnColumnHeaderAt: anIndex ]
]
Expand Down
27 changes: 27 additions & 0 deletions src/Spec2-ListView-Tests/SpColumnViewPresenterTest.class.st
Original file line number Diff line number Diff line change
@@ -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 ]
]
40 changes: 40 additions & 0 deletions src/Spec2-ListView-Tests/SpEasyColumnViewPresenterTest.class.st
Original file line number Diff line number Diff line change
@@ -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
]
38 changes: 37 additions & 1 deletion src/Spec2-ListView/SpEasyColumnViewPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,29 @@ SpEasyColumnViewPresenter >> beResizable [
contentView beResizable
]

{ #category : 'simulation' }
SpEasyColumnViewPresenter >> clickAtIndex: aNumber [

contentView clickAtIndex: aNumber
]

{ #category : 'api' }
SpEasyColumnViewPresenter >> columns: aCollection [

contentView 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' }
Expand All @@ -81,6 +93,12 @@ SpEasyColumnViewPresenter >> displayValueFor: aImage [
^ contentView displayValueFor: aImage
]

{ #category : 'simulation' }
SpEasyColumnViewPresenter >> doubleClickAtIndex: aNumber [

contentView doubleClickAtIndex: aNumber
]

{ #category : 'api' }
SpEasyColumnViewPresenter >> hideColumnHeaders [

Expand All @@ -101,6 +119,12 @@ SpEasyColumnViewPresenter >> isShowingColumnHeaders [
^ contentView isShowingColumnHeaders
]

{ #category : 'api - selection' }
SpEasyColumnViewPresenter >> selectAll [

contentView selectAll
]

{ #category : 'api' }
SpEasyColumnViewPresenter >> showColumnHeaders [

Expand All @@ -113,13 +137,25 @@ SpEasyColumnViewPresenter >> unselectAll [
contentView unselectAll
]

{ #category : 'api' }
SpEasyColumnViewPresenter >> updateItemsKeepingSelection: aSequenceableCollection [

contentView updateItemsKeepingSelection: aSequenceableCollection
]

{ #category : 'api - events' }
SpEasyColumnViewPresenter >> whenIsResizableChangedDo: aBlock [

contentView whenIsResizableChangedDo: aBlock

]

{ #category : 'api - events' }
SpEasyColumnViewPresenter >> whenMenuChangedDo: aBlock [

contentView whenMenuChangedDo: aBlock
]

{ #category : 'api - events' }
SpEasyColumnViewPresenter >> whenSelectedDo: aBlock [

Expand Down

0 comments on commit f80a480

Please sign in to comment.