mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
terminal/new: more no reflow tests
This commit is contained in:
@ -6226,6 +6226,7 @@ test "Screen: resize (no reflow) less rows with scrollback" {
|
||||
}
|
||||
}
|
||||
|
||||
// X
|
||||
// https://github.com/mitchellh/ghostty/issues/1030
|
||||
test "Screen: resize (no reflow) less rows with empty trailing" {
|
||||
const testing = std.testing;
|
||||
@ -6251,6 +6252,7 @@ test "Screen: resize (no reflow) less rows with empty trailing" {
|
||||
}
|
||||
}
|
||||
|
||||
// X
|
||||
test "Screen: resize (no reflow) empty screen" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
@ -6268,6 +6270,7 @@ test "Screen: resize (no reflow) empty screen" {
|
||||
try testing.expectEqual(@as(usize, 10), s.rowsCapacity());
|
||||
}
|
||||
|
||||
// X
|
||||
test "Screen: resize (no reflow) grapheme copy" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
@ -2158,3 +2158,24 @@ test "PageList resize (no reflow) more rows and less cols" {
|
||||
try testing.expectEqual(@as(usize, 5), cells.len);
|
||||
}
|
||||
}
|
||||
|
||||
test "PageList resize (no reflow) empty screen" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
var s = try init(alloc, 5, 5, 0);
|
||||
defer s.deinit();
|
||||
|
||||
// Resize
|
||||
try s.resize(.{ .cols = 10, .rows = 10, .reflow = false });
|
||||
try testing.expectEqual(@as(usize, 10), s.cols);
|
||||
try testing.expectEqual(@as(usize, 10), s.rows);
|
||||
try testing.expectEqual(@as(usize, 10), s.totalRows());
|
||||
|
||||
var it = s.rowIterator(.{ .screen = .{} }, null);
|
||||
while (it.next()) |offset| {
|
||||
const rac = offset.rowAndCell(0);
|
||||
const cells = offset.page.data.getCells(rac.row);
|
||||
try testing.expectEqual(@as(usize, 10), cells.len);
|
||||
}
|
||||
}
|
||||
|
@ -1971,3 +1971,28 @@ test "Screen: resize (no reflow) less rows with scrollback" {
|
||||
try testing.expectEqualStrings(expected, contents);
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/mitchellh/ghostty/issues/1030
|
||||
test "Screen: resize (no reflow) less rows with empty trailing" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
var s = try init(alloc, 5, 3, 5);
|
||||
defer s.deinit();
|
||||
const str = "1\n2\n3\n4\n5\n6\n7\n8";
|
||||
try s.testWriteString(str);
|
||||
try s.scrollClear();
|
||||
s.cursorAbsolute(0, 0);
|
||||
try s.testWriteString("A\nB");
|
||||
|
||||
const cursor = s.cursor;
|
||||
try s.resizeWithoutReflow(5, 2);
|
||||
try testing.expectEqual(cursor.x, s.cursor.x);
|
||||
try testing.expectEqual(cursor.y, s.cursor.y);
|
||||
|
||||
{
|
||||
const contents = try s.dumpStringAlloc(alloc, .{ .viewport = .{} });
|
||||
defer alloc.free(contents);
|
||||
try testing.expectEqualStrings("A\nB", contents);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user