mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-19 23:51:36 +00:00
* feat(mac): redesign menu bar critter to match the mascot * fix(mac): draw happy-eye arcs upward and guard stale celebration expiry * docs(mac): update menu bar icon states for critter redesign * fix(mac): own celebration expiry with a start-only generation counter * fix(mac): give voice-wake antennae real headroom at 18pt
71 lines
2.1 KiB
Swift
71 lines
2.1 KiB
Swift
import AppKit
|
|
import Testing
|
|
@testable import OpenClaw
|
|
|
|
@MainActor
|
|
struct CritterIconRendererTests {
|
|
@Test func `make icon renders expected size`() {
|
|
let image = CritterIconRenderer.makeIcon(
|
|
blink: 0.25,
|
|
legWiggle: 0.5,
|
|
earWiggle: 0.2,
|
|
earScale: 1,
|
|
badge: nil)
|
|
|
|
#expect(image.size.width == 18)
|
|
#expect(image.size.height == 18)
|
|
#expect(image.tiffRepresentation != nil)
|
|
}
|
|
|
|
@Test func `make icon renders with badge`() {
|
|
let image = CritterIconRenderer.makeIcon(
|
|
blink: 0,
|
|
legWiggle: 0,
|
|
earWiggle: 0,
|
|
earScale: 1,
|
|
badge: .init(symbolName: "terminal.fill", prominence: .primary))
|
|
|
|
#expect(image.tiffRepresentation != nil)
|
|
}
|
|
|
|
@Test func `make icon renders expressive states`() {
|
|
let sleeping = CritterIconRenderer.makeIcon(
|
|
blink: 1,
|
|
antennaDroop: 1,
|
|
eyesClosedLines: true)
|
|
let celebrating = CritterIconRenderer.makeIcon(blink: 0, happyEyes: true)
|
|
|
|
#expect(sleeping.tiffRepresentation != nil)
|
|
#expect(celebrating.tiffRepresentation != nil)
|
|
}
|
|
|
|
@Test func `critter status label exercises helpers`() async {
|
|
await CritterStatusLabel.exerciseForTesting()
|
|
}
|
|
|
|
@Test func `idle critter sleeps until its next animation`() {
|
|
let now = Date(timeIntervalSinceReferenceDate: 100)
|
|
let delay = CritterStatusLabel.nextAnimationTickDelay(
|
|
now: now,
|
|
isWorking: false,
|
|
deadlines: [
|
|
now.addingTimeInterval(8),
|
|
now.addingTimeInterval(5),
|
|
now.addingTimeInterval(11),
|
|
now.addingTimeInterval(7),
|
|
])
|
|
|
|
#expect(delay == 5)
|
|
}
|
|
|
|
@Test func `working critter keeps its animation cadence`() {
|
|
let now = Date(timeIntervalSinceReferenceDate: 100)
|
|
let delay = CritterStatusLabel.nextAnimationTickDelay(
|
|
now: now,
|
|
isWorking: true,
|
|
deadlines: [now.addingTimeInterval(8)])
|
|
|
|
#expect(delay == 0.35)
|
|
}
|
|
}
|