Skip to content

Commit 4af4cb8

Browse files
Add test for scaffold.1.dart (#147966)
Contributes to flutter/flutter#130459 It adds test for `examples/api/lib/material/scaffold/scaffold.1.dart`
1 parent c386acc commit 4af4cb8

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

dev/bots/check_code_samples.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// found in the LICENSE file.
44

55
// To run this, from the root of the Flutter repository:
6-
// bin/cache/dart-sdk/bin/dart --enable-asserts dev/bots/check_code_sample_links.dart
6+
// bin/cache/dart-sdk/bin/dart --enable-asserts dev/bots/check_code_samples.dart
77

88
import 'dart:io';
99

@@ -352,7 +352,6 @@ final Set<String> _knownMissingTests = <String>{
352352
'examples/api/test/material/selection_area/selection_area.0_test.dart',
353353
'examples/api/test/material/scaffold/scaffold.end_drawer.0_test.dart',
354354
'examples/api/test/material/scaffold/scaffold.drawer.0_test.dart',
355-
'examples/api/test/material/scaffold/scaffold.1_test.dart',
356355
'examples/api/test/material/scaffold/scaffold.of.0_test.dart',
357356
'examples/api/test/material/scaffold/scaffold_messenger.of.0_test.dart',
358357
'examples/api/test/material/scaffold/scaffold_messenger.0_test.dart',
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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/scaffold/scaffold.1.dart' as example;
7+
import 'package:flutter_test/flutter_test.dart';
8+
9+
void main() {
10+
testWidgets('The count should be incremented when the floating action button is tapped', (WidgetTester tester) async {
11+
await tester.pumpWidget(
12+
const example.ScaffoldExampleApp(),
13+
);
14+
15+
expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne);
16+
expect(find.widgetWithIcon(FloatingActionButton, Icons.add), findsOne);
17+
expect(find.text('You have pressed the button 0 times.'), findsOne);
18+
19+
for (int i = 1; i <= 5; i++) {
20+
await tester.tap(find.byType(FloatingActionButton));
21+
await tester.pump();
22+
expect(find.text('You have pressed the button $i times.'), findsOne);
23+
}
24+
});
25+
}

0 commit comments

Comments
 (0)