summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 22:27:44 -0300
committerGabriel Schneider <[email protected]>2026-11-05 23:58:31 -0300
commitf930d53c58187381b2f0df6892546ac1c217c9db (patch)
tree5ca1eea4698b3c14178d2b1ae5d0251c0b884543 /test/panes.zig
parent71e5a0f4a8685b385fac762995d45575b638179f (diff)
downloadpardes-f930d53c58187381b2f0df6892546ac1c217c9db.tar.gz
pardes-f930d53c58187381b2f0df6892546ac1c217c9db.zip
settings #1, Tagbottom goes, a pane's tag at its head the one value anyone used: layout.bodyTop and tagTop, mouse's seam and clampBorderRow, applyRowSplit, body_layer's copy and the tests' row arithmetic lose their other arm (reads deleted in Core.zig, layout.zig, mouse.zig, draw.zig, gui.zig, macos.zig, whose ABI slot 11 says 0 now, and ninep/events.zig, ninep/tree.zig, look.zig, Messages.zig), with the registry row, SPC t b, Help, /commands, the builtins JSON and the reference row; deleted: the snapshot scripts tagbottom, tagbottomshort and tagbottomimage with their goldens, the behaviour test "placement: under Tagbottom a look from a pane's text goes under its text too", the window scene 10-tagbottom with its gui-goldens line and the macOS parity check tags-bottom; tests that ran both ends of the tag run the head; a dump that kept the field loads without it; perf.zig's harness id moves in the two debug baselines (its reads of the field went); the window scenes after 10-tagbottom (12 to 15, 17) take new gui-goldens lines, the two Tagbottom writes gone from the scene and with them their words on the message row (the base window build running the same scenes gives the same frames); gates on tui: core-test 966/966, behaviour-test 243/243, unit-test 1484/1485, pane-test 171/172, snap all 105 scripts ok, process-test 0 of 37 failed; gui unit-test 1529/1530, gui-golden 0 of 1 failed
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig104
1 files changed, 49 insertions, 55 deletions
diff --git a/test/panes.zig b/test/panes.zig
index c1c2ef9b..45302b6f 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -32,45 +32,42 @@ const TagLayerTests = struct {
}
test "compact tag layers render and edit Unicode text beyond body column capacity" {
- for ([_]bool{ false, true }) |bottom| {
- const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 16 });
- defer p.deinit();
- const pane = try p.setTestFile("body\n");
- p.settings.tag_bottom = bottom;
- p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 };
- p.gpa.free(pane.file.?.path);
- pane.file.?.path = try p.gpa.dupe(u8, "/x");
- try setTag(pane, " " ++ &@as([38]u8, @splat('a')) ++ "\t界 END");
- var frame = std.heap.ArenaAllocator.init(p.gpa);
- defer frame.deinit();
- _ = try p.render(frame.allocator());
- const layer = try findLayer(p, .pane, 0);
- const text = try pardes.tagline.tagText(p, frame.allocator(), pane);
- const at = std.mem.indexOf(u8, text, "END").?;
- const col = panes.File.displayWidth(text[0..at]);
- try std.testing.expect(col > p.rects[0].w);
- try std.testing.expect(col + 3 < layer.cols);
- try std.testing.expectEqualStrings("E", layer.cells[col].grapheme());
- try std.testing.expectEqual(@as(u16, 0), pane.tag_scroll);
- const x = @as(f32, @floatFromInt(layer.viewport.x)) * 10 + (@as(f32, @floatFromInt(col)) + 0.5) * 5;
- var stale = mouse(layer, x, .press);
- stale.tag_hit.?.serial +%= 1;
- p.update(.{ .mouse = stale });
- try std.testing.expect(pane.focus == .body);
- p.update(.{ .mouse = mouse(layer, x, .press) });
- p.update(.{ .mouse = mouse(layer, x, .release) });
- try std.testing.expect(pane.focus == .tag);
- try std.testing.expectEqual(at, @as(usize, @intCast(pane.tag.cur_col)));
- // A clicked tag is in normal mode: `i` types where it was clicked.
- p.update(.{ .key = .{ .cp = 'i', .text = "i" } });
- p.update(.{ .key = .{ .cp = 'X', .text = "X" } });
- _ = try p.render(frame.allocator());
- const edited = try pardes.tagline.tagText(p, frame.allocator(), pane);
- try std.testing.expect(std.mem.endsWith(u8, edited, "界 XEND"));
- try std.testing.expectEqual(@as(u16, 0), pane.tag_scroll);
- try std.testing.expectEqualStrings("body\n", pane.file.?.content);
- p.update(.{ .key = .{ .cp = Key.escape } });
- }
+ const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 16 });
+ defer p.deinit();
+ const pane = try p.setTestFile("body\n");
+ p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 };
+ p.gpa.free(pane.file.?.path);
+ pane.file.?.path = try p.gpa.dupe(u8, "/x");
+ try setTag(pane, " " ++ &@as([38]u8, @splat('a')) ++ "\t界 END");
+ var frame = std.heap.ArenaAllocator.init(p.gpa);
+ defer frame.deinit();
+ _ = try p.render(frame.allocator());
+ const layer = try findLayer(p, .pane, 0);
+ const text = try pardes.tagline.tagText(p, frame.allocator(), pane);
+ const at = std.mem.indexOf(u8, text, "END").?;
+ const col = panes.File.displayWidth(text[0..at]);
+ try std.testing.expect(col > p.rects[0].w);
+ try std.testing.expect(col + 3 < layer.cols);
+ try std.testing.expectEqualStrings("E", layer.cells[col].grapheme());
+ try std.testing.expectEqual(@as(u16, 0), pane.tag_scroll);
+ const x = @as(f32, @floatFromInt(layer.viewport.x)) * 10 + (@as(f32, @floatFromInt(col)) + 0.5) * 5;
+ var stale = mouse(layer, x, .press);
+ stale.tag_hit.?.serial +%= 1;
+ p.update(.{ .mouse = stale });
+ try std.testing.expect(pane.focus == .body);
+ p.update(.{ .mouse = mouse(layer, x, .press) });
+ p.update(.{ .mouse = mouse(layer, x, .release) });
+ try std.testing.expect(pane.focus == .tag);
+ try std.testing.expectEqual(at, @as(usize, @intCast(pane.tag.cur_col)));
+ // A clicked tag is in normal mode: `i` types where it was clicked.
+ p.update(.{ .key = .{ .cp = 'i', .text = "i" } });
+ p.update(.{ .key = .{ .cp = 'X', .text = "X" } });
+ _ = try p.render(frame.allocator());
+ const edited = try pardes.tagline.tagText(p, frame.allocator(), pane);
+ try std.testing.expect(std.mem.endsWith(u8, edited, "界 XEND"));
+ try std.testing.expectEqual(@as(u16, 0), pane.tag_scroll);
+ try std.testing.expectEqualStrings("body\n", pane.file.?.content);
+ p.update(.{ .key = .{ .cp = Key.escape } });
}
test "compact tag pointer keeps physical grips and adjacent header ownership" {
@@ -838,22 +835,19 @@ const TagNameTintTests = struct {
// A file pane's is test/behaviour/tags.zig's; a search pane's needs
// results put in through fillResults.
test "tag filename tint of a search pane excludes its directory and command" {
- for ([_]bool{ false, true }) |bottom| {
- const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 24 });
- defer p.deinit();
- p.locations_config.layout = .@"inline";
- const pane = try p.setTestFile("body\n");
- p.gpa.free(pane.file.?.path);
- pane.file.?.path = try p.gpa.dupe(u8, "/project/界file.zig");
- pane.file.?.revision += 1;
- configure(p);
- defer p.custom_theme = null;
- p.settings.tag_bottom = bottom;
- try panes.Output.fillResults(p, 0, "/project", .search, "tint", try p.gpa.dupe(u8, "no matches\n"), null);
- const id = pane.search_pane.?;
- p.update(.tick);
- try std.testing.expect((try check(p, id, p.panes[id].?.file.?.path)) > 0);
- }
+ const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 24 });
+ defer p.deinit();
+ p.locations_config.layout = .@"inline";
+ const pane = try p.setTestFile("body\n");
+ p.gpa.free(pane.file.?.path);
+ pane.file.?.path = try p.gpa.dupe(u8, "/project/界file.zig");
+ pane.file.?.revision += 1;
+ configure(p);
+ defer p.custom_theme = null;
+ try panes.Output.fillResults(p, 0, "/project", .search, "tint", try p.gpa.dupe(u8, "no matches\n"), null);
+ const id = pane.search_pane.?;
+ p.update(.tick);
+ try std.testing.expect((try check(p, id, p.panes[id].?.file.?.path)) > 0);
}
test "tag filename tint follows wrapped Unicode drafted names and yields to selection" {