summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2009-04-09 15:26:51 +0000
committerVincent Sanders <vince@netsurf-browser.org>2009-04-09 15:26:51 +0000
commit6e4ab5b91771e516b3fb80f5692f31a23001d72c (patch)
treed36c59986fa08d01e0efbec0d4cb66c5f7ffc904 /test
parente136ab597105dcbe211ce0a1f49113b4cb14b1ca (diff)
downloadlibnsfb-6e4ab5b91771e516b3fb80f5692f31a23001d72c.tar.gz
libnsfb-6e4ab5b91771e516b3fb80f5692f31a23001d72c.tar.bz2
add frontend selection and fix finalisation support
svn path=/trunk/libnsfb/; revision=7072
Diffstat (limited to 'test')
-rw-r--r--test/Makefile2
-rw-r--r--test/frontend.c38
-rw-r--r--test/plottest.c2
3 files changed, 40 insertions, 2 deletions
diff --git a/test/Makefile b/test/Makefile
index e027ba0..6d4f4fa 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,3 +1,3 @@
-DIR_TEST_ITEMS := plottest:plottest.c;nsglobe.c
+DIR_TEST_ITEMS := plottest:plottest.c;nsglobe.c frontend:frontend.c
include build/makefiles/Makefile.subdir
diff --git a/test/frontend.c b/test/frontend.c
new file mode 100644
index 0000000..bdc8d67
--- /dev/null
+++ b/test/frontend.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdlib.h>
+
+#include "libnsfb.h"
+int main(int argc, char **argv)
+{
+ nsfb_t *nsfb;
+ const char *fename;
+ enum nsfb_frontend_e fetype;
+
+ if (argc < 2) {
+ fename="sdl";
+ } else {
+ fename = argv[1];
+ }
+
+ fetype = nsfb_frontend_from_name(fename);
+ if (fetype == NSFB_FRONTEND_NONE) {
+ fprintf(stderr, "Unable to initialise nsfb with %s frontend\n", fename);
+ return 1;
+ }
+
+ nsfb = nsfb_init(fetype);
+ if (nsfb == NULL) {
+ fprintf(stderr, "Unable to initialise nsfb with %s frontend\n", fename);
+ return 2;
+ }
+
+ if (nsfb_init_frontend(nsfb) == -1) {
+ fprintf(stderr, "Unable to initialise nsfb frontend\n");
+ nsfb_finalise(nsfb);
+ return 3;
+ }
+
+ nsfb_finalise(nsfb);
+ return 0;
+}
diff --git a/test/plottest.c b/test/plottest.c
index f2008fa..dc469f6 100644
--- a/test/plottest.c
+++ b/test/plottest.c
@@ -86,7 +86,7 @@ int main(int argc, char **argv)
if (nsfb_init_frontend(nsfb) == -1) {
fprintf(stderr, "Unable to initialise nsfb frontend\n");
-
+ return 2;
}
/* get the geometry of the whole screen */