feat(menubar): 拆分紧凑双页面板并按页采样
This commit is contained in:
@@ -38,24 +38,42 @@ import AppKit
|
||||
func wait(_ seconds: Int) async { try? await Task.sleep(for: .seconds(seconds)) }
|
||||
// Pin the test window so unrelated focus changes cannot invalidate a measurement.
|
||||
controller.presentation.isPinned = true
|
||||
if ProcessInfo.processInfo.environment["KYMO_AUDIT_INTERACTIVE"] == "1" {
|
||||
controller.show()
|
||||
if let value = ProcessInfo.processInfo.environment["KYMO_AUDIT_SIZE"] {
|
||||
let parts = value.split(separator: "x").compactMap { Double($0) }
|
||||
if parts.count == 2, parts.allSatisfy({ $0.isFinite }), parts[0] >= 480, parts[1] >= 360 {
|
||||
controller.panel.setContentSize(CGSize(width: min(parts[0], controller.panel.frame.width),
|
||||
height: min(parts[1], controller.panel.frame.height)))
|
||||
}
|
||||
}
|
||||
mark("interactive")
|
||||
return
|
||||
}
|
||||
let quick = ProcessInfo.processInfo.environment["KYMO_AUDIT_QUICK"] == "1"
|
||||
mark("cold")
|
||||
await wait(10)
|
||||
await wait(quick ? 3 : 10)
|
||||
mark("hidden10")
|
||||
for cycle in 1...3 {
|
||||
controller.show()
|
||||
if ProcessInfo.processInfo.environment["KYMO_AUDIT_PAGE"] == "processes" { controller.presentation.page = .processes }
|
||||
mark("open\(cycle).0")
|
||||
await wait(1); mark("open\(cycle).1")
|
||||
await wait(9); mark("open\(cycle).10")
|
||||
await wait(20); mark("open\(cycle).30")
|
||||
if cycle == 1 {
|
||||
if cycle == 1 && !quick {
|
||||
metrics.togglePause(); mark("paused.0")
|
||||
await wait(10); mark("paused.10")
|
||||
metrics.togglePause(); mark("resumed")
|
||||
}
|
||||
controller.hide()
|
||||
await wait(1); mark("closed\(cycle).1")
|
||||
await wait(9); mark("closed\(cycle).10")
|
||||
await wait(20); mark("closed\(cycle).30")
|
||||
if quick {
|
||||
await wait(4); mark("closed\(cycle).5")
|
||||
} else {
|
||||
await wait(9); mark("closed\(cycle).10")
|
||||
await wait(20); mark("closed\(cycle).30")
|
||||
}
|
||||
}
|
||||
controller.shutdown()
|
||||
mark("complete")
|
||||
|
||||
Reference in New Issue
Block a user