summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 11:05:00 -0300
committerGabriel Schneider <[email protected]>2026-11-04 11:07:13 -0300
commitfa3031d6ded24d4ba7ab5bab21e17387e48306aa (patch)
tree0817370a9560696cadc6a5ef457aa1fbb0a713b4 /src
parent273cbd0df9d8edf4725fdff5f9da560b35b63058 (diff)
downloadpardes-fa3031d6ded24d4ba7ab5bab21e17387e48306aa.tar.gz
pardes-fa3031d6ded24d4ba7ab5bab21e17387e48306aa.zip
test: src/pardes.zig's two acme-placement tests through the 9P tree alone, in test/behaviour/placement.zig: a look from a pane's text going under its three lines when most of it is blank, and, both panes full, halving the biggest (the new pane after it in /layout, its tag at the old pane's middle row, its bottom the old pane's); a look from the middle of a column (its top and bottom panes dragged by their boxes to two and three rows, under a placement's minimum) splitting only the pane it came from, the short ones keeping their rows, through a Newcol too; geometry read from where /screen draws each tag, on a 100x60 screen set by size; each checked to fail against a break (no placement under the text, the biggest split at a third, every pane in the column reweighted at a split)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src')
-rw-r--r--src/pardes.zig73
1 files changed, 0 insertions, 73 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 2b4fef70..f78c2c0d 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -1195,79 +1195,6 @@ test "first document keeps its originating shell and only opens a column when it
}
}
-test "acme placement: under a pane's text when it has many blank rows, else halving the biggest" {
- const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 60 });
- defer p.deinit();
- const top = p.active;
- _ = try p.setTestFile("one\ntwo\nthree\n");
- p.sync();
- p.setActiveColumn(0);
- // Most of the pane is blank: a document looked from it starts under its
- // three lines (makenewwindow, util.c:482-486).
- const second = p.freeSlot().?;
- _ = try p.openTutorView(second);
- exec.placeNew(p, top, top, second, .doc);
- p.sync();
- const text_end = p.bodyTop(p.panes[top].?, p.rects[top]) + 3;
- try std.testing.expectEqual(text_end, p.rects[second].y);
- // Fill both with text: no blank space is big, so the biggest pane is
- // halved.
- const full = std.mem.asBytes(&@as([80][2]u8, @splat("x\n".*)));
- for ([_]usize{ top, second }) |id| panes.File.setContent(p, &p.panes[id].?.file.?, try p.gpa.dupe(u8, full));
- p.sync();
- const big = if (p.rects[second].h >= p.rects[top].h) second else top;
- const was = p.rects[big];
- const third = p.freeSlot().?;
- _ = try p.openTutorView(third);
- exec.placeNew(p, second, second, third, .doc);
- p.sync();
- try std.testing.expectEqual(big, p.col_panes[0][layout.findPane(p, third).?.idx - 1]);
- try std.testing.expectEqual(was.y + was.h / 2, p.rects[third].y);
- try std.testing.expectEqual(was.y + was.h, p.rects[third].y + p.rects[third].h);
-}
-
-test "acme placement: a pane made from the middle of a column moves only the one it splits, short ones round it kept short" {
- const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 60 });
- defer p.deinit();
- const top = p.active;
- _ = try p.setTestFile("one\n");
- p.sync();
- p.setActiveColumn(0);
- const middle = p.freeSlot().?;
- _ = try p.openTutorView(middle);
- exec.placeNew(p, top, top, middle, .doc);
- const bottom = p.freeSlot().?;
- _ = try p.openTutorView(bottom);
- exec.placeNew(p, middle, middle, bottom, .doc);
- p.sync();
- // A short pane above and below, dragged under a placement's minimum,
- // and the middle one full of text, so it is the one halved.
- const full = std.mem.asBytes(&@as([80][2]u8, @splat("x\n".*)));
- for ([_]usize{ top, middle, bottom }) |id| panes.File.setContent(p, &p.panes[id].?.file.?, try p.gpa.dupe(u8, full));
- try std.testing.expectEqualSlices(usize, &.{ top, middle, bottom }, p.col_panes[0][0..3]);
- const total = p.rects[top].h + p.rects[middle].h + p.rects[bottom].h;
- p.panes[top].?.vweight = 2;
- p.panes[bottom].?.vweight = 2;
- p.panes[middle].?.vweight = @floatFromInt(total - 4);
- p.sync();
- const was_top = p.rects[top];
- const was_bottom = p.rects[bottom];
- try std.testing.expect(was_top.h < layout.minRows(p, top));
- const made = p.freeSlot().?;
- _ = try p.openTutorView(made);
- exec.placeNew(p, middle, middle, made, .doc);
- p.sync();
- try std.testing.expectEqual(layout.findPane(p, middle).?.idx + 1, layout.findPane(p, made).?.idx);
- try std.testing.expectEqual(was_top, p.rects[top]);
- try std.testing.expectEqual(was_bottom, p.rects[bottom]);
- // A new column narrows this one, and the short panes keep their rows.
- try std.testing.expect(p.executeBuiltinLine(made, "Newcol"));
- p.sync();
- try std.testing.expectEqual(@as(usize, 2), p.ncol);
- try std.testing.expectEqual(was_top.h, p.rects[top].h);
- try std.testing.expectEqual(was_bottom.h, p.rects[bottom].h);
-}
-
test "an empty column shows its theme's empty_col under its tag: acme's white, else the border" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 20 });
defer p.deinit();