Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Spec2-Adapters-Morphic/SpMorphicGridAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ SpMorphicGridAdapter >> children [
^ widget submorphs
]

{ #category : 'accessing' }
SpMorphicGridAdapter >> extentOfChildAt: index [

^ (widget submorphs at: index) extent
]

{ #category : 'factory' }
SpMorphicGridAdapter >> layout: aLayout [
"Build of widget was differed up to here (to know what is the direction)"
Expand Down
71 changes: 27 additions & 44 deletions src/Spec2-Backend-Tests/SpGridLayoutAdapterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ SpGridLayoutAdapterTest >> testBeColumnHomogeneous [
self openInstance.

self
assert: presenter adapter widget submorphs first width
equals: presenter adapter widget submorphs second width
assert: (self adapter extentOfChildAt: 1) x
equals: (self adapter extentOfChildAt: 2) x
]

{ #category : 'tests' }
Expand All @@ -74,8 +74,8 @@ SpGridLayoutAdapterTest >> testBeColumnNotHomogeneous [
self openInstance.

self
deny: presenter adapter widget submorphs first width
equals: presenter adapter widget submorphs second width
deny: (self adapter extentOfChildAt: 1) x
equals: (self adapter extentOfChildAt: 2) x
]

{ #category : 'tests' }
Expand All @@ -84,35 +84,29 @@ SpGridLayoutAdapterTest >> testBeRowHomogeneous [
layout
beRowHomogeneous;
add: 'Test' atPoint: 1 @ 1;
add: (presenter newMorph morph: (Morph new extent: 40 @ 40))
add: (presenter newButton extent: 40 @ 40; yourself)
atPoint: 1 @ 2.

self openInstance.

self
assert: presenter adapter widget submorphs first height
equals: presenter adapter widget submorphs second height
assert: (self adapter extentOfChildAt: 1) y
equals: (self adapter extentOfChildAt: 2) y
]

{ #category : 'tests' }
SpGridLayoutAdapterTest >> testBeRowNotHomogeneous [

| testMorph |
testMorph := Morph new
vResizing: #rigid;
extent: 40 @ 40;
yourself.

layout
beRowNotHomogeneous;
add: 'Test' atPoint: 1 @ 1;
add: (presenter newMorph morph: testMorph) atPoint: 1 @ 2.
add: (presenter newButton extent: 40 @ 40; yourself) atPoint: 1 @ 2.

self openInstance.

self
deny: presenter adapter widget submorphs first height
equals: presenter adapter widget submorphs second height
deny: (self adapter extentOfChildAt: 1) y
equals: (self adapter extentOfChildAt: 2) y
]

{ #category : 'tests' }
Expand All @@ -127,9 +121,9 @@ SpGridLayoutAdapterTest >> testColumnSpanColumnHomogeneous [
self openInstance.

self
assert: presenter adapter widget submorphs first width
equals: presenter adapter widget submorphs second width
+ presenter adapter widget submorphs third width
assert: (self adapter extentOfChildAt: 1) x
equals: (self adapter extentOfChildAt: 2) x
+ (self adapter extentOfChildAt: 3) x
]

{ #category : 'tests' }
Expand All @@ -145,12 +139,12 @@ SpGridLayoutAdapterTest >> testColumnSpanColumnNotHomogeneous [

"the first column width is equal to the sum of two columns"
self
assert: presenter adapter widget submorphs first width
equals: presenter adapter widget submorphs second width
+ presenter adapter widget submorphs third width.
assert: (self adapter extentOfChildAt: 1) x
equals: (self adapter extentOfChildAt: 2) x
+ (self adapter extentOfChildAt: 3) x.
"the first column still needs to be smaller than the first"
self assert: presenter adapter widget submorphs second width
< presenter adapter widget submorphs third width
self assert: (self adapter extentOfChildAt: 2) x
< (self adapter extentOfChildAt: 3) x
]

{ #category : 'tests' }
Expand All @@ -176,48 +170,37 @@ SpGridLayoutAdapterTest >> testRemoveElementRemovesFromAdapter [
{ #category : 'tests' }
SpGridLayoutAdapterTest >> testRowSpanRowHomogeneous [

| testMorph |
testMorph := Morph new
vResizing: #rigid;
extent: 40 @ 40;
yourself.

layout
beRowHomogeneous;
add: 'Test 1' atPoint: 1 @ 1;
add: (presenter newMorph morph: testMorph)
add: (presenter newButton extent: 40 @ 40; yourself)
atPoint: 2 @ 1
span: 1 @ 2;
add: 'Test 2' atPoint: 1 @ 2.

self openInstance.

self
assert: presenter adapter widget submorphs second height
equals: presenter adapter widget submorphs first height
+ presenter adapter widget submorphs third height
assert: (self adapter extentOfChildAt: 2) y
equals: (self adapter extentOfChildAt: 1) y
+ (self adapter extentOfChildAt: 3) y
]

{ #category : 'tests' }
SpGridLayoutAdapterTest >> testRowSpanRowNotHomogeneous [

| testMorph |
testMorph := Morph new
vResizing: #rigid;
extent: 40 @ 40;
yourself.

layout
beRowNotHomogeneous;
add: 'Test 1' atPoint: 1 @ 1;
add: (presenter newMorph morph: testMorph)
add: (presenter newButton extent: 40 @ 40; yourself)
atPoint: 2 @ 1
span: 1 @ 2;
add: 'Test 2' atPoint: 1 @ 2.

self openInstance.

self
assert: presenter adapter widget submorphs second height
equals: presenter adapter widget submorphs first height
+ presenter adapter widget submorphs third height
assert: (self adapter extentOfChildAt: 2) y
equals: (self adapter extentOfChildAt: 1) y
+ (self adapter extentOfChildAt: 3) y
]
Loading