Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring/tests and null object #81

Merged
merged 3 commits into from
Jul 18, 2022
Merged
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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initialization
on: anAnimationsEditorTimeline withExtent: anotherPoint
^ self basicNew timeline: anAnimationsEditorTimeline;
initialize;
extent: anotherPoint ;
yourself.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
initialization
initialize
super initialize.
self
extent: 3@100;
color: Color black;
position: self startMargin@25.
self
color: Color black;
position: self startMargin @ self trackHeight;
playMovingAnimation.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
accessing
playMovingAnimation
| animation |
animation:= (AnimPropertyAnimation
on: self
property: #position
start: self position
end: self position + (self animationDuration@0)
duration: self animationDuration)
start;
register;
finishBlock: [self abandon].

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"class" : {
"on:" : "SG 5/21/2022 16:01",
"on:withPosition:withExtent:" : "ob 6/9/2022 21:39",
"on:withPositionY:withExtent:" : "ob 6/9/2022 21:40" },
"on:withExtent:" : "Noel Bastubbe 7/4/2022 15:27" },
"instance" : {
"animationDuration" : "ob 6/9/2022 21:31",
"initialize" : "ob 6/9/2022 21:29",
Expand All @@ -16,3 +14,4 @@
"speed:" : "ob 6/9/2022 20:26",
"step" : "ob 6/9/2022 20:45",
"stepTime" : "Noel Bastubbe 6/22/2022 12:27" } }

Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
],
"commentStamp" : "",
"instvars" : [
"movingLine",
"speed",
"positionY" ],
],
"name" : "AnimationsEditorMovingLine",
"pools" : [
],
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
"endTime" : "Noel Bastubbe 6/22/2022 12:27",
"endTime:" : "6/14/2022 17:04:37",
"getDurationString:" : "6/14/2022 17:04:37",
"initialize" : "ob 6/13/2022 13:21",
"initialize" : "Noel Bastubbe 7/4/2022 15:31",
"initializeDuration" : "6/14/2022 17:04:37",
"intermediateLineDistance" : "Noel Bastubbe 6/14/2022 17:16",
"labelXOffset" : "6/14/2022 17:04:37",
"labelYOffset" : "6/14/2022 17:04:37",
"lineHeight" : "MH 8/1/2021 19:00",
"lineWidth" : "MH 8/1/2021 19:22",
"movingLine" : "Noel Bastubbe 6/22/2022 12:28",
"movingLine:" : "Noel Bastubbe 6/22/2022 12:28",
"startEndLineHeight" : "MH 8/1/2021 19:00",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ createMovingLine
do: [:subproperty |
subproperty isActivated ifTrue: [
numberOfProperties := numberOfProperties + 1].].
self movingLine ifNotNil: [self movingLine abandon].
self
movingLine: (AnimationsEditorMovingLine on: self withPositionY: self trackHeight withExtent: 3@(numberOfProperties * self trackHeight));
movingLine: (AnimationsEditorMovingLine on: self withExtent: self lineWidth @ (numberOfProperties * self trackHeight));
addMorphFront: movingLine.

self movingLine setMovingSpeedPerHundredMilliseconds.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
initialization
initialize
super initialize.
self
extent: self initialExtent;
color: Color lightGray;
setDefaultProperty;
initializeStartEndTime.
super initialize.
self
extent: self initialExtent;
color: Color lightGray;
setDefaultProperty;
initializeStartEndTime.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"endTime" : "MH 8/1/2021 18:57",
"endTime:" : "MH 8/1/2021 18:57",
"initialExtent" : "MH 8/1/2021 18:57",
"initialize" : "SG 5/21/2022 15:43",
"initialize" : "Noel Bastubbe 7/4/2022 15:32",
"initializeStartEndTime" : "mjs 7/31/2021 17:38",
"minimumExtent" : "NR 7/18/2022 10:43",
"movingLine" : "SG 5/21/2022 15:38",
Expand All @@ -28,7 +28,6 @@
"switchTimelineTo:" : "SG 6/17/2022 16:00",
"timebar" : "MH 8/1/2021 18:57",
"timebar:" : "MH 8/1/2021 18:57",
"trackHeight" : "MH 8/1/2021 18:57",
"update:" : "SG 5/23/2022 18:40",
"updateExtent" : "NR 7/18/2022 10:41",
"updateExtent" : "MH 8/1/2021 18:58",
"updateStartEndProperty" : "6/17/2022 14:09:28" } }
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"convertFrameToPosition:" : "Noel Bastubbe 6/9/2022 17:42",
"endMargin" : "MH 8/1/2021 18:59",
"lineSegmentWidth" : "MH 8/1/2021 18:59",
"lineWidth" : "Noel Bastubbe 7/4/2022 15:23",
"startMargin" : "Noel Bastubbe 6/9/2022 17:45",
"timeline" : "MH 8/1/2021 19:00",
"timeline:" : "MH 8/1/2021 18:48" } }
"timeline:" : "MH 8/1/2021 18:48",
"trackHeight" : "Noel Bastubbe 7/4/2022 15:20" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
referenceTime: anObject
referenceTime := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
referenceTime
^ referenceTime
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
testing
runCase

AnimAnimationRegistry
value: AnimAnimationRegistry new
during: [super runCase].
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
testing
setUp
| morph referenceTime |
| morph |

super setUp.
referenceTime := WorldState lastCycleTime.
AnimAnimationRegistry value updateAnimations: referenceTime.
self animationsEditorInstance: AnimationsEditor open.
morph := Morph new openInWorld.
self animationsEditorInstance addTargetMorph: morph.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
testing
testMovingLineInRightPosition
| movingLine |

movingLine:= Morph new extent: 3@100;
color: Color black;
position: 105@25.
5 timesRepeat: [self moveMovingLine: movingLine].
Transcript show: movingLine position x.
movingLine comeToFront.


Transcript show: ' '.
Transcript show: ((self timeline width - 130)/2+105).
self assert: true "((movingLine position x) between: ((self timeline width - 130)/2+105 - (5*self inaccuracyFactor)) and: ((self timeline width - 130)/2+105))".

self timeline createMovingLine.
self movingLine: self timeline movingLine.
self
should: self movingLine position rounded = (self movingLine startMargin @ self timeline trackHeight);
wait: 250;
assert: (self movingLine position x rounded between: (self movingLine startMargin + 249) and: (self movingLine startMargin + 251));
wait: 250;
assert: (self movingLine position x rounded between: (self movingLine startMargin + 499) and: (self movingLine startMargin + 501));
wait: 250;
assert: (self movingLine position x rounded between: (self movingLine startMargin + 749) and: (self movingLine startMargin + 751)).



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,4 @@ testMovingLineInitializedInRightPosition

self timeline createMovingLine.
self movingLine: self timeline movingLine.
self assert: (self movingLine position ) = (self movingLine startMargin @ self timeline trackHeight).






self assert: (self movingLine position ) = (self movingLine startMargin @ self timeline trackHeight).
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
testing
testMovingLineStoppedAtEndMargin
|movingLine|
movingLine:= Morph new extent: 3@100;
color: Color black;
position: self startMargin @self timeline trackHeight.
1000 timesRepeat: [self moveMovingLine: movingLine].
self assert: (movingLine position) = ((self timeline width - self endMargin)@ self timeline trackHeight).
self timeline createMovingLine.
self movingLine: self timeline movingLine.
self
wait: 1500;
should: self movingLine position x = (self movingLine startMargin + 1000).



Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
calculation
support
wait: milliseconds
"Wait some time in terms of the main world cycle. Split up waiting time into slices of 5 virtual milliseconds to get close to the real behavior."

self waitNow: 0.
milliseconds // 5 timesRepeat: [self waitNow: 5].
milliseconds // 5 timesRepeat: [self waitNow: 5].
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
calculation
support
waitNow: milliseconds
|referenceTime|

referenceTime := referenceTime + milliseconds.
AnimAnimationRegistry value updateAnimations: referenceTime.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
"positionTrack" : "MH 8/1/2021 18:42",
"positionTrack:" : "MH 8/1/2021 18:42",
"propertyPosition" : "SG 6/22/2022 14:15",
"referenceTime" : "Noel Bastubbe 7/12/2022 11:18",
"referenceTime:" : "Noel Bastubbe 7/12/2022 11:18",
"runCase" : "Noel Bastubbe 7/12/2022 12:00",
"secondLastOn:" : "NB 8/1/2021 12:16",
"setUp" : "SG 6/22/2022 14:15",
"setUp" : "Noel Bastubbe 7/12/2022 11:27",
"startFrame" : "MH 8/1/2021 18:42",
"startMargin" : "ob 5/29/2022 17:46",
"tearDown" : "SG 6/22/2022 14:15",
Expand All @@ -36,5 +39,5 @@
"testWidthOfTimeline" : "6/17/2022 14:09:29",
"timeline" : "MH 8/1/2021 18:43",
"timeline:" : "MH 8/1/2021 18:43",
"wait:" : "ob 5/27/2022 16:59",
"waitNow:" : "ob 5/27/2022 17:00" } }
"wait:" : "Noel Bastubbe 7/12/2022 11:18",
"waitNow:" : "Noel Bastubbe 7/12/2022 11:18" } }
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"timeline",
"positionTrack",
"addedKeyframeMorph",
"movingLine" ],
"movingLine",
"referenceTime" ],
"name" : "AnimationsEditorTimelineTest",
"pools" : [
],
Expand Down