summaryrefslogtreecommitdiff
path: root/test/pdf.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 11:40:11 -0300
committerGabriel Schneider <[email protected]>2026-11-05 12:41:36 -0300
commit3f1533813b6692a736251e4d467a7f108229ddee (patch)
tree37a32c5ebbf9d3af08923856fd6fa516f3b33a39 /test/pdf.zig
parentcfd2b993feda1b3f7474225bb32db8cac8edc5ae (diff)
downloadpardes-3f1533813b6692a736251e4d467a7f108229ddee.tar.gz
pardes-3f1533813b6692a736251e4d467a7f108229ddee.zip
targets: the DOM web shell goes (src/web.zig and src/web/, its harnesses web_harness, web_snapshot, web_driver_test and web-snapshots/, tools/web_fixture.py, -Dplatform=web, -Ddump, and the web, web-harness, web-snap, web-e2e and web-driver-test steps), and with it what only a freestanding build needed: `hosted` and every guard on it (every build has a host now), memory's stack-fallback arenas and reduced_target sizes, the emscripten main, the tree-sitter libc shim and the stb stub, lsp's has_client, the web arms of the platform switches (-Dplatform is tui, gui or macos); the macOS files pass zig ast-check; docs/web.md is a paragraph on what it was
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/pdf.zig')
-rw-r--r--test/pdf.zig50
1 files changed, 25 insertions, 25 deletions
diff --git a/test/pdf.zig b/test/pdf.zig
index 053e45dc..460a5734 100644
--- a/test/pdf.zig
+++ b/test/pdf.zig
@@ -94,7 +94,7 @@ const PdfLinkTests = struct {
}
test "PDF links activate embedded URLs and blank internal annotations" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
const p = try init(tmp);
@@ -112,7 +112,7 @@ const PdfLinkTests = struct {
}
test "PDF links offer distinct visible destinations and do not duplicate the same URL" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
const p = try init(tmp);
@@ -152,7 +152,7 @@ const PdfLinkTests = struct {
}
test "PDF links hover clears on leave page and reload while right drag chooses Look text" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
const p = try init(tmp);
@@ -201,7 +201,7 @@ test {
}
test "PDF mounted bytes own their source after the caller frees it" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
const source = try pardes.filesystem.readFile(gpa, "docs/design.pdf");
var document = pdf_impl.Document.openBytes(source) catch |err| {
@@ -224,7 +224,7 @@ test "PDF mounted bytes own their source after the caller frees it" {
}
test "explicit OS PDF opens and reloads keep their namespace path" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
@@ -264,7 +264,7 @@ test "PDF feature gates keep argv and builtin behavior coherent" {
try std.testing.expectEqualStrings("tz", config.leader_path.get(maybe_fit.?).?);
try std.testing.expectEqualStrings("ti", config.leader_path.get(maybe_tint.?).?);
try std.testing.expectEqualStrings("ts", config.leader_path.get(maybe_sections.?).?);
- } else if (platform != .web) {
+ } else {
const p = try Pardes.init(std.testing.allocator, .{
.file = "docs/design.pdf",
.cols = 80,
@@ -279,7 +279,7 @@ test "PDF feature gates keep argv and builtin behavior coherent" {
}
test "PdfSections Look follows the exact owning PDF, not an equal path" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
@@ -340,7 +340,7 @@ test "SDL PDF raster policy is materially denser than Kitty" {
}
test "watched PDF reload replaces MuPDF state and preserves the reading view" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
var tmp = std.testing.tmpDir(.{});
@@ -482,7 +482,7 @@ test "watched PDF reload replaces MuPDF state and preserves the reading view" {
}
test "PDF reload does not re-center an already revealed matching search" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
const fixture = try pardes.filesystem.readFile(gpa, "docs/design.pdf");
defer gpa.free(fixture);
@@ -538,7 +538,7 @@ test "PDF reload does not re-center an already revealed matching search" {
}
test "MuPDF pane renders, navigates, searches, and round-trips its page" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{
@@ -881,7 +881,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
}
test "a fling's banded pages show the reader exactly what whole pages would" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
// The contract fast scrolling is allowed to change: HOW pixels are carried
// (a strip of a page instead of the page) but never WHICH pixels arrive. So
@@ -976,7 +976,7 @@ fn expectNearRows(expected: []const u8, got: []const u8) !void {
}
test "a tall page is drawn at the display's resolution, in bands that are the whole page's rows" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
// The page is fifteen A4 heights tall. Squeezed whole into the raster
// budget it was a third as wide as the pane and blown up, blurred; it is
@@ -1145,7 +1145,7 @@ fn copySourceRect(
}
test "Escape cancels PDF chrome in place, then leaves the pane; Shift-Escape leaves at once" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{
@@ -1226,7 +1226,7 @@ test "Escape cancels PDF chrome in place, then leaves the pane; Shift-Escape lea
}
test "PDF continuous strip renders every intersecting short page" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{
@@ -1281,7 +1281,7 @@ test "PDF continuous strip renders every intersecting short page" {
}
test "PDF tint resolves a theme's null page colors to its chrome" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const p = try Pardes.init(std.testing.allocator, .{
.file = "docs/design.pdf",
@@ -1301,7 +1301,7 @@ test "PDF tint resolves a theme's null page colors to its chrome" {
}
test "PDF tint and tinted theme changes rebuild every visible raster only" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{
@@ -1441,7 +1441,7 @@ test "PDF tint and tinted theme changes rebuild every visible raster only" {
}
test "PDF resize preserves page-relative document position" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{
@@ -1487,7 +1487,7 @@ test "PDF resize preserves page-relative document position" {
}
test "PDF pane geometry change preserves its page-relative position" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{
@@ -1544,7 +1544,7 @@ test "PDF pane geometry change preserves its page-relative position" {
}
test "PDF n/N addresses and reveals distinct MuPDF hits on one page" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{
@@ -1644,7 +1644,7 @@ test "PDF n/N addresses and reveals distinct MuPDF hits on one page" {
}
test "PDF native mouse selection, Look, and highlights share page geometry" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{
@@ -2001,7 +2001,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" {
}
test "Esc back into a PDF keeps the offset within its page" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
@@ -2043,7 +2043,7 @@ test "Esc back into a PDF keeps the offset within its page" {
}
test "PDF Back and Forward clear selections and land on recorded pages" {
- if (!pdf_enabled or platform == .web) return error.SkipZigTest;
+ if (!pdf_enabled) return error.SkipZigTest;
const p = try Pardes.init(std.testing.allocator, .{ .file = "docs/design.pdf", .cols = 80, .rows = 28 });
defer p.deinit();
p.native_images = true;
@@ -2070,7 +2070,7 @@ test "PDF Back and Forward clear selections and land on recorded pages" {
}
test "a PDF's fit and tint, and Collapse, read in its ctl and come back from a Dump" {
- if (!pdf_enabled or platform == .web) return;
+ if (!pdf_enabled) return;
const gpa = std.testing.allocator;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
@@ -2121,7 +2121,7 @@ fn stripAtPlace(p: *Pardes, pane: *pardes.Pane, page: usize, fraction: f64) !f64
}
test "a PDF's jumps: Back after a far jump returns to the exact offset, two places on one page are two entries" {
- if (!pdf_enabled or platform == .web) return error.SkipZigTest;
+ if (!pdf_enabled) return error.SkipZigTest;
const p = try Pardes.init(std.testing.allocator, .{ .file = jumpPdf(), .cols = 80, .rows = 28 });
defer p.deinit();
p.native_images = true;
@@ -2156,7 +2156,7 @@ test "a PDF's jumps: Back after a far jump returns to the exact offset, two plac
}
test "a PDF's jumps: JumpScope file keeps to the PDF, and a closed PDF reopens at its place" {
- if (!pdf_enabled or platform == .web) return error.SkipZigTest;
+ if (!pdf_enabled) return error.SkipZigTest;
// Recent keeps a file by the path it was opened as: a real one here,
// as a Look opens one.
var cwd_buf: [4096]u8 = undefined;