fix(player): 完善进度预览清屏与下拉刷新
This commit is contained in:
1 parent
9b1afbdb36
commit
f8500bbaca
15 files changed
+949
-251
No files matched your search
@@ -570,14 +570,11 @@ void main() {
|
||||
32,
|
||||
);
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-synopsis-toggle')));
|
||||
await tester.pumpAndSettle();
|
||||
final expandedBottom = tester.getRect(
|
||||
final bottomPanel = tester.getRect(
|
||||
find.byKey(const Key('player-controls-bottom')),
|
||||
);
|
||||
// K29.9 展开态展示简介全文,高度会增长,但仍需留在画面下半区。
|
||||
expect(expandedBottom.height, lessThanOrEqualTo(330));
|
||||
expect(expandedBottom.top, greaterThanOrEqualTo(screenHeight * 0.5));
|
||||
expect(bottomPanel.height, lessThanOrEqualTo(330));
|
||||
expect(bottomPanel.top, greaterThanOrEqualTo(screenHeight * 0.5));
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
@@ -753,8 +750,33 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('should_toggle_synopsis_with_inline_text_button', (tester) async {
|
||||
await _pumpApp(tester);
|
||||
await _openSeriesPlayer(tester);
|
||||
final longCopy = Drama(
|
||||
id: 'long-copy-demo',
|
||||
title: 'Long Title',
|
||||
synopsis:
|
||||
'A very long synopsis that keeps describing the story far beyond '
|
||||
'the two lines available under the title in the fullscreen player.',
|
||||
posterUrl: '/files/long-copy-demo.png',
|
||||
genre: 'Drama',
|
||||
detailLoaded: true,
|
||||
episodes: const [
|
||||
Episode(
|
||||
id: 'long-copy-demo-1',
|
||||
number: 1,
|
||||
title: 'Episode 1',
|
||||
isFree: true,
|
||||
videoUrl: 'https://example.test/long-demo-1.mp4',
|
||||
),
|
||||
],
|
||||
);
|
||||
await _pumpApp(
|
||||
tester,
|
||||
catalog: FakeCatalogRepository(dramas: [longCopy]),
|
||||
);
|
||||
await _openSeriesPlayer(
|
||||
tester,
|
||||
cardKey: const Key('home-feed-card-long-copy-demo'),
|
||||
);
|
||||
|
||||
final toggle = find.byKey(const Key('player-synopsis-toggle'));
|
||||
final synopsis = find.byKey(const Key('player-synopsis'));
|
||||
@@ -762,10 +784,26 @@ void main() {
|
||||
find.descendant(of: toggle, matching: find.text('More')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.widget<Text>(synopsis).maxLines, 1);
|
||||
expect(
|
||||
tester.getRect(toggle).left - tester.getRect(synopsis).right,
|
||||
lessThanOrEqualTo(4),
|
||||
tester
|
||||
.widget<Text>(
|
||||
find.descendant(of: toggle, matching: find.text('More')),
|
||||
)
|
||||
.style
|
||||
?.color,
|
||||
AppColors.textPrimary,
|
||||
);
|
||||
expect(tester.widget<Text>(synopsis).maxLines, 2);
|
||||
expect(
|
||||
tester.widget<Padding>(find.byKey(const Key('player-synopsis-gap'))).padding,
|
||||
const EdgeInsets.only(left: 6),
|
||||
);
|
||||
final synopsisRect = tester.getRect(synopsis);
|
||||
final toggleRect = tester.getRect(toggle);
|
||||
expect(toggleRect.left, greaterThan(synopsisRect.left));
|
||||
expect(
|
||||
toggleRect.center.dy,
|
||||
greaterThan(synopsisRect.top + synopsisRect.height * 0.45),
|
||||
);
|
||||
|
||||
await tester.tap(toggle);
|
||||
@@ -774,7 +812,12 @@ void main() {
|
||||
find.descendant(of: toggle, matching: find.text('Less')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.widget<Text>(synopsis).maxLines, isNull);
|
||||
expect(tester.widget<Text>(find.byKey(const Key('player-synopsis'))).maxLines, isNull);
|
||||
final lessRect = tester.getRect(toggle);
|
||||
final textRect = tester.getRect(find.byKey(const Key('player-synopsis')));
|
||||
final block = tester.getRect(find.byKey(const Key('player-episode-synopsis')));
|
||||
expect(lessRect.top, greaterThanOrEqualTo(textRect.bottom - 1));
|
||||
expect(block.right - lessRect.right, lessThanOrEqualTo(2));
|
||||
|
||||
await tester.tap(toggle);
|
||||
await tester.pumpAndSettle();
|
||||
@@ -782,7 +825,7 @@ void main() {
|
||||
find.descendant(of: toggle, matching: find.text('More')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.widget<Text>(synopsis).maxLines, 1);
|
||||
expect(tester.widget<Text>(synopsis).maxLines, 2);
|
||||
});
|
||||
|
||||
testWidgets('should_share_one_muted_style_across_label_and_synopsis', (
|
||||
@@ -860,7 +903,11 @@ void main() {
|
||||
final synopsis = tester.widget<Text>(
|
||||
find.byKey(const Key('player-synopsis')),
|
||||
);
|
||||
expect(synopsis.maxLines, 1);
|
||||
expect(
|
||||
tester.getRect(find.byKey(const Key('player-synopsis'))).right,
|
||||
lessThanOrEqualTo(320 - 14 - 54),
|
||||
);
|
||||
expect(synopsis.maxLines, 2);
|
||||
expect(synopsis.overflow, TextOverflow.ellipsis);
|
||||
expect(
|
||||
tester.getRect(find.byKey(const Key('player-episodes-pill'))).right,
|
||||
|
||||
Reference in new issue
Block a user