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




commit 964556af7598418ccb6c7cb831b59c9d15c1f8d6
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Sep 11 23:28:06 2021 -0400

    Add tests for the jpeg loader

 testsuite/gdk/image-data/image.jpeg | Bin 0 -> 8397 bytes
 testsuite/gdk/image.c               |   9 +++++++++
 2 files changed, 9 insertions(+)
---
diff --git a/testsuite/gdk/image-data/image.jpeg b/testsuite/gdk/image-data/image.jpeg
new file mode 100644
index 0000000000..53ebb349bc
Binary files /dev/null and b/testsuite/gdk/image-data/image.jpeg differ
diff --git a/testsuite/gdk/image.c b/testsuite/gdk/image.c
index 393ffa282b..c760062761 100644
--- a/testsuite/gdk/image.c
+++ b/testsuite/gdk/image.c
@@ -1,6 +1,7 @@
 #include <gtk/gtk.h>
 #include "gdk/gdkpngprivate.h"
 #include "gdk/gdktiffprivate.h"
+#include "gdk/gdkjpegprivate.h"
 
 static void
 test_load_image (gconstpointer data)
@@ -21,6 +22,8 @@ test_load_image (gconstpointer data)
     texture = gdk_load_png (stream, &error);
   else if (g_str_has_suffix (filename, ".tiff"))
     texture = gdk_load_tiff (stream, &error);
+  else if (g_str_has_suffix (filename, ".jpeg"))
+    texture = gdk_load_jpeg (stream, &error);
   else
     g_assert_not_reached ();
 
@@ -53,6 +56,8 @@ load_image_done (GObject      *source,
     ldata->texture = gdk_load_png_finish (result, &ldata->error);
   else if (g_str_has_suffix (ldata->filename, ".tiff"))
     ldata->texture = gdk_load_tiff_finish (result, &ldata->error);
+  else if (g_str_has_suffix (ldata->filename, ".jpeg"))
+    ldata->texture = gdk_load_jpeg_finish (result, &ldata->error);
   else
     g_assert_not_reached ();
   ldata->done = TRUE;
@@ -79,6 +84,8 @@ test_load_image_async (gconstpointer data)
     gdk_load_png_async (stream, NULL, load_image_done, &ldata);
   else if (g_str_has_suffix (filename, ".tiff"))
     gdk_load_tiff_async (stream, NULL, load_image_done, &ldata);
+  else if (g_str_has_suffix (filename, ".jpeg"))
+    gdk_load_jpeg_async (stream, NULL, load_image_done, &ldata);
   else
     g_assert_not_reached ();
   while (!ldata.done)
@@ -282,8 +289,10 @@ main (int argc, char *argv[])
 
   g_test_add_data_func ("/image/load/png/sync", "image.png", test_load_image);
   g_test_add_data_func ("/image/load/tiff/sync", "image.tiff", test_load_image);
+  g_test_add_data_func ("/image/load/jpeg/sync", "image.jpeg", test_load_image);
   g_test_add_data_func ("/image/load/png/async", "image.png", test_load_image_async);
   g_test_add_data_func ("/image/load/tiff/async", "image.tiff", test_load_image_async);
+  g_test_add_data_func ("/image/load/jpeg/async", "image.jpeg", test_load_image_async);
   g_test_add_data_func ("/image/save/png/sync", "image.png", test_save_image);
   g_test_add_data_func ("/image/save/tiff/sync", "image.tiff", test_save_image);
   g_test_add_data_func ("/image/save/png/async", "image.png", test_save_image_async);


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