blob: e8791c03b323e69350b61bd73d66be3c0a011117 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#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 = imv_loader_create();
void *retval;
char *error;
unsigned int width;
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);
imv_loader_free(ldr);
}
int main(void)
{
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_jpeg_rotation),
};
return cmocka_run_group_tests(tests, NULL, NULL);
}
/* vim:set ts=2 sts=2 sw=2 et: */
|