fix(player): 修复竖滑上一集不自动播放
This commit is contained in:
1 parent
df36890b48
commit
516593499c
10 files changed
+264
-80
No files matched your search
@@ -50,7 +50,11 @@ void main() {
|
||||
.homeMode,
|
||||
isTrue,
|
||||
);
|
||||
expect(find.byType(PageView), findsOneWidget);
|
||||
final pageViews = tester.widgetList<PageView>(find.byType(PageView));
|
||||
expect(
|
||||
pageViews.where((pageView) => pageView.scrollDirection == Axis.vertical),
|
||||
hasLength(1),
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
|
||||
@@ -16,10 +16,17 @@ sprite_001.jpg#xywh=0,0,160,90
|
||||
|
||||
void main() {
|
||||
test('should_return_no_opening_frame_when_thumbnails_url_is_empty', () {
|
||||
expect(playerOpeningFrame(null), isNull);
|
||||
expect(playerOpeningFrame(null, posterUrl: ' '), isNull);
|
||||
expect(playerOpeningFrame(' '), isNull);
|
||||
});
|
||||
|
||||
test('should_keep_opening_frame_when_only_poster_is_available', () {
|
||||
expect(
|
||||
playerOpeningFrame(null, posterUrl: 'https://cdn.test/poster.jpg'),
|
||||
isA<PlayerOpeningFrame>(),
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('should_load_and_reuse_first_sprite_frame', (tester) async {
|
||||
final loader = _FakeSpriteLoader();
|
||||
final cache = OpeningFrameCache();
|
||||
@@ -58,6 +65,24 @@ void main() {
|
||||
|
||||
expect(find.byKey(const Key('player-opening-sprite')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should_show_poster_while_sprite_is_loading', (tester) async {
|
||||
final cache = OpeningFrameCache();
|
||||
addTearDown(cache.clear);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: PlayerOpeningFrame(
|
||||
thumbnailsUrl: 'https://cdn.test/thumbnails.vtt',
|
||||
posterUrl: 'https://cdn.test/poster.jpg',
|
||||
loader: _FakeSpriteLoader(),
|
||||
cache: cache,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byKey(const Key('player-opening-poster')), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
class _FakeSpriteLoader implements SpriteThumbnailAssetLoader {
|
||||
|
||||
Reference in new issue
Block a user