From c181e7ee9bf236b24cdf8bf4c413885366e713a3 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Wed, 30 Jan 2019 23:15:14 +0000 Subject: Update tests for new backend approach --- Makefile | 5 +++-- test/loader.c | 52 --------------------------------------------------- test/orientation.jpg | Bin 212 -> 0 bytes 3 files changed, 3 insertions(+), 54 deletions(-) delete mode 100644 test/loader.c delete mode 100644 test/orientation.jpg diff --git a/Makefile b/Makefile index 9e16cfd..58dce34 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,6 @@ TARGET := $(BUILDDIR)/imv SOURCES := $(wildcard src/*.c) OBJECTS := $(patsubst src/%.c,$(BUILDDIR)/%.o,$(SOURCES)) TESTS := $(patsubst test/%.c,$(BUILDDIR)/test_%,$(wildcard test/*.c)) -TFLAGS ?= -g $(CFLAGS) $(CPPFLAGS) $(shell pkg-config --cflags cmocka) -TLIBS := $(LIBS) $(shell pkg-config --libs cmocka) VERSION != git describe --dirty --always --tags 2> /dev/null || echo v3.0.0 @@ -43,6 +41,9 @@ ifeq ($(BACKEND_LIBRSVG),yes) LIBS += $(shell pkg-config --libs librsvg-2.0) endif +TFLAGS ?= -g $(CFLAGS) $(CPPFLAGS) $(shell pkg-config --cflags cmocka) +TLIBS := $(LIBS) $(shell pkg-config --libs cmocka) + imv: $(TARGET) $(TARGET): $(OBJECTS) diff --git a/test/loader.c b/test/loader.c deleted file mode 100644 index 3456abc..0000000 --- a/test/loader.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "loader.h" -#include "bitmap.h" - -static void test_jpeg_rotation(void **state) -{ - (void)state; - struct imv_loader *ldr = imv_loader_create(); - - assert_false(SDL_Init(SDL_INIT_VIDEO)); - unsigned int NEW_IMAGE = SDL_RegisterEvents(1); - unsigned int BAD_IMAGE = SDL_RegisterEvents(1); - imv_loader_set_event_types(ldr, NEW_IMAGE, BAD_IMAGE); - - imv_loader_load(ldr, "test/orientation.jpg", NULL, 0); - - struct imv_bitmap *bmp = NULL; - SDL_Event event; - while(SDL_WaitEvent(&event)) { - assert_false(event.type == BAD_IMAGE); - - if(event.type == NEW_IMAGE) { - bmp = event.user.data1; - break; - } - } - - assert_false(bmp == NULL); - unsigned int width = bmp->width; - assert_true(width == 1); - - imv_bitmap_free(bmp); - 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: */ diff --git a/test/orientation.jpg b/test/orientation.jpg deleted file mode 100644 index c74189b..0000000 Binary files a/test/orientation.jpg and /dev/null differ -- cgit v1.2.3