The Trunk: MorphicTests-mt.31.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: MorphicTests-mt.31.mcz

commits-2
Marcel Taeumel uploaded a new version of MorphicTests to project The Trunk:
http://source.squeak.org/trunk/MorphicTests-mt.31.mcz

==================== Summary ====================

Name: MorphicTests-mt.31
Author: mt
Time: 19 May 2015, 4:17:55.16 pm
UUID: 60717262-4e28-a549-a8a2-6918f0a28581
Ancestors: MorphicTests-mt.30

Tests added for scroll panes.

=============== Diff against MorphicTests-mt.30 ===============

Item was added:
+ ScrollPaneTest subclass: #ScrollPaneLeftBarTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'MorphicTests-Widgets'!

Item was added:
+ ----- Method: ScrollPaneLeftBarTest class>>shouldInheritSelectors (in category 'testing') -----
+ shouldInheritSelectors
+
+ ^ true!

Item was added:
+ ----- Method: ScrollPaneLeftBarTest>>setUp (in category 'running') -----
+ setUp
+
+ super setUp.
+ sut scrollBarOnLeft: true.!

Item was added:
+ ScrollPaneTest subclass: #ScrollPaneRetractableBarsTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'MorphicTests-Widgets'!

Item was added:
+ ----- Method: ScrollPaneRetractableBarsTest class>>shouldInheritSelectors (in category 'testing') -----
+ shouldInheritSelectors
+
+ ^ true!

Item was added:
+ ----- Method: ScrollPaneRetractableBarsTest>>setUp (in category 'running') -----
+ setUp
+
+ super setUp.
+ sut retractable: true.!

Item was added:
+ ----- Method: ScrollPaneRetractableBarsTest>>test01ScrollBarPolicyWhenNeeded (in category 'tests') -----
+ test01ScrollBarPolicyWhenNeeded
+
+ sut
+ hScrollBarPolicy: #whenNeeded;
+ vScrollBarPolicy: #whenNeeded.
+
+ content extent: 100@100.
+ self refresh.
+
+ self
+ deny: sut hIsScrollbarShowing;
+ deny: sut vIsScrollbarShowing.
+
+ content extent: 150@150.
+ self refresh.
+
+ self
+ deny: sut hIsScrollbarShowing;
+ deny: sut vIsScrollbarShowing.!

Item was added:
+ ----- Method: ScrollPaneRetractableBarsTest>>test02ScrollBarPolicyAlways (in category 'tests') -----
+ test02ScrollBarPolicyAlways
+
+ sut
+ hScrollBarPolicy: #always;
+ vScrollBarPolicy: #always.
+
+ content extent: 50@50.
+ self refresh.
+
+ self
+ deny: sut hIsScrollbarShowing;
+ deny: sut vIsScrollbarShowing.
+
+ content extent: 150@150.
+ self refresh.
+
+ self
+ deny: sut hIsScrollbarShowing;
+ deny: sut vIsScrollbarShowing.!

Item was added:
+ ----- Method: ScrollPaneRetractableBarsTest>>test06ScrollRanges (in category 'tests') -----
+ test06ScrollRanges
+
+ content extent: 200@300.
+ self refresh.
+
+ self
+ assert: 200 equals: sut hTotalScrollRange;
+ assert: 300 equals: sut vTotalScrollRange;
+ assert: 100 equals: sut hLeftoverScrollRange;
+ assert: 200 equals: sut vLeftoverScrollRange.
+
+ sut hScrollBarValue: 50.
+ sut vScrollBarValue: 30.
+
+ "Scrolling does not affect the scroll ranges."
+ self
+ assert: 200 equals: sut hTotalScrollRange;
+ assert: 300 equals: sut vTotalScrollRange;
+ assert: 100 equals: sut hLeftoverScrollRange;
+ assert: 200 equals: sut vLeftoverScrollRange.!

Item was added:
+ ----- Method: ScrollPaneRetractableBarsTest>>test08ScrollToShow (in category 'tests') -----
+ test08ScrollToShow
+
+ content extent: 300@300.
+ self refresh.
+
+ "1a) Scroll down/right to show bottom right corner."
+ self scrollToTopLeft.
+ sut scrollToShow: (50@50 corner: 100@100).
+ self assert: 0@0 equals: sut scroller offset.
+
+ "1b) Scroll up/left to show top left corner."
+ self scrollToBottomRight.
+ sut scrollToShow: (100@100 corner: 150@150).
+ self assert: 100@100 equals: sut scroller offset.
+
+ "2a) Too big, so show bottom right corner because we scroll down/right."
+ self scrollToTopLeft.
+ sut scrollToShow: (0@0 corner: 100@100).
+ self assert: 0@0 equals: sut scroller offset.
+
+ "2b) Too big, so show top left corner because we scroll up/left."
+ self scrollToBottomRight.
+ sut scrollToShow: (50@50 corner: 150@150).
+ self assert: 50@50 equals: sut scroller offset.
+
+ "3) No negative offsets."
+ self scrollToTopLeft.
+ sut scrollToShow: (-10 @ -10 corner: 50@50).
+ self assert: 0@0 equals: sut scroller offset.!

Item was added:
+ TestCase subclass: #ScrollPaneTest
+ instanceVariableNames: 'sut content'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'MorphicTests-Widgets'!

Item was added:
+ ----- Method: ScrollPaneTest>>refresh (in category 'running') -----
+ refresh
+ "Since there is now direct communication between the content and the scroll pane, re-layouting as to be explicit."
+
+ sut
+ resizeScrollBars;
+ resizeScroller;
+ setScrollDeltas.
+ !

Item was added:
+ ----- Method: ScrollPaneTest>>scrollToBottomRight (in category 'running') -----
+ scrollToBottomRight
+
+ sut hScrollBar setValue: sut hScrollBar maximumValue.
+ sut vScrollBar setValue: sut vScrollBar maximumValue.!

Item was added:
+ ----- Method: ScrollPaneTest>>scrollToTopLeft (in category 'running') -----
+ scrollToTopLeft
+
+ sut
+ hScrollBarValue: 0;
+ vScrollBarValue: 0;
+ setScrollDeltas.!

Item was added:
+ ----- Method: ScrollPaneTest>>setUp (in category 'running') -----
+ setUp
+
+ super setUp.
+ sut := ScrollPane new.
+ sut
+ retractable: false;
+ scrollBarOnLeft: false;
+ extent: 100@100;
+ borderWidth: 0. "Very important for the math in tests!!"
+ content := Morph new.
+ sut scroller addMorph: content.!

Item was added:
+ ----- Method: ScrollPaneTest>>test00SetUp (in category 'tests') -----
+ test00SetUp
+
+ self assert: 100@100 equals: sut extent.!

Item was added:
+ ----- Method: ScrollPaneTest>>test01ScrollBarPolicyWhenNeeded (in category 'tests') -----
+ test01ScrollBarPolicyWhenNeeded
+
+ sut
+ hScrollBarPolicy: #whenNeeded;
+ vScrollBarPolicy: #whenNeeded.
+
+ content extent: 100@100.
+ self refresh.
+
+ self
+ deny: sut hIsScrollbarShowing;
+ deny: sut vIsScrollbarShowing.
+
+ content extent: 150@150.
+ self refresh.
+
+ self
+ assert: sut hIsScrollbarShowing;
+ assert: sut vIsScrollbarShowing.!

Item was added:
+ ----- Method: ScrollPaneTest>>test02ScrollBarPolicyAlways (in category 'tests') -----
+ test02ScrollBarPolicyAlways
+
+ sut
+ hScrollBarPolicy: #always;
+ vScrollBarPolicy: #always.
+
+ content extent: 50@50.
+ self refresh.
+
+ self
+ assert: sut hIsScrollbarShowing;
+ assert: sut vIsScrollbarShowing.
+
+ content extent: 150@150.
+ self refresh.
+
+ self
+ assert: sut hIsScrollbarShowing;
+ assert: sut vIsScrollbarShowing.!

Item was added:
+ ----- Method: ScrollPaneTest>>test03ScrollBarPolicyNever (in category 'tests') -----
+ test03ScrollBarPolicyNever
+
+ sut
+ hScrollBarPolicy: #never;
+ vScrollBarPolicy: #never.
+
+ content extent: 50@50.
+ self refresh.
+
+ self
+ deny: sut hIsScrollbarShowing;
+ deny: sut vIsScrollbarShowing.
+
+ content extent: 150@150.
+ self refresh.
+
+ self
+ deny: sut hIsScrollbarShowing;
+ deny: sut vIsScrollbarShowing.!

Item was added:
+ ----- Method: ScrollPaneTest>>test04ScrollingCallIn (in category 'tests') -----
+ test04ScrollingCallIn
+
+ content extent: 200@200.
+ self refresh.
+
+ self
+ assert: 0 equals: sut hScrollBar value;
+ assert: 0 equals: sut vScrollBar value;
+ assert: 0@0 equals: sut scroller offset.
+
+ sut hScrollBar setValue: 50.
+ sut vScrollBar setValue: 50.
+
+ self
+ assert: 50 equals: sut hScrollBar value;
+ assert: 50 equals: sut vScrollBar value;
+ assert: 50@50 equals: sut scroller offset.
+ !

Item was added:
+ ----- Method: ScrollPaneTest>>test05ScrollingCallOut (in category 'tests') -----
+ test05ScrollingCallOut
+ "There is no automatic call-out from pane to scroll bars yet."
+
+ content extent: 200@200.
+ self refresh.
+
+ self
+ assert: 0 equals: sut hScrollBar value;
+ assert: 0 equals: sut vScrollBar value;
+ assert: 0@0 equals: sut scroller offset.
+
+ sut hScrollBarValue: 50.
+ sut vScrollBarValue: 50.
+
+ self
+ assert: 0 equals: sut hScrollBar value;
+ assert: 0 equals: sut vScrollBar value;
+ assert: 50@50 equals: sut scroller offset.
+
+ sut hSetScrollDelta.
+ sut vSetScrollDelta.
+
+ self
+ assert: 50 equals: sut hScrollBar value;
+ assert: 50 equals: sut vScrollBar value.!

Item was added:
+ ----- Method: ScrollPaneTest>>test06ScrollRanges (in category 'tests') -----
+ test06ScrollRanges
+
+ content extent: 200@300.
+ self refresh.
+
+ self
+ assert: 200 equals: sut hTotalScrollRange;
+ assert: 300 equals: sut vTotalScrollRange;
+ assert: 100 equals: sut hLeftoverScrollRange - sut scrollBarThickness;
+ assert: 200 equals: sut vLeftoverScrollRange - sut scrollBarThickness.
+
+ sut hScrollBarValue: 50.
+ sut vScrollBarValue: 30.
+
+ "Scrolling does not affect the scroll ranges."
+ self
+ assert: 200 equals: sut hTotalScrollRange;
+ assert: 300 equals: sut vTotalScrollRange;
+ assert: 100 equals: sut hLeftoverScrollRange - sut scrollBarThickness;
+ assert: 200 equals: sut vLeftoverScrollRange - sut scrollBarThickness.
+ !

Item was added:
+ ----- Method: ScrollPaneTest>>test07GuardOffsets (in category 'tests') -----
+ test07GuardOffsets
+ "Scroll bars will never report negative values because they have 0 as minimum. Programmatic access, however, might provide those. Visual appearance should not break then."
+
+ content extent: 200@300.
+ self refresh.
+
+ sut hScrollBarValue: -10.
+ sut vScrollBarValue: -20.
+
+ self assert: 0@0 equals: sut scroller offset.!

Item was added:
+ ----- Method: ScrollPaneTest>>test08ScrollToShow (in category 'tests') -----
+ test08ScrollToShow
+
+ content extent: 300@300.
+ self refresh.
+
+ "1a) Scroll down/right to show bottom right corner."
+ self scrollToTopLeft.
+ sut scrollToShow: (50@50 corner: 100@100).
+ self assert: (sut scrollBarThickness @ sut scrollBarThickness) equals: sut scroller offset.
+
+ "1b) Scroll up/left to show top left corner."
+ self scrollToBottomRight.
+ sut scrollToShow: (100@100 corner: 150@150).
+ self assert: 100@100 equals: sut scroller offset.
+
+ "2a) Too big, so show bottom right corner because we scroll down/right."
+ self scrollToTopLeft.
+ sut scrollToShow: (0@0 corner: 100@100).
+ self assert: (sut scrollBarThickness @ sut scrollBarThickness) equals: sut scroller offset.
+
+ "2b) Too big, so show top left corner because we scroll up/left."
+ self scrollToBottomRight.
+ sut scrollToShow: (50@50 corner: 150@150).
+ self assert: 50@50 equals: sut scroller offset.
+
+ "3) No negative offsets."
+ self scrollToTopLeft.
+ sut scrollToShow: (-10 @ -10 corner: 50@50).
+ self assert: 0@0 equals: sut scroller offset.!

Item was added:
+ ----- Method: ScrollPaneTest>>test09HideShowTransition (in category 'tests') -----
+ test09HideShowTransition
+
+ content extent: 300@300.
+ self refresh.
+
+ "1) Horizontal bar not needed anymore."
+ sut extent: 100@100.
+ sut vScrollBar setValue: 50.
+ sut width: content width + sut vScrollBar width.
+ self assert: sut vLeftoverScrollRange equals: sut vScrollBar maximumValue.
+
+ "2) Vertical bar not needed anymore."
+ sut extent: 100@100.
+ sut hScrollBar setValue: 50.
+ sut height: content height + sut hScrollBar height.
+ self assert: sut hLeftoverScrollRange equals: sut hScrollBar maximumValue.
+ !