Remove Cupertino shell branches
Keep the Material-only shell path while preserving public cupertino parameters for callers. Narrow matching tests to Material hosts and behavior because the app always runs under MaterialApp.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
@@ -35,16 +34,11 @@ Future<void> _search(WidgetTester tester) async {
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
Future<void> _pump(
|
||||
WidgetTester tester,
|
||||
AppDestination from, {
|
||||
bool cupertino = false,
|
||||
}) async {
|
||||
Future<void> _pump(WidgetTester tester, AppDestination from) async {
|
||||
tester.view.physicalSize = const Size(1200, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final shell = AdaptiveShell(
|
||||
cupertino: cupertino,
|
||||
destination: from,
|
||||
destinationBodies: {
|
||||
for (final destination in AppDestination.values)
|
||||
@@ -53,9 +47,7 @@ Future<void> _pump(
|
||||
SearchScreen(gateway: _Gateway(), onOpen: (_) {}, embedded: true),
|
||||
},
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino ? CupertinoApp(home: shell) : MaterialApp(home: shell),
|
||||
);
|
||||
await tester.pumpWidget(MaterialApp(home: shell));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
@@ -87,24 +79,6 @@ void main() {
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets(
|
||||
'Cupertino Escape preserves native Search focus handoff and previous tab',
|
||||
(tester) async {
|
||||
await _pump(tester, AppDestination.runs, cupertino: true);
|
||||
await _search(tester);
|
||||
await tester.enterText(find.byKey(searchFieldKey), 'query');
|
||||
await tester.pumpAndSettle();
|
||||
_field(tester).focusNode.unfocus();
|
||||
await tester.pumpAndSettle();
|
||||
await _press(tester, LogicalKeyboardKey.escape);
|
||||
expect(_field(tester).focusNode.hasPrimaryFocus, isTrue);
|
||||
expect(_field(tester).controller.text, 'query');
|
||||
await _press(tester, LogicalKeyboardKey.escape);
|
||||
expect(find.text('Body runs'), findsOneWidget);
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('Escape dismisses a Search dialog before changing tabs', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user