diff options
| author | Gabriel Schneider <[email protected]> | 2026-07-03 14:43:30 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-01 15:02:07 -0300 |
| commit | d1ed5bd8f55935e6470c4a7559216119571a084f (patch) | |
| tree | 434478ce8a5dcd9aed367334816f54da9953e56d /tests.zig | |
| parent | 153f0a88862507cf1f5dda71f71db3d6649dfeaa (diff) | |
| download | pardes-d1ed5bd8f55935e6470c4a7559216119571a084f.tar.gz pardes-d1ed5bd8f55935e6470c4a7559216119571a084f.zip | |
fixed scaling and fitting on web ui
Diffstat (limited to 'tests.zig')
| -rw-r--r-- | tests.zig | 54 |
1 files changed, 52 insertions, 2 deletions
@@ -67,6 +67,40 @@ fn writeReplayFixture(io: std.Io, gpa: std.mem.Allocator, path: []const u8) !voi }); } +fn writeReplayScrollFixture(io: std.Io, gpa: std.mem.Allocator, path: []const u8) !void { + var file_content: std.ArrayList(u8) = .empty; + defer file_content.deinit(gpa); + var line_no: usize = 1; + while (line_no <= 80) : (line_no += 1) { + const line = try std.fmt.allocPrint(gpa, "replay scroll line {d}\n", .{line_no}); + defer gpa.free(line); + try file_content.appendSlice(gpa, line); + } + const content_b64 = try dump.encodeBytes(gpa, file_content.items); + defer gpa.free(content_b64); + const panes = [_]dump.Pane{.{ + .kind = .file, + .tag = "nm /tmp/replay_scroll_fixture.zig Save Del", + .body = "", + .cols = 78, + .rows = 22, + .file = .{ + .path = "/tmp/replay_scroll_fixture.zig", + .content = file_content.items, + .content_b64 = content_b64, + }, + }}; + const col_panes = [_]usize{0}; + const columns = [_]dump.Column{.{ .weight = 1, .panes = &col_panes }}; + try dump.writeFile(io, gpa, path, .{ + .screen = .{ .cols = 80, .rows = 24 }, + .topbar = "Kill Newcol Tutor Debug Colors NextColor Dump", + .theme = "dark", + .columns = &columns, + .panes = &panes, + }); +} + fn writeReplayImageFixture(io: std.Io, gpa: std.mem.Allocator, path: []const u8) !void { const png_b64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII="; const panes = [_]dump.Pane{.{ @@ -178,6 +212,22 @@ pub fn main(init: std.process.Init) !void { try replay_file.expectNotContains("\xc2\xaa", "replay file line numbers used invalid stack bytes"); } { + const fixture_path = "/tmp/pardes-replay-scroll-fixture.zon"; + try writeReplayScrollFixture(io, gpa, fixture_path); + var replay_scroll = try Harness.initArgs(gpa, replay_exe.ptr, 24, 80, fixture_path); + replay_scroll.trace = config.trace; + defer replay_scroll.deinit(); + try replay_scroll.pump(1200); + try replay_scroll.expectContains(" 1 replay scroll line 1", "replay scrollbar fixture did not start at the top"); + try replay_scroll.send("\x1b[<2;1;23M\x1b[<2;1;23m"); + try replay_scroll.pump(300); + try replay_scroll.expectContains(" 21 replay scroll line 21", "replay right-click scrollbar did not scroll down"); + try replay_scroll.expectNotContains(" 1 replay scroll line 1", "replay right-click scrollbar left the top line visible"); + try replay_scroll.send("\x1b[<0;1;23M\x1b[<0;1;23m"); + try replay_scroll.pump(300); + try replay_scroll.expectContains(" 1 replay scroll line 1", "replay left-click scrollbar did not scroll back up"); + } + { const fixture_path = "/tmp/pardes-replay-image.zon"; try writeReplayImageFixture(io, gpa, fixture_path); var replay_image = try Harness.initArgs(gpa, replay_exe.ptr, 24, 80, fixture_path); @@ -417,13 +467,13 @@ pub fn main(init: std.process.Init) !void { } try hs.resize(30, 100); // clean geometry (right column starts ~col 51) try hs.pump(700); // settle the reflow - try hs.send("\x1b[<0;60;19M\x1b[<0;60;19m"); // left-click a blank row well below the ls output, right column -> normal + pin (+1 row: global tagbar) + try hs.send("\x1b[<0;60;26M\x1b[<0;60;26m"); // left-click a blank row well below the ls output, right column -> normal + pin (+1 row: global tagbar) try hs.pump(400); try hs.send("i"); // normal -> insert so typing composes the path:line try hs.pump(400); try hs.send("/tmp/pardesE2Efile.txt:150"); try hs.pump(800); // build the run - try hs.send("\x1b[<2;70;19M\x1b[<2;70;19m"); // right-click on the typed path (+1 row: global tagbar) + try hs.send("\x1b[<2;70;26M\x1b[<2;70;26m"); // right-click on the typed path (+1 row: global tagbar) try hs.expectWaitFor("ZZDEEPMARK", 20000, "right-click 'path:150' did not open the file scrolled to line 150"); try hs.expectContains("Save Del", "file pane tag did not include the default Save command"); try hs.expectNotContains("Delcol", "Delcol is still shown in the default pane tag"); |
