fix(flutter): feed 清屏保留顶栏并寻址恢复播放

This commit is contained in:
Zhou Weidong committed 2026-10-20 14:33:35 +08:00
1 parent 9b99d96a07
commit c87798fb16
5 files changed
+83 -28

No files matched your search

+39 -4
View File
@@ -114,13 +114,48 @@ void main() {
final railBottom = tester
.getRect(find.byKey(const Key('rail-share')))
.bottom;
final infoTop = tester
.getRect(find.byKey(const Key('home-feed-series-meta')))
final seriesTop = tester
.getRect(find.byKey(const Key('home-feed-full-series')))
.top;
final titleRight = tester
.getRect(find.byKey(const Key('home-feed-title')))
.right;
final railLeft = tester.getRect(find.byKey(const Key('rail-save'))).left;
expect(railTop, greaterThan(844 * 0.45));
expect(railBottom, lessThanOrEqualTo(infoTop));
expect(infoTop - railBottom, lessThanOrEqualTo(20));
expect(seriesTop - railBottom, closeTo(12, 1));
expect(titleRight, lessThanOrEqualTo(railLeft + 2));
});
testWidgets('should_keep_feed_header_and_progress_after_clear', (
tester,
) async {
await _pumpApp(tester);
final gesture = await tester.startGesture(const Offset(195, 300));
await tester.pump(const Duration(milliseconds: 700));
await tester.pump();
await gesture.up();
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('player-more-clear')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('home-feed-refresh')), findsOneWidget);
expect(find.byKey(const Key('home-feed-tab-recommend')), findsOneWidget);
expect(find.byKey(const Key('home-feed-search')), findsOneWidget);
expect(find.byKey(const Key('home-feed-full-series')), findsOneWidget);
expect(find.byKey(const Key('home-feed-progress')), findsOneWidget);
expect(find.byKey(const Key('rail-save')), findsNothing);
expect(find.byKey(const Key('home-feed-title')), findsNothing);
final exit = tester.getRect(
find.byKey(const Key('home-feed-exit-clear-screen')),
);
expect(exit.right, greaterThan(340));
expect(exit.center.dy, greaterThan(600));
await tester.tap(find.byKey(const Key('home-feed-exit-clear-screen')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('rail-save')), findsOneWidget);
expect(find.byKey(const Key('home-feed-title')), findsOneWidget);
});
testWidgets('should_boost_feed_on_side_long_press', (tester) async {
+21
View File
@@ -215,6 +215,27 @@ void main() {
logic.dispose();
await _drain(logic);
});
test('should_resume_playback_after_seek_when_paused', () async {
final logic = _logic(FakeWatchHistory());
logic.attach(
PlayerPage(drama: _drama('signal'), initialIndex: 0),
isMounted: () => true,
);
logic.start(
factory: _RecordingFactory().create,
coordinator: PlaybackCoordinator(),
);
await _drain(logic);
logic.session.setUserWantsPlay(false);
expect(logic.session.userWantsPlay, isFalse);
logic.resumeAfterSeek();
expect(logic.session.userWantsPlay, isTrue);
logic.dispose();
await _drain(logic);
});
});
group('history writes', () {