test(tv): follow the native text input contract on Apple TV

71735354 made TvTextInputPresentation.automatic use native platform
input for single-line Apple TV fields, and 829d3745 migrated the search
and Add Jellyfin suites to it. These five cases still expected the
Flutter on-screen keyboard widget and failed looking for a panel that no
longer exists.

Drives the native path instead: each case asserts input is live
(readOnly false), raises the keyboard, then keeps its original
regression intent — the first Back deactivates input and is consumed so
it cannot also pop, and only the second Back pops or cancels.
This commit is contained in:
edde746
2026-07-26 23:05:53 +02:00
parent ef310459e5
commit 01d7d523aa
4 changed files with 32 additions and 11 deletions
+8 -3
View File
@@ -88,18 +88,23 @@ void main() {
final result = showTextInputDialog(hostContext, title: 'Name', labelText: 'Name', initialValue: 'TV value');
await tester.pumpAndSettle();
final field = tester.widget<TextField>(find.byType(TextField, skipOffstage: false));
expect(find.byKey(const Key('tv_virtual_keyboard_dialog')), findsOneWidget);
final fieldFinder = find.byType(TextField, skipOffstage: false);
final field = tester.widget<TextField>(fieldFinder);
expect(find.byKey(const Key('tv_virtual_keyboard_dialog')), findsNothing);
expect(field.readOnly, isFalse);
await tester.showKeyboard(fieldFinder);
await tester.sendKeyDownEvent(LogicalKeyboardKey.escape);
await tester.pump();
expect(find.byKey(const Key('tv_virtual_keyboard_dialog')), findsOneWidget);
expect(find.byType(AlertDialog), findsOneWidget);
expect(tester.widget<TextField>(fieldFinder).readOnly, isTrue);
await tester.sendKeyUpEvent(LogicalKeyboardKey.escape);
await tester.pumpAndSettle();
expect(find.byKey(const Key('tv_virtual_keyboard_dialog')), findsNothing);
expect(find.byType(AlertDialog), findsOneWidget);
expect(field.focusNode?.hasPrimaryFocus, isTrue);
expect(tester.widget<TextField>(fieldFinder).readOnly, isTrue);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pumpAndSettle();