summaryrefslogtreecommitdiff
path: root/test/fs_namespace.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 10:36:27 -0300
committerGabriel Schneider <[email protected]>2026-10-01 10:46:01 -0300
commit860796aa8832bb9bf32b2770bc0584b962bb51b7 (patch)
tree3cbfcec1aa2fb8b652a9436a0b9a2613352918ca /test/fs_namespace.zig
parentedad6d960dc0fc1165cbb3b801e0538045b2247f (diff)
downloadpardes-860796aa8832bb9bf32b2770bc0584b962bb51b7.tar.gz
pardes-860796aa8832bb9bf32b2770bc0584b962bb51b7.zip
A dump no longer embeds a picture or a PDF that is on disk: Restore reads it from there, as a clean file's text is
Every Dump carried each image's and PDF's bytes in base64 (a 900 KB PDF made a 1.3 MB dump), and a Restore showed that copy however the file had changed. One on disk now goes by its path alone; one not on disk (no file behind it) still has its bytes kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/fs_namespace.zig')
-rw-r--r--test/fs_namespace.zig11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/fs_namespace.zig b/test/fs_namespace.zig
index 5bce9eda..30c656ca 100644
--- a/test/fs_namespace.zig
+++ b/test/fs_namespace.zig
@@ -286,7 +286,7 @@ test "owned cwd failed file opens never publish a pane or retain a reservation"
try std.testing.expect(succeeded);
}
-test "images decode and dump through explicit filesystem mounts" {
+test "images decode through explicit filesystem mounts, and a dump reads one on disk from there" {
if (!filesystem.platform_has_fs) return error.SkipZigTest;
const gpa = std.testing.allocator;
pardes.image.start(std.testing.io, gpa);
@@ -308,8 +308,9 @@ test "images decode and dump through explicit filesystem mounts" {
const state = pane.image.?;
try std.testing.expectEqual(@as(usize, 1), state.iw);
try std.testing.expectEqual(@as(usize, 1), state.ih);
- const saved = try pardes.panes.Image.dumpPane(p, arena.allocator(), pane, "", "", 0, path, &.{});
- const decoded = try pardes.dump.decodeBytes(gpa, saved.image.?.bytes_b64);
- defer gpa.free(decoded);
- try std.testing.expectEqualStrings(bytes, decoded);
+ // On disk, the picture is no part of the dump: Restore reads it there.
+ const saved = try pardes.panes.Image.dumpPane(p, arena.allocator(), pane, "", "", 0, path, state.raw);
+ try std.testing.expectEqualStrings("", saved.image.?.bytes_b64);
+ const restored = try pardes.panes.Image.restore(p, p.freeSlot().?, saved);
+ try std.testing.expectEqualStrings(bytes, restored.image.?.raw);
}