aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2019-08-12 00:28:24 +0100
committerHarry Jeffery <harry@exec64.co.uk>2019-08-12 00:28:24 +0100
commit18c95a7226148747ae886eb4992d2424cd80aae8 (patch)
tree7a4fcbcb82e86c9fc2c00f70c55cc0889e407810
parentd07749824010f38de33b33b5d1f4036d67183fb1 (diff)
downloadimv-18c95a7226148747ae886eb4992d2424cd80aae8.tar.gz
Dummy windows for unit testing
-rw-r--r--Makefile2
-rw-r--r--src/dummy_window.c96
2 files changed, 97 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index e6729cb..bf1f8e1 100644
--- a/Makefile
+++ b/Makefile
@@ -117,7 +117,7 @@ $(BUILDDIR):
$(BUILDDIR)/%.o: src/%.c Makefile
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
-$(BUILDDIR)/test_%: test/%.c $(filter-out src/main.c, $(SOURCES))
+$(BUILDDIR)/test_%: test/%.c src/dummy_window.c $(filter-out src/main.c, $(SOURCES))
$(CC) -o $@ -Isrc $(TFLAGS) $^ $(LDFLAGS) $(TLIBS)
check: $(BUILDDIR) $(TESTS)
diff --git a/src/dummy_window.c b/src/dummy_window.c
new file mode 100644
index 0000000..ae6e9c3
--- /dev/null
+++ b/src/dummy_window.c
@@ -0,0 +1,96 @@
+#include "window.h"
+
+#include <stdbool.h>
+#include <unistd.h>
+
+struct imv_window *imv_window_create(int w, int h, const char *title)
+{
+ (void)w;
+ (void)h;
+ (void)title;
+ return NULL;
+}
+
+void imv_window_free(struct imv_window *window)
+{
+ (void)window;
+}
+
+void imv_window_clear(struct imv_window *window, unsigned char r,
+ unsigned char g, unsigned char b)
+{
+ (void)window;
+ (void)r;
+ (void)g;
+ (void)b;
+}
+
+void imv_window_get_size(struct imv_window *window, int *w, int *h)
+{
+ (void)window;
+ (void)w;
+ (void)h;
+}
+
+void imv_window_get_framebuffer_size(struct imv_window *window, int *w, int *h)
+{
+ (void)window;
+ (void)w;
+ (void)h;
+}
+
+void imv_window_set_title(struct imv_window *window, const char *title)
+{
+ (void)window;
+ (void)title;
+}
+
+bool imv_window_is_fullscreen(struct imv_window *window)
+{
+ (void)window;
+ return false;
+}
+
+void imv_window_set_fullscreen(struct imv_window *window, bool fullscreen)
+{
+ (void)window;
+ (void)fullscreen;
+}
+
+bool imv_window_get_mouse_button(struct imv_window *window, int button)
+{
+ (void)window;
+ (void)button;
+ return false;
+}
+
+void imv_window_get_mouse_position(struct imv_window *window, double *x, double *y)
+{
+ (void)window;
+ (void)x;
+ (void)y;
+}
+
+void imv_window_present(struct imv_window *window)
+{
+ (void)window;
+}
+
+void imv_window_wait_for_event(struct imv_window *window, double timeout)
+{
+ (void)window;
+ (void)timeout;
+}
+
+void imv_window_push_event(struct imv_window *window, struct imv_event *e)
+{
+ (void)window;
+ (void)e;
+}
+
+void imv_window_pump_events(struct imv_window *window, imv_event_handler handler, void *data)
+{
+ (void)window;
+ (void)handler;
+ (void)data;
+}