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
5import 'package:flutter/material.dart';
6import 'package:flutter_api_samples/material/progress_indicator/circular_progress_indicator.1.dart'
7 as example;
8import 'package:flutter_test/flutter_test.dart';
9
10void 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

Provided by KDAB

Privacy Policy
Learn more about Flutter for embedded and desktop on industrialflutter.com