Skip to content

Commit 71ac7f5

Browse files
Add tests for about_list_tile.0.dart (flutter#150181)
Contributes to flutter#130459 It adds a test for - `examples/api/lib/material/about/about_list_tile.0.dart`
1 parent f11d368 commit 71ac7f5

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

dev/bots/check_code_samples.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ final Set<String> _knownMissingTests = <String>{
339339
'examples/api/test/material/search_anchor/search_anchor.0_test.dart',
340340
'examples/api/test/material/search_anchor/search_anchor.1_test.dart',
341341
'examples/api/test/material/search_anchor/search_anchor.2_test.dart',
342-
'examples/api/test/material/about/about_list_tile.0_test.dart',
343342
'examples/api/test/material/selection_area/selection_area.0_test.dart',
344343
'examples/api/test/material/scaffold/scaffold_messenger.of.0_test.dart',
345344
'examples/api/test/material/scaffold/scaffold_messenger.0_test.dart',
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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/about/about_list_tile.0.dart'
7+
as example;
8+
import 'package:flutter_test/flutter_test.dart';
9+
10+
void main() {
11+
testWidgets('It should show the about dialog after clicking on the button', (WidgetTester tester) async {
12+
await tester.pumpWidget(const example.AboutListTileExampleApp());
13+
14+
expect(find.widgetWithText(AppBar, 'Show About Example'), findsOne);
15+
16+
await tester.tap(find.widgetWithText(ElevatedButton, 'Show About Example'));
17+
await tester.pumpAndSettle();
18+
19+
expect(find.byType(AboutDialog), findsOne);
20+
expect(find.widgetWithText(AboutDialog, 'Show About Example'), findsOne);
21+
expect(find.text('August 2019'), findsOne);
22+
expect(find.byType(FlutterLogo), findsOne);
23+
expect(find.text('\u{a9} 2014 The Flutter Authors'), findsOne);
24+
expect(
25+
find.text(
26+
"Flutter is Google's UI toolkit for building beautiful, "
27+
'natively compiled applications for mobile, web, and desktop '
28+
'from a single codebase. Learn more about Flutter at '
29+
'https://flutter.dev.',
30+
findRichText: true,
31+
),
32+
findsOne,
33+
);
34+
});
35+
36+
testWidgets('It should show the about dialog after clicking on about list tile in the drawer', (WidgetTester tester) async {
37+
await tester.pumpWidget(const example.AboutListTileExampleApp());
38+
39+
expect(find.widgetWithText(AppBar, 'Show About Example'), findsOne);
40+
41+
await tester.tap(find.byType(DrawerButton));
42+
await tester.pumpAndSettle();
43+
44+
expect(find.byType(Drawer), findsOne);
45+
expect(find.widgetWithText(AboutListTile, 'About Show About Example'), findsOne);
46+
expect(find.widgetWithIcon(AboutListTile, Icons.info), findsOne);
47+
48+
await tester.tap(find.widgetWithIcon(AboutListTile, Icons.info));
49+
await tester.pumpAndSettle();
50+
51+
expect(find.byType(AboutDialog), findsOne);
52+
expect(find.widgetWithText(AboutDialog, 'Show About Example'), findsOne);
53+
expect(find.text('August 2019'), findsOne);
54+
expect(find.byType(FlutterLogo), findsOne);
55+
expect(find.text('\u{a9} 2014 The Flutter Authors'), findsOne);
56+
expect(
57+
find.text(
58+
"Flutter is Google's UI toolkit for building beautiful, "
59+
'natively compiled applications for mobile, web, and desktop '
60+
'from a single codebase. Learn more about Flutter at '
61+
'https://flutter.dev.',
62+
findRichText: true,
63+
),
64+
findsOne,
65+
);
66+
});
67+
}

0 commit comments

Comments
 (0)