On mobile data the single default streaming quality either burns through the user's data plan or permanently caps quality at home. Playback start now applies a dedicated cellular default when the device is on a cellular-only connection, read from the app's existing single connectivity subscription. The new setting defaults to following the general default, ships in Settings > Playback for phones/tablets only, and explicit per-play quality picks still win. 'Metered connection' had been spelled out independently in the offline provider, the download WiFi-only gate and the sync-rule cooldown. Rather than add a fourth copy, all four now share ConnectivityLinkType. Network *presence* is deliberately left alone: its callers disagree on whether an empty snapshot counts as connected, so folding that in would change behavior. showSelectionDialog now returns the picked DialogOption instead of its raw value so the tile's null-valued 'Same as Default Quality' option stays distinguishable from dismissing the dialog. close #2147
51 lines
1.8 KiB
Dart
51 lines
1.8 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:plezy/models/transcode_quality_preset.dart';
|
|
|
|
void main() {
|
|
group('TranscodeQualityPreset.resolveStartupDefault', () {
|
|
test('a backend without transcoding starts at original regardless of saved defaults', () {
|
|
final preset = TranscodeQualityPreset.resolveStartupDefault(
|
|
serverSupportsTranscoding: false,
|
|
onCellularOnly: true,
|
|
cellularDefault: TranscodeQualityPreset.p720_2mbps,
|
|
generalDefault: TranscodeQualityPreset.p1080_8mbps,
|
|
);
|
|
|
|
expect(preset, TranscodeQualityPreset.original);
|
|
});
|
|
|
|
test('cellular-only applies the cellular default when one is set', () {
|
|
final preset = TranscodeQualityPreset.resolveStartupDefault(
|
|
serverSupportsTranscoding: true,
|
|
onCellularOnly: true,
|
|
cellularDefault: TranscodeQualityPreset.p720_2mbps,
|
|
generalDefault: TranscodeQualityPreset.original,
|
|
);
|
|
|
|
expect(preset, TranscodeQualityPreset.p720_2mbps);
|
|
});
|
|
|
|
test('cellular-only without a cellular default follows the general default', () {
|
|
final preset = TranscodeQualityPreset.resolveStartupDefault(
|
|
serverSupportsTranscoding: true,
|
|
onCellularOnly: true,
|
|
cellularDefault: null,
|
|
generalDefault: TranscodeQualityPreset.p1080_8mbps,
|
|
);
|
|
|
|
expect(preset, TranscodeQualityPreset.p1080_8mbps);
|
|
});
|
|
|
|
test('off cellular, the cellular default is ignored', () {
|
|
final preset = TranscodeQualityPreset.resolveStartupDefault(
|
|
serverSupportsTranscoding: true,
|
|
onCellularOnly: false,
|
|
cellularDefault: TranscodeQualityPreset.p240_320,
|
|
generalDefault: TranscodeQualityPreset.original,
|
|
);
|
|
|
|
expect(preset, TranscodeQualityPreset.original);
|
|
});
|
|
});
|
|
}
|