summaryrefslogtreecommitdiff
path: root/test/pdf.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-11 12:38:56 -0300
committerGabriel Schneider <[email protected]>2026-09-15 17:24:42 -0300
commit682e237df7e8b22f820d14a4adee58e6e2f84268 (patch)
tree5d888cb46f1a49e89fc55e2a4c232d3af0265b1d /test/pdf.zig
parent6878e1c309172d624c0d7a3555f6f0217ae6770e (diff)
downloadpardes-682e237df7e8b22f820d14a4adee58e6e2f84268.tar.gz
pardes-682e237df7e8b22f820d14a4adee58e6e2f84268.zip
trunk: resume before the Reload experiment
Empty marker on the last pre-Reload change. Keep the Reload experiment on reload (3801914), its first change on reload-start (200a1fc), and the unfinished performance investigation on reload-perf-wip.
Diffstat (limited to 'test/pdf.zig')
-rw-r--r--test/pdf.zig30
1 files changed, 13 insertions, 17 deletions
diff --git a/test/pdf.zig b/test/pdf.zig
index b2d03bb8..a5720f3f 100644
--- a/test/pdf.zig
+++ b/test/pdf.zig
@@ -25,7 +25,7 @@ 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 pane_tail = " " ++ config.pane_builtins_str;
+const pane_tail = " " ++ config.pdf_pane_builtins_str;
fn hasPdf(pane: *const pardes.Pane) bool {
return if (comptime pdf_enabled) pane.pdf != null else false;
@@ -445,10 +445,8 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
try std.testing.expectEqual(@as(u16, 8), p.cell_pixels.w);
try std.testing.expectEqual(@as(u16, 16), p.cell_pixels.h);
const initial_tag = try pardes.test_api.tagText(p, p.scratch.allocator(), pane);
- try std.testing.expect(std.mem.indexOf(u8, initial_tag, "pdf 1/") != null);
- try std.testing.expect(std.mem.indexOf(u8, initial_tag, " width ") != null);
- try std.testing.expect(std.mem.indexOf(u8, initial_tag, " height ") == null);
- try std.testing.expect(std.mem.indexOf(u8, initial_tag, "PdfFit") != null);
+ const expected_tag = try std.fmt.allocPrint(p.scratch.allocator(), "{s} [1/{d}]{s}", .{ pane.pdf.?.path, pane.pdf.?.page_count, pane_tail });
+ try std.testing.expectEqualStrings(expected_tag, initial_tag);
try std.testing.expect(std.mem.endsWith(u8, initial_tag, pane_tail));
p.native_images = true;
@@ -668,10 +666,8 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
panes.Pdf.rasterForPage(&pane.pdf.?, pane.pdf.?.page).?.revision,
);
const height_tag = try pardes.test_api.tagText(p, p.scratch.allocator(), pane);
- try std.testing.expect(std.mem.indexOf(u8, height_tag, "pdf 1/") != null);
- try std.testing.expect(std.mem.indexOf(u8, height_tag, " width ") == null);
- try std.testing.expect(std.mem.indexOf(u8, height_tag, " height ") != null);
- try std.testing.expect(std.mem.indexOf(u8, height_tag, "PdfFit") != null);
+ const expected_height_tag = try std.fmt.allocPrint(p.scratch.allocator(), "{s} [{d}/{d}]{s}", .{ pane.pdf.?.path, pane.pdf.?.page + 1, pane.pdf.?.page_count, pane_tail });
+ try std.testing.expectEqualStrings(expected_height_tag, height_tag);
for (p.panes) |slot| {
const other = slot orelse continue;
if (hasPdf(other)) continue;
@@ -1072,7 +1068,7 @@ test "PDF continuous strip renders every intersecting short page" {
}
}
-test "PdfTint cycles pane-local state and exposes it in the live PDF tag" {
+test "PdfTint cycles pane-local state without adding tag clutter" {
if (!pdf_enabled or platform == .web) return;
const p = try Pardes.init(std.testing.allocator, .{
@@ -1088,11 +1084,9 @@ test "PdfTint cycles pane-local state and exposes it in the live PDF tag" {
try std.testing.expectEqual(PdfTintMode.filtered, pv.tint);
const initial_tag = try pardes.test_api.tagText(p, p.scratch.allocator(), pane);
- try std.testing.expect(std.mem.indexOf(
- u8,
- initial_tag,
- "width PdfFit filtered PdfTint",
- ) != null);
+ try std.testing.expect(std.mem.startsWith(u8, initial_tag, pv.path));
+ try std.testing.expect(std.mem.endsWith(u8, initial_tag, " PdfSections PdfTint Collapse"));
+ try std.testing.expect(std.mem.indexOf(u8, initial_tag, "filtered") == null);
try std.testing.expect(pardes.test_api.runBuiltin(
p,
@@ -1103,7 +1097,8 @@ test "PdfTint cycles pane-local state and exposes it in the live PDF tag" {
));
try std.testing.expectEqual(PdfTintMode.full, pv.tint);
const full_tag = try pardes.test_api.tagText(p, p.scratch.allocator(), pane);
- try std.testing.expect(std.mem.indexOf(u8, full_tag, "full PdfTint") != null);
+ try std.testing.expectEqualStrings(initial_tag, full_tag);
+ try std.testing.expect(std.mem.indexOf(u8, full_tag, "full") == null);
// Running the same pane-scoped word in a terminal cannot mutate the PDF
// next to it. A FILE boot is one pane now, so that terminal is asked for
@@ -1130,7 +1125,8 @@ test "PdfTint cycles pane-local state and exposes it in the live PDF tag" {
));
try std.testing.expectEqual(PdfTintMode.disabled, pv.tint);
const disabled_tag = try pardes.test_api.tagText(p, p.scratch.allocator(), pane);
- try std.testing.expect(std.mem.indexOf(u8, disabled_tag, "disabled PdfTint") != null);
+ try std.testing.expectEqualStrings(initial_tag, disabled_tag);
+ try std.testing.expect(std.mem.indexOf(u8, disabled_tag, "disabled") == null);
try std.testing.expect(pardes.test_api.runBuiltin(
p,
@tagName(tint_builtin),