summaryrefslogtreecommitdiff
path: root/test/behaviour/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/behaviour/panes.zig')
-rw-r--r--test/behaviour/panes.zig23
1 files changed, 16 insertions, 7 deletions
diff --git a/test/behaviour/panes.zig b/test/behaviour/panes.zig
index 4c76df25..11c2a0e6 100644
--- a/test/behaviour/panes.zig
+++ b/test/behaviour/panes.zig
@@ -167,7 +167,7 @@ test "panes: a second lock is refused until the holder unlocks or closes, and bi
s.clunk(e);
}
-test "panes: an unsaved file's tag is its name alone, its dirty file says it is unsaved" {
+test "panes: an unsaved file's tag marks nothing on its name, Save and Undo come into its words, its dirty file says it is unsaved" {
var s = try Session.initFile(std.testing.allocator, "before\n");
defer s.deinit();
// A held pane (Keep): its tag as it was before the walk, no `Keep` word (SPEC ยง6.5).
@@ -175,9 +175,13 @@ test "panes: an unsaved file's tag is its name alone, its dirty file says it is
const n = try s.focused();
const tag = s.at("/pane/{d}/tag", .{n});
const clean = try s.read(tag);
+ try std.testing.expectEqualStrings("/test.txt Del ", clean);
try s.write(s.at("/pane/{d}/body", .{n}), "after\n");
- try std.testing.expectEqualStrings(clean, try s.read(tag));
- try std.testing.expect(std.mem.indexOf(u8, clean, " *") == null);
+ // Its words say what acts now, Save and Undo (UX K'3); no mark after
+ // the name.
+ const unsaved = try s.read(tag);
+ try std.testing.expectEqualStrings("/test.txt Save Undo Del ", unsaved);
+ try std.testing.expect(std.mem.indexOf(u8, unsaved, " *") == null);
try s.expect(s.at("/pane/{d}/dirty", .{n}), "1\n");
}
@@ -237,14 +241,19 @@ test "panes: Collapse keeps the text and folds the pane to its tag, and again re
var t = try Session.initTerm(std.testing.allocator);
defer t.deinit();
const n = try s.focused();
+ // Collapse is no word of a tag (UX K'3), a file's, a scratch's or a
+ // terminal's: its keys are C-w c and SPC w c, and it runs from ctl.
for ([_][]const u8{
try s.read(s.at("/pane/{d}/tag", .{n})),
try s.read(s.at("/pane/{d}/tag", .{try s.newPane()})),
- }) |tag| try std.testing.expect(std.mem.endsWith(u8, tag, " Collapse Follow Del"));
- try std.testing.expect(std.mem.endsWith(u8, try t.read(t.at("/pane/{d}/tag", .{try t.focused()})), " Collapse Del"));
+ try t.read(t.at("/pane/{d}/tag", .{try t.focused()})),
+ }) |tag| try std.testing.expect(std.mem.indexOf(u8, tag, "Collapse") == null);
try s.write(s.at("/pane/{d}/ctl", .{try s.focused()}), "Del\n");
const ctl = s.at("/pane/{d}/ctl", .{n});
- try s.write(ctl, "Collapse\n");
+ // C-w c folds the outlined pane, the keyboard's; Esc leaves window
+ // mode on it.
+ try std.testing.expectEqual(n, try s.focused());
+ try s.keys("\x17c\x1b");
// Folded to its tag: no text drawn, no cursor in it, the text kept.
try std.testing.expect(std.mem.indexOf(u8, try s.read(ctl), " collapsed ") != null);
try std.testing.expect(std.mem.indexOf(u8, try s.screen(), "keep this text") == null);
@@ -321,7 +330,7 @@ test "panes: PdfTint steps a PDF's tint, read in its ctl and never in its tag, a
const n = try s.lookFile("docs/design.pdf");
const ctl = s.at("/pane/{d}/ctl", .{n});
const tag = try s.read(s.at("/pane/{d}/tag", .{n}));
- try std.testing.expect(std.mem.endsWith(u8, tag, " PdfSections PdfTint PdfFit Collapse Del"));
+ try std.testing.expect(std.mem.endsWith(u8, tag, " PdfSections PdfTint PdfFit Del "));
for ([_][]const u8{ "full", "disabled", "filtered" }) |want| {
try std.testing.expect(std.mem.indexOf(u8, try s.read(ctl), "fit:width ") != null);
try s.write(ctl, "PdfTint\n");