Repository navigation
Animation controller test - #88251
Conversation
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
@googlebot I fixed it. |
|
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
|
@googlebot I consent. |
Co-authored-by: Alexander Dahlberg <[email protected]> Fixes test/animation/animation_controller_test.dart in flutter#85160 Problem: The test 'animateTo can deal with duration == Duration.Zero' was failing with the following error: Expected: <0> Actual: <5> Expected no animation. package:test_api expect package:flutter_test/src/widget_tester.dart 484:3 expect test/animation/animation_controller_test.dart 511:5 main. Following line finds 5 transientCallbacks scheduled, while expecting zero, if shuffled with seed 123: expect(SchedulerBinding.instance!.transientCallbackCount, equals(0), reason: 'Expected no animation.'); This is caused by some other test leaving transientCallbacks scheduled. Fix: By disposing the AnimationController after each test, the transientCallbacks get cleaned up. I chose to dispose all controllers in every test, to make sure there is no risk of leaks.

Fixes test/animation/animation_controller_test.dart in #85160
Problem:
The test 'animateTo can deal with duration == Duration.Zero' was failing with the following error:
Following line finds 5 transientCallbacks scheduled, while expecting zero, if shuffled with seed 123:
expect(SchedulerBinding.instance!.transientCallbackCount, equals(0), reason: 'Expected no animation.');This is caused by some other test leaving transientCallbacks scheduled.
The tests I have identified leaving transientCallbacks behind is:
1. 'calling repeat with reverse set to true makes the animation alternate 'between lowerBound and upperBound values on each repeat' (1 callback)
2. calling repeat with specified min and max values makes the animation alternate between min and max values on each repeat (1 callback)
3. 2 AnimationBehavior > AnimationBehavior.normal runs "faster" than AnimationBehavior.preserve (2 callbacks)
4. 1 Simulations run forward (1 callback)
5. 1 Simulations run forward even after a reverse run (1 callback)
6. 1 Repeating animation with reverse: true report as forward and reverse (1 callback)
Fix:
By disposing the AnimationController after each test, the transientCallbacks get cleaned up.
I chose to dispose all controllers in every test, to make sure there is no risk of leaks.
Alternate fixes:
I am happy for any feedback about the best solution.
Pre-launch Checklist
///).