-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- changed some formattings (e.g. lowerCase titles in Dictionaries)
- changed the current test structure (now: instantiation of the selectedTreeNode in the respective test Method) - changed line-by-line asserts to Dictionary comparison - WIP: extracting the instantiation
- Loading branch information
1 parent
e3e3e64
commit 43f83eb
Showing
13 changed files
with
146 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 23 additions & 11 deletions
34
...s/AnimationsEditor-Tests.package/AnimationsEditorTest.class/instance/testAddColorFrame.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
saveJson | ||
testAddColorFrame | ||
| colorProperty jsonFrame aTreeNode | | ||
|
||
colorProperty := ((self animationsEditorInstance propertyList at: 2) subproperties at: 2). "1: Rotation, 2: Color, 3: Position, 4: Size" | ||
colorProperty targetColor: 'red'. | ||
|
||
self animationsEditorInstance selectedTreeNode: colorProperty. | ||
self animationsEditorInstance playAnimations. | ||
aTreeNode := self animationsEditorInstance selectedTreeNode. | ||
| jsonFrame aTreeNode animationsEditorProperty testFrame | | ||
|
||
"still need to extract instantiation of the TreeNode" | ||
animationsEditorProperty := self animationsEditorInstance propertyList at: 2. | ||
aTreeNode := AnimationsEditorPropertyColor new. | ||
aTreeNode | ||
copyOfTargetMorph: animationsEditorProperty targetMorph; | ||
targetMorph: aTreeNode copyOfTargetMorph copy. | ||
aTreeNode targetMorph color: Color red. | ||
aTreeNode | ||
targetDuration: animationsEditorProperty defaultTargetDuration; | ||
targetColor: 'red'. | ||
|
||
jsonFrame := self animationsEditorInstance addColorFrame: aTreeNode. | ||
self assert: (jsonFrame at: #frame) equals: aTreeNode targetDuration. | ||
self assert: (((jsonFrame at: #properties) at: 1) at: #name) equals: 'Color'. | ||
self assert: (((jsonFrame at: #properties) at: 1) at: #value) equals: 'Color red'. | ||
|
||
"also extract instantiation of testFrame" | ||
testFrame := Dictionary | ||
with: #frame->500 | ||
with: #properties->{ | ||
Dictionary | ||
with: #name->'Color' | ||
with: #value->'Color red'. | ||
}. | ||
|
||
self assert: (jsonFrame = testFrame). |
37 changes: 25 additions & 12 deletions
37
...nimationsEditor-Tests.package/AnimationsEditorTest.class/instance/testAddPositionFrame.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
saveJson | ||
testAddPositionFrame | ||
| positionProperty jsonFrame aTreeNode | | ||
| jsonFrame aTreeNode animationsEditorProperty testFrame | | ||
|
||
positionProperty := ((self animationsEditorInstance propertyList at: 2) subproperties at: 3). "1: Rotation, 2: Color, 3: Position, 4: Size" | ||
positionProperty targetPosition: 100 @ 200. | ||
|
||
self animationsEditorInstance selectedTreeNode: positionProperty. | ||
self animationsEditorInstance playAnimations. | ||
aTreeNode := self animationsEditorInstance selectedTreeNode. | ||
"still need to extract instantiation of the TreeNode" | ||
animationsEditorProperty := self animationsEditorInstance propertyList at: 2. | ||
aTreeNode := AnimationsEditorPropertyPosition new. | ||
aTreeNode | ||
copyOfTargetMorph: animationsEditorProperty targetMorph; | ||
targetMorph: aTreeNode copyOfTargetMorph copy. | ||
aTreeNode targetMorph position: 100 @ 200. | ||
aTreeNode | ||
targetDuration: animationsEditorProperty defaultTargetDuration; | ||
targetPosition: 100 @ 200. | ||
|
||
jsonFrame := self animationsEditorInstance addPositionFrame: aTreeNode. | ||
self assert: (jsonFrame at: #frame) equals: aTreeNode targetDuration. | ||
self assert: (((jsonFrame at: #properties) at: 1) at: #name) equals: 'PositionX'. | ||
self assert: (((jsonFrame at: #properties) at: 1) at: #value) equals: 100. | ||
self assert: (((jsonFrame at: #properties) at: 2) at: #name) equals: 'PositionY'. | ||
self assert: (((jsonFrame at: #properties) at: 2) at: #value) equals: 200. | ||
|
||
"also extract instantiation of testFrame" | ||
testFrame := Dictionary | ||
with: #frame -> 500 | ||
with: #properties -> { | ||
Dictionary | ||
with: #name -> 'PositionX' | ||
with: #value -> 100. | ||
Dictionary | ||
with: #name -> 'PositionY' | ||
with: #value -> 200. | ||
}. | ||
|
||
self assert: (jsonFrame = testFrame). |
32 changes: 22 additions & 10 deletions
32
...nimationsEditor-Tests.package/AnimationsEditorTest.class/instance/testAddRotationFrame.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
saveJson | ||
testAddRotationFrame | ||
| rotationProperty jsonFrame aTreeNode | | ||
| jsonFrame aTreeNode animationsEditorProperty testFrame | | ||
|
||
rotationProperty := ((self animationsEditorInstance propertyList at: 2) subproperties at: 1). "1: Rotation, 2: Color, 3: Position, 4: Size" | ||
rotationProperty targetRotation: 45. | ||
|
||
self animationsEditorInstance selectedTreeNode: rotationProperty. | ||
self animationsEditorInstance playAnimations. | ||
aTreeNode := self animationsEditorInstance selectedTreeNode. | ||
"still need to extract instantiation of the TreeNode" | ||
animationsEditorProperty := self animationsEditorInstance propertyList at: 2. | ||
aTreeNode := AnimationsEditorPropertyRotation new. | ||
aTreeNode | ||
copyOfTargetMorph: animationsEditorProperty targetMorph; | ||
targetMorph: aTreeNode copyOfTargetMorph copy. | ||
aTreeNode targetMorph rotationDegrees: 70. | ||
aTreeNode | ||
targetDuration: animationsEditorProperty defaultTargetDuration; | ||
targetRotation: 70. | ||
|
||
jsonFrame := self animationsEditorInstance addRotationFrame: aTreeNode. | ||
self assert: (jsonFrame at: #frame) equals: aTreeNode targetDuration. | ||
self assert: (((jsonFrame at: #properties) at: 1) at: #name) equals: 'Rotation'. | ||
self assert: (((jsonFrame at: #properties) at: 1) at: #value) equals: 45. | ||
|
||
"also extract instantiation of testFrame" | ||
testFrame := Dictionary | ||
with: #frame -> 500 | ||
with: #properties -> { | ||
Dictionary | ||
with: #name -> 'Rotation' | ||
with: #value -> 70. | ||
}. | ||
|
||
self assert: (jsonFrame = testFrame). |
37 changes: 25 additions & 12 deletions
37
...es/AnimationsEditor-Tests.package/AnimationsEditorTest.class/instance/testAddSizeFrame.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
saveJson | ||
testAddSizeFrame | ||
| sizeProperty jsonFrame aTreeNode | | ||
| jsonFrame aTreeNode animationsEditorProperty testFrame | | ||
|
||
sizeProperty := ((self animationsEditorInstance propertyList at: 2) subproperties at: 4). "1: Rotation, 2: Color, 3: Position, 4: Size" | ||
sizeProperty targetSize: 200 @ 100. | ||
|
||
self animationsEditorInstance selectedTreeNode: sizeProperty. | ||
self animationsEditorInstance playAnimations. | ||
aTreeNode := self animationsEditorInstance selectedTreeNode. | ||
"still need to extract instantiation of the TreeNode" | ||
animationsEditorProperty := self animationsEditorInstance propertyList at: 2. | ||
aTreeNode := AnimationsEditorPropertySize new. | ||
aTreeNode | ||
copyOfTargetMorph: animationsEditorProperty targetMorph; | ||
targetMorph: aTreeNode copyOfTargetMorph copy. | ||
aTreeNode targetMorph extent: 100 @ 200. | ||
aTreeNode | ||
targetDuration: animationsEditorProperty defaultTargetDuration; | ||
targetSize: 100 @ 200. | ||
|
||
jsonFrame := self animationsEditorInstance addSizeFrame: aTreeNode. | ||
self assert: (jsonFrame at: #frame) equals: aTreeNode targetDuration. | ||
self assert: (((jsonFrame at: #properties) at: 1) at: #name) equals: 'Width'. | ||
self assert: (((jsonFrame at: #properties) at: 1) at: #value) equals: 200. | ||
self assert: (((jsonFrame at: #properties) at: 2) at: #name) equals: 'Height'. | ||
self assert: (((jsonFrame at: #properties) at: 2) at: #value) equals: 100. | ||
|
||
"also extract instantiation of testFrame" | ||
testFrame := Dictionary | ||
with: #frame -> 500 | ||
with: #properties -> { | ||
Dictionary | ||
with: #name -> 'width' | ||
with: #value -> 100. | ||
Dictionary | ||
with: #name -> 'height' | ||
with: #value -> 200. | ||
}. | ||
|
||
self assert: (jsonFrame = testFrame). |
40 changes: 26 additions & 14 deletions
40
...onsEditor-Tests.package/AnimationsEditorTest.class/instance/testCreateStartInformation.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
saveJson | ||
testCreateStartInformation | ||
| json aMorph | | ||
| json aMorph testJson | | ||
|
||
aMorph := (self animationsEditorInstance propertyList at: 2) targetMorph. | ||
json := self animationsEditorInstance createStartInformation: aMorph. | ||
|
||
"also extract instantiation of testFrame" | ||
testJson := Dictionary | ||
with: #type -> 'Morph' | ||
with: #properties -> { | ||
Dictionary | ||
with: #name -> 'rotation' | ||
with: #value -> 0. | ||
Dictionary | ||
with: #name -> 'positionX' | ||
with: #value -> 25. | ||
Dictionary | ||
with: #name -> 'positionY' | ||
with: #value -> 974. | ||
Dictionary | ||
with: #name -> 'width' | ||
with: #value -> 50. | ||
Dictionary | ||
with: #name -> 'height' | ||
with: #value -> 40. | ||
Dictionary | ||
with: #name -> 'color' | ||
with: #value -> 'Color blue'. | ||
}. | ||
|
||
"maby it's better to compare two dicts" | ||
self assert: (json at: #type) equals: (aMorph class) asString. | ||
self assert: (((json at: #properties) at: 1) at: #name) equals: 'rotation'. | ||
self assert: (((json at: #properties) at: 1) at: #value) equals: aMorph rotationDegrees. | ||
self assert: (((json at: #properties) at: 2) at: #name) equals: 'positionX'. | ||
self assert: (((json at: #properties) at: 2) at: #value) equals: aMorph x. | ||
self assert: (((json at: #properties) at: 3) at: #name) equals: 'positionY'. | ||
self assert: (((json at: #properties) at: 3) at: #value) equals: aMorph y. | ||
self assert: (((json at: #properties) at: 4) at: #name) equals: 'width'. | ||
self assert: (((json at: #properties) at: 4) at: #value) equals: aMorph width. | ||
self assert: (((json at: #properties) at: 5) at: #name) equals: 'height'. | ||
self assert: (((json at: #properties) at: 5) at: #value) equals: aMorph height. | ||
self assert: (((json at: #properties) at: 6) at: #name) equals: 'color'. | ||
self assert: (((json at: #properties) at: 6) at: #value) equals: (aMorph color) asString. | ||
self assert: (json = testJson) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters