mirror of
https://github.com/spotiflacapp/SpotiFLAC-Mobile.git
synced 2026-06-01 03:15:17 +07:00
- Add YouTubeQualityOpus320 constant and opus_320 parser case in Go backend - Expand opus supported bitrates to [128, 256, 320] across Go, Dart settings, and UI - Update default YouTube Opus option from 256 to 320kbps - Remove Tidal HIGH (lossy 320kbps) quality from Go backend, settings model, settings provider, download queue provider (both SAF and non-SAF paths), settings UI (quality option, format picker, helper methods), and l10n keys - Add settings migration v6: auto-migrate users with audioQuality=HIGH to LOSSLESS - Update and add Go test cases for opus_320 and adjusted max bitrate - Regenerate l10n files, remove 10 unused downloadLossy* l10n keys
54 lines
1.7 KiB
Go
54 lines
1.7 KiB
Go
package gobackend
|
|
|
|
import "testing"
|
|
|
|
func TestParseYouTubeQualityInput_OpusNormalizesToSupportedBitrates(t *testing.T) {
|
|
format, bitrate, normalized := parseYouTubeQualityInput("opus_160")
|
|
if format != "opus" {
|
|
t.Fatalf("expected opus format, got %s", format)
|
|
}
|
|
if bitrate != 128 {
|
|
t.Fatalf("expected 128 bitrate, got %d", bitrate)
|
|
}
|
|
if normalized != YouTubeQualityOpus128 {
|
|
t.Fatalf("expected %s normalized, got %s", YouTubeQualityOpus128, normalized)
|
|
}
|
|
}
|
|
|
|
func TestParseYouTubeQualityInput_Mp3NormalizesToSupportedBitrates(t *testing.T) {
|
|
format, bitrate, normalized := parseYouTubeQualityInput("mp3_192")
|
|
if format != "mp3" {
|
|
t.Fatalf("expected mp3 format, got %s", format)
|
|
}
|
|
if bitrate != 256 {
|
|
t.Fatalf("expected 256 bitrate, got %d", bitrate)
|
|
}
|
|
if normalized != YouTubeQualityMP3256 {
|
|
t.Fatalf("expected %s normalized, got %s", YouTubeQualityMP3256, normalized)
|
|
}
|
|
}
|
|
|
|
func TestParseYouTubeQualityInput_PicksNearestSupportedBitrate(t *testing.T) {
|
|
_, opusBitrate, _ := parseYouTubeQualityInput("opus_999")
|
|
if opusBitrate != 320 {
|
|
t.Fatalf("expected opus normalization to 320, got %d", opusBitrate)
|
|
}
|
|
|
|
_, mp3Bitrate, _ := parseYouTubeQualityInput("mp3_1")
|
|
if mp3Bitrate != 128 {
|
|
t.Fatalf("expected mp3 normalization to 128, got %d", mp3Bitrate)
|
|
}
|
|
}
|
|
|
|
func TestParseYouTubeQualityInput_Opus320(t *testing.T) {
|
|
format, bitrate, normalized := parseYouTubeQualityInput("opus_320")
|
|
if format != "opus" {
|
|
t.Fatalf("expected opus format, got %s", format)
|
|
}
|
|
if bitrate != 320 {
|
|
t.Fatalf("expected 320 bitrate, got %d", bitrate)
|
|
}
|
|
if normalized != YouTubeQualityOpus320 {
|
|
t.Fatalf("expected %s normalized, got %s", YouTubeQualityOpus320, normalized)
|
|
}
|
|
}
|