Skip to content

Commit

Permalink
-fixed and refactored LoadJsonTests
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bessin committed Jun 25, 2021
1 parent ccd8e93 commit e77c335
Show file tree
Hide file tree
Showing 18 changed files with 66 additions and 78 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
loadJson
loadFrames: anArray with: anAnimationEditorProperty
|frameId|
anArray do:[:frame|
frameId:= frame at: 'frame'.

anArray do: [ :frame|
frameId := frame at: 'frame'.
(frame at: 'properties')
do: [:each | ((self framePropertiesDictionary:frameId) at: (each at: 'name') asSymbol)
value: anAnimationEditorProperty subproperties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"initialize" : "DM 6/22/2020 01:26",
"initializePropertyEditorPanel" : "DM 8/6/2020 10:38",
"insertMorph:Into:" : "JIZ 6/3/2020 16:56",
"loadFrames:with:" : "FH 6/9/2021 10:20",
"loadFrames:with:" : "NB 6/25/2021 11:33",
"loadJson:" : "LW 5/15/2021 14:30",
"loadJsonWithExceptionHandling:" : "FH 5/20/2021 17:44",
"loadMorphs:" : "LW 5/15/2021 14:14",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
initialize-release
testLoadJsonCircleMorph
loadJson
testCircleMorph
| morph |

morph := self animationsEditorInstance createMorphFromString: 'CircleMorph'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
initialize-release
testLoadJsonDefaultMorph
loadJson
testDefaultMorph
| morph |

morph := self animationsEditorInstance createMorphFromString: 'AnimationsEditorKlippschliefer'.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
initialize-release
loadJson
testLoadJsonTargetColor
| data morph morphProperty |

data := {{'properties' ->{{
'value' -> 'blue'.
'name' -> 'color'
} as: Dictionary
}} as: Dictionary} as: Array.
data := {{'frame' -> 500 . 'properties' -> {{'value' -> 'blue' . 'name' -> 'color'} as: Dictionary}} as: Dictionary . {'frame' -> 1000 . 'properties' -> {{'value' -> 'lightGray' . 'name' -> 'color'} as: Dictionary}} as: Dictionary} as: Array.

morph := Morph new openInWorld.
morphProperty := self animationsEditorInstance addTargetMorph: morph.
self animationsEditorInstance loadFrames: data with: morphProperty.
self assert: (morphProperty subproperties at: 'color') targetColor = Color blue.
self assert: ((morphProperty subproperties at: 'color') targetValues at: 500) = 'blue'.
self assert: ((morphProperty subproperties at: 'color') targetValues at: 1000) = 'lightGray'.
morph abandon.
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
initialize-release
loadJson
testLoadJsonTargetPosition
| data morph morphProperty |

data := {{'properties' ->{{
'value' -> 48.0.
'name' -> 'positionX'
} as: Dictionary.
{
'value' -> 104 .
'name' -> 'positionY'
} as: Dictionary}} as: Dictionary} as: Array.
data := {{'frame' -> 500. 'properties' -> {{'value' -> 48. 'name' -> 'positionX'} as: Dictionary. {'value' -> 104. 'name' -> 'positionY'} as: Dictionary}} as: Dictionary . {'frame' -> 1000. 'properties' -> {{'value' -> 3. 'name' -> 'positionX'} as: Dictionary. {'value' -> 42. 'name' -> 'positionY'} as: Dictionary}} as: Dictionary} as: Array.

morph := Morph new openInWorld.
morphProperty := self animationsEditorInstance addTargetMorph: morph.
self animationsEditorInstance loadFrames: data with: morphProperty.
self assert: (morphProperty subproperties at: 'position') targetPosition = (48@104).
self assert: ((morphProperty subproperties at: 'position') targetValues at: 500) = (48 @ 104).
self assert: ((morphProperty subproperties at: 'position') targetValues at: 1000) = (3 @ 42).
morph abandon.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
initialize-release
loadJson
testLoadJsonTargetRotation
| data morph morphProperty |

data := {{'properties' ->{{
'value' -> 40 .
'name' -> 'rotation'
}as: Dictionary}} as: Dictionary} as: Array.
data := {{'frame' -> 500. 'properties' -> {{'value' -> 40. 'name' -> 'rotation'} as: Dictionary}} as: Dictionary. {'frame' -> 1000. 'properties' -> {{'value' -> 80. 'name' -> 'rotation'} as: Dictionary}} as: Dictionary} as: Array.

morph := Morph new openInWorld.
morphProperty := self animationsEditorInstance addTargetMorph: morph.
self animationsEditorInstance loadFrames: data with: morphProperty.
self assert: (morphProperty subproperties at: 'rotation') targetRotation = 40.
self assert: ((morphProperty subproperties at: 'rotation') targetValues at: 500) = 40.
self assert: ((morphProperty subproperties at: 'rotation') targetValues at: 1000) = 80.
morph abandon.
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
initialize-release
loadJson
testLoadJsonTargetSize
| data morph morphProperty |

data := {{'properties' ->{{
'value' -> 50 .
'name' -> 'width'
} as: Dictionary.
{
'value' -> 40 .
'name' -> 'height'
} as: Dictionary
}} as: Dictionary} as: Array.
data := {{'frame' -> 500. 'properties' -> {{'value' -> 50. 'name' -> 'width'} as: Dictionary. {'value' -> 40. 'name' -> 'height'} as: Dictionary}} as: Dictionary. {'frame' -> 1000. 'properties' -> {{'value' -> 87. 'name' -> 'width'} as: Dictionary. {'value' -> 500. 'name' -> 'height'} as: Dictionary}} as: Dictionary} as: Array.

morph := Morph new openInWorld.
morphProperty := self animationsEditorInstance addTargetMorph: morph.
self animationsEditorInstance loadFrames: data with: morphProperty.
self assert: (morphProperty subproperties at: 'size') targetSize = (50@40).
self assert: ((morphProperty subproperties at: 'size') targetValues at: 500) = (50 @ 40).
self assert: ((morphProperty subproperties at: 'size') targetValues at: 1000) = (87 @ 500).
morph abandon.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
loadJson
testLoadMorphs
| morph data |

data := {{'type' -> 'Morph'. 'properties' -> {}. 'frames' -> {{'frame' -> 500. 'properties' -> {}} as: Dictionary}} as: Dictionary. {'type' -> 'Morph'. 'properties' -> {}. 'frames' -> {{'frame' -> 1000 . 'properties' -> {}} as: Dictionary}} as: Dictionary}.

morph := self animationsEditorInstance loadMorphs: data.
self assert: self animationsEditorInstance propertyList size = 4.
self animationsEditorInstance propertyList third targetMorph abandon.
self animationsEditorInstance propertyList fourth targetMorph abandon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
initialize-release
testLoadJsonStartEnd
loadJson
testLoadStartEnd
| data |

data := {'end' -> 500 . 'start' -> 0} as: Dictionary.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
initialize-release
testLoadJsonPropertyColor
loadJson
testLoadStartPropertyColor
| morph data |

data := {{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
initialize-release
testLoadJsonPropertyPosition
loadJson
testLoadStartPropertyPosition
| morph data |

data := {{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
initialize-release
testLoadJsonPropertyRotation
loadJson
testLoadStartPropertyRotation
| morph data |

data := {{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
initialize-release
testLoadJsonPropertySize
loadJson
testLoadStartPropertySize
| morph data |

data := {{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
initialize-release
testLoadJsonMorph
loadJson
testMorph
| morph |

morph := self animationsEditorInstance createMorphFromString: 'Morph'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
initialize-release
testLoadJsonRectangleMorph
loadJson
testRectangleMorph
| morph |

morph := self animationsEditorInstance createMorphFromString: 'RectangleMorph'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@
"testAddPositionFrame" : "MH 6/5/2021 09:34",
"testAddRotationFrame" : "MH 6/5/2021 09:34",
"testAddSizeFrame" : "MH 6/5/2021 09:34",
"testCircleMorph" : "NB 6/25/2021 12:18",
"testCreateFrameCollection" : "MH 6/5/2021 09:48",
"testCreateStartInformation" : "LW 5/23/2021 12:08",
"testCreateStructure" : "MH 5/15/2021 11:24",
"testDefaultMorph" : "NB 6/25/2021 12:19",
"testDictionaryToJson" : "MH 5/20/2021 11:24",
"testEmptyPanelsGetter" : "DM 8/7/2020 17:52",
"testEmptyPanelsSetter" : "DM 8/7/2020 17:37",
"testGetDeepestMorph" : "DM 8/4/2020 13:26",
"testInstanceCreation" : "DM 8/4/2020 13:26",
"testLoadJsonCircleMorph" : "LW 5/23/2021 11:59",
"testLoadJsonDefaultMorph" : "LW 5/23/2021 12:00",
"testLoadJsonLoadMorphs" : "LW 5/23/2021 12:03",
"testLoadJsonMorph" : "LW 5/23/2021 12:04",
"testLoadJsonPropertyColor" : "LW 5/23/2021 12:04",
"testLoadJsonPropertyPosition" : "LW 5/23/2021 12:04",
"testLoadJsonPropertyRotation" : "LW 5/23/2021 12:05",
"testLoadJsonPropertySize" : "LW 5/23/2021 12:05",
"testLoadJsonRectangleMorph" : "LW 5/23/2021 12:05",
"testLoadJsonStartEnd" : "LW 5/23/2021 12:05",
"testLoadJsonTargetColor" : "FH 6/9/2021 09:29",
"testLoadJsonTargetPosition" : "FH 6/9/2021 09:29",
"testLoadJsonTargetRotation" : "FH 6/9/2021 09:29",
"testLoadJsonTargetSize" : "FH 6/9/2021 09:29",
"testLoadJsonTargetColor" : "NB 6/25/2021 12:14",
"testLoadJsonTargetPosition" : "NB 6/25/2021 12:07",
"testLoadJsonTargetRotation" : "NB 6/25/2021 12:08",
"testLoadJsonTargetSize" : "NB 6/25/2021 12:12",
"testLoadMorphs" : "NB 6/25/2021 12:19",
"testLoadStartEnd" : "NB 6/25/2021 12:26",
"testLoadStartPropertyColor" : "NB 6/25/2021 12:23",
"testLoadStartPropertyPosition" : "NB 6/25/2021 12:23",
"testLoadStartPropertyRotation" : "NB 6/25/2021 12:22",
"testLoadStartPropertySize" : "NB 6/25/2021 12:23",
"testMorph" : "NB 6/25/2021 12:25",
"testPlayAnimations" : "CL 5/30/2021 14:17",
"testRectangleMorph" : "NB 6/25/2021 12:25",
"testSelectMorphByHand" : "DM 8/7/2020 18:59",
"testShowMessagePlayAnimation" : "CL 5/30/2021 14:17",
"testToolBuilderGetter" : "DM 8/7/2020 17:53",
Expand Down

0 comments on commit e77c335

Please sign in to comment.