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(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

Provided by KDAB

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