feat(ui): 统一实现卡片背景趋势与大数值布局

This commit is contained in:
2026-11-15 15:40:29 +08:00
parent 397156249b
commit 3c1a2baace
25 changed files with 447 additions and 268 deletions
+19 -1
View File
@@ -23,6 +23,10 @@ import QuartzCore
plot.configure(continuous)
let image = bitmap(plot)
precondition(redPixels(image, from: 0.4, to: 0.6) > 10, "Continuous curve must cross the middle")
let fill = image.colorAt(x: image.pixelsWide / 2, y: image.pixelsHigh / 2)!
precondition(fill.alphaComponent > 0.10 && fill.alphaComponent < 0.18,
"A continuous run must have a translucent area below its real curve")
precondition(plot.grid.isHidden, "Background trends must not draw a chart grid")
plot.needsDisplay = false; plot.configure(continuous)
precondition(!plot.needsDisplay, "Identical inputs must not invalidate the plot")
plot.configure(input([0.8,0.8,nil,0.8]))
@@ -39,6 +43,20 @@ import QuartzCore
precondition(dots.path == nil, "Connecting a missing value must not invent a measured hover dot")
plot.configure(input([nil,nil,nil,nil]))
precondition(redPixels(bitmap(plot)) == 0)
plot.configure(input([nil,0.8,nil,nil]))
let single = bitmap(plot)
precondition(single.colorAt(x: single.pixelsWide / 2, y: single.pixelsHigh / 2)!.alphaComponent == 0,
"A single sample must not create a fabricated area")
var hiddenSeries = NativePanelCurve.Input(frame: .init(dates: dates,
series: [[nil,nil,nil,nil], [0.8,0.8,0.8,0.8]], intervals: [2,2,2,2], boundaryDates: []),
colors: [.red, .red], scales: [1], maximumGap: 5)
hiddenSeries.visibleSeriesCount = 1; hiddenSeries.hoveredIndex = 1
plot.configure(hiddenSeries)
precondition(redPixels(bitmap(plot)) == 0, "A tooltip-only series must not leak lines, fill or hover dots")
var unfilled = continuous; unfilled.filledSeriesCount = 0
plot.configure(unfilled)
let noArea = bitmap(plot)
precondition(noArea.colorAt(x: noArea.pixelsWide / 2, y: noArea.pixelsHigh / 2)!.alphaComponent == 0)
let changedDates = [0.0, 2, 8, 10].map { Date(timeIntervalSinceReferenceDate: $0) }
plot.configure(.init(frame: .init(dates: changedDates, series: [[0.8,0.8,0.8,0.8]],
intervals: [2,30,2,2], boundaryDates: []), colors: [.red], scales: [1], maximumGap: 5))
@@ -84,7 +102,7 @@ import QuartzCore
assertStatic(plot.layer!)
plot.removeFromSuperview()
window.orderOut(nil); window.close()
print("PASS: static curve pixels, immediate stable updates, no animation/material/gradient layers, real gaps, hover cache, palette growth, appearance, full history and unmount")
print("PASS: static background lines/area pixels, no single-point fill, hidden-series isolation, immediate stable updates, no animation/material/gradient layers, real gaps, hover cache, palette growth, appearance, full history and unmount")
fflush(stdout); NSApp.terminate(nil)
}
NSApp.run()