aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDmitrij D. Czarkoff <czarkoff@gmail.com>2016-02-21 16:35:36 +0100
committerDmitrij D. Czarkoff <czarkoff@gmail.com>2016-02-21 16:35:36 +0100
commit9cdab1b173af8a2fabe76d674f05faeef5319ac3 (patch)
treedfa825a97a571142ed8fe1bf210744acf4766450 /test
parentb4dfe40a577aa23bcac2d580122a13246e431d66 (diff)
downloadimv-9cdab1b173af8a2fabe76d674f05faeef5319ac3.tar.gz
Add test to check for EXIF rotation of JPEG images
Diffstat (limited to 'test')
-rw-r--r--test/loader.c40
-rw-r--r--test/orientation.jpgbin0 -> 212 bytes
2 files changed, 40 insertions, 0 deletions
diff --git a/test/loader.c b/test/loader.c
new file mode 100644
index 0000000..b528c8f
--- /dev/null
+++ b/test/loader.c
@@ -0,0 +1,40 @@
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+#include <unistd.h>
+#include <FreeImage.h>
+#include <pthread.h>
+#include "loader.h"
+
+static void test_jpeg_rotation(void **state)
+{
+ (void)state;
+ struct imv_loader ldr;
+ void *retval;
+ char *error;
+ unsigned int width;
+
+ imv_init_loader(&ldr);
+
+ imv_loader_load(&ldr, "test/orientation.jpg", NULL, 0);
+ pthread_join(ldr.bg_thread, &retval);
+
+ error = imv_loader_get_error(&ldr);
+ assert_false(error);
+
+ assert_false(retval == PTHREAD_CANCELED);
+ assert_false(ldr.out_bmp == NULL);
+
+ width = FreeImage_GetWidth(ldr.out_bmp);
+ assert_true(width == 1);
+}
+
+int main(void)
+{
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test_jpeg_rotation),
+ };
+
+ return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/test/orientation.jpg b/test/orientation.jpg
new file mode 100644
index 0000000..c74189b
--- /dev/null
+++ b/test/orientation.jpg
Binary files differ