Remove double MaterialApp wrap from api samples (#150055)
The widget under test already contains a MaterialApp, so there's no need to wrap it again with one in the test. In fact, the additional MaterialApp could hide problems in the widget under test.
This commit is contained in:
committed by
GitHub
parent
1f93809ad2
commit
962ae8a334
@@ -10,11 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
testWidgets('has four containers', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: example.CustomMultiChildLayoutApp(),
|
||||
),
|
||||
),
|
||||
const example.CustomMultiChildLayoutApp(),
|
||||
);
|
||||
final Finder containerFinder = find.byType(Container);
|
||||
expect(containerFinder, findsNWidgets(4));
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
testWidgets('MouseRegion detects mouse entries, exists, and location', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(home: example.MouseRegionApp()),
|
||||
const example.MouseRegionApp(),
|
||||
);
|
||||
|
||||
expect(find.text('0 Entries\n0 Exits'), findsOneWidget);
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
testWidgets('MouseRegion detects mouse hover', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(home: example.MouseRegionApp()),
|
||||
const example.MouseRegionApp(),
|
||||
);
|
||||
|
||||
Container container = tester.widget<Container>(find.byType(Container));
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
testWidgets('MouseRegion update mouse hover with a delay', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(home: example.MouseRegionApp()),
|
||||
const example.MouseRegionApp(),
|
||||
);
|
||||
|
||||
expect(find.text('Not hovering'), findsOneWidget);
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/widgets/basic/offstage.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Can off/on stage Flutter logo widget', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(home: example.OffstageApp()),
|
||||
const example.OffstageApp(),
|
||||
);
|
||||
|
||||
// The Flutter logo is off stage and not visible.
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
testWidgets('PhysicalShape is an ancestor of the text widget', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(home: example.PhysicalShapeApp()),
|
||||
const example.PhysicalShapeApp(),
|
||||
);
|
||||
|
||||
final PhysicalShape physicalShape = tester.widget<PhysicalShape>(
|
||||
|
||||
Reference in New Issue
Block a user