fix(player): 优化封面过渡与换集起播
This commit is contained in:
1 parent
516593499c
commit
04f034817c
6 files changed
+65
-19
No files matched your search
@@ -83,6 +83,34 @@ void main() {
|
||||
|
||||
expect(find.byKey(const Key('player-opening-poster')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should_reuse_decoded_sprite_when_parent_rebuilds', (
|
||||
tester,
|
||||
) async {
|
||||
final loader = _FakeSpriteLoader();
|
||||
final cache = OpeningFrameCache();
|
||||
addTearDown(cache.clear);
|
||||
Widget build() => MaterialApp(
|
||||
home: PlayerOpeningFrame(
|
||||
thumbnailsUrl: 'https://cdn.test/thumbnails.vtt',
|
||||
posterUrl: 'https://cdn.test/poster.jpg',
|
||||
loader: loader,
|
||||
cache: cache,
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpWidget(build());
|
||||
await tester.pumpAndSettle();
|
||||
expect(loader.vttCalls, 1);
|
||||
expect(loader.spriteCalls, hasLength(1));
|
||||
|
||||
await tester.pumpWidget(build());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(loader.vttCalls, 1);
|
||||
expect(loader.spriteCalls, hasLength(1));
|
||||
expect(find.byKey(const Key('player-opening-sprite')), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
class _FakeSpriteLoader implements SpriteThumbnailAssetLoader {
|
||||
|
||||
Reference in new issue
Block a user