[gdk-pixbuf] tests: Add test for wrongly typed orientation EXIF tag



commit e8d0ced40555bd4f99508af3e3d214db502933a9
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Apr 21 13:30:26 2015 +0200

    tests: Add test for wrongly typed orientation EXIF tag
    
    Note that the rotation, once applied, should have the test photo
    looking sideways (vertical) and not horizontal as you'd expect.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725582

 tests/Makefile.am              |    2 ++
 tests/bug725582-testrotate.jpg |  Bin 0 -> 191853 bytes
 tests/bug725582-testrotate.png |  Bin 0 -> 515373 bytes
 tests/pixbuf-jpeg.c            |   30 ++++++++++++++++++++++++++++++
 4 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cf5eb6d..058ad68 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -50,6 +50,8 @@ dist_installed_test_data =            \
        dpi.tiff                        \
        premature-end.png               \
        premature-end.jpg               \
+       bug725582-testrotate.jpg        \
+       bug725582-testrotate.png        \
        $(wildcard $(srcdir)/test-images/*)
 
 pixbuf_icc_SOURCES =                   \
diff --git a/tests/bug725582-testrotate.jpg b/tests/bug725582-testrotate.jpg
new file mode 100644
index 0000000..f95a38f
Binary files /dev/null and b/tests/bug725582-testrotate.jpg differ
diff --git a/tests/bug725582-testrotate.png b/tests/bug725582-testrotate.png
new file mode 100644
index 0000000..cddc341
Binary files /dev/null and b/tests/bug725582-testrotate.png differ
diff --git a/tests/pixbuf-jpeg.c b/tests/pixbuf-jpeg.c
index 057f188..351fa20 100644
--- a/tests/pixbuf-jpeg.c
+++ b/tests/pixbuf-jpeg.c
@@ -50,12 +50,42 @@ test_inverted_cmyk_jpeg (void)
   g_object_unref (ref2);
 }
 
+static void
+test_type9_rotation_exif_tag (void)
+{
+  GError *error = NULL;
+  GdkPixbuf *ref, *ref1, *ref2;
+  gboolean ret;
+
+  if (!format_supported ("jpeg") || !format_supported ("png"))
+    {
+      g_test_skip ("format not supported");
+      return;
+    }
+
+  ref = gdk_pixbuf_new_from_file (g_test_get_filename (G_TEST_DIST, "bug725582-testrotate.jpg", NULL), 
&error);
+  g_assert_no_error (error);
+  ref1 = gdk_pixbuf_apply_embedded_orientation (ref);
+
+  ref2 = gdk_pixbuf_new_from_file (g_test_get_filename (G_TEST_DIST, "bug725582-testrotate.png", NULL), 
&error);
+  g_assert_no_error (error);
+
+  ret = pixdata_equal (ref1, ref2, &error);
+  g_assert_no_error (error);
+  g_assert (ret);
+
+  g_assert_cmpstr (gdk_pixbuf_get_option (ref, "orientation"), ==, "6");
+
+  g_object_unref (ref);
+}
+
 int
 main (int argc, char **argv)
 {
   g_test_init (&argc, &argv, NULL);
 
   g_test_add_func ("/pixbuf/jpeg/inverted_cmyk_jpeg", test_inverted_cmyk_jpeg);
+  g_test_add_func ("/pixbuf/jpeg/type9_rotation_exif_tag", test_type9_rotation_exif_tag);
 
   return g_test_run ();
 }


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