-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
90 changed files
with
732 additions
and
2,849 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
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
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
52 changes: 0 additions & 52 deletions
52
src/Spec2-Adapters-Morphic-ListView/SpMorphicListViewAdapter.class.st
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
src/Spec2-Adapters-Morphic-ListView/SpMorphicListViewDataSource.class.st
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
src/Spec2-Adapters-Morphic-Tests/SpMorphicListAdapterTest.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,54 @@ | ||
Class { | ||
#name : 'SpMorphicListAdapterTest', | ||
#superclass : 'TestCase', | ||
#instVars : [ | ||
'presenter' | ||
], | ||
#category : 'Spec2-Adapters-Morphic-Tests', | ||
#package : 'Spec2-Adapters-Morphic-Tests' | ||
} | ||
|
||
{ #category : 'private' } | ||
SpMorphicListAdapterTest >> configureList: aNumber [ | ||
|
||
presenter := SpListPresenter new | ||
items: (1 to: aNumber); | ||
yourself. | ||
|
||
] | ||
|
||
{ #category : 'running' } | ||
SpMorphicListAdapterTest >> tearDown [ | ||
|
||
presenter delete. | ||
super tearDown. | ||
] | ||
|
||
{ #category : 'tests' } | ||
SpMorphicListAdapterTest >> testScrollToIndexInvisibleScrollbars [ | ||
|
||
self configureList: 5. | ||
presenter open. | ||
presenter scrollToIndex: 100. | ||
self | ||
assert: presenter scrollIndex | ||
equals: 1. | ||
] | ||
|
||
{ #category : 'tests' } | ||
SpMorphicListAdapterTest >> testScrollToIndexVisibleScrollbars [ | ||
|
||
self configureList: 100. | ||
presenter | ||
open; | ||
withWindowDo: [ : w | w resize: (200 @ 400) scaledByDisplayScaleFactor ]. | ||
self | ||
assert: presenter scrollIndex | ||
equals: 1. | ||
|
||
presenter scrollToIndex: 50. | ||
|
||
self | ||
assert: presenter scrollIndex > 1 | ||
description: 'For now we only check if the scroller worked, the CI returns 39 but running the test interactively returns 38 without loading preferences' | ||
] |
81 changes: 81 additions & 0 deletions
81
src/Spec2-Adapters-Morphic-Tests/SpMorphicScrollableAdapterTest.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,81 @@ | ||
Class { | ||
#name : 'SpMorphicScrollableAdapterTest', | ||
#superclass : 'TestCase', | ||
#instVars : [ | ||
'scrollable', | ||
'presenter' | ||
], | ||
#category : 'Spec2-Adapters-Morphic-Tests', | ||
#package : 'Spec2-Adapters-Morphic-Tests' | ||
} | ||
|
||
{ #category : 'running' } | ||
SpMorphicScrollableAdapterTest >> configureBasicContainer: aNumber [ | ||
|
||
| boxLayout widgets | | ||
boxLayout := SpBoxLayout newVertical. | ||
widgets := (1 to: aNumber) collect: [ : i | | ||
boxLayout add: (SpButtonPresenter new label: i asString; yourself) ]. | ||
|
||
presenter := SpPresenter new | ||
layout: (scrollable := SpScrollableLayout new | ||
child:(SpPresenter new | ||
layout: boxLayout; | ||
yourself); | ||
yourself); | ||
yourself. | ||
|
||
] | ||
|
||
{ #category : 'running' } | ||
SpMorphicScrollableAdapterTest >> tearDown [ | ||
|
||
presenter delete. | ||
super tearDown. | ||
] | ||
|
||
{ #category : 'tests' } | ||
SpMorphicScrollableAdapterTest >> testVScrollToAfterOpen100SubPresenters [ | ||
|
||
| adapterWidget | | ||
|
||
self configureBasicContainer: 100. | ||
presenter open. | ||
scrollable withAdapterDo: [ : a | a widget height: 270 ]. | ||
|
||
self assert: presenter isDisplayed. | ||
self assert: presenter isVisible. | ||
|
||
scrollable scrollTo: 0.1 @ 2. | ||
adapterWidget := scrollable adapter widget. | ||
self assert: adapterWidget vScrollbarValue closeTo: 0.74074074074074. | ||
|
||
scrollable scrollTo: 0.5 @ 2. | ||
adapterWidget := scrollable adapter widget. | ||
self assert: adapterWidget vScrollbarValue closeTo: 0.74074074074074 | ||
] | ||
|
||
{ #category : 'tests' } | ||
SpMorphicScrollableAdapterTest >> testVScrollToAfterOpen500SubPresenters [ | ||
|
||
| adapterWidget | | ||
|
||
self configureBasicContainer: 500. | ||
presenter open. | ||
scrollable withAdapterDo: [ : a | a widget height: 270 ]. | ||
scrollable scrollTo: 0.1 @ 2. | ||
adapterWidget := scrollable adapter widget. | ||
self assert: adapterWidget vScrollbarValue closeTo: 0.74074074074074 | ||
] | ||
|
||
{ #category : 'tests' } | ||
SpMorphicScrollableAdapterTest >> testVScrollToBeforeOpen100SubPresenters [ | ||
|
||
| adapterWidget | | ||
|
||
self configureBasicContainer: 100. | ||
scrollable scrollTo: 0.1 @ 2. | ||
presenter open. | ||
adapterWidget := scrollable adapter widget. | ||
self assert: adapterWidget vScrollbarValue closeTo: 0.0 | ||
] |
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
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
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
Oops, something went wrong.