Add WidgetTester.hasRunningAnimation (#8886)

Fixes #4017
This commit is contained in:
Adam Barth
2017-03-20 13:32:00 -07:00
committed by GitHub
parent 9c8763368f
commit 142922deb4
2 changed files with 22 additions and 1 deletions

View File

@@ -185,4 +185,20 @@ void main() {
);
});
});
testWidgets('hasRunningAnimations control test', (WidgetTester tester) async {
final AnimationController controller = new AnimationController(
duration: const Duration(seconds: 1),
vsync: const TestVSync()
);
expect(tester.hasRunningAnimations, isFalse);
controller.forward();
expect(tester.hasRunningAnimations, isTrue);
controller.stop();
expect(tester.hasRunningAnimations, isFalse);
controller.forward();
expect(tester.hasRunningAnimations, isTrue);
await tester.pumpAndSettle();
expect(tester.hasRunningAnimations, isFalse);
});
}