From 6e4ab5b91771e516b3fb80f5692f31a23001d72c Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 9 Apr 2009 15:26:51 +0000 Subject: add frontend selection and fix finalisation support svn path=/trunk/libnsfb/; revision=7072 --- test/Makefile | 2 +- test/frontend.c | 38 ++++++++++++++++++++++++++++++++++++++ test/plottest.c | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 test/frontend.c (limited to 'test') 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 +#include +#include + +#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 */ -- cgit v1.2.3