Add tests for the tiff loader

This commit is contained in:
Matthias Clasen 2021-09-12 01:07:16 -04:00 committed by Benjamin Otte
parent f925e12e1d
commit 945c2531ac
2 changed files with 7 additions and 0 deletions

Binary file not shown.

View File

@ -1,5 +1,6 @@
#include <gtk/gtk.h>
#include "gdk/loaders/gdkpngprivate.h"
#include "gdk/loaders/gdktiffprivate.h"
static void
assert_texture_equal (GdkTexture *t1,
@ -47,6 +48,8 @@ test_load_image (gconstpointer data)
if (g_str_has_suffix (filename, ".png"))
texture = gdk_load_png (bytes, &error);
else if (g_str_has_suffix (filename, ".tiff"))
texture = gdk_load_tiff (bytes, &error);
else
g_assert_not_reached ();
@ -81,6 +84,8 @@ test_save_image (gconstpointer test_data)
if (g_str_has_suffix (filename, ".png"))
bytes = gdk_save_png (texture);
else if (g_str_has_suffix (filename, ".tiff"))
bytes = gdk_save_tiff (texture);
else
g_assert_not_reached ();
@ -112,7 +117,9 @@ main (int argc, char *argv[])
(g_test_init) (&argc, &argv, NULL);
g_test_add_data_func ("/image/load/png", "image.png", test_load_image);
g_test_add_data_func ("/image/load/tiff", "image.tiff", test_load_image);
g_test_add_data_func ("/image/save/png", "image.png", test_save_image);
g_test_add_data_func ("/image/save/tiff", "image.tiff", test_save_image);
return g_test_run ();
}