mirror of
https://github.com/acamarata/curtain.git
synced 2026-06-30 18:54:25 +00:00
Detection: netstat lives at /usr/sbin/netstat, not /usr/bin — the hardcoded wrong path silently killed the ESTABLISHED-TCP activator (root cause of the failed live test). Fixed and live-verified. Added peered-UDP activator (5900-5902) for High-Performance sessions, per-signal transition logging, unconditional error logging for dead probe helpers, and probe v2 with full CGSession dictionary diffing. 7 new parser tests (32 total). Fixes from a full audit + adversarial review: idle source setting honored (default now Remote session activity), cover scope reduced to a coherent two-mode model with legacy migration (per-display toggle was inverted in onlyMarked and dead in all), curtain test no longer schedules a teardown over a live session, specific-display password box placement gets a real picker, refuse-to-arm enforced, activation notification posts a real banner, menu password gate bypassed when the event tap is dead, shared single-decoder aerial player with stale-task guard and async playability check, password buffer zeroed on successful unlock and Esc, XPC interruption/invalidation handlers, modern Accessibility settings URL, launchPath modernized, codesign failures now abort release.sh, monotonic CFBundleVersion, install.sh temp cleanup, dead armDisarmHotkey setting removed. Refactor: Curtain.swift and PreferencesWindow.swift split into focused files (largest now 479 lines). Wiki, README, and contributing docs updated to match. Build clean at 0 warnings, 32/32 tests pass.
43 lines
1.3 KiB
Swift
43 lines
1.3 KiB
Swift
import XCTest
|
|
@testable import CurtainShared
|
|
|
|
final class HexColorTests: XCTestCase {
|
|
func testRoundTripBlack() {
|
|
let rgb = HexColor.toRGB("#000000")
|
|
XCTAssertNotNil(rgb)
|
|
XCTAssertEqual(HexColor.fromRGB(rgb!.r, rgb!.g, rgb!.b), "#000000")
|
|
}
|
|
|
|
func testRoundTripWhite() {
|
|
let rgb = HexColor.toRGB("#ffffff")
|
|
XCTAssertNotNil(rgb)
|
|
XCTAssertEqual(rgb!.r, 1.0, accuracy: 1e-9)
|
|
XCTAssertEqual(HexColor.fromRGB(rgb!.r, rgb!.g, rgb!.b), "#ffffff")
|
|
}
|
|
|
|
func testRoundTripArbitrary() {
|
|
let rgb = HexColor.toRGB("#1a2b3c")
|
|
XCTAssertNotNil(rgb)
|
|
XCTAssertEqual(HexColor.fromRGB(rgb!.r, rgb!.g, rgb!.b), "#1a2b3c")
|
|
}
|
|
|
|
func testToRGBWithoutHashPrefix() {
|
|
XCTAssertNotNil(HexColor.toRGB("1a2b3c"))
|
|
}
|
|
|
|
func testRejectsMalformed() {
|
|
XCTAssertNil(HexColor.toRGB("#12345")) // too short
|
|
XCTAssertNil(HexColor.toRGB("#1234567")) // too long
|
|
XCTAssertNil(HexColor.toRGB("#gggggg")) // non-hex
|
|
XCTAssertNil(HexColor.toRGB("")) // empty
|
|
}
|
|
|
|
func testFromRGBClamps() {
|
|
XCTAssertEqual(HexColor.fromRGB(2.0, -1.0, 0.5), "#ff0080")
|
|
}
|
|
|
|
func testFromRGBKnownValue() {
|
|
// 26/255, 43/255, 60/255 == 0x1a, 0x2b, 0x3c
|
|
XCTAssertEqual(HexColor.fromRGB(26.0 / 255, 43.0 / 255, 60.0 / 255), "#1a2b3c")
|
|
}
|
|
}
|