diff options
Diffstat (limited to 'test/process/window.zig')
| -rw-r--r-- | test/process/window.zig | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/test/process/window.zig b/test/process/window.zig index 59c84616..292e0e00 100644 --- a/test/process/window.zig +++ b/test/process/window.zig @@ -8,6 +8,7 @@ const process = @import("../process.zig"); pub const cases = .{ .{ "window: a monkey over the effects: random clicks, drags, wheels, keys, columns, looks and themes, then it settles, alive, with no crash record", monkey }, .{ "window: its frame corpus, every kept frame and its sha256 into PARDES_GUI_CORPUS, to compare two builds on one machine", corpus }, + .{ "window: a lone Esc written to its test stdin is the Escape key at once, the key written after it its own", loneEscape }, }; fn envOr(name: [*:0]const u8, default: []const u8) []const u8 { @@ -193,6 +194,25 @@ fn bodyHas(f: *process.Files, serial: u32, word: []const u8) !void { if (process.nowMs() > deadline) return error.NoOutput; } +/// A lone Esc a driver writes to the window's stdin, as its keys come: +/// the Escape key at once. Held for the next write (DESIGN D15, POLISH 16), +/// that write's `A` came as Alt-A and its `y` was typed where insert mode +/// still was. +fn loneEscape(gpa: std.mem.Allocator, exe: [:0]const u8) !void { + try process.only(.gui); + var d = try process.Detached.start(gpa, exe, "loneesc", .{}); + defer d.deinit(); + const f = &d.files; + const pane = try paneWith(f, "loneesc.txt"); + try d.typeKeys("ix"); + try d.settle(gpa); + try d.typeKeys("\x1b"); + try d.settle(gpa); + try d.typeKeys("Ay"); + try d.settle(gpa); + try std.testing.expectEqualStrings("xinitialy\n", try f.read(f.at("/pane/{d}/body", .{pane}))); +} + extern "c" fn system(cmd: [*:0]const u8) c_int; extern "c" fn ioctl(fd: c_int, request: c_ulong, ...) c_int; @@ -402,10 +422,10 @@ fn corpus(gpa: std.mem.Allocator, exe: [:0]const u8) !void { defer arena.deinit(); const a = arena.allocator(); defer _ = system("rm -rf -- /tmp/pardes-gui-corpus"); - // Its Looks open panes and Del them by serial, as `Jumps new-pane` - // does (SPEC ยง6.6): under walk a file pane steps in place, a new - // serial, and the frames would not be the base's to compare. - const init = "Shell /bin/sh\nTheme forge\nMessageLinger 0\nCursorBlink off\nJumps new-pane\n"; + // Jumps walk, the default: the file pane's Looks at files step it in + // place, the same pane (its serial kept, Trail.show); a picture's and a + // PDF's open panes of their own. + const init = "Shell /bin/sh\nTheme forge\nMessageLinger 0\nCursorBlink off\n"; var k: Corpus = .{ .gpa = gpa, .a = a, .out = out }; { try corpusRoot(a); @@ -474,7 +494,8 @@ fn corpus(gpa: std.mem.Allocator, exe: [:0]const u8) !void { const image = try paneWith(f, "ramp.ppm"); try k.keep(&d, 0, "09 an image pane", false); try f.write(f.at("/pane/{d}/exec", .{image}), "Del\n"); - try f.write(f.at("/pane/{d}/exec", .{notes}), "Del\n"); + // The file pane walks back to shapes.zig (its trail's step). + try f.write(f.at("/pane/{d}/look", .{notes}), root ++ "/shapes.zig\n"); try f.write(f.at("/pane/{d}/look", .{first}), root ++ "/doc.pdf\n"); _ = try paneWith(f, "doc.pdf"); try k.keep(&d, 0, "09 a PDF pane", false); |
