fix(player): 仅在暂停时显示播放按钮
This commit is contained in:
1 parent
60ec19f08d
commit
0eabb0a763
2 files changed
+53
-10
No files matched your search
@@ -69,7 +69,7 @@ void main() {
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('should_hide_pause_toggle_when_playback_is_paused', (
|
||||
testWidgets('should_show_play_toggle_only_when_playback_is_paused', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpApp(tester);
|
||||
@@ -82,16 +82,18 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key('detail-cta')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-play-toggle')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('player-play-toggle')), findsNothing);
|
||||
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-controls-bottom')), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-video-tap')));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byKey(const Key('player-play-toggle')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-controls-bottom')), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-play-toggle')));
|
||||
await tester.pump();
|
||||
expect(find.byKey(const Key('player-play-toggle')), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('should_keep_controls_visible_until_clear_screen_is_tapped', (
|
||||
@@ -109,6 +111,10 @@ void main() {
|
||||
|
||||
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-controls-bottom')), findsOneWidget);
|
||||
expect(find.byType(PlayerCenterToggle), findsNothing);
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-video-tap')));
|
||||
await tester.pump();
|
||||
expect(find.byType(PlayerCenterToggle), findsOneWidget);
|
||||
|
||||
await tester.pump(const Duration(seconds: 5));
|
||||
@@ -176,6 +182,21 @@ void main() {
|
||||
expect(find.byKey(const Key('home-feed-info-card')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-scrim')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should_show_home_play_toggle_only_when_paused', (tester) async {
|
||||
await _pumpApp(tester);
|
||||
await tester.tap(find.byKey(const Key('tab-home')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('home-feed-center-play')), findsNothing);
|
||||
await tester.tap(find.byKey(const Key('home-feed-video-toggle')));
|
||||
await tester.pump();
|
||||
expect(find.byKey(const Key('home-feed-center-play')), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(const Key('home-feed-center-play')));
|
||||
await tester.pump();
|
||||
expect(find.byKey(const Key('home-feed-center-play')), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
void _expectFullscreenOverlay(WidgetTester tester) {
|
||||
@@ -185,7 +206,7 @@ void _expectFullscreenOverlay(WidgetTester tester) {
|
||||
for (final key in const [Key('player-back'), Key('player-more')]) {
|
||||
expect(tester.getSize(find.byKey(key)), const Size(36, 36));
|
||||
}
|
||||
expect(find.byKey(const Key('player-play-toggle')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-play-toggle')), findsNothing);
|
||||
expect(find.byKey(const Key('player-episodes')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-comments')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-next')), findsOneWidget);
|
||||
|
||||
Reference in new issue
Block a user