terminal/new: couple missing tests

This commit is contained in:
Mitchell Hashimoto
2024-02-25 21:48:51 -08:00
parent 977f079fdd
commit 805abd4e29
2 changed files with 50 additions and 0 deletions

View File

@ -5141,6 +5141,7 @@ test "Terminal: deleteChars split wide character tail" {
}
}
// X
test "Terminal: eraseChars resets pending wrap" {
const alloc = testing.allocator;
var t = try init(alloc, 5, 5);
@ -5159,6 +5160,7 @@ test "Terminal: eraseChars resets pending wrap" {
}
}
// X
test "Terminal: eraseChars resets wrap" {
const alloc = testing.allocator;
var t = try init(alloc, 5, 5);

View File

@ -2848,6 +2848,54 @@ test "Terminal: eraseChars wide character" {
}
}
test "Terminal: eraseChars resets pending wrap" {
const alloc = testing.allocator;
var t = try init(alloc, 5, 5);
defer t.deinit(alloc);
for ("ABCDE") |c| try t.print(c);
try testing.expect(t.screen.cursor.pending_wrap);
t.eraseChars(1);
try testing.expect(!t.screen.cursor.pending_wrap);
try t.print('X');
{
const str = try t.plainString(testing.allocator);
defer testing.allocator.free(str);
try testing.expectEqualStrings("ABCDX", str);
}
}
test "Terminal: eraseChars resets wrap" {
const alloc = testing.allocator;
var t = try init(alloc, 5, 5);
defer t.deinit(alloc);
for ("ABCDE123") |c| try t.print(c);
{
const list_cell = t.screen.pages.getCell(.{ .active = .{ .x = 0, .y = 0 } }).?;
const row = list_cell.row;
try testing.expect(row.wrap);
}
t.setCursorPos(1, 1);
t.eraseChars(1);
{
const list_cell = t.screen.pages.getCell(.{ .active = .{ .x = 0, .y = 0 } }).?;
const row = list_cell.row;
try testing.expect(!row.wrap);
}
try t.print('X');
{
const str = try t.plainString(testing.allocator);
defer testing.allocator.free(str);
try testing.expectEqualStrings("XBCDE\n123", str);
}
}
test "Terminal: reverseIndex" {
const alloc = testing.allocator;
var t = try init(alloc, 2, 5);