test: remove redundant coverage and shorten timers
This commit is contained in:
@@ -4,9 +4,6 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:plezy/focus/focusable_wrapper.dart';
|
||||
import 'package:plezy/focus/input_mode_tracker.dart';
|
||||
|
||||
/// The wrapper's focus chrome (scale Transform + border AnimatedContainer)
|
||||
/// must only exist in keyboard/d-pad mode: on touch it is pure dead weight
|
||||
/// multiplied by every card in a grid (see library scroll jank).
|
||||
void main() {
|
||||
Finder chromeIn(Type type) => find.descendant(of: find.byType(FocusableWrapper), matching: find.byType(type));
|
||||
|
||||
@@ -19,15 +16,12 @@ void main() {
|
||||
|
||||
expect(chromeIn(Transform), findsNothing);
|
||||
expect(chromeIn(AnimatedContainer), findsNothing);
|
||||
// The Focus node stays mounted so d-pad traversal finds the card the
|
||||
// moment keyboard mode activates.
|
||||
expect(chromeIn(Focus), findsWidgets);
|
||||
});
|
||||
|
||||
testWidgets('keyboard mode builds the scale/border chrome', (tester) async {
|
||||
await tester.pumpWidget(InputModeTracker(child: MaterialApp(home: buildWrapper())));
|
||||
|
||||
// A navigation key press flips the tracker into keyboard mode.
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
|
||||
await tester.pump();
|
||||
|
||||
|
||||
@@ -252,68 +252,5 @@ void main() {
|
||||
|
||||
expect(activations, 1);
|
||||
});
|
||||
|
||||
testWidgets('moves through detail actions when trailer is inserted before shuffle', (tester) async {
|
||||
final play = FocusNode(debugLabel: 'detail_play');
|
||||
final outside = FocusNode(debugLabel: 'outside');
|
||||
addTearDown(play.dispose);
|
||||
addTearDown(outside.dispose);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Row(
|
||||
children: [
|
||||
FocusableActionBar(
|
||||
actions: [
|
||||
FocusableAction(
|
||||
debugLabel: 'unused_play_label',
|
||||
focusNode: play,
|
||||
icon: Icons.play_arrow,
|
||||
onPressed: () {},
|
||||
),
|
||||
FocusableAction(debugLabel: 'detail_trailer', icon: Icons.theaters, onPressed: () {}),
|
||||
FocusableAction(debugLabel: 'detail_shuffle', icon: Icons.shuffle, onPressed: () {}),
|
||||
FocusableAction(debugLabel: 'detail_download', icon: Icons.download, onPressed: () {}),
|
||||
FocusableAction(debugLabel: 'detail_watched', icon: Icons.check, onPressed: () {}),
|
||||
FocusableAction(debugLabel: 'detail_more', icon: Icons.more_vert, onPressed: () {}),
|
||||
],
|
||||
),
|
||||
Focus(focusNode: outside, child: const SizedBox(width: 50, height: 50)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
play.requestFocus();
|
||||
await tester.pump();
|
||||
expect(FocusManager.instance.primaryFocus?.debugLabel, 'detail_play');
|
||||
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);
|
||||
await tester.pump();
|
||||
expect(FocusManager.instance.primaryFocus?.debugLabel, 'detail_trailer');
|
||||
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);
|
||||
await tester.pump();
|
||||
expect(FocusManager.instance.primaryFocus?.debugLabel, 'detail_shuffle');
|
||||
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);
|
||||
await tester.pump();
|
||||
expect(FocusManager.instance.primaryFocus?.debugLabel, 'detail_download');
|
||||
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);
|
||||
await tester.pump();
|
||||
expect(FocusManager.instance.primaryFocus?.debugLabel, 'detail_watched');
|
||||
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);
|
||||
await tester.pump();
|
||||
expect(FocusManager.instance.primaryFocus?.debugLabel, 'detail_more');
|
||||
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);
|
||||
await tester.pump();
|
||||
expect(FocusManager.instance.primaryFocus?.debugLabel, 'detail_more');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user