refactor(ui): 统一资源卡片规范并收敛面板布局与公共组件
This commit is contained in:
@@ -13,14 +13,21 @@ import CoreGraphics
|
||||
precondition(visible.insetBy(dx: 16, dy: 16).contains(centered))
|
||||
}
|
||||
}
|
||||
for size in [CGSize(width: 1240, height: 820), CGSize(width: 1160, height: 810)] {
|
||||
let compact = PanelLayout.resourceRowHeight(size: size, coreRows: 2)
|
||||
let expanded = PanelLayout.resourceRowHeight(size: size, coreRows: 3)
|
||||
let width = PanelLayout.cardWidth(size: size)
|
||||
precondition(compact >= 224 && compact <= 239)
|
||||
precondition(expanded == min(265, compact + 26))
|
||||
precondition(abs(3 * width + 16 - (size.width - 20)) < 0.001)
|
||||
for width: CGFloat in [640, 899, 900, 1159, 1160, 1240] {
|
||||
let size = CGSize(width: width, height: 820)
|
||||
let columns = PanelLayout.columns(width: width)
|
||||
let cardWidth = PanelLayout.cardWidth(size: size)
|
||||
precondition(abs(CGFloat(columns) * cardWidth + CGFloat(columns - 1) * 8 - (width - 20)) < 0.001)
|
||||
let rows = PanelLayout.rowHeights(columns: columns, coreRows: 3, fanCount: 6)
|
||||
let requirements: [CGFloat] = [306, 332, 280, 280, 280, 280]
|
||||
for index in requirements.indices {
|
||||
precondition(rows[index / columns] >= requirements[index])
|
||||
}
|
||||
precondition(rows.count == (6 + columns - 1) / columns)
|
||||
precondition(PanelLayout.needsResourceScroll(size: CGSize(width: width, height: 600), rows: rows))
|
||||
precondition(!PanelLayout.needsResourceScroll(size: CGSize(width: width, height: 2400), rows: rows))
|
||||
}
|
||||
precondition(PanelLayout.rowHeights(columns: 2, coreRows: 2, fanCount: 0) == [280, 280, 280])
|
||||
let input: [ProcessMetrics] = (0..<2000).map { (index: Int) -> ProcessMetrics in
|
||||
let id = ProcessIdentity(pid: Int32(index + 1), seconds: 1, microseconds: 0)
|
||||
let path: String? = index == 42 ? "/test/needle" : nil
|
||||
@@ -36,6 +43,6 @@ import CoreGraphics
|
||||
let matched = ProcessTableProjection.rows(input, query: "needle", byMemory: false, order: [])
|
||||
precondition(matched.count == 1 && matched[0].id.pid == 43)
|
||||
precondition(ProcessTableProjection.rows(input, query: "does-not-exist", byMemory: false, order: []).isEmpty)
|
||||
print("PASS: visible-frame bounds/chrome/negative origins, 2000-row CPU/RSS projection, frozen order, path search and empty results")
|
||||
print("PASS: physical-row heights, column breakpoints, width conservation, resource scrolling, visible-frame bounds/chrome/negative origins, 2000-row CPU/RSS projection, frozen order, path search and empty results")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user