fix(download): swap local track variant actions

This commit is contained in:
zarzet
2026-07-27 14:31:39 +07:00
parent 9b4a960324
commit af6ca12e85
6 changed files with 122 additions and 23 deletions
@@ -0,0 +1,36 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:spotiflac_android/widgets/track_collection_action_policy.dart';
void main() {
group('quality variant track menu', () {
test('is hidden when quality variants are disabled', () {
expect(
resolveQualityVariantMenuAction(
allowQualityVariants: false,
hasLocalPlaybackCandidate: true,
),
isNull,
);
});
test('offers another download when the track is not local', () {
expect(
resolveQualityVariantMenuAction(
allowQualityVariants: true,
hasLocalPlaybackCandidate: false,
),
QualityVariantMenuAction.downloadAnotherQuality,
);
});
test('swaps to local playback when row tap handles the download', () {
expect(
resolveQualityVariantMenuAction(
allowQualityVariants: true,
hasLocalPlaybackCandidate: true,
),
QualityVariantMenuAction.playLocal,
);
});
});
}