rive-flutter icon indicating copy to clipboard operation
rive-flutter copied to clipboard

Use the stopwatch from the clock package

Open Abestanis opened this issue 2 years ago • 1 comments

This makes rive animations respect fake clocks during testing.

We use rive in our app and tested that this did not introduce any visual change in the app. It does fix timeouts in our tests though.

We use flutters pumpAndSettle in our tests, which started throwing timeout errors when we were switching from flare to rive. The flutter testing framework uses a fake clock (from the clock package). pumpAndSettle has a timeout of 10 minutes, but this refers to the fake clock, which advances much faster during the test, so the timeout is hit and our rive animations are still running because less than a second might have passed in real time.

Abestanis avatar Jul 02 '22 19:07 Abestanis

Hey @luigi-rosso, sorry if you are the wrong person to ping, but is there any chance I could get a review for this? I don't know the review procedure at rive but the diff here is extremely small, it improves testability, and the clock package is maintained by the dart developers themself (the repository is under the dart-lang organization).

Please let me know, if there is anything else that I can do to help this along.

Abestanis avatar Nov 09 '22 17:11 Abestanis

Closing this issue as it's no longer valid. Rive now uses a Ticker, which calls a callback once per animation frame.

This change is needed for testing purposes. A Stopwatch introduces randomness to animations advancing, making golden testing impossible. It also syncs the Rive animation the global timeDilation.

HayesGordon avatar Jun 14 '24 10:06 HayesGordon