Co-authored-by: Alexander 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.
* Revert "Revert "Reland 2: Make LiveTestWidgetsFlutterBinding work with setSurfaceSize and live tests (#86912)" (#87233)"
This reverts commit 5b80d32a8430e1c44d052307dcee3c4f9fee4874.
* Record tap positions
This turns on order shuffling for all tests that don't fail with it on, marking those tests that do fail with a tag so that they will be run without shuffling on.
To determine which tests fail with it on, I ran all the tests 100 times with different random shuffle seeds, and then also ran it with the date seeds from today until the end of July, and tagged all of the test suites (files) that fail, with a seed that caused them to fail.
Adds tests to the following behaviors, which have existed without tests:
- When tapping during live testing, a message is printed with widgets that contain the tap location.
- When tapping during live testing, a mark is displayed on screen on the tap location.
This adds a "three point" cubic curve that combines two cubic curves into one curve, where the control points are all in the same coordinate system. It's called "three point" because it incorporates a middle point that the curve runs through, and that point is in addition to the existing implicit (0,0) and (1,1) points that a Curve already has.
I also added an example of this curve, which is just a more emphasized version of the easeInOutCubic.
Flutter's `moreOrLessEquals` has a few advantages over `closeTo` from
the `matcher` package:
* It emits the epsilon value in the test result on failure.
* It uses a named parameter for epsilon, which improves readability
at the call site.
* It has a reasonable default for epsilon in cases where something
more specific isn't required.
Using it also has the nice property that it aids in its own discovery
when when people go looking for such functionality in new tests.
This change also includes a couple unrelated whitespace formatting cleanups.
moreOrLessEquals is the preferred mechanism for checking that a value is
within some error bound epsilon, with default value for epsilon of
precisionErrorTolerance.
This patch replaces instances of closeTo using precisionErrorTolerance.