| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import 'package:cardash_launcher/core/app_identity.dart';
- import 'package:cardash_launcher/data/models/media_playback.dart';
- import 'package:cardash_launcher/features/home/home_media_state.dart';
- import 'package:flutter_test/flutter_test.dart';
- const _carDashPlaying = MediaPlayback(
- hasAccess: true,
- hasSession: true,
- playing: true,
- packageName: appPackageName,
- );
- const _chromePlaying = MediaPlayback(
- hasAccess: true,
- hasSession: true,
- playing: true,
- packageName: 'com.android.chrome',
- );
- void main() {
- group('shouldShowMusicEqualizer', () {
- test(
- 'stays quiet while the stale session is CarDash after a Jellyfin pause',
- () {
- expect(
- shouldShowMusicEqualizer(
- systemMusicPlaying: true,
- jellyfinPlaying: false,
- systemMedia: _carDashPlaying,
- ),
- isFalse,
- );
- },
- );
- test('animates for another app', () {
- expect(
- shouldShowMusicEqualizer(
- systemMusicPlaying: true,
- jellyfinPlaying: false,
- systemMedia: _chromePlaying,
- ),
- isTrue,
- );
- });
- test('stays quiet while Jellyfin is playing', () {
- expect(
- shouldShowMusicEqualizer(
- systemMusicPlaying: true,
- jellyfinPlaying: true,
- systemMedia: _carDashPlaying,
- ),
- isFalse,
- );
- });
- test('falls back to system music with no media session', () {
- expect(
- shouldShowMusicEqualizer(
- systemMusicPlaying: true,
- jellyfinPlaying: false,
- systemMedia: const MediaPlayback(),
- ),
- isTrue,
- );
- });
- });
- test('detects CarDash versus external media sessions', () {
- expect(isExternalSystemMedia(_carDashPlaying), isFalse);
- expect(isExternalSystemMedia(_chromePlaying), isTrue);
- expect(isExternalSystemMedia(const MediaPlayback()), isTrue);
- });
- }
|