From 6b0f2de39c2d8b9e8d346abd8548024da4ae8185 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 12 Jul 2026 17:51:22 +0300 Subject: showimage: loader, detect, viewer widget, EXIF orientation, tests (gt0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit M1 (task gt0): show one image with zoom/pan. - src/loader/detect.{c,h}: magic-byte format sniffing (JPEG/PNG/GIF/WebP/ TIFF/ICO/JXL/AVIF/HEIF) -> GgazeFormat; pure, no I/O, unit-testable. - src/loader/loader.{c,h}: loader_load() sniffs the header and dispatches to the first registered backend; GgazeLoaderBackend struct; pixbuf is the fallback (last, accepts UNKNOWN). M1 ships only the pixbuf backend. - src/loader/backends/pixbuf.c: GdkPixbufLoader decode + gdk_pixbuf_apply_embedded_orientation (decision #26) -> GdkTexture via gdk_memory_texture_new (avoids the deprecated gdk_texture_new_for_pixbuf). - src/viewer.{c,h}: GgazeViewer : GtkWidget custom widget (decision #31) — fit/100%/in/out zoom, cursor-centered zoom, drag-to-pan with clamping, dark background, GtkSnapshot render nodes. - src/window.c: open -> loader_load -> viewer_set_texture -> stack 'large'. - tests: unit test_detect (13 cases) + test_loader_pixbuf (plain/rotated-EXIF 8x4 orient6->4x8/png/rgba/missing/unsupported jxl-avif-heif/corrupt), integration test_open_and_show (fixture + rotated + ./sample-images skip-if-absent). 6/6 green; detect 97% / loader 91% / pixbuf 87% coverage. - fixtures: gen.py produces plain.jpg, rot6.jpg, small.png, rgba.png. - AGENTS.md: documents the ./sample-images optional test corpus convention. Sub-agent review fixes: use-after-free of c_name in ggaze_window_open (BLOCKER), gtk_stack_get_pages leak in test_window (BLOCKER), coverage gap, dead branch, viewer measure, _prefix/_cb naming, include order, extern in header, pan clamp, stale comments — all addressed. --- AGENTS.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'AGENTS.md') diff --git a/AGENTS.md b/AGENTS.md index f56a48a..8b3ac2d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -42,6 +42,14 @@ Shared helpers go in `tests/helpers/`; fixtures in `tests/fixtures/` (grow per milestone). Integration suites land with the milestone that first makes a flow possible — see `docs/IMPLEMENTATION.md` "Planned integration suites". +**Optional realistic corpus:** `./sample-images/` (a local, NOT git-tracked +613-image camera dump: 601 JPEG + 12 PNG, sizes up to 46MB, varied EXIF) is +the realistic test corpus for integration tests and leak-check sessions. Any +test or scripted session that uses it MUST skip cleanly when the directory is +absent (so CI, which only has `tests/fixtures/`, stays green) and MUST NOT +mutate the corpus — work on temp copies. The committed `tests/fixtures/` are +the CI-portable baseline; `./sample-images/` is a local supplement. + ## Conventions (enforced) - `docs/coding-conventions.md` summarizes; the `c-best-practices` skill wins. -- cgit v1.2.3