terminal: scrollDown dirty tests

This commit is contained in:
Mitchell Hashimoto
2024-04-16 11:10:08 -07:00
parent bd1a7d3db1
commit b46e028069

View File

@ -4987,11 +4987,15 @@ test "Terminal: scrollDown simple" {
try t.linefeed();
try t.printString("GHI");
t.setCursorPos(2, 2);
const cursor = t.screen.cursor;
t.clearDirty();
t.scrollDown(1);
try testing.expectEqual(cursor.x, t.screen.cursor.x);
try testing.expectEqual(cursor.y, t.screen.cursor.y);
for (0..5) |y| try testing.expect(t.isDirty(.{ .active = .{ .x = 0, .y = y } }));
{
const str = try t.plainString(testing.allocator);
defer testing.allocator.free(str);
@ -5013,11 +5017,18 @@ test "Terminal: scrollDown outside of scroll region" {
try t.printString("GHI");
t.setTopAndBottomMargin(3, 4);
t.setCursorPos(2, 2);
const cursor = t.screen.cursor;
t.clearDirty();
t.scrollDown(1);
try testing.expectEqual(cursor.x, t.screen.cursor.x);
try testing.expectEqual(cursor.y, t.screen.cursor.y);
try testing.expect(!t.isDirty(.{ .active = .{ .x = 0, .y = 0 } }));
try testing.expect(!t.isDirty(.{ .active = .{ .x = 0, .y = 1 } }));
try testing.expect(t.isDirty(.{ .active = .{ .x = 0, .y = 2 } }));
try testing.expect(t.isDirty(.{ .active = .{ .x = 0, .y = 3 } }));
{
const str = try t.plainString(testing.allocator);
defer testing.allocator.free(str);
@ -5040,11 +5051,15 @@ test "Terminal: scrollDown left/right scroll region" {
t.scrolling_region.left = 1;
t.scrolling_region.right = 3;
t.setCursorPos(2, 2);
const cursor = t.screen.cursor;
t.clearDirty();
t.scrollDown(1);
try testing.expectEqual(cursor.x, t.screen.cursor.x);
try testing.expectEqual(cursor.y, t.screen.cursor.y);
for (0..4) |y| try testing.expect(t.isDirty(.{ .active = .{ .x = 0, .y = y } }));
{
const str = try t.plainString(testing.allocator);
defer testing.allocator.free(str);
@ -5067,11 +5082,15 @@ test "Terminal: scrollDown outside of left/right scroll region" {
t.scrolling_region.left = 1;
t.scrolling_region.right = 3;
t.setCursorPos(1, 1);
const cursor = t.screen.cursor;
t.clearDirty();
t.scrollDown(1);
try testing.expectEqual(cursor.x, t.screen.cursor.x);
try testing.expectEqual(cursor.y, t.screen.cursor.y);
for (0..4) |y| try testing.expect(t.isDirty(.{ .active = .{ .x = 0, .y = y } }));
{
const str = try t.plainString(testing.allocator);
defer testing.allocator.free(str);