summaryrefslogtreecommitdiff
path: root/test/behaviour
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-26 09:41:38 -0300
committerGabriel Schneider <[email protected]>2026-11-26 10:16:37 -0300
commit2dae98b564e677c24c5275070c413d05a85d12fc (patch)
tree6a18f7ea935efdfca0b6f50229ca9eca6052741d /test/behaviour
parent0fb10f2748bc1593b9c0dda0e74b53cb66a69a95 (diff)
downloadpardes-2dae98b564e677c24c5275070c413d05a85d12fc.tar.gz
pardes-2dae98b564e677c24c5275070c413d05a85d12fc.zip
abi, Kind, pdf, fake: ABI 3.4, a kind's window holds the theme's search hit colours, `hit` and `hit_current` (Chrome's, read through p.chrome() as each pane of a kind is painted), and a PDF's search draws its hits in them, the current hit apart, where every hit was the literal amber #ffd54f (the colour line's leftover, themes DESIGN.md part F, L2e's row "PDF hits", B8's `PDF's ffd54f -> chrome.hit`: "current hit" had three colours, the body's, the rail's and the PDF's); THE ABI: pa_window gains `uint32_t hit, hit_current` at its end (24 to 32 bytes, the header's and Kind.zig's size checks), PA_ABI_MINOR 4; an addon reads them once `api->abi >= 0x30004`, so one built against 3.3 loads, opens and paints as before (the core refuses another major only, and reads nothing new of an addon), and one built against 3.4 under an older pardes is handed the amber its PDFs drew (abi/addon.zig's Window, filled by the glue); WHY THE WINDOW, NOT THE VIEW (pa_view, where fg, bg, sel and link are): a view's facts are a step's (`view` is on the tape, and a plain kind keeps them in its block: the pdf's Layout holds the whole pa_view), so two more colours there would grow the pdf's block, and an Upgrade's revival hands `load` the old block, whose size it would refuse, every open PDF a placeholder; the hits are drawn by paint alone, which writes nothing a step reads, and the window is made each paint; THE CORE: Kind.paint fills them, the theme colour's PA_RGB by Kind's one `rgb` (viewOf's, out of its function); THE PDF: paint hands its window to reconcile, and marksOf marks each hit of the page in `win.hit`, those of the current hit (`find.hit`, its quads) in `win.hit_current`, at the alpha they had; THE FAKE: paints `hits rrggbb rrggbb` on its fifth row (since 3.4), and is built once more with its head saying 3.3 (`fake_addon_old`, named fakeold); addons/fake/fake.out re-recorded (that row in each of its 11 frames, `hits 5e4923 917a53`, the addon test's theme; nothing else moved); docs/typ/reference.typ's paint says it; RUN (TEST FIRST): behaviour/addons.zig "addons: a kind's pane is painted with the theme's search hit colours, the current hit's apart (ABI 3.4), and a library whose head says 3.3 still loads, opens and paints": acme's `hits ffc790 a05200`, then neonotte84's `hits 4c301a e59d3c`, then fakeold listed `3.3 ... loaded` and its pane's `count 0`: with the header and the fake alone fails (the core's window `hits 000000 000000`), passes now; pdf.zig "a search's hits are marked in the theme's hit colours its window is painted with, the current hit in the current hit's (ABI 3.4)": a page's three quads, the second hit's two current: fails with the amber (expected 4c301a70, found ffd54f70), passes now; the ABI the addons say in /addons moves to 3.4 in five behaviour checks; a user saw every PDF hit amber in every theme and the current one no different; NEW HOT PATHS: per frame, per pane of a kind painted, two colours packed from the chrome (no allocation, no derivation: Chrome's resolved fields); none per key; GATES (the stack kysrwqpz, rqlxkzuq, this, Debug): core-test 1163/1338 (175 skipped: +1 skipped, the rerun test needs a terminal), shell-test 1379/1382 (3 skipped), pane-test 184/185, behaviour-test 288/288 (+1) and --replay 20 seeds of 70 steps, 0 failures, process-test 0 of 149 failed (3 skipped), term-test 17/17, kitty-test 45/45, addon-test 157/157 steps, 8/8 tests (fake.out, snake, pdf and their own tests); the soak with the pdf addon on this top found a second preview leak, pictures (the next change); the 40,000-seed dump fuzz crashed at join seed 8324 in draw.zig's Debug overlay (a General protection exception printing a string from a damaged dump), whose dumped session has no kind, no command pane and no window: these changes move none of its bytes (see the report); pdf-harness tui fails `KittyPdfBoundaryPageMissing` on M2 alike (8959b031dc33, run here), not this change's; no dump layout change (the window is made each paint); load 4.5 to 12.5
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'test/behaviour')
-rw-r--r--test/behaviour/addons.zig31
-rw-r--r--test/behaviour/addons_pdf.zig2
2 files changed, 28 insertions, 5 deletions
diff --git a/test/behaviour/addons.zig b/test/behaviour/addons.zig
index 0b0555c2..88c477ea 100644
--- a/test/behaviour/addons.zig
+++ b/test/behaviour/addons.zig
@@ -37,7 +37,7 @@ test "addons: Addon load takes a library in, /addons lists it with the kinds com
defer unload(&s, "fake");
// `<kind> <version> <abi> <panes open> <path> <blake3> <state>`.
const listed = try s.read("/addons");
- try std.testing.expect(std.mem.startsWith(u8, listed, "fake 1 3.3 0 /"));
+ try std.testing.expect(std.mem.startsWith(u8, listed, "fake 1 3.4 0 /"));
var fields = std.mem.tokenizeScalar(u8, listed[0..std.mem.indexOfScalar(u8, listed, '\n').?], ' ');
for (0..5) |_| _ = fields.next();
try std.testing.expectEqual(@as(usize, 64), fields.next().?.len);
@@ -51,7 +51,7 @@ test "addons: Addon load takes a library in, /addons lists it with the kinds com
// A pane of it open, it stays; closed, it goes.
try s.write("/ctl", "Fake\n");
const pane = try paneOf(&s, "fake");
- try std.testing.expect(std.mem.startsWith(u8, try s.read("/addons"), "fake 1 3.3 1 /"));
+ try std.testing.expect(std.mem.startsWith(u8, try s.read("/addons"), "fake 1 3.4 1 /"));
try std.testing.expect(try s.refused("/ctl", "Addon unload fake\n") != 0);
try std.testing.expect(has(s.said, "1 fake pane is open"));
try s.write(s.at("/pane/{d}/ctl", .{pane}), "Del\n");
@@ -68,7 +68,7 @@ test "addons: a library of another ABI, one with no pardes_addon, and one whose
try std.testing.expect(std.mem.startsWith(u8, listed, "fakeabi 1 2.2 0 /"));
try std.testing.expect(has(listed, " refused: wants abi 2, this pardes speaks 3\n"));
try std.testing.expect(has(listed, " refused: it has no pardes_addon\n"));
- try std.testing.expect(has(listed, "\nfakeword 1 3.3 0 /"));
+ try std.testing.expect(has(listed, "\nfakeword 1 3.4 0 /"));
try std.testing.expect(has(listed, " refused: word Save is the core's\n"));
// A file that is no library at all: listed with what the loader said.
var tmp = std.testing.tmpDir(.{});
@@ -120,7 +120,7 @@ test "addons: the image addon opens the pictures a Look names, fitted, with the
defer s.deinit();
try load(&s, Session.image_addon);
const listed = try s.read("/addons");
- try std.testing.expect(std.mem.startsWith(u8, listed, "image 1 3.3 0 /") and has(listed, " loaded\n"));
+ try std.testing.expect(std.mem.startsWith(u8, listed, "image 1 3.4 0 /") and has(listed, " loaded\n"));
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
var buf: [4096]u8 = undefined;
@@ -530,3 +530,26 @@ test "addons: Enter on a picture in a picker opens its kind's pane, never its by
try std.testing.expect(has(screen, s.at("\"serial\":{d},", .{image})) and has(screen, "\"src\":[0,0,2,1]"));
try std.testing.expect(!has(try s.screen(), "1 P6"));
}
+
+test "addons: a kind's pane is painted with the theme's search hit colours, the current hit's apart (ABI 3.4), and a library whose head says 3.3 still loads, opens and paints" {
+ {
+ var s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ try load(&s, fake.ok);
+ defer unload(&s, "fake");
+ try s.write("/ctl", "Theme acme\n");
+ try s.write("/ctl", "Fake\n");
+ // acme's: its hit ground, and its amber held for its page's ink.
+ try std.testing.expect(has(try s.screen(), "hits ffc790 a05200"));
+ try s.write("/ctl", "Theme neonotte84\n");
+ try std.testing.expect(has(try s.screen(), "hits 4c301a e59d3c"));
+ }
+ var s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ try load(&s, fake.old);
+ defer unload(&s, "fakeold");
+ const listed = try s.read("/addons");
+ try std.testing.expect(std.mem.startsWith(u8, listed, "fakeold 1 3.3 0 /") and has(listed, " loaded\n"));
+ try s.write("/ctl", "Fake\n");
+ try std.testing.expect(has(try s.screen(), "count 0"));
+}
diff --git a/test/behaviour/addons_pdf.zig b/test/behaviour/addons_pdf.zig
index 7df5d5ee..c59b4a93 100644
--- a/test/behaviour/addons_pdf.zig
+++ b/test/behaviour/addons_pdf.zig
@@ -38,7 +38,7 @@ test "addons: a PDF is the pdf addon's pane, its pages pictures, its page in its
s.graphics();
const n = try s.lookFile("docs/design.pdf");
try std.testing.expect(has(try s.read("/index"), " pdf "));
- try std.testing.expect(std.mem.startsWith(u8, try s.read("/addons"), "pdf 1 3.3 1 /"));
+ try std.testing.expect(std.mem.startsWith(u8, try s.read("/addons"), "pdf 1 3.4 1 /"));
const pages = (try s.pdfPage(n))[1];
try std.testing.expectEqual(@as(u32, 16), pages);
// Its first page, a picture over its body.