mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
terminal: scrollDown dirty tests
This commit is contained in:
@ -4987,11 +4987,15 @@ test "Terminal: scrollDown simple" {
|
|||||||
try t.linefeed();
|
try t.linefeed();
|
||||||
try t.printString("GHI");
|
try t.printString("GHI");
|
||||||
t.setCursorPos(2, 2);
|
t.setCursorPos(2, 2);
|
||||||
|
|
||||||
const cursor = t.screen.cursor;
|
const cursor = t.screen.cursor;
|
||||||
|
t.clearDirty();
|
||||||
t.scrollDown(1);
|
t.scrollDown(1);
|
||||||
try testing.expectEqual(cursor.x, t.screen.cursor.x);
|
try testing.expectEqual(cursor.x, t.screen.cursor.x);
|
||||||
try testing.expectEqual(cursor.y, t.screen.cursor.y);
|
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);
|
const str = try t.plainString(testing.allocator);
|
||||||
defer testing.allocator.free(str);
|
defer testing.allocator.free(str);
|
||||||
@ -5013,11 +5017,18 @@ test "Terminal: scrollDown outside of scroll region" {
|
|||||||
try t.printString("GHI");
|
try t.printString("GHI");
|
||||||
t.setTopAndBottomMargin(3, 4);
|
t.setTopAndBottomMargin(3, 4);
|
||||||
t.setCursorPos(2, 2);
|
t.setCursorPos(2, 2);
|
||||||
|
|
||||||
const cursor = t.screen.cursor;
|
const cursor = t.screen.cursor;
|
||||||
|
t.clearDirty();
|
||||||
t.scrollDown(1);
|
t.scrollDown(1);
|
||||||
try testing.expectEqual(cursor.x, t.screen.cursor.x);
|
try testing.expectEqual(cursor.x, t.screen.cursor.x);
|
||||||
try testing.expectEqual(cursor.y, t.screen.cursor.y);
|
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);
|
const str = try t.plainString(testing.allocator);
|
||||||
defer testing.allocator.free(str);
|
defer testing.allocator.free(str);
|
||||||
@ -5040,11 +5051,15 @@ test "Terminal: scrollDown left/right scroll region" {
|
|||||||
t.scrolling_region.left = 1;
|
t.scrolling_region.left = 1;
|
||||||
t.scrolling_region.right = 3;
|
t.scrolling_region.right = 3;
|
||||||
t.setCursorPos(2, 2);
|
t.setCursorPos(2, 2);
|
||||||
|
|
||||||
const cursor = t.screen.cursor;
|
const cursor = t.screen.cursor;
|
||||||
|
t.clearDirty();
|
||||||
t.scrollDown(1);
|
t.scrollDown(1);
|
||||||
try testing.expectEqual(cursor.x, t.screen.cursor.x);
|
try testing.expectEqual(cursor.x, t.screen.cursor.x);
|
||||||
try testing.expectEqual(cursor.y, t.screen.cursor.y);
|
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);
|
const str = try t.plainString(testing.allocator);
|
||||||
defer testing.allocator.free(str);
|
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.left = 1;
|
||||||
t.scrolling_region.right = 3;
|
t.scrolling_region.right = 3;
|
||||||
t.setCursorPos(1, 1);
|
t.setCursorPos(1, 1);
|
||||||
|
|
||||||
const cursor = t.screen.cursor;
|
const cursor = t.screen.cursor;
|
||||||
|
t.clearDirty();
|
||||||
t.scrollDown(1);
|
t.scrollDown(1);
|
||||||
try testing.expectEqual(cursor.x, t.screen.cursor.x);
|
try testing.expectEqual(cursor.x, t.screen.cursor.x);
|
||||||
try testing.expectEqual(cursor.y, t.screen.cursor.y);
|
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);
|
const str = try t.plainString(testing.allocator);
|
||||||
defer testing.allocator.free(str);
|
defer testing.allocator.free(str);
|
||||||
|
Reference in New Issue
Block a user