[squeak-dev] The Inbox: MorphicTests-nice.61.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Mar 7 21:52:56 UTC 2020


Nicolas Cellier uploaded a new version of MorphicTests to project The Inbox:
http://source.squeak.org/inbox/MorphicTests-nice.61.mcz

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

Name: MorphicTests-nice.61
Author: nice
Time: 7 March 2020, 10:52:54.214955 pm
UUID: 0c47a827-1141-46f6-b217-614031ef17b0
Ancestors: MorphicTests-mt.60

Attempt to let some tests pass even if using retractable scroll bars.

Note: the workaround is not ideal, because forcing the preferences triggers allSubInstancesDo: which is too sllooowwww for a Unit TestCase...

=============== Diff against MorphicTests-mt.60 ===============

Item was changed:
  ----- Method: MorphLayoutTest>>testScrollPaneBarUpdate (in category 'tests') -----
  testScrollPaneBarUpdate
  
+ 	| child container savedPreference |
+ 	savedPreference := ScrollPane useRetractableScrollBars.
+ 	
+ 	[ScrollPane useRetractableScrollBars: false.
- 	| child container |
  	container := ScrollPane new color: Color green; extent: 300 @ 300; showVScrollBarOnlyWhenNeeded; showHScrollBarOnlyWhenNeeded.
  	container scroller addMorphBack: (child := Morph new color: Color red; extent: 100 @ 100).
  	
  	self ensureLayout: container.
  	self assert: container hScrollBar owner isNil.
  	self assert: container vScrollBar owner isNil.
  	
  	child extent: 400 @ 100.
  	self ensureLayout: container.
  	self assert: container hScrollBar owner notNil.
  	self assert: container vScrollBar owner isNil.
  	
  	child extent: 400 @ 400.
  	self ensureLayout: container.
  	self assert: container hScrollBar owner notNil.
+ 	self assert: container hScrollBar owner notNil]
+ 		ensure: [ScrollPane useRetractableScrollBars: savedPreference]!
- 	self assert: container hScrollBar owner notNil!

Item was changed:
  ----- Method: TableLayoutTest>>testPluggableTextMorph (in category 'tests') -----
  testPluggableTextMorph
  
+ 	| ptm savedPreference |
+ 	savedPreference := ScrollPane useRetractableScrollBars.
+ 	
+ 	[ScrollPane useRetractableScrollBars: false.
- 	| ptm |
  	ptm := PluggableTextMorph new
  		extent: 100 at 50;
  		setText: 'Hello World!! Hello World!! Hello World!! Hello World!!';
  		wrapFlag: true.
  			
  	container := self newContainer addMorphBack: ptm.
  	self ensureLayout: container.
  	self assert: 100 at 50 equals: container extent.
  
  	self assert: ptm vIsScrollbarShowing.
  	self deny: ptm hIsScrollbarShowing.
  
  	"Make it a one-liner."
  	ptm wrapFlag: false.
  	self ensureLayout: container.
  	self deny: ptm vIsScrollbarShowing.
  	self assert: ptm hIsScrollbarShowing.
  
  	"Make it a one-liner without the horizontal scrollbar."
  	ptm hideScrollBarsIndefinitely.
  	self ensureLayout: container.
  	self deny: ptm vIsScrollbarShowing.
+ 	self deny: ptm hIsScrollbarShowing]
+ 		ensure: [ScrollPane useRetractableScrollBars: savedPreference]
- 	self deny: ptm hIsScrollbarShowing.
  !

Item was changed:
  ----- Method: TableLayoutTest>>testPluggableTextMorphScrollBarNotNeeded (in category 'tests') -----
  testPluggableTextMorphScrollBarNotNeeded
  	"The entire test might fit if the scroll bar would only disappear..."
  
+ 	| ptm savedPreference |
+ 	savedPreference := ScrollPane useRetractableScrollBars.
+ 	
+ 	[ScrollPane useRetractableScrollBars: false.
- 	| ptm |
  	ptm := PluggableTextMorph new
  		extent: 100 at 50;
  		setText: 'Hello World!! Hello World!! \\\ Hello World!! Hello World!!' withCRs.
  	container := self newContainer addMorphBack: ptm.
  	
  	"Make it fit exactly first."
  	ptm hResizing: #shrinkWrap; vResizing: #shrinkWrap.
  	self ensureLayout: container.
  	ptm hResizing: #rigid; vResizing: #rigid.
  	ptm wrapFlag: true.
  
  	"No scrollbars required."
  	self ensureLayout: container.
  	self deny: ptm vIsScrollbarShowing.
  	
  	"It wraps immediately."
  	ptm width: ptm width - 5.
  	self ensureLayout: container.
  	self assert: ptm vIsScrollbarShowing.
  
  	"No scrollbars required."
  	ptm width: ptm width + 5.
  	self ensureLayout: container.
+ 	self deny: ptm vIsScrollbarShowing]
+ 		ensure: [ScrollPane useRetractableScrollBars: savedPreference]!
- 	self deny: ptm vIsScrollbarShowing.!

Item was changed:
  ----- Method: TableLayoutTest>>testScrollPaneShrinkWrap (in category 'tests') -----
  testScrollPaneShrinkWrap
  
+ 	| scroll scrollContent savedPreference |
+ 	savedPreference := ScrollPane useRetractableScrollBars.
+ 	
+ 	[ScrollPane useRetractableScrollBars: false.
- 	| scroll scrollContent |
  	container := self newContainer
  		vResizing: #rigid;
  		addMorphBack: (self newMorph extent: 50 @ 50);
  		addMorphBack: (scroll := ScrollPane new
  			hResizing: #shrinkWrap;
  			vResizing: #spaceFill;
  			showVScrollBarOnlyWhenNeeded;
  			hideHScrollBarIndefinitely).
  	
  	" shrinkWrap the horizontal axis but scroll vertically "
  	scroll scroller
  		layoutPolicy: TableLayout new;
  		addMorphBack: (scrollContent := self newMorph extent: 200 @ 500).
  
  	container extent: 1 @ 300.
  	self ensureLayout: container.
  	self assert: container left = (container layoutChanged; fullBounds; left). "Do not be jumpy."
  	self assert: (200 + scroll scrollBarThickness + scroll borderWidth) @ 300 equals: scroll extent.
  	
  	scrollContent extent: 300 @ 500.
  	self ensureLayout: container.
+ 	self assert: (300 + scroll scrollBarThickness + scroll borderWidth) @ 300 equals: scroll extent]
+ 		ensure: [ScrollPane useRetractableScrollBars: savedPreference]!
- 	self assert: (300 + scroll scrollBarThickness + scroll borderWidth) @ 300 equals: scroll extent!

Item was changed:
  ----- Method: TableLayoutTest>>testShrinkWrapScrollPaneAlwaysShowBars (in category 'tests') -----
  testShrinkWrapScrollPaneAlwaysShowBars
  
+ 	| scroll scrollContent savedPreference |
+ 	savedPreference := ScrollPane useRetractableScrollBars.
+ 	
+ 	[ScrollPane useRetractableScrollBars: false.
- 	| scroll scrollContent |
  	container := self newContainer
  		vResizing: #shrinkWrap;
  		hResizing: #shrinkWrap;
  		addMorphBack: (scroll := ScrollPane new
  			hResizing: #shrinkWrap;
  			vResizing: #shrinkWrap;
  			alwaysShowHScrollBar;
  			alwaysShowVScrollBar).
  	
  	scroll scroller
  		layoutPolicy: TableLayout new;
  		addMorphBack: (scrollContent := self newMorph extent: 300 @ 300).
  	
  	self ensureLayout: container.
+ 	self assert: (300 @ 300) + scroll scrollBarThickness + scroll borderWidth equals: container extent]
+ 		ensure: [ScrollPane useRetractableScrollBars: savedPreference]!
- 	self assert: (300 @ 300) + scroll scrollBarThickness + scroll borderWidth equals: container extent!

Item was changed:
  ----- Method: TableLayoutTest>>testSidebarAndScrollingView (in category 'tests - example layouts') -----
  testSidebarAndScrollingView
  	" construct a container that has a fixed size sidebar on the left and a scrolling window that adapts flexibly to the container's size "
  
+ 	| scrolling sidebar content title savedPreference |
+ 	savedPreference := ScrollPane useRetractableScrollBars.
+ 	
+ 	[ScrollPane useRetractableScrollBars: false.
- 	| scrolling sidebar content title |
  	container := self newContainer
  		addMorphBack: (sidebar := self newMorph width: 200; hResizing: #rigid; vResizing: #spaceFill);
  		addMorphBack: (scrolling := ScrollPane new hResizing: #spaceFill; vResizing: #spaceFill).
  	
  	scrolling scroller
  		layoutPolicy: TableLayout new;
  		addMorphBack: (self newContainer
  			hResizing: #spaceFill;
  			vResizing: #spaceFill;
  			listDirection: #topToBottom;
  			addMorphBack: (title := TextMorph new hResizing: #spaceFill; contents: 'Here comes a title');
  			addMorphBack: (content := self newMorph extent: 400 @ 400; hResizing: #spaceFill)).
  	"container openInHand."
  	
  	container extent: 500 @ 500.
  	self ensureLayout: container.
  	self assert: 200 @ 500 equals: sidebar extent.
  	self assert: 300 @ 500 equals: scrolling extent.
  	self assert: 300 - (scrolling borderWidth  * 2) @ 400 equals: content extent.
  	
  	container extent: 300 @ 300.
  	self ensureLayout: container.
  	self assert: 200 @ 300 equals: sidebar extent.
  	self assert: 100 @ 300 equals: scrolling extent.
+ 	self assert: 100 - scrolling borderWidth - scrolling scrollBarThickness @ 400 equals: content extent]
+ 		ensure: [ScrollPane useRetractableScrollBars: savedPreference]!
- 	self assert: 100 - scrolling borderWidth - scrolling scrollBarThickness @ 400 equals: content extent!



More information about the Squeak-dev mailing list