fix(player): 调整 rail 倍速弹窗与进度时间

This commit is contained in:
Zhou Weidong committed 2026-10-19 17:44:06 +08:00
1 parent 87628e7d10
commit 4d7173d035
5 files changed
+88 -42

No files matched your search

+4
View File
@@ -61,6 +61,10 @@ void main() {
find.byKey(const Key('home-feed-episode')),
);
expect(episodeRect.left, lessThan(cardRect.center.dx));
final railCenter = tester.getCenter(find.byKey(const Key('rail-like')));
final railBottom = tester.getBottomLeft(find.byKey(const Key('rail-save')));
expect(railCenter.dy, greaterThan(844 * 0.4));
expect(railBottom.dy, lessThan(cardRect.top));
expect(find.byKey(const Key('home-feed-follow-series')), findsOneWidget);
expect(find.byKey(const Key('home-feed-episodes')), findsOneWidget);
for (final key in const [Key('home-feed-search'), Key('home-feed-more')]) {
@@ -56,11 +56,13 @@ void main() {
await tester.pump();
expect(started, 1);
expect(target, isNull);
expect(find.textContaining('/ 00:12'), findsOneWidget);
await gesture.up();
await tester.pumpAndSettle();
expect(target, isNotNull);
expect(target!, greaterThan(const Duration(seconds: 3)));
expect(target!, lessThan(const Duration(seconds: 12)));
expect(find.textContaining('/ 00:12'), findsNothing);
});
testWidgets('should_show_time_only_while_dragging_when_seek_bar_is_compact', (
+57 -9
View File
@@ -10,6 +10,7 @@ import 'package:fruitshorts/core/data/repositories/favorite_repository.dart';
import 'package:fruitshorts/core/data/repositories/playback_repository.dart';
import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart';
import 'package:fruitshorts/pages/player/widgets/player_center_toggle.dart';
import 'package:fruitshorts/pages/player/widgets/seek_progress_bar.dart';
import '../support/fake_catalog.dart';
import '../support/fake_category.dart';
@@ -260,8 +261,10 @@ void main() {
await tester.tap(find.byKey(const Key('detail-cta')));
await tester.pumpAndSettle();
expect(find.text('1.0x'), findsOneWidget);
await tester.tap(find.byKey(const Key('player-speed')));
await tester.tap(find.byKey(const Key('player-more')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('player-more-speed')), findsOneWidget);
await tester.tap(find.byKey(const Key('player-more-speed')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('player-speed-sheet')), findsOneWidget);
@@ -273,7 +276,15 @@ void main() {
await tester.pumpAndSettle();
expect(find.byKey(const Key('player-speed-sheet')), findsNothing);
expect(find.text('1.5x'), findsOneWidget);
await tester.tap(find.byKey(const Key('player-more')));
await tester.pumpAndSettle();
expect(
find.descendant(
of: find.byKey(const Key('player-more-speed')),
matching: find.text('1.5x'),
),
findsOneWidget,
);
});
testWidgets('should_hide_speed_entry_in_clear_screen_and_keep_speed', (
@@ -289,24 +300,61 @@ void main() {
await tester.tap(find.byKey(const Key('detail-cta')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('player-speed')));
await tester.tap(find.byKey(const Key('player-more')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('player-more-speed')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('player-speed-1.5')));
await tester.pumpAndSettle();
expect(find.text('1.5x'), findsOneWidget);
await tester.tap(find.byKey(const Key('player-clear-screen')));
await tester.pump();
expect(find.byKey(const Key('player-speed')), findsNothing);
expect(find.byKey(const Key('player-more')), findsNothing);
await tester.tap(find.byKey(const Key('player-exit-clear-screen')));
await tester.pump();
expect(find.byKey(const Key('player-speed')), findsOneWidget);
expect(find.text('1.5x'), findsOneWidget);
await tester.tap(find.byKey(const Key('player-more')));
await tester.pumpAndSettle();
expect(
find.descendant(
of: find.byKey(const Key('player-more-speed')),
matching: find.text('1.5x'),
),
findsOneWidget,
);
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
await tester.drag(find.byType(PageView), const Offset(0, -550));
await tester.pumpAndSettle();
expect(find.text('1.5x'), findsOneWidget);
await tester.tap(find.byKey(const Key('player-more')));
await tester.pumpAndSettle();
expect(
find.descendant(
of: find.byKey(const Key('player-more-speed')),
matching: find.text('1.5x'),
),
findsOneWidget,
);
});
testWidgets('should_enable_drag_time_preview_on_player_progress', (
tester,
) async {
await _pumpApp(tester);
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('drawer-open-series')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('detail-cta')));
await tester.pumpAndSettle();
final bar = tester.widget<SeekProgressBar>(
find.byKey(const Key('player-progress')),
);
expect(bar.showTimes, isTrue);
});
testWidgets('should_clear_and_restore_home_feed_chrome', (tester) async {