From 3914a11ed7496ccc6592577da3fd1ca7a4291c71 Mon Sep 17 00:00:00 2001 From: SullyMLT Date: Mon, 11 Aug 2025 16:17:52 +0200 Subject: [PATCH] Change size to extent due to a bloc update --- .../BlocSerializationChildrenTests.class.st | 107 ++++++++++++------ ...BlocSerializationConstraintsTests.class.st | 6 +- .../BlocSerializationLayoutTests.class.st | 8 +- 3 files changed, 79 insertions(+), 42 deletions(-) diff --git a/src/Bloc-Serialization-Tests/BlocSerializationChildrenTests.class.st b/src/Bloc-Serialization-Tests/BlocSerializationChildrenTests.class.st index 7f66176..874d047 100644 --- a/src/Bloc-Serialization-Tests/BlocSerializationChildrenTests.class.st +++ b/src/Bloc-Serialization-Tests/BlocSerializationChildrenTests.class.st @@ -13,18 +13,18 @@ BlocSerializationChildrenTests >> testChildren [ e2 := BlElement new. e3 := BlElement new. - origin addChildren: { + origin addChildren: { e1. e2. e3 }. - self test: origin on: [ :element | + self test: origin on: [ :element | self assert: element parent equals: nil. self assert: element children size equals: 3. - self assert: (element childAt: 1) owner equals: element. + self assert: (element childAt: 1) parent equals: element. self assert: (element childAt: 1) isFirstChild equals: true. self assert: (element childAt: 1) isLastChild equals: false. - self assert: (element childAt: 2) owner equals: element. + self assert: (element childAt: 2) parent equals: element. self assert: (element childAt: 2) isFirstChild equals: false. self assert: (element childAt: 2) isLastChild equals: false. self assert: (element childAt: 3) owner equals: element. @@ -36,17 +36,29 @@ BlocSerializationChildrenTests >> testChildren [ BlocSerializationChildrenTests >> testChildren1 [ | origin e1 e2 e3 | - origin := BlElement new size: 300 @ 500; background: Color red; yourself. - e1 := BlElement new size: 200 @ 100; background: Color blue; yourself. - e2 := BlElement new size: 50 @ 10; background: Color green; yourself. - e3 := BlElement new size: 80 @ 600; background: Color yellow; yourself. + origin := BlElement new + extent: 300 @ 500; + background: Color red; + yourself. + e1 := BlElement new + extent: 200 @ 100; + background: Color blue; + yourself. + e2 := BlElement new + size: 50 @ 10; + background: Color green; + yourself. + e3 := BlElement new + size: 80 @ 600; + background: Color yellow; + yourself. - origin addChildren: { + origin addChildren: { e1. e2. e3 }. - self test: origin on: [ :element | + self test: origin on: [ :element | self assert: element parent equals: nil. self assert: element children size equals: 3. self assert: (element childAt: 1) owner equals: element. @@ -65,11 +77,11 @@ BlocSerializationChildrenTests >> testChildren2 [ | origin e1 e2 e3 | origin := BlElement new - size: 300 @ 500; + extent: 300 @ 500; background: Color red; yourself. e1 := BlElement new - size: 200 @ 100; + extent: 200 @ 100; background: Color blue; yourself. e2 := BlElement new @@ -81,7 +93,7 @@ BlocSerializationChildrenTests >> testChildren2 [ background: Color yellow; yourself. - origin addChildren: { + origin addChildren: { e1. e2. e3 }. @@ -89,12 +101,24 @@ BlocSerializationChildrenTests >> testChildren2 [ self test: origin on: [ :element | self assert: element constraints horizontal resizer size equals: 300. self assert: element constraints vertical resizer size equals: 500. - self assert: (element childAt: 1) constraints horizontal resizer size equals: 200. - self assert: (element childAt: 2) constraints horizontal resizer size equals: 50. - self assert: (element childAt: 3) constraints horizontal resizer size equals: 80. - self assert: (element childAt: 1) constraints vertical resizer size equals: 100. - self assert: (element childAt: 2) constraints vertical resizer size equals: 10. - self assert: (element childAt: 3) constraints vertical resizer size equals: 600. ] + self + assert: (element childAt: 1) constraints horizontal resizer size + equals: 200. + self + assert: (element childAt: 2) constraints horizontal resizer size + equals: 50. + self + assert: (element childAt: 3) constraints horizontal resizer size + equals: 80. + self + assert: (element childAt: 1) constraints vertical resizer size + equals: 100. + self + assert: (element childAt: 2) constraints vertical resizer size + equals: 10. + self + assert: (element childAt: 3) constraints vertical resizer size + equals: 600 ] ] { #category : #tests } @@ -102,11 +126,11 @@ BlocSerializationChildrenTests >> testChildren3 [ | origin e1 e2 e3 | origin := BlElement new - size: 300 @ 500; + extent: 300 @ 500; background: Color red; yourself. e1 := BlElement new - size: 200 @ 100; + extent: 200 @ 100; background: Color blue; yourself. e2 := BlElement new @@ -118,16 +142,22 @@ BlocSerializationChildrenTests >> testChildren3 [ background: Color yellow; yourself. - origin addChildren: { + origin addChildren: { e1. e2. e3 }. - self test: origin on: [ :element | + self test: origin on: [ :element | self assert: element background paint color equals: Color red. - self assert: (element childAt: 1) background paint color equals: Color blue. - self assert: (element childAt: 2) background paint color equals: Color green. - self assert: (element childAt: 3) background paint color equals: Color yellow ] + self + assert: (element childAt: 1) background paint color + equals: Color blue. + self + assert: (element childAt: 2) background paint color + equals: Color green. + self + assert: (element childAt: 3) background paint color + equals: Color yellow ] ] { #category : #tests } @@ -139,18 +169,18 @@ BlocSerializationChildrenTests >> testChildrenBasic1 [ e2 := BlElement new. e3 := BlElement new. - origin addChildren: { + origin addChildren: { e1. e2. e3 }. - self test: origin on: [ :element | + self test: origin on: [ :element | self assert: element parent equals: nil. self assert: element children size equals: 3. - self assert: (element childAt: 1) owner equals: element. + self assert: (element childAt: 1) parent equals: element. self assert: (element childAt: 1) isFirstChild equals: true. self assert: (element childAt: 1) isLastChild equals: false. - self assert: (element childAt: 2) owner equals: element. + self assert: (element childAt: 2) parent equals: element. self assert: (element childAt: 2) isFirstChild equals: false. self assert: (element childAt: 2) isLastChild equals: false. self assert: (element childAt: 3) owner equals: element. @@ -171,19 +201,24 @@ BlocSerializationChildrenTests >> testChildrenBasic2 [ e1 addChild: e2. e2 addChild: e3. - self test: origin on: [ :element | + self test: origin on: [ :element | self assert: element parent equals: nil. self assert: element children size equals: 1. - self assert: (element childAt: 1) owner equals: element. + self assert: (element childAt: 1) parent equals: element. self assert: (element childAt: 1) children size equals: 1. - self assert: ((element childAt: 1) childAt: 1) children size equals: 1. self - assert: ((element childAt: 1) childAt: 1) owner + assert: ((element childAt: 1) childAt: 1) children size + equals: 1. + self + assert: ((element childAt: 1) childAt: 1) parent equals: (element childAt: 1). - - self assert: (((element childAt: 1) childAt: 1) childAt: 1) children size equals: 0. + + self + assert: + (((element childAt: 1) childAt: 1) childAt: 1) children size + equals: 0. self assert: (((element childAt: 1) childAt: 1) childAt: 1) owner equals: ((element childAt: 1) childAt: 1) ] diff --git a/src/Bloc-Serialization-Tests/BlocSerializationConstraintsTests.class.st b/src/Bloc-Serialization-Tests/BlocSerializationConstraintsTests.class.st index 4607682..6e1abe1 100644 --- a/src/Bloc-Serialization-Tests/BlocSerializationConstraintsTests.class.st +++ b/src/Bloc-Serialization-Tests/BlocSerializationConstraintsTests.class.st @@ -179,8 +179,10 @@ BlocSerializationConstraintsTests >> testPosition2 [ BlocSerializationConstraintsTests >> testSize [ | origin | - origin := BlElement new size: 10 @ 20; yourself. - self test: origin on: [ :element | + origin := BlElement new + extent: 10 @ 20; + yourself. + self test: origin on: [ :element | self assert: element constraints horizontal resizer size equals: 10. self assert: element constraints vertical resizer size equals: 20 ] ] diff --git a/src/Bloc-Serialization-Tests/BlocSerializationLayoutTests.class.st b/src/Bloc-Serialization-Tests/BlocSerializationLayoutTests.class.st index 8730e21..e2a52b2 100644 --- a/src/Bloc-Serialization-Tests/BlocSerializationLayoutTests.class.st +++ b/src/Bloc-Serialization-Tests/BlocSerializationLayoutTests.class.st @@ -20,7 +20,7 @@ BlocSerializationLayoutTests >> testBlFrameLayoutChildrenTest1 [ | origin | origin := BlFrameLayoutChildrenTest new - testChildElementWithExactSize100per50. + testChildElementWithExactExtent100per50. self test: origin on: [ :element | @@ -34,7 +34,7 @@ BlocSerializationLayoutTests >> testBlFrameLayoutChildrenTest2 [ | origin | origin := BlFrameLayoutChildrenTest new - testParentWithFrameLayoutAndFixedSize. + testParentWithFrameLayoutAndFixedExtent. self test: origin on: [ :element | @@ -46,7 +46,7 @@ BlocSerializationLayoutTests >> testBlFrameLayoutChildrenTest3 [ | origin | origin := BlFrameLayoutChildrenTest new - testParentWithFrameLayoutAndFixedSize300per250. + testParentWithFrameLayoutAndFixedExtent300per250. self test: origin on: [ :element | @@ -64,7 +64,7 @@ BlocSerializationLayoutTests >> testBlFrameLayoutMultipleChildrenTestTest1 [ | origin | origin := BlFrameLayoutMultipleChildrenTest new - testChildElementWithExactSize140per140. + testChildElementWithExactExtent140per140. self test: origin on: [ :element | self assert: element position equals: 0 @ 0. self assert: element extent equals: 0 @ 0.