[gtk/image-loading: 7/14] Add tests for the tiff loader




commit 823996a799153014aa49c2b158f754bc04228359
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               |  11 +++++++++++
 2 files changed, 11 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 5288b7ff9f..4aa787e1f5 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
 test_load_image (gconstpointer data)
@@ -18,6 +19,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 ();
 
@@ -67,6 +70,12 @@ test_save_image (gconstpointer test_data)
                         width, height, width * 4,
                         GDK_MEMORY_DEFAULT,
                         &error);
+  else if (g_str_has_suffix (filename, ".tiff"))
+    ret = gdk_save_tiff (g_io_stream_get_output_stream (stream),
+                         data,
+                         width, height, width * 4,
+                         GDK_MEMORY_DEFAULT,
+                         &error);
   else
     g_assert_not_reached ();
 
@@ -110,7 +119,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]