diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile | 2 | ||||
-rw-r--r-- | test/frontend.c | 38 | ||||
-rw-r--r-- | test/plottest.c | 2 |
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 */ |