mirror of
https://github.com/flutter/flutter
synced 2024-09-12 21:01:59 +00:00
test: Fix memory leak in transitions test (#146747)
This commit is contained in:
parent
63634c25ad
commit
0099d1a96a
|
@ -5,6 +5,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('toString control test', (WidgetTester tester) async {
|
||||
|
@ -95,12 +96,18 @@ void main() {
|
|||
expect(actualDecoration.boxShadow, null);
|
||||
});
|
||||
|
||||
testWidgets('animations work with curves test', (WidgetTester tester) async {
|
||||
final Animation<Decoration> curvedDecorationAnimation =
|
||||
decorationTween.animate(CurvedAnimation(
|
||||
testWidgets(
|
||||
'animations work with curves test',
|
||||
// TODO(polina-c): remove when fixed https://github.com/flutter/flutter/issues/145600 [leak-tracking-opt-in]
|
||||
experimentalLeakTesting: LeakTesting.settings.withTracked(classes: const <String>['CurvedAnimation']),
|
||||
(WidgetTester tester) async {
|
||||
final CurvedAnimation animation = CurvedAnimation(
|
||||
parent: controller,
|
||||
curve: Curves.easeOut,
|
||||
));
|
||||
);
|
||||
addTearDown(animation.dispose);
|
||||
final Animation<Decoration> curvedDecorationAnimation =
|
||||
decorationTween.animate(animation);
|
||||
|
||||
final DecoratedBoxTransition transitionUnderTest = DecoratedBoxTransition(
|
||||
decoration: curvedDecorationAnimation,
|
||||
|
@ -141,7 +148,8 @@ void main() {
|
|||
expect(actualDecoration.boxShadow![0].spreadRadius, moreOrLessEquals(1.2, epsilon: 0.1));
|
||||
// Scaling a shadow doesn't change the color.
|
||||
expect(actualDecoration.boxShadow![0].color, const Color(0x66000000));
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('AlignTransition animates', (WidgetTester tester) async {
|
||||
|
|
Loading…
Reference in a new issue