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( |
13 | const example.ProgressIndicatorApp(), |
14 | ); |
15 | |
16 | expect( |
17 | find.bySemanticsLabel('Circular progress indicator').first, |
18 | findsOneWidget, |
19 | ); |
20 | |
21 | // Test if CircularProgressIndicator is animating. |
22 | expect(tester.hasRunningAnimations, isTrue); |
23 | |
24 | await tester.pump(const Duration(seconds: 1)); |
25 | expect(tester.hasRunningAnimations, isTrue); |
26 | |
27 | // Test determinate mode button. |
28 | await tester.tap(find.byType(Switch)); |
29 | await tester.pumpAndSettle(); |
30 | expect(tester.hasRunningAnimations, isFalse); |
31 | |
32 | await tester.tap(find.byType(Switch)); |
33 | await tester.pump(const Duration(seconds: 1)); |
34 | expect(tester.hasRunningAnimations, isTrue); |
35 | }); |
36 | } |
37 |