summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-02 09:15:06 -0300
committerGabriel Schneider <[email protected]>2026-11-02 09:15:06 -0300
commit99d0bf3669a939fb09ac4ae5a0b2ddbace3d3f63 (patch)
tree7c7b078c60b78af5d4d2384eac7999be62271fbf /test
parent6d3b6cbc1361d174ffabb49b2ee84c5c6039dda5 (diff)
downloadpardes-99d0bf3669a939fb09ac4ae5a0b2ddbace3d3f63.tar.gz
pardes-99d0bf3669a939fb09ac4ae5a0b2ddbace3d3f63.zip
Fix macOS stale tag borders, spacing and drag cursors
Diffstat (limited to 'test')
-rw-r--r--test/macos-snapshots/drag-cursor.golden8
-rw-r--r--test/macos-snapshots/drag-cursor.snap20
-rw-r--r--test/macos-snapshots/retired-tags.golden2
-rw-r--r--test/macos-snapshots/retired-tags.snap19
-rw-r--r--test/macos_e2e.swift100
5 files changed, 149 insertions, 0 deletions
diff --git a/test/macos-snapshots/drag-cursor.golden b/test/macos-snapshots/drag-cursor.golden
new file mode 100644
index 00000000..a31c5639
--- /dev/null
+++ b/test/macos-snapshots/drag-cursor.golden
@@ -0,0 +1,8 @@
+== pointer grab native cursor verified
+== pointer dragging native cursor verified
+== pointer grab native cursor verified
+== pointer grab native cursor verified
+== pointer dragging native cursor verified
+== pointer grab native cursor verified
+== pointer text native cursor verified
+== pointer resize-vertical native cursor verified
diff --git a/test/macos-snapshots/drag-cursor.snap b/test/macos-snapshots/drag-cursor.snap
new file mode 100644
index 00000000..0fcb1e23
--- /dev/null
+++ b/test/macos-snapshots/drag-cursor.snap
@@ -0,0 +1,20 @@
+start 24 80
+wait 8000 $
+stable 700 20000
+mouse none motion 0 2
+check-pointer grab
+mouse left press 0 2
+check-pointer dragging
+mouse left release 0 2
+check-pointer grab
+mouse none motion 0 1
+check-pointer grab
+mouse left press 0 1
+check-pointer dragging
+mouse left release 0 1
+check-pointer grab
+mouse none motion 40 15
+check-pointer text
+command New
+stable 700 20000
+check-divider-drag
diff --git a/test/macos-snapshots/retired-tags.golden b/test/macos-snapshots/retired-tags.golden
new file mode 100644
index 00000000..86d5d98b
--- /dev/null
+++ b/test/macos-snapshots/retired-tags.golden
@@ -0,0 +1,2 @@
+== empty-edges retired-notices clean
+== empty-edges moved-tags clean
diff --git a/test/macos-snapshots/retired-tags.snap b/test/macos-snapshots/retired-tags.snap
new file mode 100644
index 00000000..6949c494
--- /dev/null
+++ b/test/macos-snapshots/retired-tags.snap
@@ -0,0 +1,19 @@
+start 33 107
+native-metrics
+wait 8000 $
+command Theme forge
+command New
+stable 1800 20000
+capture two-panes
+resize 28 85
+command Theme dark
+command Theme forge
+text ix
+key esc
+stable 1800 20000
+check-empty-edges retired-notices
+command New
+command Del
+resize 40 120
+stable 1800 20000
+check-empty-edges moved-tags
diff --git a/test/macos_e2e.swift b/test/macos_e2e.swift
index 2b0eedad..7d183016 100644
--- a/test/macos_e2e.swift
+++ b/test/macos_e2e.swift
@@ -671,6 +671,100 @@ private final class Driver: PardesViewDelegate {
output += "== context \(label) compact separators verified\n"
}
+ /// After notices disappear and tags move, empty pane edges must return to
+ /// the theme ground. A retired layer's retained geometry used to leave
+ /// horizontal rules here even though it no longer supplied any cells.
+ private func checkEmptyEdges(_ label: String) throws {
+ let view = try live(), rep = try renderedCapture(label)
+ let scale = CGFloat(rep.pixelsWide) / view.bounds.width
+ guard let ground = view.themeBG else {
+ throw ScriptError(message: "empty edges: needs an opaque theme")
+ }
+ var tagBands: [Range<Int>] = []
+ for index in 0..<pardes_tag_layer_limit() {
+ guard pardes_tag_layer_value(index, 0) > 0,
+ pardes_tag_layer_cells(index) != nil else { continue }
+ let row = Int(pardes_tag_layer_value(index, 5))
+ let top = Int(CGFloat(row) * view.cellHeight * scale)
+ let bottom = Int(CGFloat(row + 1) * view.cellHeight * scale)
+ tagBands.append(top..<bottom)
+ }
+ let expected = [CGFloat((ground >> 16) & 255), CGFloat((ground >> 8) & 255), CGFloat(ground & 255)]
+ for y in 2..<(rep.pixelsHigh - 2) {
+ if tagBands.contains(where: { $0.contains(y) }) { continue }
+ guard let c = sample(rep, x: rep.pixelsWide - 3, y: y) else {
+ throw ScriptError(message: "empty edges: no pixel at row \(y)")
+ }
+ let actual = [c.redComponent, c.greenComponent, c.blueComponent]
+ guard zip(actual, expected).allSatisfy({ abs($0 * 255 - $1) < 4 }) else {
+ throw ScriptError(message: "empty edges: stray paint at pixel row \(y): \(actual) vs \(expected)")
+ }
+ }
+ output += "== empty-edges \(label) clean\n"
+ }
+
+ private func checkPointer(_ name: String) throws {
+ let view = try live()
+ // The real app presents between gestures. Pay that presentation debt
+ // here too, so the next press is not held behind an unseen layout.
+ _ = readFrame()
+ pump()
+ let shape: UInt32
+ let cursor: NSCursor
+ switch name {
+ case "text": shape = 0; cursor = .iBeam
+ case "grab": shape = 4; cursor = .openHand
+ case "dragging": shape = 3; cursor = .closedHand
+ case "resize-vertical": shape = 6; cursor = .resizeUpDown
+ default: throw ScriptError(message: "unknown pointer \(name)")
+ }
+ guard pardes_pointer_shape() == shape else {
+ throw ScriptError(message: "pointer \(name): core reported \(pardes_pointer_shape())")
+ }
+ guard let window, let event = NSEvent.mouseEvent(
+ with: .mouseMoved, location: .zero, modifierFlags: [], timestamp: 0,
+ windowNumber: window.windowNumber, context: nil,
+ eventNumber: 0, clickCount: 0, pressure: 0) else {
+ throw ScriptError(message: "pointer: no mouse event")
+ }
+ let previous = NSCursor.current
+ defer { previous.set() }
+ view.cursorUpdate(with: event)
+ guard NSCursor.current === cursor else {
+ throw ScriptError(message: "pointer \(name): AppKit did not install the expected cursor")
+ }
+ output += "== pointer \(name) native cursor verified\n"
+ }
+
+ private func checkDividerDrag() throws {
+ let view = try live()
+ _ = readFrame()
+ let paneRows = (0..<pardes_tag_layer_limit()).compactMap { index -> UInt32? in
+ guard pardes_tag_layer_value(index, 0) > 0,
+ pardes_tag_layer_value(index, 1) == 2 else { return nil }
+ return pardes_tag_layer_value(index, 5)
+ }.sorted()
+ guard paneRows.count >= 2, let window else {
+ throw ScriptError(message: "divider drag: needs two panes")
+ }
+ let scale = window.backingScaleFactor
+ let point = view.convert(CGPoint(
+ x: view.bounds.width / 2,
+ y: CGFloat(paneRows[1]) * view.cellHeight + 0.5 / scale), to: nil)
+ func event(_ type: NSEvent.EventType) -> NSEvent? {
+ NSEvent.mouseEvent(with: type, location: point, modifierFlags: [],
+ timestamp: 0, windowNumber: window.windowNumber, context: nil,
+ eventNumber: 0, clickCount: 1, pressure: 1)
+ }
+ guard let down = event(.leftMouseDown), let up = event(.leftMouseUp) else {
+ throw ScriptError(message: "divider drag: no mouse event")
+ }
+ view.mouseDown(with: down)
+ pump()
+ defer { view.mouseUp(with: up); pump() }
+ try checkPointer("resize-vertical")
+ }
+
private func checkPDF(_ label: String) throws {
let view = try live(), rep = try renderedCapture(label)
guard nativeMetrics, pardes_frame_images() > 0, let images = pardes_frame_image_list() else {
@@ -744,6 +838,12 @@ private final class Driver: PardesViewDelegate {
try checkBackgrounds(rest)
case "check-context":
try checkContext(rest)
+ case "check-empty-edges":
+ try checkEmptyEdges(rest)
+ case "check-pointer":
+ try checkPointer(rest)
+ case "check-divider-drag":
+ try checkDividerDrag()
case "check-pdf":
try checkPDF(rest)
case "capture":