summaryrefslogtreecommitdiff
path: root/test/pdf.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/pdf.zig')
-rw-r--r--test/pdf.zig16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/pdf.zig b/test/pdf.zig
index a0eb8154..b8a768c8 100644
--- a/test/pdf.zig
+++ b/test/pdf.zig
@@ -25,7 +25,7 @@ const themes = pardes.themes;
const pdf_raster_policy = pardes.pdf_raster_policy;
const PDF_PAGE_GAP_PX = pardes.PDF_PAGE_GAP_PX;
const BOX_H = pardes.BOX_H;
-const sel_slot = @intFromEnum(config.select_button);
+const sel_slot = @backingInt(config.select_button);
const pane_tail = " " ++ config.pdf_pane_builtins_str;
fn hasPdf(pane: *const pardes.Pane) bool {
@@ -483,10 +483,10 @@ test "`:N` on a PDF turns to page N, from the pane and from the root's look, and
try std.testing.expectEqual(failures, p.fs.failures);
// Over 9P too: the root's look at `@pN:2` answers ok and logs no err.
const ctlfs = pardes.ctlfs;
- const written = p.serveFs(.{ .tag = 1, .op = .write, .node = @intFromEnum(ctlfs.TopFile.look), .data = try std.fmt.bufPrint(&line, "@p{d}:2\n", .{doc.serial}) });
+ const written = p.serveFs(.{ .tag = 1, .op = .write, .node = @backingInt(ctlfs.TopFile.look), .data = try std.fmt.bufPrint(&line, "@p{d}:2\n", .{doc.serial}) });
try std.testing.expectEqual(ctlfs.Status.ok, written.status);
try std.testing.expectEqual(@as(usize, 1), doc.pdf.?.page);
- const log = @intFromEnum(ctlfs.TopFile.log);
+ const log = @backingInt(ctlfs.TopFile.log);
const h = p.serveFs(.{ .tag = 2, .op = .open, .node = log }).handle;
const record = p.fsPayload(p.serveFs(.{ .tag = 3, .op = .read, .node = log, .handle = h, .size = 1 << 16 }));
try std.testing.expect(std.mem.indexOf(u8, record, "\nerr ") == null);
@@ -1470,9 +1470,11 @@ test "Escape cancels PDF chrome in place and Shift-Escape leaves the pane" {
panes.Pdf.openSections(p, 0);
p.update(.{ .key = .{ .cp = 'w', .ctrl = true } });
p.update(.{ .key = .{ .cp = 'j' } });
+ p.update(.{ .key = .{ .cp = Key.enter } });
try std.testing.expectEqual(@as(usize, 1), p.active);
p.update(.{ .key = .{ .cp = 'w', .ctrl = true } });
p.update(.{ .key = .{ .cp = 'k' } });
+ p.update(.{ .key = .{ .cp = Key.enter } });
try std.testing.expectEqual(@as(usize, 0), p.active);
// Everything a reader can see over the page: a search overlay and a live
@@ -2080,14 +2082,14 @@ test "PDF native mouse selection, Look, and highlights share page geometry" {
@as(i32, r.y + r.h - 1),
));
if (!panes.Pdf.beginSelection(p, pane, col, row)) continue;
- if (std.ascii.indexOfIgnoreCase(pv.selection_text, "Pardes") != null) {
+ if (std.ascii.findIgnoreCase(pv.selection_text, "Pardes") != null) {
selected_col = col;
selected_row = row;
break :find_word;
}
};
const word_col = selected_col orelse return error.PdfMouseMappingMissedWord;
- try std.testing.expect(std.ascii.indexOfIgnoreCase(
+ try std.testing.expect(std.ascii.findIgnoreCase(
pardes.test_api.heldSelection(p, 0).?,
"Pardes",
) != null);
@@ -2142,7 +2144,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" {
const hover = p.pdf_hover_preview orelse return error.MissingPdfHoverPreview;
try std.testing.expectEqual(@as(usize, 0), hover.probe.page);
try std.testing.expect(hover.probe.quads.len > 0);
- try std.testing.expect(std.ascii.indexOfIgnoreCase(hover.probe.text, "Pardes") != null);
+ try std.testing.expect(std.ascii.findIgnoreCase(hover.probe.text, "Pardes") != null);
try std.testing.expect(p.look_hover_preview == null);
try std.testing.expect(p.look_hover_wait == null);
@@ -2188,7 +2190,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" {
// search highlights without carrying an old selection into the result.
p.update(.{ .mouse = .{ .button = config.look_button, .kind = .press, .col = word_col, .row = selected_row } });
p.update(.{ .mouse = .{ .button = config.look_button, .kind = .release, .col = word_col, .row = selected_row } });
- try std.testing.expect(std.ascii.indexOfIgnoreCase(pv.search_query, "Pardes") != null);
+ try std.testing.expect(std.ascii.findIgnoreCase(pv.search_query, "Pardes") != null);
pv.resolveSearch(p.pdf_gpa);
const highlights = (try panes.Pdf.buildHighlights(
pv,