summaryrefslogtreecommitdiff
path: root/test/web-snapshots/touch.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'test/web-snapshots/touch.mjs')
-rw-r--r--test/web-snapshots/touch.mjs21
1 files changed, 13 insertions, 8 deletions
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;