mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-20 17:41:33 -06:00
8c8ab1ea69
* feat(mac): Quick Chat v2 — enable toggle, agent avatars and switching, zoom entrance, window screenshots - Settings toggle (openclaw.quickChatEnabled) gating hotkey, menu item, recorder - agent chip renders avatar image (data URIs only; remote URLs deliberately not fetched to avoid SSRF), emoji, or tinted monogram; native NSMenu agent picker routes via canonical agent:<id>:<mainKey> or global+agentId per server contract - 'main session' capsule removed; placeholder carries the identity - fade+zoom presentation (96% scale in, 97% out) via frame+alpha animators - window screenshot picker: labeled overlays on renderable windows (Peekaboo filtering + z-order hit tests), overlays torn down pre-capture, SCK window capture, ChatImageProcessor JPEG, auto-send as chat.send attachment with the draft or a default caption; ownership-token pipeline bound to presentation and route; user-initiated Screen Recording alert; cancellable bounded discovery - ⌘Return opens the accepted route's session; global-scope agent threading is a filed follow-up; locale artifacts refreshed for new strings * chore(mac): regenerate i18n inventory after rebase onto main
50 lines
1.6 KiB
Swift
50 lines
1.6 KiB
Swift
import AppKit
|
|
import Testing
|
|
@testable import OpenClaw
|
|
|
|
@Suite(.serialized)
|
|
@MainActor
|
|
struct QuickChatPlacementTests {
|
|
@Test func `centers bar at spotlight height`() {
|
|
let frame = QuickChatPlacement.barFrame(
|
|
contentSize: NSSize(width: 620, height: 60),
|
|
visibleFrame: NSRect(x: 0, y: 0, width: 1000, height: 800))
|
|
|
|
#expect(frame == NSRect(x: 190, y: 564, width: 620, height: 60))
|
|
}
|
|
|
|
@Test func `respects visible frame origin`() {
|
|
let frame = QuickChatPlacement.barFrame(
|
|
contentSize: NSSize(width: 620, height: 80),
|
|
visibleFrame: NSRect(x: 1200, y: 40, width: 1400, height: 900))
|
|
|
|
#expect(frame.origin.x == 1590)
|
|
#expect(frame.maxY == 742)
|
|
}
|
|
|
|
@Test func `clamps oversized content to small screen`() {
|
|
let visible = NSRect(x: 20, y: 30, width: 300, height: 100)
|
|
let frame = QuickChatPlacement.barFrame(
|
|
contentSize: NSSize(width: 620, height: 200),
|
|
visibleFrame: visible)
|
|
|
|
#expect(frame == visible)
|
|
}
|
|
|
|
@Test func `zero visible frame returns zero`() {
|
|
#expect(QuickChatPlacement.barFrame(
|
|
contentSize: NSSize(width: 620, height: 60),
|
|
visibleFrame: .zero) == .zero)
|
|
}
|
|
|
|
@Test func `scaled rect preserves center and applies factor`() {
|
|
let source = NSRect(x: 100, y: 200, width: 600, height: 100)
|
|
let scaled = QuickChatPlacement.scaledRect(source, factor: 0.96)
|
|
|
|
#expect(scaled.midX == source.midX)
|
|
#expect(scaled.midY == source.midY)
|
|
#expect(scaled.width == 576)
|
|
#expect(scaled.height == 96)
|
|
}
|
|
}
|