• 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
..
animation Loading commit data...
cupertino Loading commit data...
examples Loading commit data...
foundation Loading commit data...
gestures Loading commit data...
harness Loading commit data...
material Loading commit data...
painting Loading commit data...
physics Loading commit data...
rendering Loading commit data...
scheduler Loading commit data...
semantics Loading commit data...
services Loading commit data...
widgets Loading commit data...
_goldens_io.dart Loading commit data...
_goldens_web.dart Loading commit data...
flutter_test_config.dart Loading commit data...
image_data.dart Loading commit data...