feat(settings): 重构液态玻璃设置并更新品牌图标
This commit is contained in:
@@ -95,3 +95,16 @@ swiftc -module-cache-path /private/tmp/kymo-check-cache \
|
||||
```
|
||||
|
||||
检查真实 IOKit 请求的创建、重复开关与生命周期释放;测试结束不保留唤醒断言。不能替代实际空闲锁屏、息屏及面板视觉验收。
|
||||
|
||||
## 设置窗口展示检查
|
||||
|
||||
检查必须作为完整 `.app` 启动,直接运行 CLI 可执行文件时 macOS 不会自动激活测试应用:
|
||||
|
||||
```bash
|
||||
swiftc -module-cache-path /private/tmp/kymo-settings-cache \
|
||||
kymo/Core/Services/SettingsPresentation.swift \
|
||||
kymo/Features/Settings/SettingsWindowLifecycle.swift \
|
||||
kymoTests/SettingsWindowChecks.swift -o /private/tmp/kymo-settings-checks
|
||||
```
|
||||
|
||||
将临时可执行文件放入带 Info.plist 并已完成代码签名的临时 `.app/Contents/MacOS`,再用 `open -n -W` 启动。检查首次展示、焦点恢复、隐藏重开、最小化恢复、普通窗口层级及关闭生命周期;不替代实际多窗口场景与视觉验收。
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import AppKit
|
||||
import SwiftUI
|
||||
|
||||
@main struct SettingsWindowChecks {
|
||||
@MainActor static func main() {
|
||||
_ = NSApplication.shared
|
||||
Task { @MainActor in
|
||||
await runChecks()
|
||||
NSApp.terminate(nil)
|
||||
}
|
||||
NSApp.run()
|
||||
}
|
||||
|
||||
@MainActor static func runChecks() async {
|
||||
let request = SettingsPresentation()
|
||||
request.request()
|
||||
precondition(request.requestID == 1)
|
||||
request.request()
|
||||
precondition(request.requestID == 2)
|
||||
let window = NSWindow(contentRect: NSRect(x: 100, y: 100, width: 680, height: 450),
|
||||
styleMask: [.titled, .closable, .miniaturizable], backing: .buffered, defer: false)
|
||||
window.isReleasedWhenClosed = false
|
||||
let view = SettingsWindowLifecycle.WindowObserverView()
|
||||
var closed = false
|
||||
view.onClose = { closed = true }
|
||||
view.title = "Settings checks"
|
||||
window.contentView = view
|
||||
await settle()
|
||||
precondition(window.isVisible && window.isKeyWindow)
|
||||
precondition(window.level == .normal)
|
||||
let other = NSWindow(contentRect: window.frame, styleMask: [.titled], backing: .buffered, defer: false)
|
||||
other.isReleasedWhenClosed = false
|
||||
other.makeKeyAndOrderFront(nil)
|
||||
precondition(other.isKeyWindow)
|
||||
view.requestID = request.requestID
|
||||
await settle()
|
||||
precondition(window.isKeyWindow)
|
||||
window.orderOut(nil)
|
||||
precondition(!window.isVisible)
|
||||
request.request()
|
||||
view.requestID = request.requestID
|
||||
await settle()
|
||||
precondition(window.isVisible && window.isKeyWindow)
|
||||
window.miniaturize(nil)
|
||||
request.request()
|
||||
view.requestID = request.requestID
|
||||
await settle()
|
||||
precondition(!window.isMiniaturized && window.isKeyWindow)
|
||||
window.close()
|
||||
precondition(closed)
|
||||
precondition(NSApp.activationPolicy() == .accessory)
|
||||
other.close()
|
||||
print("PASS: request sequence, first presentation, key-window recovery, hidden reopen, miniaturized recovery, normal level and close lifecycle")
|
||||
}
|
||||
|
||||
@MainActor private static func settle() async {
|
||||
try? await Task.sleep(for: .milliseconds(350))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user