diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-22 09:55:50 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-22 09:55:50 +0300 |
| commit | 00f9ad7f18349781a679e7b3281d7e8f84ebb5b1 (patch) | |
| tree | 7d38c655a3b0e48bc0d25952db679a2903dc3ff3 /tests | |
| parent | d39915e214b66423e5edff788d81199c9db0b045 (diff) | |
enhance: layered (composable) filter toggles, highlighted rows, side panel next to image
Filters are now independent toggles that compose: the active set is a
bitmask (u_enhance_mask) and the enabled GEGL ops are chained in array
order (enhancer_apply_chain / enhancer_export_chain). Press 1-8 to
toggle any preset on/off at any time; 0 / the Original row clears all;
the live preview re-applies the whole stack each time, so you can
add/remove filters in any order. The window title lists the enabled
presets.
The side panel now sits NEXT TO the image (a horizontal content box:
[panel] + image area) instead of over it; in fullscreen it reparents
to an overlay over the image so fullscreen stays full. Enabled rows
are highlighted (.ggaze-enhance-on: accent background, white bold).
enhancer.c: extract _op_for_builtin, add enhancer_apply_chain and
enhancer_export_chain (single-preset apply/export kept for the tests);
_save_buffer factored out (ju0/ku0 fixes unchanged). New
test /enhancer/apply_chain (compose + empty-mask rejection).
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_enhancer.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_enhancer.c b/tests/test_enhancer.c index 1445c41..3f17ea1 100644 --- a/tests/test_enhancer.c +++ b/tests/test_enhancer.c @@ -261,6 +261,33 @@ test_export_real_success(void) { g_free(tmp); } +static void +test_apply_chain(void) { + Enhancer *e = enhancer_new(); + const GPtrArray *p = enhancer_get_presets(e); + GeglRectangle rect = {0, 0, 4, 4}; + GeglBuffer *buf = gegl_buffer_new(&rect, babl_format("RGBA float")); + g_assert_nonnull(buf); + /* Compose Auto-fix (bit 0) + Sharpen (bit 6) if those ops exist. */ + guint8 u_mask = (guint8)((1u << 0) | (1u << 6)); + GError *p_err = NULL; + GeglBuffer *p_out = enhancer_apply_chain(e, buf, p, u_mask, &p_err); + if (p_out != NULL) { + g_assert_cmpint(gegl_buffer_get_width(p_out), ==, 4); + g_assert_cmpint(gegl_buffer_get_height(p_out), ==, 4); + g_object_unref(p_out); + } else { + g_clear_error(&p_err); /* ops may be unavailable; skip gracefully */ + } + /* An empty mask must fail (no preset enabled). */ + p_out = enhancer_apply_chain(e, buf, p, 0, &p_err); + g_assert_null(p_out); + g_assert_nonnull(p_err); + g_clear_error(&p_err); + g_object_unref(buf); + enhancer_delete(e); +} + int main(int argc, char **argv) { gegl_init(&argc, &argv); @@ -270,5 +297,6 @@ main(int argc, char **argv) { g_test_add_func("/enhancer/load_and_to_texture", test_load_and_to_texture); g_test_add_func("/enhancer/export_format", test_export_format); g_test_add_func("/enhancer/export_real_success", test_export_real_success); + g_test_add_func("/enhancer/apply_chain", test_apply_chain); return g_test_run(); }
\ No newline at end of file |
