Don't double-label voices whose name already carries the quality tier
Premium/enhanced voices ship with the tier in their name (e.g. "Ava (Premium)"), so appending "— Premium" produced "Ava (Premium) — Premium" in the voice picker. Move the label logic to SpeechSettings.displayLabel and skip the suffix when the name already contains the tier (still name-only for default voices). Deterministic string helper, unit-tested. Claude-Session: https://claude.ai/code/session_01BQcEWmAPA78338QuEwRkAh
This commit is contained in:
@@ -36,6 +36,18 @@ struct SpeechSettingsTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test func displayLabelAvoidsRedundantQualitySuffix() {
|
||||
// Default voices: name only, no "— Default" noise.
|
||||
#expect(SpeechSettings.displayLabel(name: "Samantha", quality: .default) == "Samantha")
|
||||
|
||||
// Enhanced/premium voices get the tier appended when the name lacks it.
|
||||
#expect(SpeechSettings.displayLabel(name: "Samantha", quality: .enhanced) == "Samantha — Enhanced")
|
||||
|
||||
// …but not when the name already carries it (e.g. "Ava (Premium)").
|
||||
#expect(SpeechSettings.displayLabel(name: "Ava (Premium)", quality: .premium) == "Ava (Premium)")
|
||||
#expect(SpeechSettings.displayLabel(name: "Daniel (Enhanced)", quality: .enhanced) == "Daniel (Enhanced)")
|
||||
}
|
||||
|
||||
@Test func prosodyValuesClampToValidRanges() {
|
||||
let rateKey = SpeechSettings.rateKey
|
||||
let originalRate = UserDefaults.standard.object(forKey: rateKey) as? Double
|
||||
|
||||
Reference in New Issue
Block a user