From c8553032ef84aec74cbb5d07d07f934eecf3d4a9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 05:19:21 -0300 Subject: kinds #9, the core's image code gone: src/image.zig (558 lines) and the static table go, so no kind is compiled in (Registry.init, Kind.image, compiledIn, `static` in /addons and "is compiled in" with them) and a test of the core's side of a kind's pane opens Kind.test_kind (a picture of one pixel, no library); a placement's fit (NativeGeometry, containGeometry) moves to surface.zig and a PDF's fit modes to pdf_view.zig; a terminal's kitty PNG decodes in TerminalImages.zig through wuffs as before, its downscale through stb_image_resize, the one part of zstbi the core keeps (stb_image patched out of it, the wuffs_images option, tag_image and image_exts gone); the image cases load the built image.so by path: test/panes.zig's and fs_namespace's through Addon.perform, T1 through Addon load (a new behaviour case: PNG, JPEG and PPM through 9P, the art words, a refused corrupt PNG, a dump's placeholder and its picture back, which replaces the decode unit test and ctl.zig's corrupt-image case), the snapshot, process and image harnesses by linking it into each session's data directory; images.snap unchanged Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/fs_namespace.zig | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'test/fs_namespace.zig') diff --git a/test/fs_namespace.zig b/test/fs_namespace.zig index 6ee50f77..22ce27fe 100644 --- a/test/fs_namespace.zig +++ b/test/fs_namespace.zig @@ -1,6 +1,5 @@ const std = @import("std"); const pardes = @import("pardes"); -const image = pardes.image; const filesystem = pardes.filesystem; test "runtime Mount and Unmount copy command arguments and change Look resolution" { @@ -289,8 +288,6 @@ test "owned cwd failed file opens never publish a pane or retain a reservation" 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); - defer pardes.image.stop(); var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); const bytes = "P6\n1 1\n255\n\x0d\x4d\xe7"; @@ -299,22 +296,27 @@ test "images decode through explicit filesystem mounts, and a dump reads one on const directory_len = try tmp.dir.realPath(std.testing.io, &directory_buffer); const path = try std.fmt.allocPrint(gpa, "/n/os{s}/pixel.ppm", .{directory_buffer[0..directory_len]}); defer gpa.free(path); - const p = try pardes.Pardes.init(gpa, .{ .tty_only = true, .file = path }); + const p = try pardes.Pardes.init(gpa, .{ .tty_only = true }); defer p.deinit(); + // The image addon loaded, as `Addon load` loads it; the picture looked at. + pardes.Addon.perform(p, .load, 0, @import("test_addons").image); + pardes.look.lookAt(p, 0, path); var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); // Its decode is a job its host runs: here, at once. - while (p.nextEffect()) |e| p.perform(e); + while (p.nextEffect()) |e| if (e == .job) p.perform(e); _ = try p.render(arena.allocator()); const shown = p.surface.placements.items; try std.testing.expectEqual(@as(usize, 1), shown.len); try std.testing.expectEqual(@as(u32, 1), shown[0].raster.w); try std.testing.expectEqual(@as(u32, 1), shown[0].raster.h); - // The picture's bytes are in the dump: it comes back as it was shown. + // The picture's bytes are in the dump: it comes back as it was shown + // (a placeholder holding them, as a core without the addon keeps it). try pardes.dump.dumpState(p); const restored = try pardes.dump.initFromDump(gpa, .{ .tty_only = true }, p.dump_out.?); defer restored.deinit(); - const slot = restored.panes[0].?.addon.?; - var kept: [64]u8 = undefined; - try std.testing.expectEqualStrings(bytes, kept[0..image.kind.dump.?(slot.st, &kept, kept.len)]); + const slot = for (restored.panes) |pane| { + if (pane) |each| if (each.addon) |s| break s; + } else return error.NoImagePane; + try std.testing.expectEqualStrings(bytes, slot.record.?); } -- cgit v1.3