tv-anarchy/Tests/TVAnarchyCoreTests/DisplayInfoTests.swift
Natalie 4a2ceb9781 feat(offline): inline star-to-keep and trash-to-cull on cache rows
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>
2026-06-30 00:12:41 -04:00

30 lines
No EOL
1.2 KiB
Swift

import XCTest
@testable import TVAnarchyCore
final class DisplayInfoTests: XCTestCase {
private let builtIn = DisplayInfo(displayId: 1, name: "Built-in Retina Display",
width: 1728, height: 1117, isPrimary: true, isBuiltIn: true)
private let tv = DisplayInfo(displayId: 2, name: "SAMSUNG", width: 3840, height: 2160,
isPrimary: false, isBuiltIn: false)
func testPickTVPrefersExternal() {
XCTAssertEqual(DisplayInfo.pickTV(from: [builtIn, tv])?.displayId, 2)
XCTAssertNil(DisplayInfo.pickTV(from: [builtIn]))
}
func testResolveAutoUsesTVWhenPresent() {
XCTAssertEqual(DisplayInfo.resolve(preference: nil, from: [builtIn, tv])?.displayId, 2)
}
func testResolveAutoFallsBackToPrimary() {
XCTAssertEqual(DisplayInfo.resolve(preference: nil, from: [builtIn])?.displayId, 1)
}
func testResolveHonorsExplicitPreference() {
XCTAssertEqual(DisplayInfo.resolve(preference: 1, from: [builtIn, tv])?.displayId, 1)
}
func testResolveIgnoresStalePreference() {
XCTAssertEqual(DisplayInfo.resolve(preference: 99, from: [builtIn, tv])?.displayId, 2)
}
}