feat(menubar): 拆分紧凑双页面板并按页采样
This commit is contained in:
@@ -61,11 +61,22 @@ private struct Host: View {
|
||||
let coordinator = table.delegate as! NativeProcessTable.Coordinator
|
||||
let probe = DelegateProbe(state, coordinator)
|
||||
table.delegate = probe
|
||||
precondition(table.numberOfRows == 500 && table.tableColumns.count == 6)
|
||||
precondition(table.numberOfRows == 500 && table.tableColumns.count == 7)
|
||||
precondition(table.frame.width >= table.enclosingScrollView!.contentSize.width - 1, "Native table must fill its viewport")
|
||||
precondition(coordinator.createdCells > 0 && coordinator.createdCells < 200, "Rows must be virtualized")
|
||||
let memoryCell = table.view(atColumn: 4, row: 0, makeIfNecessary: true) as! NSTableCellView
|
||||
precondition(memoryCell.textField?.stringValue == "9.5 MB", "Memory column must match Activity Monitor binary MB display")
|
||||
let powerColumn = table.tableColumns.firstIndex { $0.identifier.rawValue == "power" }!
|
||||
let emptyPower = table.view(atColumn: powerColumn, row: 0, makeIfNecessary: true) as! NSTableCellView
|
||||
precondition(emptyPower.textField?.stringValue == "--")
|
||||
state.rows[0].cpuPower = 0.005
|
||||
state.rows[0].powerWindow = 5
|
||||
await until { emptyPower.textField?.stringValue == "5.0 mW" }
|
||||
precondition(emptyPower.toolTip?.contains("5.0 s") == true)
|
||||
table.sortDescriptors = [NSSortDescriptor(key: "power", ascending: false)]
|
||||
await until { state.sorting == [ProcessSort(key: .power)] }
|
||||
table.sortDescriptors = [NSSortDescriptor(key: "power", ascending: true)]
|
||||
await until { state.sorting == [ProcessSort(key: .power, order: .forward)] }
|
||||
let chosen = state.rows[10].id
|
||||
table.selectRowIndexes(IndexSet(integer: 10), byExtendingSelection: false)
|
||||
precondition(state.selection == nil, "Native selection must be deferred")
|
||||
|
||||
Reference in New Issue
Block a user