diff options
Diffstat (limited to 'menubar/main.swift')
| -rw-r--r-- | menubar/main.swift | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/menubar/main.swift b/menubar/main.swift index 135c099..2230817 100644 --- a/menubar/main.swift +++ b/menubar/main.swift @@ -424,6 +424,18 @@ if arguments.contains("--selftest") { if rowTitle(high).string != "✓ ! Fix it" || rowTitlePrefix(high) != "✓ ! " { failures.append("title: a high agent is marked: \(rowTitle(high).string)") } + let markColor = rowTitle(high).attribute(.foregroundColor, at: rowTitlePrefix(high).utf16.count - 2, + effectiveRange: nil) as? NSColor + if markColor != herdrPeach { failures.append("title: the ! is peach") } + let normal = Row(paneId: "%2", agent: "pi", name: "Fix it", status: .done, session: "s", window: "w", since: 1) + if rowTitle(normal).string != "✓ Fix it" || rowTitlePrefix(normal).count != rowTitlePrefix(high).count { + failures.append("title: names line up with or without the mark: '\(rowTitle(normal).string)'") + } + let low = Row(paneId: "%3", agent: "pi", name: "Fix it", status: .done, session: "s", window: "w", since: 1, + importance: .low) + let lowColor = rowTitle(low).attribute(.foregroundColor, at: rowTitlePrefix(low).utf16.count, + effectiveRange: nil) as? NSColor + if lowColor?.alphaComponent != lowImportanceAlpha { failures.append("title: a low agent's name is dimmed") } failures.forEach { print("FAIL \($0)") } print(failures.isEmpty ? "selftest ok" : "selftest: \(failures.count) failed") exit(failures.isEmpty ? 0 : 1) |
