File tree Expand file tree Collapse file tree 4 files changed +55
-2
lines changed
examples/api/test/material/scaffold Expand file tree Collapse file tree 4 files changed +55
-2
lines changed Original file line number Diff line number Diff line change @@ -351,9 +351,7 @@ final Set<String> _knownMissingTests = <String>{
351
351
'examples/api/test/material/scaffold/scaffold.drawer.0_test.dart' ,
352
352
'examples/api/test/material/scaffold/scaffold_messenger.of.0_test.dart' ,
353
353
'examples/api/test/material/scaffold/scaffold_messenger.0_test.dart' ,
354
- 'examples/api/test/material/scaffold/scaffold.0_test.dart' ,
355
354
'examples/api/test/material/scaffold/scaffold_state.show_bottom_sheet.0_test.dart' ,
356
- 'examples/api/test/material/scaffold/scaffold.2_test.dart' ,
357
355
'examples/api/test/material/scaffold/scaffold_messenger_state.show_material_banner.0_test.dart' ,
358
356
'examples/api/test/material/scaffold/scaffold_messenger.of.1_test.dart' ,
359
357
'examples/api/test/material/scaffold/scaffold_messenger_state.show_snack_bar.0_test.dart' ,
Original file line number Diff line number Diff line change
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.0.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
+ }
Original file line number Diff line number Diff line change @@ -21,5 +21,8 @@ void main() {
21
21
await tester.pump ();
22
22
expect (find.text ('You have pressed the button $i times.' ), findsOne);
23
23
}
24
+
25
+ final Scaffold scaffold = tester.firstWidget <Scaffold >(find.byType (Scaffold ));
26
+ expect (scaffold.backgroundColor, Colors .blueGrey.shade200);
24
27
});
25
28
}
Original file line number Diff line number Diff line change
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.2.dart' as example;
7
+ import 'package:flutter_test/flutter_test.dart' ;
8
+
9
+ void main () {
10
+ testWidgets ('The count should be incremented when the centered 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
+ expect (find.byType (BottomAppBar ), findsOne);
19
+ expect (tester.getCenter (find.byType (FloatingActionButton )).dx, 400 );
20
+
21
+ for (int i = 1 ; i <= 5 ; i++ ) {
22
+ await tester.tap (find.byType (FloatingActionButton ));
23
+ await tester.pump ();
24
+ expect (find.text ('You have pressed the button $i times.' ), findsOne);
25
+ }
26
+ });
27
+ }
You can’t perform that action at this time.
0 commit comments