Skip to content

Commit

Permalink
8236753: Animations do not play backwards after being stopped
Browse files Browse the repository at this point in the history
Reviewed-by: kcr, arapte
  • Loading branch information
nlisker committed Jan 22, 2020
1 parent 16cea41 commit 9ae37f1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ private void set(T value) {
/* Package-private for testing purposes */
ClipEnvelope clipEnvelope;

private boolean lastPlayedFinished = false;
private boolean lastPlayedFinished = true;

private boolean lastPlayedForward = true;
/**
Expand Down Expand Up @@ -978,6 +978,7 @@ public void stop() {
clipEnvelope.abortCurrentPulse();
doStop();
jumpTo(Duration.ZERO);
lastPlayedFinished = true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,19 @@ public void testPlay() {
assertFalse(listener.wasCalled);
assertFalse(timer.containsPulseReceiver(animation.shim_pulseReceiver()));
animation.stop();
animation.setRate(1.0);

// stopped timeline, rate = -1
listener.wasCalled = false;
animation.setRate(-1.0);
animation.play();
assertEquals(ONE_SEC.toMillis(), animation.getCurrentTime().toMillis(), EPSILON);
assertFalse(listener.wasCalled);
assertTrue(timer.containsPulseReceiver(animation.shim_pulseReceiver()));
animation.stop();

// stopped timeline, cycleDuration = 0
listener.wasCalled = false;
animation.setRate(1.0);
animation.shim_setCycleDuration(Duration.ZERO);
animation.play();
assertEquals(Status.STOPPED, animation.getStatus());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,10 @@ public void testCycleReverse() {
st.play();

assertEquals(Status.RUNNING, st.getStatus());
assertEquals(Status.RUNNING, child1X.getStatus());
assertEquals(Status.STOPPED, child1Y.getStatus());
assertEquals(0, xProperty.get());
assertEquals(0, yProperty.get());
assertEquals(Status.STOPPED, child1X.getStatus());
assertEquals(Status.RUNNING, child1Y.getStatus());
assertEquals(60000, xProperty.get());
assertTrue(0 < yProperty.get() && yProperty.get() < 10000);

st.jumpTo(TickCalculation.toDuration(100));

Expand Down

0 comments on commit 9ae37f1

Please sign in to comment.