diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/output.zig | 2 | ||||
| -rw-r--r-- | test/panes.zig | 44 | ||||
| -rw-r--r-- | test/pdf.zig | 18 |
3 files changed, 32 insertions, 32 deletions
diff --git a/test/output.zig b/test/output.zig index 8403effa..523e8129 100644 --- a/test/output.zig +++ b/test/output.zig @@ -387,7 +387,7 @@ test "result stepping reaches an unterminated last row" { const source = try p.setTestFile("one\ntwo\n"); const rows = try std.fmt.allocPrint(p.gpa, "{s}:1:1 first\n{s}:2:1 last", .{ source.file.?.path, source.file.?.path }); try panes.Output.fillResults(p, 0, "/tmp", .search, "", rows, 0); - try std.testing.expect(pardes.test_api.searchStep(p, 0, 1)); + try std.testing.expect(pardes.look.searchStep(p, 0, 1)); try std.testing.expectEqual(@as(usize, 1), source.search_row.?); const result = p.panes[source.search_pane.?].?; try std.testing.expectEqual(@as(i32, 1), result.body.cur_row); diff --git a/test/panes.zig b/test/panes.zig index 1b1b3eea..28f14d94 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -610,7 +610,7 @@ const BodyHitTests = struct { // Release at a different source row without an intermediate drag event. p.update(.{ .mouse = mouse(layer, last, prefix + 14, .release) }); // A stream: the last row from its start, indentation and all. - try std.testing.expect(std.mem.endsWith(u8, pardes.test_api.heldSelection(p, 0).?, "// body") and std.mem.startsWith(u8, pardes.test_api.heldSelection(p, 0).?, "body\n")); + try std.testing.expect(std.mem.endsWith(u8, pardes.exec.heldSelection(p, 0).?, "// body") and std.mem.startsWith(u8, pardes.exec.heldSelection(p, 0).?, "body\n")); p.update(.{ .mouse = mouse(layer, last, 10, .press) }); p.update(.{ .mouse = mouse(layer, last, 10, .release) }); try std.testing.expectEqual(expected, pane.body.cur_row); @@ -915,7 +915,7 @@ const TtySelectionTests = struct { JumpSelectionTests.drag(p, x + @as(u16, if (prompt) 0 else 1), y, x + 3, y + @as(u16, if (prompt) 0 else 1)); const expected = if (prompt) "$ ab" else "lpha\nbrav"; try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode); - try std.testing.expectEqualStrings(expected, pardes.test_api.heldSelection(p, 0).?); + try std.testing.expectEqualStrings(expected, pardes.exec.heldSelection(p, 0).?); try std.testing.expectEqualStrings(expected, p.registers.text(p.gpa, '"') orelse return error.MissingAutomaticTtyYank); try noChildInput(p); @@ -934,7 +934,7 @@ const TtySelectionTests = struct { try std.testing.expect(!std.meta.eql(selected, normal.at(x + 4, y + 1).style.bg)); try std.testing.expect(!std.meta.eql(selected, normal.at(x, y).style.bg)); } - try std.testing.expectEqualStrings(expected, pardes.test_api.heldSelection(p, 0).?); + try std.testing.expectEqualStrings(expected, pardes.exec.heldSelection(p, 0).?); p.update(.{ .key = .{ .cp = 'y' } }); try std.testing.expectEqualStrings(expected, p.registers.text(p.gpa, '"').?); try noChildInput(p); @@ -942,11 +942,11 @@ const TtySelectionTests = struct { try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode); try noChildInput(p); _ = try p.render(frame.allocator()); - try std.testing.expectEqualStrings(expected, pardes.test_api.heldSelection(p, 0).?); + try std.testing.expectEqualStrings(expected, pardes.exec.heldSelection(p, 0).?); p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b]133;C\x07" ++ std.mem.asBytes(&@as([30][12]u8, @splat("\r\nnew output".*))) } }); _ = try p.render(frame.allocator()); try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode); - try std.testing.expectEqualStrings(expected, pardes.test_api.heldSelection(p, 0).?); + try std.testing.expectEqualStrings(expected, pardes.exec.heldSelection(p, 0).?); try std.testing.expectEqualStrings(expected, p.registers.text(p.gpa, '"').?); try noChildInput(p); } @@ -1007,7 +1007,7 @@ const TtySelectionTests = struct { try std.testing.expectEqualStrings(expected, written.written()); try std.testing.expectEqual(panes.Text.Mode.tty, p.panes[0].?.body.mode); try std.testing.expectEqual(panes.Text.Mode.tty, p.panes[1].?.body.mode); - try std.testing.expectEqualStrings("lpha\nbrav", pardes.test_api.heldSelection(p, 0).?); + try std.testing.expectEqualStrings("lpha\nbrav", pardes.exec.heldSelection(p, 0).?); } } } @@ -1277,7 +1277,7 @@ const ClickCursorTests = struct { const x = rect.x + config.GUTTER + panes.File.gutterWidth(pane); const y = bodyY(p, rect); JumpSelectionTests.drag(p, x + 1, y + 4, x + 3, y + 4); - try std.testing.expectEqualStrings("lph", pardes.test_api.heldSelection(p, 0).?); + try std.testing.expectEqualStrings("lph", pardes.exec.heldSelection(p, 0).?); for (0..2) |_| p.update(.{ .mouse = .{ .button = .wheel_down, .kind = .press, .col = x + 2, .row = y + 4 } }); try std.testing.expectEqual(@as(usize, 2), pane.file.?.scroll); _ = try p.render(frame.allocator()); @@ -1339,7 +1339,7 @@ const JumpSelectionTests = struct { else drag(p, x + first_col, y, x + last_col, y + 1); - const selected = try p.gpa.dupe(u8, pardes.test_api.heldSelection(p, 0) orelse return error.MissingMouseSelection); + const selected = try p.gpa.dupe(u8, pardes.exec.heldSelection(p, 0) orelse return error.MissingMouseSelection); defer p.gpa.free(selected); if (expected) |want| try std.testing.expectEqualStrings(want, selected); try std.testing.expect(std.mem.indexOfScalar(u8, selected, '\n') != null); @@ -1358,7 +1358,7 @@ const JumpSelectionTests = struct { try std.testing.expect(pane.file.?.scroll > 20); try LookResetTests.cleared(pane); try std.testing.expect(!pane.body.vsel.active); - try std.testing.expect(pardes.test_api.heldSelection(p, 0) == null); + try std.testing.expect(pardes.exec.heldSelection(p, 0) == null); try std.testing.expectEqual(@as(i32, 59), pane.body.cur_row); try std.testing.expectEqual(@as(i32, 0), pane.body.cur_col); @@ -1366,7 +1366,7 @@ const JumpSelectionTests = struct { // Back announces itself, so the body sits under a notice band now. const y2 = p.bodyTop(pane, p.rects[0]); drag(p, x + 1, y2, x + 3, y2 + 1); - try std.testing.expect(pardes.test_api.heldSelection(p, 0) != null); + try std.testing.expect(pardes.exec.heldSelection(p, 0) != null); p.update(.{ .key = .{ .cp = 'i', .ctrl = true } }); _ = frame.reset(.retain_capacity); _ = try p.render(frame.allocator()); @@ -1374,7 +1374,7 @@ const JumpSelectionTests = struct { try std.testing.expectEqual(@as(usize, 0), pane.file.?.scroll); try LookResetTests.cleared(pane); try std.testing.expect(!pane.body.vsel.active); - try std.testing.expect(pardes.test_api.heldSelection(p, 0) == null); + try std.testing.expect(pardes.exec.heldSelection(p, 0) == null); try std.testing.expectEqual(@as(i32, 0), pane.body.cur_row); try std.testing.expectEqual(@as(i32, 0), pane.body.cur_col); } @@ -1392,10 +1392,10 @@ const JumpSelectionTests = struct { // From the press to the end of its line, the line between whole, the // last from its start: no line numbers, no rectangle. drag(p, x + 2, y, x + 1, y + 2); - try std.testing.expectEqualStrings("pha\nbravo\nch", pardes.test_api.heldSelection(p, 0).?); + try std.testing.expectEqualStrings("pha\nbravo\nch", pardes.exec.heldSelection(p, 0).?); // Upward, the same text. drag(p, x + 1, y + 2, x + 2, y); - try std.testing.expectEqualStrings("pha\nbravo\nch", pardes.test_api.heldSelection(p, 0).?); + try std.testing.expectEqualStrings("pha\nbravo\nch", pardes.exec.heldSelection(p, 0).?); // A tag of several rows sweeps the same way. if (pane.tag.own) |own| p.gpa.free(own); pane.tag.own = try p.gpa.dupe(u8, "Save Del\nLook Edit"); @@ -2919,17 +2919,17 @@ const OutputTests = struct { } try std.testing.expectEqual(@as(usize, 2), count); try std.testing.expectEqual(matches[1], pane.search_row.?); - try std.testing.expect(pardes.test_api.searchStep(p, 0, -1)); + try std.testing.expect(pardes.look.searchStep(p, 0, -1)); try std.testing.expectEqual(matches[0], pane.search_row.?); try std.testing.expectEqual(@as(i32, 3), pane.body.cur_row); - try std.testing.expect(pardes.test_api.searchStep(p, 0, 1)); + try std.testing.expect(pardes.look.searchStep(p, 0, 1)); try std.testing.expectEqual(matches[1], pane.search_row.?); try std.testing.expectEqual(@as(i32, 5), pane.body.cur_row); - try std.testing.expect(pardes.test_api.searchStep(p, 0, 1)); + try std.testing.expect(pardes.look.searchStep(p, 0, 1)); try std.testing.expectEqual(matches[1], pane.search_row.?); pane.search_row = null; - try std.testing.expect(pardes.test_api.searchStep(p, 0, 1)); + try std.testing.expect(pardes.look.searchStep(p, 0, 1)); try std.testing.expectEqual(matches[0], pane.search_row.?); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); @@ -2971,11 +2971,11 @@ const OutputTests = struct { // still governs stepping when that output is attached to a source. restored_source.search_pane = restored_id; restored_source.search_row = null; - try std.testing.expect(pardes.test_api.searchStep(restored, 0, 1)); + try std.testing.expect(pardes.look.searchStep(restored, 0, 1)); try std.testing.expectEqual(matches[0], restored_source.search_row.?); - try std.testing.expect(pardes.test_api.searchStep(restored, 0, 1)); + try std.testing.expect(pardes.look.searchStep(restored, 0, 1)); try std.testing.expectEqual(matches[1], restored_source.search_row.?); - try std.testing.expect(pardes.test_api.searchStep(restored, 0, -1)); + try std.testing.expect(pardes.look.searchStep(restored, 0, -1)); try std.testing.expectEqual(matches[0], restored_source.search_row.?); // Editing drops source metadata; hidden context padding still keeps @@ -2983,9 +2983,9 @@ const OutputTests = struct { panes.File.setContent(p, file, try p.gpa.dupe(u8, file.content)); try std.testing.expectEqual(@as(usize, 0), file.location_rows.len); pane.search_row = null; - try std.testing.expect(pardes.test_api.searchStep(p, 0, 1)); + try std.testing.expect(pardes.look.searchStep(p, 0, 1)); try std.testing.expectEqual(matches[0], pane.search_row.?); - try std.testing.expect(pardes.test_api.searchStep(p, 0, 1)); + try std.testing.expect(pardes.look.searchStep(p, 0, 1)); try std.testing.expectEqual(matches[1], pane.search_row.?); } diff --git a/test/pdf.zig b/test/pdf.zig index cc4a258d..ea23f90a 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -1610,7 +1610,7 @@ test "PdfTint cycles pane-local state without adding tag clutter" { // here rather than inherited from init. _ = try p.newShell(1, ""); _ = layout.splitColumn(p, 0, 1, false); - pardes.test_api.sync(p); // rects for the new column, exactly as the two-pane boot did + p.sync(); // rects for the new column, exactly as the two-pane boot did try std.testing.expect(!hasPdf(p.panes[1].?)); try std.testing.expect(pardes.test_api.runBuiltin( p, @@ -1852,7 +1852,7 @@ test "PDF pane geometry change preserves its page-relative position" { // so the divider drag below needs a second column to take the width from. _ = try p.newShell(1, ""); _ = layout.splitColumn(p, 0, 1, false); - pardes.test_api.sync(p); // rects for the new column, exactly as the two-pane boot did + p.sync(); // rects for the new column, exactly as the two-pane boot did const pane = p.panes[0].?; const pv = &pane.pdf.?; p.native_images = true; @@ -1949,7 +1949,7 @@ test "PDF n/N addresses and reveals distinct MuPDF hits on one page" { var frame = std.heap.ArenaAllocator.init(gpa); defer frame.deinit(); - try std.testing.expect(pardes.test_api.searchStep(p, 0, 1)); + try std.testing.expect(pardes.look.searchStep(p, 0, 1)); try std.testing.expectEqual(@as(usize, 0), pv.search_hit); try std.testing.expectEqual(@as(usize, 0), pane.search_row.?); const first = try p.render(frame.allocator()); @@ -1968,14 +1968,14 @@ test "PDF n/N addresses and reveals distinct MuPDF hits on one page" { try std.testing.expect(first_y >= first_geometry.src.y and first_y < first_geometry.src.y + first_geometry.src.h); - try std.testing.expect(pardes.test_api.searchStep(p, 0, 1)); + try std.testing.expect(pardes.look.searchStep(p, 0, 1)); try std.testing.expectEqual(@as(usize, 1), pv.search_hit); try std.testing.expectEqual(@as(usize, 2), pane.search_row.?); _ = frame.reset(.retain_capacity); const second = try p.render(frame.allocator()); try std.testing.expectEqual(revision, second.images[0].?.native.revision); - try std.testing.expect(pardes.test_api.searchStep(p, 0, 1)); + try std.testing.expect(pardes.look.searchStep(p, 0, 1)); try std.testing.expectEqual(@as(usize, 2), pv.search_hit); try std.testing.expectEqual(@as(usize, 4), pane.search_row.?); _ = frame.reset(.retain_capacity); @@ -2092,7 +2092,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { }; const word_col = selected_col orelse return error.PdfMouseMappingMissedWord; try std.testing.expect(std.ascii.findIgnoreCase( - pardes.test_api.heldSelection(p, 0).?, + pardes.exec.heldSelection(p, 0).?, "Pardes", ) != null); @@ -2368,7 +2368,7 @@ test "Esc back into a PDF keeps the offset within its page" { const doc = p.active; const dp = p.panes[doc].?; try std.testing.expect(dp.pdf != null); - pardes.test_api.sync(p); + p.sync(); // Read a little way DOWN the page you are on, then step away. const pv = &dp.pdf.?; @@ -2376,12 +2376,12 @@ test "Esc back into a PDF keeps the offset within its page" { const mid = pv.document_scroll_y; pv.scroll_to_page_pending = false; p.update(.{ .key = .{ .cp = 'n', .alt = true } }); // a shell under the doc - pardes.test_api.sync(p); + p.sync(); const shell = p.active; try std.testing.expect(shell != doc); p.update(.{ .key = .{ .cp = Key.escape } }); // Esc: back into the PDF - pardes.test_api.sync(p); + p.sync(); try std.testing.expectEqual(doc, p.active); // The jumps stack records a PDF as its PAGE, so returning revealed the page |
