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>
54 lines
No EOL
2 KiB
Swift
54 lines
No EOL
2 KiB
Swift
import XCTest
|
|
@testable import TVAnarchyCore
|
|
|
|
@MainActor
|
|
final class PlayerDisplayTests: XCTestCase {
|
|
private var shows: [CachedShow] {
|
|
[
|
|
CachedShow(
|
|
name: "Dharma & Greg",
|
|
rootDir: "/tv/Dharma",
|
|
episodes: [
|
|
CachedEpisode(path: "/tv/Dharma/S01E01 Pilot.mkv", season: 1, episode: 1, label: "S01E01 Pilot"),
|
|
CachedEpisode(path: "/tv/Dharma/S01E03 Shower.mkv", season: 1, episode: 3,
|
|
label: "Dharma & Greg S01E03 Shower the People You Love With Love"),
|
|
CachedEpisode(path: "/tv/Dharma/S01E04 Next.mkv", season: 1, episode: 4, label: "S01E04 And Then"),
|
|
]
|
|
),
|
|
]
|
|
}
|
|
|
|
func testDisplayTitleStripsExtensionAndShowPrefix() {
|
|
XCTAssertEqual(
|
|
PlayerController.displayTitle(
|
|
forTitle: "Dharma & Greg S01E03 Shower the People You Love With Love.mkv",
|
|
in: shows
|
|
),
|
|
"Shower the People You Love With Love"
|
|
)
|
|
}
|
|
|
|
func testEpisodeLookupByFilename() {
|
|
let hit = PlayerController.episode(forTitle: "S01E03 Shower.mkv", in: shows)
|
|
XCTAssertEqual(hit?.episode.episode, 3)
|
|
XCTAssertEqual(hit?.show.name, "Dharma & Greg")
|
|
}
|
|
|
|
func testQueueChipParts() {
|
|
let parts = PlayerController.queueChipParts(for: "/tv/Dharma/S01E04 Next.mkv", in: shows)
|
|
XCTAssertEqual(parts.code, "S01E04")
|
|
XCTAssertEqual(parts.title, "And Then")
|
|
}
|
|
|
|
func testShortEpisodeTitleStripsCode() {
|
|
XCTAssertEqual(
|
|
PlayerController.shortEpisodeTitle("Dharma & Greg S01E03 Shower the People You Love With Love"),
|
|
"Shower the People You Love With Love"
|
|
)
|
|
}
|
|
|
|
func testEpisodeCodeFormatting() {
|
|
let ep = CachedEpisode(path: "/p.mkv", season: 1, episode: 8, label: "x")
|
|
XCTAssertEqual(PlayerController.episodeCode(ep), "S01E08")
|
|
}
|
|
} |