• 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
..
lib Loading commit data...
test Loading commit data...
test_fixes Loading commit data...
test_private Loading commit data...
test_release Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
analysis_options.yaml Loading commit data...
build.yaml Loading commit data...
dart_test.yaml Loading commit data...
pubspec.yaml Loading commit data...