1 | // Copyright 2014 The Flutter Authors. All rights reserved. |
---|---|
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | import 'package:flutter/material.dart'; |
6 | import 'package:flutter_api_samples/material/progress_indicator/circular_progress_indicator.1.dart' |
7 | as example; |
8 | import 'package:flutter_test/flutter_test.dart'; |
9 | |
10 | void main() { |
11 | testWidgets('Finds CircularProgressIndicator', (WidgetTester tester) async { |
12 | await tester.pumpWidget(const example.ProgressIndicatorExampleApp()); |
13 | |
14 | expect(find.bySemanticsLabel('Circular progress indicator').first, findsOneWidget); |
15 | |
16 | // Test if CircularProgressIndicator is animating. |
17 | expect(tester.hasRunningAnimations, isTrue); |
18 | |
19 | await tester.pump(const Duration(seconds: 1)); |
20 | expect(tester.hasRunningAnimations, isTrue); |
21 | |
22 | // Test determinate mode button. |
23 | await tester.tap(find.byType(Switch)); |
24 | await tester.pumpAndSettle(); |
25 | expect(tester.hasRunningAnimations, isFalse); |
26 | |
27 | await tester.tap(find.byType(Switch)); |
28 | await tester.pump(const Duration(seconds: 1)); |
29 | expect(tester.hasRunningAnimations, isTrue); |
30 | }); |
31 | } |
32 |