summaryrefslogtreecommitdiff
path: root/test/web-snapshots
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-29 19:09:26 -0300
committerGabriel Schneider <[email protected]>2026-10-29 21:13:33 -0300
commit2eb8860b2ca05c426f3962661441aaee13d3be44 (patch)
tree8d363280576cc86db7209ef37c6210a0d5b75c8e /test/web-snapshots
parente4cfd57bc41c5740e3a823a8f05d70d3e87b68ca (diff)
downloadpardes-2eb8860b2ca05c426f3962661441aaee13d3be44.tar.gz
pardes-2eb8860b2ca05c426f3962661441aaee13d3be44.zip
web: the browser shell builds again and loads a dump of a native build: a theme by its name, a field compiled out passed over, no disk asked; touch.dump replaces the hand-written ZON fixture
Fixed for wasm32-freestanding: counts as usize, no threads, stb_image, tape or host stat there. touch.mjs follows the renderer's 13 tag-layer fields, helix's retuned colours and the tag column. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/web-snapshots')
-rw-r--r--test/web-snapshots/README.md2
-rw-r--r--test/web-snapshots/touch-fixture.zig58
-rw-r--r--test/web-snapshots/touch.dumpbin0 -> 96576 bytes
-rw-r--r--test/web-snapshots/touch.dump.zon73
-rw-r--r--test/web-snapshots/touch.mjs21
5 files changed, 72 insertions, 82 deletions
diff --git a/test/web-snapshots/README.md b/test/web-snapshots/README.md
index a7cd865e..999e8fad 100644
--- a/test/web-snapshots/README.md
+++ b/test/web-snapshots/README.md
@@ -1,6 +1,6 @@
# Browser interaction tests
-`zig build web-snap` loads `touch.dump.zon` and runs `touch.mjs` in Chromium.
+`zig build web-snap` loads `touch.dump` (`python3 -B tools/web_fixture.py <pardes> test/web-snapshots/touch.dump` makes it: a native session on `touch-fixture.zig` at 100x30, theme helix, Verbose off) and runs `touch.mjs` in Chromium.
The fixed source fixture exercises complete keyword styles, touch Look through
the self filesystem, separator resizing, and scrolling without another Look.
Assertions locate current pane geometry; no live project source or author paths
diff --git a/test/web-snapshots/touch-fixture.zig b/test/web-snapshots/touch-fixture.zig
new file mode 100644
index 00000000..b1d5d81e
--- /dev/null
+++ b/test/web-snapshots/touch-fixture.zig
@@ -0,0 +1,58 @@
+pub fn choose(value: u32) []const u8 {
+ if (value == 42) return "touch fixture";
+ return "/virtual/pane/1/body";
+}
+
+pub const rows = [_]u32{
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 28,
+ 29,
+ 30,
+ 31,
+ 32,
+ 33,
+ 34,
+ 35,
+ 36,
+ 37,
+ 38,
+ 39,
+ 40,
+ 41,
+ 42,
+ 43,
+ 44,
+ 45,
+ 46,
+ 47,
+ 48,
+ 49,
+ 50,
+}; \ No newline at end of file
diff --git a/test/web-snapshots/touch.dump b/test/web-snapshots/touch.dump
new file mode 100644
index 00000000..bcc58352
--- /dev/null
+++ b/test/web-snapshots/touch.dump
Binary files differ
diff --git a/test/web-snapshots/touch.dump.zon b/test/web-snapshots/touch.dump.zon
deleted file mode 100644
index 230d29e7..00000000
--- a/test/web-snapshots/touch.dump.zon
+++ /dev/null
@@ -1,73 +0,0 @@
-.{
- .screen = .{ .cols = 100, .rows = 30 },
- .theme = "helix",
- .columns = .{.{ .panes = .{0} }},
- .panes = .{.{
- .kind = .file,
- .tag = "touch-fixture.zig",
- .body = "",
- .file = .{
- .path = "touch-fixture.zig",
- .content =
- \\pub fn choose(value: u32) []const u8 {
- \\ if (value == 42) return "touch fixture";
- \\ return "/virtual/pane/1/body";
- \\}
- \\
- \\pub const rows = [_]u32{
- \\ 0,
- \\ 1,
- \\ 2,
- \\ 3,
- \\ 4,
- \\ 5,
- \\ 6,
- \\ 7,
- \\ 8,
- \\ 9,
- \\ 10,
- \\ 11,
- \\ 12,
- \\ 13,
- \\ 14,
- \\ 15,
- \\ 16,
- \\ 17,
- \\ 18,
- \\ 19,
- \\ 20,
- \\ 21,
- \\ 22,
- \\ 23,
- \\ 24,
- \\ 25,
- \\ 26,
- \\ 27,
- \\ 28,
- \\ 29,
- \\ 30,
- \\ 31,
- \\ 32,
- \\ 33,
- \\ 34,
- \\ 35,
- \\ 36,
- \\ 37,
- \\ 38,
- \\ 39,
- \\ 40,
- \\ 41,
- \\ 42,
- \\ 43,
- \\ 44,
- \\ 45,
- \\ 46,
- \\ 47,
- \\ 48,
- \\ 49,
- \\ 50,
- \\};
- ,
- },
- }},
-}
diff --git a/test/web-snapshots/touch.mjs b/test/web-snapshots/touch.mjs
index 69f8a4a5..3793c0f9 100644
--- a/test/web-snapshots/touch.mjs
+++ b/test/web-snapshots/touch.mjs
@@ -1,8 +1,9 @@
import assert from "node:assert/strict";
function tags(frame) {
- // This fixture has workspace and column bars in its first two rows.
- return frame.styleRows.flatMap((cells, y) => y > 1 && /^\s{3}\S/.test(frame.lines[y]) && cells.some((cell) => cell[2] & 128) ? [y] : []);
+ // This fixture has workspace and column bars in its first two rows; a
+ // pane's tag text starts after the two-cell marker gutter.
+ return frame.styleRows.flatMap((cells, y) => y > 1 && /^\s{2}\S/.test(frame.lines[y]) && cells.some((cell) => cell[2] & 128) ? [y] : []);
}
function pane(frame, name) {
@@ -13,14 +14,17 @@ function pane(frame, name) {
return { top, bottom, lines: frame.lines.slice(top + 1, bottom) };
}
+// helix's keyword and string/number colours (src/themes/helix.zig).
+const KW = 0xd776f9, STR = 0xf3cd7a;
+
function styled(frame) {
const source = pane(frame, "touch-fixture.zig");
for (const [line, word, fg, bold] of [
- ["pub fn choose", "fn", 0xcf87e8, false],
+ ["pub fn choose", "fn", KW, false],
["pub fn choose", "choose", 0xbdbdbd, false],
- ["if (value", "if", 0xcf87e8, false],
- ["if (value", "42", 0xe3c78a, false],
- ["if (value", '"touch fixture"', 0xe3c78a, false],
+ ["if (value", "if", KW, false],
+ ["if (value", "42", STR, false],
+ ["if (value", '"touch fixture"', STR, false],
]) {
const row = source.lines.findIndex((text) => text.includes(line));
assert(row >= 0, `missing source line ${line}`);
@@ -35,7 +39,7 @@ function styled(frame) {
const number = /\b(\d+),/.exec(line);
if (!number) continue;
for (let x = number.index; x < number.index + number[1].length; x++) {
- assert.equal(frame.styleRows[source.top + 1 + row][x][0], 0xe3c78a, `row ${row} number foreground`);
+ assert.equal(frame.styleRows[source.top + 1 + row][x][0], STR, `row ${row} number foreground`);
}
}
}
@@ -79,7 +83,8 @@ export default async function ({ grid, touch, wait, stable, delay, evaluate, mou
renderer.render();
result.closedGapBorders=borders();
result.borderChangeInvalidates=renderer.layerRoot.firstChild!==withGap;
- const tagValues=[2,2,0,42,1,0,1,1,1,1,0x334455];
+ // The 13 fields of a tag layer: a one-line tag, its caret on line 0.
+ const tagValues=[2,2,0,42,1,0,1,1,1,1,0x334455,1,0];
wasm.pardes_tag_layer_limit=()=>1;
wasm.pardes_tag_layer_value=(_,field)=>tagValues[field];
wasm.pardes_tag_layer_cells=()=>1024;