summaryrefslogtreecommitdiff
path: root/test/process
diff options
context:
space:
mode:
Diffstat (limited to 'test/process')
-rw-r--r--test/process/root_ctl.zig9
-rw-r--r--test/process/tty_boot.zig51
-rw-r--r--test/process/tty_editing.zig8
-rw-r--r--test/process/tty_images.zig3
-rw-r--r--test/process/tty_layout.zig3
-rw-r--r--test/process/tty_terminals.zig12
6 files changed, 61 insertions, 25 deletions
diff --git a/test/process/root_ctl.zig b/test/process/root_ctl.zig
index 979cfc48..7c27d33e 100644
--- a/test/process/root_ctl.zig
+++ b/test/process/root_ctl.zig
@@ -12,7 +12,7 @@ const check = process.check;
pub const cases = .{
.{ "root-ctl: Exit is answered before the editor quits", exitAnswers },
- .{ "root-ctl: with nothing attached a message leaves after MessageLinger on its own clock", messagesExpire },
+ .{ "root-ctl: with nothing attached a message stays on the notice row until the next one: no clock takes it", messagesStay },
.{ "root-ctl: Putall with one pane's file changed on disk fails, answered once the other panes' saves have landed", putallAfterSaves },
.{ "root-ctl: long and odd paths where a path goes (name, look, DumpDir, Dump, Save) are refused or said, never a crash; a bad ThemeFile fails the write", oddPaths },
.{ "root-ctl: Restore asks once about unsaved text, is answered before it cuts every connection, and the dump's panes come back under their serials", restore },
@@ -26,7 +26,7 @@ fn exitAnswers(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
}
/// Nothing attached, no key, no click, no other request comes to move it along.
-fn messagesExpire(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
+fn messagesStay(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// With nothing attached: a window always is.
try process.only(.tui);
var d = try process.Detached.start(gpa, exe, "msg", .{});
@@ -35,7 +35,10 @@ fn messagesExpire(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try expect(has(try d.files.screen(), "lingering-words"));
// Reading /screen is itself a request, so wait without asking.
process.sleep(2500);
- try expect(!has(try d.files.screen(), "lingering-words"));
+ try expect(has(try d.files.screen(), "lingering-words"));
+ try d.files.write("/pane/1/ctl", "Msg next-words\n");
+ const shown = try d.files.screen();
+ try expect(has(shown, "next-words") and !has(shown, "lingering-words"));
}
fn putallAfterSaves(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
diff --git a/test/process/tty_boot.zig b/test/process/tty_boot.zig
index 01b35a24..e342ea46 100644
--- a/test/process/tty_boot.zig
+++ b/test/process/tty_boot.zig
@@ -114,14 +114,17 @@ fn boot(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
fn builtins(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
var t = try Tty.init(gpa, exe, "builtins");
defer t.deinit();
- try t.lines("notes.txt", 6, "");
+ // SPC ? is Help in the tag now (pick-ui SPEC §4.5): the +Help index is
+ // the word's, `Help` run from the workspace's tag, `Help c` swept here.
+ try t.file("notes.txt", "Help c Help h\nline 2\nline 3\nline 4\nline 5\nline 6\n");
try t.start(67, 120, &.{"notes.txt"});
try t.wait(8000, "notes.txt");
try t.stable(700, 20000);
try t.snap("boot");
// The full index includes commands without leader paths.
- try t.key("space ?");
+ try t.press("middle", "@Help", 1);
+ try t.release("middle", "@Help", 1);
try t.wait(10000, "pardes builtins: each one's keys and its name");
try t.wait(10000, "ClipPasteBefore");
// The words with no SPC path come last, each under its documentation:
@@ -141,19 +144,20 @@ fn builtins(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.key("space j n space j n space j n");
try t.wait(10000, "Look enter, right-click");
try t.wait(10000, "Look at its argument as B3 does");
- try t.key("space c ?");
+ try sweepHelp(&t, "@Help#1", 4);
try t.wait(10000, "under SPC c");
try t.wait(10000, "Joincol");
try t.stable(700, 15000);
try t.snap("column-group");
- try t.key("space h ?");
+ try sweepHelp(&t, "@Help#2", 4);
try t.wait(10000, "Tutor");
try t.stable(700, 15000);
try t.snap("docs-group");
- // Tutor's row, under the documentation of the three before it
- try t.press("middle", "@Tutor", 24);
- try t.release("middle", "@Tutor", 24);
+ // Tutor's row, under the documentation of the four before it (Keys,
+ // describe-key, is SPC h k)
+ try t.press("middle", "@Tutor", 30);
+ try t.release("middle", "@Tutor", 30);
try t.wait(10000, "PARDES TUTOR");
try t.stable(700, 15000);
try t.snap("tutor-from-index");
@@ -472,13 +476,18 @@ fn topbarexec(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
fn leader(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
var t = try Tty.init(gpa, exe, "leader");
defer t.deinit();
- try t.file("cmds.txt", "Help");
+ // SPC ? and `?` down a level are Help in the tag now (pick-ui SPEC
+ // §4.5): the +Help index for a group is the word's, `Help h` swept here.
+ try t.file("cmds.txt", "Help Help h Help t Help c Help l");
try t.start(41, 100, &.{"cmds.txt"});
try t.wait(8000, "Newcol Joincol");
try t.wait(8000, "cmds.txt");
try t.stable(700, 20000);
+ // SPC's level, rolled in the tag once its delay is up (a frame on the
+ // clock, which a quiet screen does not wait for)
try t.key("space");
+ try t.wait(5000, "↓ unroll");
try t.stable(400, 5000);
try t.snap("spc");
try t.key("h");
@@ -489,15 +498,21 @@ fn leader(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.stable(400, 5000);
try t.snap("abandoned");
try t.key("space x");
+ try t.wait(5000, "↓ unroll");
try t.stable(400, 5000);
try t.snap("unmapped");
+ // A key the level has no child for is struck and the level stays
+ // (which-key); Esc leaves it.
+ try t.key("esc");
+ try t.settle(100);
+ try t.stable(400, 5000);
// Executing Help as text opens the full index, not a filtered group.
try t.press("middle", "@Help", 4);
try t.release("middle", "@Help", 4);
try t.wait(10000, "pardes builtins: each one's keys and its name");
try t.wait(10000, "ClipPasteBefore");
- try t.key("space h ?");
+ try sweepHelp(&t, "@Help#2", 4);
try t.wait(10000, "under SPC h");
try t.stable(700, 15000);
try t.snap("help-group");
@@ -517,23 +532,24 @@ fn leader(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.key("space d");
try t.stable(700, 15000);
- try t.key("space ?");
+ try t.press("middle", "@Help", 4);
+ try t.release("middle", "@Help", 4);
try t.wait(10000, "pardes builtins: each one's keys and its name");
try t.wait(10000, "ClipPasteBefore");
// PDF commands depend on the build; these toggles do not.
- try t.key("space t ?");
+ try sweepHelp(&t, "@Help#3", 4);
try t.wait(10000, "under SPC t");
// its first rows: each word's documentation under it, the rest below
try t.wait(10000, "SPC t a Ascii");
try t.wait(10000, "SPC t c Changes");
// SPC w is Window itself now, not a group; the column group stands in
- try t.key("space c ?");
+ try sweepHelp(&t, "@Help#4", 4);
try t.wait(10000, "under SPC c");
try t.wait(10000, "Joincol");
try t.stable(700, 15000);
try t.snap("help-column");
- try t.key("space l ?");
+ try sweepHelp(&t, "@Help#5", 4);
try t.wait(10000, "WsDiagnostics");
try t.stable(700, 15000);
try t.snap("help-language");
@@ -544,6 +560,15 @@ fn leader(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.done();
}
+/// B2 swept over `Help <key>` from the word `at` on `row` (its six
+/// cells): the word and its argument run, as a sweep anywhere runs them.
+fn sweepHelp(t: *Tty, at: []const u8, row: u16) !void {
+ const end = try std.fmt.allocPrint(t.arena, "{s}+6", .{at});
+ try t.press("middle", at, row);
+ try t.drag("middle", end, row);
+ try t.release("middle", end, row);
+}
+
fn mini(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
var t = try Tty.init(gpa, exe, "mini");
defer t.deinit();
diff --git a/test/process/tty_editing.zig b/test/process/tty_editing.zig
index 53e1da1e..896a3634 100644
--- a/test/process/tty_editing.zig
+++ b/test/process/tty_editing.zig
@@ -371,7 +371,8 @@ fn chordcut(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// unrelated right column untouched. Give the caller enough cells that the selected
// `echo B''OO g.txt` remains one displayed row; this test is about chords, not
// soft-wrap traversal.
- try t.start(31, 120, &.{ "-n", "3" });
+ // A row more than its panes take: the notice row under them.
+ try t.start(32, 120, &.{ "-n", "3" });
try t.wait(8000, "f.txt");
try t.stable(700, 20000);
// open f.txt: click a body spot, type the name, look it
@@ -608,9 +609,12 @@ fn find(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.start(41, 120, &.{"here.txt"});
try t.wait(8000, "here.txt");
try t.stable(700, 20000);
- // SPC f is a group (Find, New, Save, Recent, Grep): the indicator waits
+ // SPC f is a group (Find, New, Save, Recent, Grep): its level rolled in
+ // the tag once SPC's delay is up (a frame on the clock, which a quiet
+ // screen does not wait for)
try t.key("space");
try t.key("f");
+ try t.wait(5000, "↓ unroll");
try t.stable(400, 5000);
try t.snap("group");
// the second f opens the query pane: every file listed, line 1 `Find `
diff --git a/test/process/tty_images.zig b/test/process/tty_images.zig
index 5c39d4f3..9c37a40d 100644
--- a/test/process/tty_images.zig
+++ b/test/process/tty_images.zig
@@ -15,7 +15,8 @@ fn images(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
var t = try Tty.init(gpa, exe, "images");
defer t.deinit();
try t.ppmDiag("pic.ppm");
- try t.start(31, 150, &.{ "-n", "3" });
+ // A row more than its panes take: the notice row under them.
+ try t.start(32, 150, &.{ "-n", "3" });
try t.wait(8000, "pic.ppm");
try t.stable(700, 20000);
try t.press("left", "5", 9);
diff --git a/test/process/tty_layout.zig b/test/process/tty_layout.zig
index 08a02488..3c50b8a5 100644
--- a/test/process/tty_layout.zig
+++ b/test/process/tty_layout.zig
@@ -290,7 +290,8 @@ fn layout_open(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
defer t.deinit();
try t.dir("sub");
try t.file("sub/f.txt", "echo 'TTY'OK");
- try t.start(31, 100, &.{ "-n", "3" });
+ // A row more than its panes take: the notice row under them.
+ try t.start(32, 100, &.{ "-n", "3" });
try t.wait(8000, "sub");
try t.stable(700, 20000);
// give pane 0 (top-left) some content so its content-height split is visible
diff --git a/test/process/tty_terminals.zig b/test/process/tty_terminals.zig
index 9f7c9308..838b2aea 100644
--- a/test/process/tty_terminals.zig
+++ b/test/process/tty_terminals.zig
@@ -226,12 +226,13 @@ fn ttyhelp(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// row 0, which is not a pane, so the terminal never saw it.
try t.key("c-b");
try t.stable(600, 10000);
+ // SPC ? is Help in the focused pane's tag (pick-ui SPEC §4.5): a field
+ // typed in, the leaves it matches in rows under the tag, the cursor's
+ // documentation beside them.
try t.key("space");
try t.key("?");
- // The bare-tty boot now opens an empty pane under the shell, so the index is
- // half as tall: wait on a row that is on screen. What the leader route
- // produced is the snapshot below, not this.
- try t.wait(10000, "SPC ? Help");
+ try t.send("tutor");
+ try t.wait(10000, "SPC h t · Tutor · help");
try t.stable(700, 15000);
try t.snap("leaderworks");
try t.done();
@@ -590,7 +591,8 @@ fn reflow(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
fn respawn(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
var t = try Tty.init(gpa, exe, "respawn");
defer t.deinit();
- try t.start(31, 140, &.{ "-n", "3" });
+ // A row more than its panes take: the notice row under them.
+ try t.start(32, 140, &.{ "-n", "3" });
try t.wait(8000, "Newcol Joincol");
try t.stable(700, 20000);
// middle-click Del on the lower-left pane's tag: the pane id is freed while