From b30948f044fbbc216a1bbdd2effe2af39c1bfd1b Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 17 Apr 2006 12:45:07 +0000 Subject: [PATCH] * Use cucul_get_export_list() in the export test instead of hardcoding the list of available formats. Also added a few truecolor blocks to the test. --- test/export.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/test/export.c b/test/export.c index 6596cee..a70d7c9 100644 --- a/test/export.c +++ b/test/export.c @@ -37,24 +37,31 @@ int main(int argc, char *argv[]) cucul_t *qq; cucul_dither_t *dither; cucul_buffer_t *buffer; + char const * const * exports, * const * p; int x, y; + exports = cucul_get_export_list(); + if(argc != 2) { fprintf(stderr, "%s: wrong argument count\n", argv[0]); fprintf(stderr, "usage: %s \n", argv[0]); - fprintf(stderr, "where is one of: ansi, html, html3, irc, ps, svg\n"); + fprintf(stderr, "where is one of:\n"); + for(p = exports; *p; p += 2) + fprintf(stderr, " \"%s\" (%s)\n", *p, *(p + 1)); exit(-1); } - if(strcasecmp(argv[1], "ansi") - && strcasecmp(argv[1], "html") - && strcasecmp(argv[1], "html3") - && strcasecmp(argv[1], "irc") - && strcasecmp(argv[1], "ps") - && strcasecmp(argv[1], "svg")) + for(p = exports; *p; p += 2) + if(!strcasecmp(argv[1], *p)) + break; + + if(!*p) { fprintf(stderr, "%s: unknown format `%s'\n", argv[0], argv[1]); + fprintf(stderr, "please use one of:\n"); + for(p = exports; *p; p += 2) + fprintf(stderr, " \"%s\" (%s)\n", *p, *(p + 1)); exit(-1); } @@ -89,6 +96,12 @@ int main(int argc, char *argv[]) cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_LIGHTBLUE); cucul_putstr(qq, WIDTH / 2 - 7, HEIGHT / 2, " LIBCACA "); + for(x = 0; x < 16; x++) + { + cucul_set_truecolor(qq, 0xff00 | x, 0xf00f | (x << 4)); + cucul_putstr(qq, WIDTH / 2 - 7 + x, HEIGHT / 2 + 5, "#"); + } + buffer = cucul_create_export(qq, argv[1]); fwrite(cucul_get_buffer_data(buffer), cucul_get_buffer_size(buffer), 1, stdout);