The Trunk: MorphicTests-mt.57.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.57.mcz

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

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

Name: MorphicTests-mt.57
Author: mt
Time: 8 October 2019, 5:02:13.932299 pm
UUID: 932a800f-1029-8240-8152-3fe36173f576
Ancestors: MorphicTests-mt.56

Adds more layout tests.

=============== Diff against MorphicTests-mt.56 ===============

Item was added:
+ ----- Method: ScrollPaneRetractableBarsTest>>test10ShrinkWrapHorizontally (in category 'tests') -----
+ test10ShrinkWrapHorizontally
+
+ sut vResizing: #rigid.
+ sut hResizing: #shrinkWrap.
+ sut vScrollBarPolicy: #always.
+
+ content extent: 300@300.
+ sut extent: 100@100.
+
+ sut hScrollBarPolicy: #always.
+ self refresh.
+ self assert: 300 equals: content width.
+ self assert: content width equals: sut width.
+
+ sut hScrollBarPolicy: #whenNeeded.
+ self refresh.
+ self assert: 300 equals: content width.
+ self assert: content width equals: sut width.
+
+ content width: 450.
+ self refresh.
+ self assert: (sut right = sut vScrollBar left or: [sut left = sut vScrollBar right]).!

Item was added:
+ ----- Method: ScrollPaneRetractableBarsTest>>test11ShrinkWrapVertically (in category 'tests') -----
+ test11ShrinkWrapVertically
+
+ sut vResizing: #shrinkWrap.
+ sut hResizing: #rigid.
+ sut hScrollBarPolicy: #always.
+
+ content extent: 300@300.
+ sut extent: 100@100.
+
+ sut vScrollBarPolicy: #always.
+ self refresh.
+ self assert: 300 equals: content height.
+ self assert: content height equals: sut height.
+
+ sut vScrollBarPolicy: #whenNeeded.
+ self refresh.
+ self assert: 300 equals: content height.
+ self assert: content height equals: sut height.
+
+ content height: 450.
+ self refresh.
+ self assert: sut bottom equals: sut hScrollBar top.!

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

Item was added:
+ ----- Method: ScrollPaneTest>>test10ShrinkWrapHorizontally (in category 'tests') -----
+ test10ShrinkWrapHorizontally
+
+ sut vResizing: #rigid.
+ sut hResizing: #shrinkWrap.
+ sut vScrollBarPolicy: #always.
+
+ content extent: 300@300.
+ sut extent: 100@100.
+
+ sut hScrollBarPolicy: #always.
+ self refresh.
+ self assert: 300 equals: content width.
+ self assert: content width + sut scrollBarThickness equals: sut width.
+
+ sut hScrollBarPolicy: #whenNeeded.
+ self refresh.
+ self assert: 300 equals: content width.
+ self assert: content width + sut scrollBarThickness equals: sut width.
+
+ content width: 450.
+ self refresh.
+ self assert: (sut right = sut vScrollBar right or: [sut left = sut vScrollBar left]).!

Item was added:
+ ----- Method: ScrollPaneTest>>test11ShrinkWrapVertically (in category 'tests') -----
+ test11ShrinkWrapVertically
+
+ sut vResizing: #shrinkWrap.
+ sut hResizing: #rigid.
+ sut hScrollBarPolicy: #always.
+
+ content extent: 300@300.
+ sut extent: 100@100.
+
+ sut vScrollBarPolicy: #always.
+ self refresh.
+ self assert: 300 equals: content height.
+ self assert: content height + sut scrollBarThickness equals: sut height.
+
+ sut vScrollBarPolicy: #whenNeeded.
+ self refresh.
+ self assert: 300 equals: content height.
+ self assert: content height + sut scrollBarThickness equals: sut height.
+
+ content height: 450.
+ self refresh.
+ self assert: sut bottom equals: sut hScrollBar bottom.!

Item was added:
+ ----- Method: TableLayoutTest>>testInnerTopLeft (in category 'tests') -----
+ testInnerTopLeft
+ "The morph that is layed out in the owner must be in the top-left corner, regardless of its resizing properties."
+
+ | inner |
+ container := self newContainer
+ hResizing: #rigid;
+ vResizing: #rigid;
+ addMorphBack: (inner := self newMorph
+ layoutPolicy: nil;
+ addMorphBack: self newMorph;
+ yourself);
+ yourself.
+
+ #(rigid shrinkWrap spaceFill) do: [:h | #(rigid shrinkWrap spaceFill) do: [:v |
+ inner hResizing: h; vResizing: v.
+ self ensureLayout: container.
+ self assert: container topLeft equals: inner topLeft]].!

Item was added:
+ ----- Method: TableLayoutTest>>testPluggableTextMorph (in category 'tests') -----
+ testPluggableTextMorph
+
+ | ptm |
+ ptm := PluggableTextMorph new
+ extent: 100@50;
+ setText: 'Hello World!! Hello World!! Hello World!! Hello World!!';
+ wrapFlag: true.
+
+ container := self newContainer addMorphBack: ptm.
+ self ensureLayout: container.
+ self assert: 100@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.
+ !

Item was added:
+ ----- Method: TableLayoutTest>>testPluggableTextMorphScrollBarNotNeeded (in category 'tests') -----
+ testPluggableTextMorphScrollBarNotNeeded
+ "The entire test might fit if the scroll bar would only disappear..."
+
+ | ptm |
+ ptm := PluggableTextMorph new
+ extent: 100@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.!

Item was added:
+ ----- Method: TableLayoutTest>>testPluggableTextMorphShrinkWrap (in category 'tests') -----
+ testPluggableTextMorphShrinkWrap
+
+ | ptm |
+ ptm := PluggableTextMorph new
+ extent: 100@50;
+ setText: 'Hello World!! Hello World!! \\\ Hello World!! Hello World!!' withCRs.
+ container := self newContainer addMorphBack: ptm.
+
+ ptm wrapFlag: false. "for the inner text morph"
+ ptm hResizing: #shrinkWrap; vResizing: #shrinkWrap. "for the outer scroll pane"
+ self ensureLayout: container.
+
+ self deny: ptm vIsScrollbarShowing.
+ self deny: ptm hIsScrollbarShowing.
+ self assert: ptm innerExtent equals: ptm textMorph extent.!

Item was changed:
  ----- Method: TableLayoutTest>>testScrollPaneShrinkWrap (in category 'tests') -----
  testScrollPaneShrinkWrap
 
  | scroll scrollContent |
  container := self newContainer
  vResizing: #rigid;
  addMorphBack: (self newMorph extent: 50 @ 50);
  addMorphBack: (scroll := ScrollPane new
  hResizing: #shrinkWrap;
  vResizing: #spaceFill;
- retractable: false;
  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.
-
- container extent: 250 @ 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.
- self assert: 211 @ 300 equals: scroll extent.
 
  scrollContent extent: 300 @ 500.
  self ensureLayout: container.
+ self assert: (300 + scroll scrollBarThickness + scroll borderWidth) @ 300 equals: scroll extent!
- self assert: 311 @ 300 equals: scroll extent!