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:
Michael Goderbauer
2024-06-11 22:22:23 -07:00
committed by GitHub
parent 1f93809ad2
commit 962ae8a334
27 changed files with 30 additions and 136 deletions

View File

@@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_api_samples/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0.dart'
as example;
import 'package:flutter_test/flutter_test.dart';
@@ -19,9 +18,7 @@ void main() {
testWidgets('Reorder list item', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: example.ReorderableApp(),
),
const example.ReorderableApp(),
);
expect(tester.getCenter(find.text('Item 3')).dy, 280.0);

View File

@@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_api_samples/material/reorderable_list/reorderable_list_view.reorderable_list_view_builder.0.dart'
as example;
import 'package:flutter_test/flutter_test.dart';
@@ -19,9 +18,7 @@ void main() {
testWidgets('Reorder list item', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: example.ReorderableApp(),
),
const example.ReorderableApp(),
);
expect(tester.getCenter(find.text('Item 3')).dy, 252.0);