mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 22:40:45 +08:00
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
29 lines
938 B
Swift
29 lines
938 B
Swift
import Foundation
|
|
import Testing
|
|
@testable import OpenClawChatUI
|
|
|
|
#if os(macOS)
|
|
import AppKit
|
|
#endif
|
|
|
|
#if os(macOS)
|
|
private func luminance(_ color: NSColor) throws -> CGFloat {
|
|
let rgb = try #require(color.usingColorSpace(.deviceRGB))
|
|
return 0.2126 * rgb.redComponent + 0.7152 * rgb.greenComponent + 0.0722 * rgb.blueComponent
|
|
}
|
|
#endif
|
|
|
|
@Suite struct ChatThemeTests {
|
|
@Test func assistantBubbleResolvesForLightAndDark() throws {
|
|
#if os(macOS)
|
|
let lightAppearance = try #require(NSAppearance(named: .aqua))
|
|
let darkAppearance = try #require(NSAppearance(named: .darkAqua))
|
|
|
|
let lightResolved = OpenClawChatTheme.resolvedAssistantBubbleColor(for: lightAppearance)
|
|
let darkResolved = OpenClawChatTheme.resolvedAssistantBubbleColor(for: darkAppearance)
|
|
#expect(try luminance(lightResolved) > luminance(darkResolved))
|
|
#else
|
|
#expect(Bool(true))
|
|
#endif
|
|
}
|
|
}
|