summaryrefslogtreecommitdiff
path: root/test/behaviour/placement.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-03 17:22:47 -0300
committerGabriel Schneider <[email protected]>2026-11-03 17:24:11 -0300
commit3632bbeaa75f912281d0c9d636feb153d04f668e (patch)
treedd3e91c78036b3c168c71b030047f42a9b55aa31 /test/behaviour/placement.zig
parent5cc02232d522d5cd5a453caedd1e592ca20471ea (diff)
downloadpardes-3632bbeaa75f912281d0c9d636feb153d04f668e.tar.gz
pardes-3632bbeaa75f912281d0c9d636feb153d04f668e.zip
test: five more of src/pardes.zig's tests through the 9P tree alone (test/behaviour/placement, panes, terminals, modes): an empty active column taking a look from another column's text whole, Collapse folding a pane to its tag (no text drawn, no cursor, its tag still typed into) and restoring it, a pane its whole text fits in never scrolled for a margin, Togglettymode and Ctrl-B sharing the mode's transitions from the body or the tag and a text pane refusing it, Esc back into a file keeping its view where a look's :N centres; Session's where (the first place /screen draws a text); each checked to fail against a break (acmeColumn ignoring the active column, toggleCollapse never unfolding, the scroll margin clamped at the last line alone, toggleTty leaving the tag the keyboard, Last landing centred)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/behaviour/placement.zig')
-rw-r--r--test/behaviour/placement.zig24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/behaviour/placement.zig b/test/behaviour/placement.zig
new file mode 100644
index 00000000..350e94f8
--- /dev/null
+++ b/test/behaviour/placement.zig
@@ -0,0 +1,24 @@
+//! docs/typ/reference.typ, Placement <placement>.
+const std = @import("std");
+const Session = @import("session").Session;
+
+test "placement: an empty active column takes the new pane whole, a look from another column's text too" {
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "f.txt", .data = "f\n" });
+ var dir: [4096]u8 = undefined;
+ const at = dir[0..try tmp.dir.realPath(std.testing.io, &dir)];
+ var s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ const first = try s.focused();
+ // Its tag has the keyboard: it is the active column, and stays so
+ // when Esc gives the keyboard back.
+ try s.write("/ctl", "Newcol\n");
+ try s.keys("\x1b");
+ try std.testing.expectEqual(first, try s.focused());
+ // A look from the first pane's text still lands in the active column,
+ // as acme's makenewwindow puts it in activecol first (util.c:456).
+ try s.write(s.at("/pane/{d}/look", .{first}), s.at("{s}/f.txt\n", .{at}));
+ const made = try s.focused();
+ try std.testing.expectEqualStrings(s.at("{d}:{d} {d}:{d}", .{ try s.column(0), first, try s.column(1), made }), try s.columns());
+}