summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig28
1 files changed, 23 insertions, 5 deletions
diff --git a/test/panes.zig b/test/panes.zig
index ca53af3d..42dd6b77 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -4891,7 +4891,7 @@ test {
_ = LookResetTests;
}
-test "a terminal's pty follows its pane down to its last row" {
+test "a terminal keeps its tag and two body rows through a squeeze, a drag and a smaller window; a text pane does not" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 });
defer p.deinit();
p.presentation.enabled = false;
@@ -4903,16 +4903,34 @@ test "a terminal's pty follows its pane down to its last row" {
p.newScratchBelow(term);
p.sync();
while (p.nextEffect()) |_| {}
- // The terminal squeezed to its tag alone, folded by nobody.
+ const col = layout.findPane(p, term).?.col;
+ const floor = p.panes[term].?.tag_rows + layout.min_body_rows;
+ // Squeezed by the weights: the others give it its floor.
p.panes[term].?.vweight = 0.01;
- for (p.col_panes[0][0..p.col_n[0]]) |k| if (k != term) {
+ for (p.col_panes[col][0..p.col_n[col]]) |k| if (k != term) {
p.panes[k].?.vweight = 1000;
};
p.sync();
- try std.testing.expect(p.rects[term].h <= p.panes[term].?.tag_rows);
+ try std.testing.expectEqual(floor, p.rects[term].h);
var rows: ?u16 = null;
while (p.nextEffect()) |effect| if (effect == .resize_pty and effect.resize_pty.pane == term) {
rows = effect.resize_pty.rows;
};
- try std.testing.expectEqual(@as(?u16, 1), rows);
+ try std.testing.expectEqual(@as(?u16, layout.min_body_rows), rows);
+ // A drag of the grip under it up to its tag stops at the floor; one
+ // the other way takes a text pane down to its tag alone.
+ const k = layout.findPane(p, term).?.idx;
+ if (k + 1 < p.col_n[col]) {
+ layout.applyRowSplit(p, col, k, p.rects[term].y);
+ p.sync();
+ try std.testing.expectEqual(floor, p.rects[term].h);
+ const text = p.col_panes[col][k + 1];
+ layout.applyRowSplit(p, col, k, p.screen_h);
+ p.sync();
+ try std.testing.expect(p.rects[text].h <= p.panes[text].?.tag_rows);
+ }
+ // A window too short for all: the terminal keeps its floor still.
+ p.update(.{ .resize = .{ .cols = 100, .rows = 10 } });
+ p.sync();
+ try std.testing.expect(p.rects[term].h >= p.panes[term].?.tag_rows + layout.min_body_rows);
}