Surface the existing pin (keep-from-cull) and per-file delete actions as visible inline buttons on each offline cache row instead of context-menu-only: a star toggles protection from auto-cull (and restore-if-missing), a trash culls that file early. Aligns wording/icons to the star metaphor. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
47 lines
No EOL
1.9 KiB
Swift
47 lines
No EOL
1.9 KiB
Swift
import XCTest
|
|
@testable import TVAnarchyCore
|
|
|
|
final class AudioOutputTests: XCTestCase {
|
|
private let builtInDisplay = DisplayInfo(
|
|
displayId: 1, name: "Built-in Retina Display",
|
|
width: 1728, height: 1117, isPrimary: true, isBuiltIn: true)
|
|
private let tvDisplay = DisplayInfo(
|
|
displayId: 2, name: "SAMSUNG", width: 3840, height: 2160,
|
|
isPrimary: false, isBuiltIn: false)
|
|
|
|
private let laptopSpeakers = AudioOutputInfo(deviceId: 71, name: "MacBook Air Speakers", isBuiltIn: true)
|
|
private let tvAudio = AudioOutputInfo(deviceId: 83, name: "SAMSUNG", isBuiltIn: false)
|
|
|
|
func testPickTVAudioByName() {
|
|
let picked = AudioOutputInfo.pick(for: tvDisplay, from: [laptopSpeakers, tvAudio])
|
|
XCTAssertEqual(picked?.deviceId, 83)
|
|
}
|
|
|
|
func testPickBuiltInSpeakersForBuiltInDisplay() {
|
|
let picked = AudioOutputInfo.pick(for: builtInDisplay, from: [laptopSpeakers, tvAudio])
|
|
XCTAssertEqual(picked?.deviceId, 71)
|
|
}
|
|
|
|
func testPickExternalFallbackWhenNameDiffers() {
|
|
let lgDisplay = DisplayInfo(
|
|
displayId: 3, name: "LG TV", width: 1920, height: 1080,
|
|
isPrimary: false, isBuiltIn: false)
|
|
let picked = AudioOutputInfo.pick(for: lgDisplay, from: [laptopSpeakers, tvAudio])
|
|
XCTAssertEqual(picked?.deviceId, 83)
|
|
}
|
|
|
|
func testInferBuiltInFromSpeakersSuffix() {
|
|
XCTAssertTrue(AudioOutputInfo.inferBuiltIn(name: "MacBook Air Speakers"))
|
|
XCTAssertFalse(AudioOutputInfo.inferBuiltIn(name: "SAMSUNG"))
|
|
}
|
|
|
|
func testRewriteVlcrcAudioDevice() {
|
|
let input = """
|
|
[auhal] # HAL AudioUnit output
|
|
auhal-audio-device=0
|
|
"""
|
|
let out = AudioOutputService.rewriteVlcrcAudioDevice(input, deviceId: 83)
|
|
XCTAssertEqual(out?.contains("auhal-audio-device=83"), true)
|
|
XCTAssertEqual(out?.contains("auhal-audio-device=0"), false)
|
|
}
|
|
} |