diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/behaviour/other_files.zig | 7 | ||||
| -rw-r--r-- | test/behaviour/panes.zig | 13 | ||||
| -rw-r--r-- | test/fs.py | 4 | ||||
| -rw-r--r-- | test/pdf.zig | 2 | ||||
| -rw-r--r-- | test/record_demos.py | 5 |
5 files changed, 25 insertions, 6 deletions
diff --git a/test/behaviour/other_files.zig b/test/behaviour/other_files.zig index b97affc4..c0f9c08f 100644 --- a/test/behaviour/other_files.zig +++ b/test/behaviour/other_files.zig @@ -21,3 +21,10 @@ test "other-files: kbdin types at the pane with the keyboard and mousein clicks, try std.testing.expectEqual(@as(u16, 22), try s.refused("/kbdin", "\xff")); try std.testing.expectError(error.Refused, s.read("/kbdin")); } + +test "other-files: kbdin's Kalt rune is Alt on the key after it alone, and an Alt key types nothing" { + var s = try Session.initFile(std.testing.allocator, "x\n"); + defer s.deinit(); + try s.keys("i\u{F015}zy\x1b"); + try s.expect(s.at("/pane/{d}/body", .{try s.focused()}), "yx\n"); +} diff --git a/test/behaviour/panes.zig b/test/behaviour/panes.zig index 45b7152c..01820a07 100644 --- a/test/behaviour/panes.zig +++ b/test/behaviour/panes.zig @@ -8,7 +8,18 @@ test "panes: a collapsed pane's ctl says so" { const first = try s.focused(); _ = try s.newPane(); try s.write(s.at("/pane/{d}/ctl", .{first}), "Collapse\n"); - try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{first})), " collapsed ")); + try std.testing.expect(std.mem.indexOf(u8, try s.read(s.at("/pane/{d}/ctl", .{first})), " collapsed ") != null); +} + +test "panes: a pane's ctl read ends with its mode, as its tag's box shows it" { + var s = try Session.initFile(std.testing.allocator, "x\n"); + defer s.deinit(); + const ctl = s.at("/pane/{d}/ctl", .{try s.focused()}); + try std.testing.expect(std.mem.endsWith(u8, try s.read(ctl), " mode:normal ")); + try s.keys("i"); + try std.testing.expect(std.mem.endsWith(u8, try s.read(ctl), " mode:insert ")); + try s.keys("\x1bv"); + try std.testing.expect(std.mem.endsWith(u8, try s.read(ctl), " mode:select ")); } test "panes: the ctl word name refuses a leading blank, as the name file does" { @@ -267,8 +267,8 @@ def discovery(binary, embedded=False): # wctl `current` does; a pane's ctl line ends saying which it is. client.write('/focus', f'{first}\n'.encode()) assert client.read('/focus') == f'{first}\n'.encode() - assert client.read(f'/pane/{first}/ctl').endswith(b' current ') - assert client.read(f'/pane/{second}/ctl').endswith(b' notcurrent ') + assert b' current ' in client.read(f'/pane/{first}/ctl') + assert b' notcurrent ' in client.read(f'/pane/{second}/ctl') try: client.write('/focus', b'99999\n') raise AssertionError('focus took a serial no pane has') diff --git a/test/pdf.zig b/test/pdf.zig index 3bb751e2..fca0c240 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -2418,7 +2418,7 @@ test "a PDF's fit and tint, and Collapse, read in its ctl and come back from a D const ctlfs = pardes.ctlfs; const ctl_node = ctlfs.Node.of(doc.serial, .ctl); const read = p.fsPayload(p.serveFs(.{ .tag = 1, .op = .read, .node = ctl_node, .size = 4096 })); - try std.testing.expect(std.mem.endsWith(u8, read, "fit:height tint:full ")); + try std.testing.expect(std.mem.indexOf(u8, read, "fit:height tint:full ") != null); try pardes.dump.dumpState(p); const restored = try pardes.dump.restore(p, p.dump_out.?, "/tmp/pardes.dump.zon"); defer restored.deinit(); diff --git a/test/record_demos.py b/test/record_demos.py index 3c64f55c..a2e48d73 100644 --- a/test/record_demos.py +++ b/test/record_demos.py @@ -819,8 +819,9 @@ def pdf_tint_fit(s): s.pointer = s.cell_px(44, 12) s.shot(1.2) for _ in range(3): - before = s.read('/pane/1/ctl').split()[-1] - s.click(2, *pdf_tag(s, 'PdfTint'), done=lambda: s.read('/pane/1/ctl').split()[-1] != before, + tint = lambda: next(w for w in s.read('/pane/1/ctl').split() if w.startswith(b'tint:')) + before = tint() + s.click(2, *pdf_tag(s, 'PdfTint'), done=lambda: tint() != before, what='the tint', after=1.0) for fit in ('height', 'width'): s.click(2, *pdf_tag(s, 'PdfFit'), done=lambda: f'fit:{fit}' in s.read('/pane/1/ctl'), what='the fit', |
