• Swiftaxe's avatar
    Animation controller test (#88251) · fe337dca
    Swiftaxe authored
    Co-authored-by: 's avatarAlexander Dahlberg <alexander.dahlberg@sigma.se>
    
    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:
    
    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.
    fe337dca
Name
Last commit
Last update
.github Loading commit data...
bin Loading commit data...
dev Loading commit data...
examples Loading commit data...
packages Loading commit data...
.ci.yaml Loading commit data...
.cirrus.yml Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CODEOWNERS Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
PATENT_GRANT Loading commit data...
README.md Loading commit data...
SECURITY.md Loading commit data...
TESTOWNERS Loading commit data...
analysis_options.yaml Loading commit data...
dartdoc_options.yaml Loading commit data...
flutter_console.bat Loading commit data...