mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-30 13:19:44 +02:00
fix(lyrics): pulse instrumental countdown dots
This commit is contained in:
1 parent
5259c86365
commit
0e1881d837
2 files changed
+97
-21
No files matched your search
@@ -1235,7 +1235,7 @@ void main() {
|
||||
updatePosition: Duration(seconds: seconds),
|
||||
),
|
||||
);
|
||||
if (state == AudioProcessingState.ready) {
|
||||
if (state == AudioProcessingState.ready && !playing) {
|
||||
await tester.pumpAndSettle();
|
||||
} else {
|
||||
await tester.pump();
|
||||
@@ -1273,6 +1273,34 @@ void main() {
|
||||
}
|
||||
}
|
||||
|
||||
final firstDot = find.byKey(const ValueKey('lyric-gap-dot-0'));
|
||||
double dotWidth() =>
|
||||
(tester.getBottomRight(firstDot) - tester.getTopLeft(firstDot)).dx;
|
||||
final restingWidth = dotWidth();
|
||||
final restingCenter = tester.getCenter(firstDot);
|
||||
final rowSize = tester.getSize(find.byType(LyricGapIndicator));
|
||||
await positionAt(6, playing: true);
|
||||
await tester.pump(const Duration(milliseconds: 400));
|
||||
final filling = dotAlphas();
|
||||
final growingWidth = dotWidth();
|
||||
expect(growingWidth, greaterThan(restingWidth));
|
||||
await tester.pump(const Duration(milliseconds: 350));
|
||||
final peakWidth = dotWidth();
|
||||
expect(peakWidth, greaterThan(growingWidth));
|
||||
await tester.pump(const Duration(milliseconds: 750));
|
||||
expect(dotWidth(), lessThan(peakWidth));
|
||||
expect(tester.getCenter(firstDot), restingCenter);
|
||||
expect(tester.getSize(find.byType(LyricGapIndicator)), rowSize);
|
||||
expect(dotAlphas(), filling);
|
||||
|
||||
// Pause mid-pulse: both the size and countdown must hold their place.
|
||||
await tester.pump(const Duration(milliseconds: 900));
|
||||
await positionAt(6);
|
||||
final pausedWidth = dotWidth();
|
||||
await tester.pump(const Duration(seconds: 2));
|
||||
expect(dotWidth(), pausedWidth);
|
||||
expect(dotAlphas(), [1.0, 1.0, 0.25]);
|
||||
|
||||
await positionAt(6, playing: true, state: AudioProcessingState.buffering);
|
||||
expect(find.byType(LyricGapIndicator), findsNothing);
|
||||
await positionAt(6);
|
||||
|
||||
Reference in new issue
Block a user