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:
2026-11-11 03:48:41 +00:00
parent baac6eca9a
commit 9bdabb32d9
33 changed files with 1646 additions and 2326 deletions
+62 -79
View File
@@ -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';
@@ -6,89 +5,73 @@ import 'package:pipelines_app/shell/adaptive_shell.dart';
import 'package:pipelines_app/shell/destination.dart';
void main() {
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
testWidgets(
'$host Ctrl+Tab and Ctrl+Shift+Tab leave destinations unchanged',
(tester) async {
final app = AdaptiveShell(
cupertino: cupertino,
destinationBodies: {
for (final destination in shellTabDestinations)
destination: (_) => Focus(
autofocus: destination == AppDestination.pipelines,
child: Text(destination.name),
),
},
);
await tester.pumpWidget(
cupertino ? CupertinoApp(home: app) : MaterialApp(home: app),
);
Future<void> press({required bool shift}) async {
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
if (shift) {
await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
}
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
if (shift) {
await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);
}
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pump();
}
expect(find.text('pipelines'), findsOneWidget);
await press(shift: true);
expect(find.text('pipelines'), findsOneWidget);
await press(shift: false);
expect(find.text('pipelines'), findsOneWidget);
testWidgets('Ctrl+Tab and Ctrl+Shift+Tab leave destinations unchanged', (
tester,
) async {
final app = AdaptiveShell(
destinationBodies: {
for (final destination in shellTabDestinations)
destination: (_) => Focus(
autofocus: destination == AppDestination.pipelines,
child: Text(destination.name),
),
},
);
await tester.pumpWidget(MaterialApp(home: app));
testWidgets(
'$host plain Tab traverses and Ctrl+Tab does not change destinations',
(tester) async {
final first = FocusNode();
final second = FocusNode();
addTearDown(first.dispose);
addTearDown(second.dispose);
final app = AdaptiveShell(
cupertino: cupertino,
destinationBodies: {
AppDestination.pipelines: (_) => Column(
children: [
cupertino
? CupertinoTextField(focusNode: first)
: TextField(focusNode: first),
cupertino
? CupertinoTextField(focusNode: second)
: TextField(focusNode: second),
],
),
AppDestination.runs: (_) => const Text('runs'),
},
);
await tester.pumpWidget(
cupertino ? CupertinoApp(home: app) : MaterialApp(home: app),
);
first.requestFocus();
await tester.pump();
Future<void> press({required bool shift}) async {
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
if (shift) {
await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
}
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
if (shift) {
await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);
}
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pump();
}
// Plain Tab retains normal traversal semantics and does not select a tab.
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.pump();
expect(second.hasFocus, isTrue);
expect(find.text('pipelines'), findsOneWidget);
await press(shift: true);
expect(find.text('pipelines'), findsOneWidget);
await press(shift: false);
expect(find.text('pipelines'), findsOneWidget);
});
first.requestFocus();
await tester.pump();
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pump();
expect(find.text('runs'), findsNothing);
testWidgets('plain Tab traverses and Ctrl+Tab does not change destinations', (
tester,
) async {
final first = FocusNode();
final second = FocusNode();
addTearDown(first.dispose);
addTearDown(second.dispose);
final app = AdaptiveShell(
destinationBodies: {
AppDestination.pipelines: (_) => Column(
children: [
TextField(focusNode: first),
TextField(focusNode: second),
],
),
AppDestination.runs: (_) => const Text('runs'),
},
);
}
await tester.pumpWidget(MaterialApp(home: app));
first.requestFocus();
await tester.pump();
// Plain Tab retains normal traversal semantics and does not select a tab.
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.pump();
expect(second.hasFocus, isTrue);
first.requestFocus();
await tester.pump();
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pump();
expect(find.text('runs'), findsNothing);
});
}