mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-02 16:20:57 +02:00
fix(library): sync track playback controls
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import 'package:audio_service/audio_service.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:spotiflac_android/providers/music_player_provider.dart';
|
||||
|
||||
void main() {
|
||||
test('Library playback state follows only the current media item', () async {
|
||||
final container = ProviderContainer(
|
||||
overrides: [
|
||||
currentMediaItemProvider.overrideWith(
|
||||
(ref) =>
|
||||
Stream.value(const MediaItem(id: 'track-1', title: 'Track 1')),
|
||||
),
|
||||
playbackPlayingProvider.overrideWith((ref) => true),
|
||||
playbackLoadingProvider.overrideWith((ref) => false),
|
||||
],
|
||||
);
|
||||
addTearDown(container.dispose);
|
||||
final currentMediaSubscription = container.listen(
|
||||
currentMediaItemProvider,
|
||||
(_, _) {},
|
||||
);
|
||||
addTearDown(currentMediaSubscription.close);
|
||||
|
||||
await container.read(currentMediaItemProvider.future);
|
||||
|
||||
expect(container.read(mediaItemPlaybackUiProvider('track-1')), (
|
||||
isCurrent: true,
|
||||
isPlaying: true,
|
||||
isLoading: false,
|
||||
));
|
||||
expect(container.read(mediaItemPlaybackUiProvider('track-2')), (
|
||||
isCurrent: false,
|
||||
isPlaying: false,
|
||||
isLoading: false,
|
||||
));
|
||||
});
|
||||
}
|
||||
@@ -407,12 +407,13 @@ void main() {
|
||||
expect(gridSource, contains('CompletionBridgePlayableStatus.checking'));
|
||||
expect(gridSource, contains('semanticsLabel:'));
|
||||
expect(gridSource, contains('queueCheckingDownloadedFile'));
|
||||
expect(gridSource, contains('TrackGridPlayButton('));
|
||||
expect(gridSource, contains('_LibraryPlaybackButton('));
|
||||
expect(gridSource, contains('grid: true'));
|
||||
expect(listSource, contains('resolveCompletionBridgePlayablePath('));
|
||||
expect(listSource, contains('_completionBridgePlayableProbe.listenable('));
|
||||
expect(listSource, contains('CompletionBridgePlayableStatus.checking'));
|
||||
expect(listSource, contains('semanticsLabel:'));
|
||||
expect(listSource, contains('queueCheckingDownloadedFile'));
|
||||
expect(listSource, contains('Icons.play_arrow'));
|
||||
expect(listSource, contains('_LibraryPlaybackButton('));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user