RFR: 8241582: Infinite animation does not start from the end when started with a negative rate

Nir Lisker nlisker at openjdk.java.net
Fri Apr 10 06:39:40 UTC 2020

### Cause

`Animation#jumpTo(Duration)` does not handle `Duration.INDEFINITE` properly. This causes
`InfiniteClipEnvelope#jumpTo(long)` to receive an erroneous value and start the animation not from the end, depending
on the modulo calculation.

### Fix

For infinite cycles, use the `cycleDuration` as the destination since that is the effective end point.

### Tests

* Added an `testJumpTo_IndefiniteCycles` test that fails without the patch and passes after it.
* Added a `testJumpTo_IndefiniteCycleDuration` that passes both before and after, just to make sure that this type of
  infinite duration is correct.
* Removed a test in `SequentialTransition` that fails with this patch, but it passed before it only because the modulo
  value happened to land in the right place. Changing the duration of one of the child animation can cause it to fail, so
  the test is faulty anyway at this stage.

### Future work

Playing backwards will still not work correctly, but at least now it start from the correct value. This is the first of
a series of fixes under the umbrella issue [JDK-8210238](https://bugs.openjdk.java.net/browse/JDK-8210238).


Commit messages:
 - Comment out erroneous test
 - Fix IndefiniteCycleDuration test
 - Fixed single loop test
 - Initial commit

Changes: https://git.openjdk.java.net/jfx/pull/169/files
 Webrev: https://webrevs.openjdk.java.net/jfx/169/webrev.00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8241582
  Stats: 28 lines in 3 files changed: 19 ins; 1 del; 8 mod
  Patch: https://git.openjdk.java.net/jfx/pull/169.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/169/head:pull/169

PR: https://git.openjdk.java.net/jfx/pull/169

More information about the openjfx-dev mailing list