[gtk/image-loading: 5/12] Add tests for the tiff loader




commit 20109c34058fa819d739825260e5f34701a2f4c0
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Sep 12 01:07:16 2021 -0400

    Add tests for the tiff loader

 testsuite/gdk/image-data/image.tiff | Bin 0 -> 205344 bytes
 testsuite/gdk/image.c               |   7 +++++++
 2 files changed, 7 insertions(+)
---
diff --git a/testsuite/gdk/image-data/image.tiff b/testsuite/gdk/image-data/image.tiff
new file mode 100644
index 0000000000..ddd0d03609
Binary files /dev/null and b/testsuite/gdk/image-data/image.tiff differ
diff --git a/testsuite/gdk/image.c b/testsuite/gdk/image.c
index 0a916eb404..ceae44df67 100644
--- a/testsuite/gdk/image.c
+++ b/testsuite/gdk/image.c
@@ -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 ();
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]