summaryrefslogtreecommitdiff
path: root/test/process/window.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/process/window.zig')
-rw-r--r--test/process/window.zig20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/process/window.zig b/test/process/window.zig
index 2a1331ad..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;