-
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.
started with testing (not complete)
- Loading branch information
Max Hoffmann
committed
May 15, 2021
1 parent
9213510
commit b4a8ad5
Showing
25 changed files
with
197 additions
and
58 deletions.
There are no files selected for viewing
8 changes: 5 additions & 3 deletions
8
packages/AnimationsEditor-Core.package/AnimationsEditor.class/instance/addColorFrame..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,13 +1,15 @@ | ||
saveJson | ||
addColorFrame: aTreeNode | ||
addColorFrame: aTreeNode | ||
| jsonFrame | | ||
|
||
jsonFrame := Dictionary | ||
with: #frame -> aTreeNode targetDuration | ||
with: #properties -> { | ||
Dictionary | ||
with: #name -> aTreeNode title | ||
with: #value -> aTreeNode targetColorAsString. | ||
with: #value -> aTreeNode targetColorAsString | ||
}. | ||
|
||
^ jsonFrame. | ||
^ jsonFrame. | ||
|
||
|
5 changes: 3 additions & 2 deletions
5
...ges/AnimationsEditor-Core.package/AnimationsEditor.class/instance/addMorphToJson.with..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
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
25 changes: 10 additions & 15 deletions
25
.../AnimationsEditor-Core.package/AnimationsEditor.class/instance/createStartInformation..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,30 +1,25 @@ | ||
saveJson | ||
createStartInformation: aTreeNode | ||
| json originMorph | | ||
createStartInformation: aMorph | ||
|
||
originMorph := aTreeNode copyOfTargetMorph. | ||
|
||
json := Dictionary | ||
with: #type -> (originMorph class) asString | ||
^ Dictionary | ||
with: #type -> (aMorph class) asString | ||
with: #properties -> { | ||
Dictionary | ||
with: #name -> 'rotation' | ||
with: #value -> originMorph rotationDegrees. | ||
with: #value -> aMorph rotationDegrees. | ||
Dictionary | ||
with: #name -> 'positionX' | ||
with: #value -> originMorph x. | ||
with: #value -> aMorph x. | ||
Dictionary | ||
with: #name -> 'positionY' | ||
with: #value -> originMorph y. | ||
with: #value -> aMorph y. | ||
Dictionary | ||
with: #name -> 'width' | ||
with: #value -> originMorph width. | ||
with: #value -> aMorph width. | ||
Dictionary | ||
with: #name -> 'height' | ||
with: #value -> originMorph height. | ||
with: #value -> aMorph height. | ||
Dictionary | ||
with: #name -> 'color' | ||
with: #value -> (originMorph color) asString | ||
}. | ||
|
||
^ json. | ||
with: #value -> (aMorph color) asString | ||
}. |
5 changes: 5 additions & 0 deletions
5
...ages/AnimationsEditor-Core.package/AnimationsEditor.class/instance/outputFileDirectory.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
saveJson | ||
outputFileDirectory | ||
^ UIManager default saveFilenameRequest: 'Please, enter file name.' initialAnswer: 'test'. | ||
|
||
|
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
8 changes: 0 additions & 8 deletions
8
packages/AnimationsEditor-Core.package/AnimationsEditor.class/instance/writeJsonToFile..st
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...es/AnimationsEditor-Core.package/AnimationsEditor.class/instance/writeJsonToFile.with..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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
saveJson | ||
writeJsonToFile: aJsonString with: aDirectory | ||
| outputStream | | ||
|
||
outputStream := StandardFileStream newFileNamed: aDirectory, '.json'. | ||
aJsonString storeOn: outputStream. | ||
|
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
4 changes: 0 additions & 4 deletions
4
...s/AnimationsEditor-Tests.package/AnimationsEditorTest.class/instance/animationsEditor..st
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
...es/AnimationsEditor-Tests.package/AnimationsEditorTest.class/instance/animationsEditor.st
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
...ionsEditor-Tests.package/AnimationsEditorTest.class/instance/animationsEditorInstance..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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
animationsEditorInstance: anObject | ||
|
||
animationsEditorInstance := anObject. |
4 changes: 4 additions & 0 deletions
4
...tionsEditor-Tests.package/AnimationsEditorTest.class/instance/animationsEditorInstance.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
animationsEditorInstance | ||
|
||
^ animationsEditorInstance |
9 changes: 7 additions & 2 deletions
9
packages/AnimationsEditor-Tests.package/AnimationsEditorTest.class/instance/setUp.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,5 +1,10 @@ | ||
saveJson | ||
setUp | ||
self animationsEditor: AnimationsEditor open. | ||
self animationsEditor addTargetMorph: Morph new. | ||
| morph | | ||
|
||
self animationsEditorInstance: AnimationsEditor open. | ||
morph := Morph new. | ||
morph openInWorld. | ||
animationsEditorInstance addTargetMorph: morph. | ||
|
||
|
7 changes: 7 additions & 0 deletions
7
packages/AnimationsEditor-Tests.package/AnimationsEditorTest.class/instance/tearDown.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
saveJson | ||
tearDown | ||
"self animationsEditorInstance selectedTreeNode targetMorph abandon. " | ||
(self animationsEditorInstance propertyList at: 2) targetMorph abandon. | ||
self animationsEditorInstance windowReference abandon. | ||
|
||
|
15 changes: 13 additions & 2 deletions
15
...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,4 +1,15 @@ | ||
saveJson | ||
testAddColorFrame | ||
self animationsEditor selectedTreeNode: AnimationsEditorPropertyColor new. | ||
|
||
| 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 := 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'. |
17 changes: 17 additions & 0 deletions
17
...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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
saveJson | ||
testAddPositionFrame | ||
| positionProperty jsonFrame aTreeNode | | ||
|
||
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. | ||
|
||
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. |
15 changes: 15 additions & 0 deletions
15
...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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
saveJson | ||
testAddRotationFrame | ||
| rotationProperty jsonFrame aTreeNode | | ||
|
||
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. | ||
|
||
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. |
17 changes: 17 additions & 0 deletions
17
...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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
saveJson | ||
testAddSizeFrame | ||
| sizeProperty jsonFrame aTreeNode | | ||
|
||
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. | ||
|
||
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. |
22 changes: 22 additions & 0 deletions
22
...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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
saveJson | ||
testCreateStartInformation | ||
| json aMorph | | ||
|
||
aMorph := (self animationsEditorInstance propertyList at: 2) targetMorph. | ||
json := self animationsEditorInstance createStartInformation: aMorph. | ||
|
||
"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. | ||
|
13 changes: 13 additions & 0 deletions
13
...AnimationsEditor-Tests.package/AnimationsEditorTest.class/instance/testCreateStructure.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
saveJson | ||
testCreateStructure | ||
| aStartTime anEndTime json | | ||
|
||
aStartTime := 0. | ||
anEndTime := 500. | ||
json := self animationsEditorInstance createStructure: aStartTime with: anEndTime. | ||
|
||
self assert: (json at: #start) equals: aStartTime. | ||
self assert: (json at: #end) equals: anEndTime. | ||
self assert: (json at: #morphs) isEmpty. | ||
|
||
|
13 changes: 13 additions & 0 deletions
13
...nimationsEditor-Tests.package/AnimationsEditorTest.class/instance/testDictionaryToJson.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
saveJson | ||
testDictionaryToJson | ||
| json jsonString | | ||
|
||
json := Dictionary | ||
with: #Test -> 100. | ||
|
||
jsonString := '{ | ||
"Test" : 100 | ||
}'. | ||
self assert: (self animationsEditorInstance dictionaryToJson: json) equals: jsonString. | ||
|
||
|
8 changes: 8 additions & 0 deletions
8
...AnimationsEditor-Tests.package/AnimationsEditorTest.class/instance/testWriteJsonToFile.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
saveJson | ||
testWriteJsonToFile | ||
| jsonString | | ||
|
||
jsonString := '{ "Test": { "id": "1"} }'. | ||
self animationsEditorInstance writeJsonToFile: jsonString with: 'test'. | ||
self assert: false. | ||
"read json using STON reader and compare. Delete Test file" |
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
Oops, something went wrong.