fix(player): 优化封面过渡与换集起播
This commit is contained in:
1 parent
516593499c
commit
04f034817c
6 files changed
+65
-19
No files matched your search
@@ -30,6 +30,7 @@ void main() {
|
||||
|
||||
expect(find.byKey(const Key('player-opening-frame')), findsOneWidget);
|
||||
expect(find.byKey(const Key('fake-opening')), findsOneWidget);
|
||||
expect(_openingOpacity(tester), 1);
|
||||
expect(_opacity(tester), 0);
|
||||
});
|
||||
|
||||
@@ -48,7 +49,7 @@ void main() {
|
||||
expect(find.byKey(const Key('player-opening-frame')), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('should_fade_video_in_within_200ms_after_first_frame', (
|
||||
testWidgets('should_cross_fade_video_over_opening_frame', (
|
||||
tester,
|
||||
) async {
|
||||
final controller = await _pumpSurface(
|
||||
@@ -67,7 +68,7 @@ void main() {
|
||||
await tester.pump();
|
||||
|
||||
expect(_opacity(tester), 1);
|
||||
expect(find.byKey(const Key('player-opening-frame')), findsNothing);
|
||||
expect(find.byKey(const Key('player-opening-frame')), findsOneWidget);
|
||||
expect(
|
||||
tester
|
||||
.widget<AnimatedOpacity>(
|
||||
@@ -80,8 +81,12 @@ void main() {
|
||||
final halfway = _fadeValue(tester);
|
||||
expect(halfway, greaterThan(0));
|
||||
expect(halfway, lessThan(1));
|
||||
final openingHalfway = _openingFadeValue(tester);
|
||||
expect(openingHalfway, greaterThan(0));
|
||||
expect(openingHalfway, lessThan(1));
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
expect(_fadeValue(tester), 1);
|
||||
expect(_openingFadeValue(tester), 0);
|
||||
});
|
||||
|
||||
testWidgets('should_show_video_error_above_retained_fallback', (
|
||||
@@ -182,6 +187,14 @@ double _opacity(WidgetTester tester) {
|
||||
.opacity;
|
||||
}
|
||||
|
||||
double _openingOpacity(WidgetTester tester) {
|
||||
return tester
|
||||
.widget<AnimatedOpacity>(
|
||||
find.byKey(const Key('player-opening-frame')),
|
||||
)
|
||||
.opacity;
|
||||
}
|
||||
|
||||
double _fadeValue(WidgetTester tester) {
|
||||
final fade = find.descendant(
|
||||
of: find.byKey(const Key('player-video-opacity')),
|
||||
@@ -189,3 +202,11 @@ double _fadeValue(WidgetTester tester) {
|
||||
);
|
||||
return tester.widget<FadeTransition>(fade).opacity.value;
|
||||
}
|
||||
|
||||
double _openingFadeValue(WidgetTester tester) {
|
||||
final fade = find.descendant(
|
||||
of: find.byKey(const Key('player-opening-frame')),
|
||||
matching: find.byType(FadeTransition),
|
||||
);
|
||||
return tester.widget<FadeTransition>(fade).opacity.value;
|
||||
}
|
||||
Reference in new issue
Block a user