Bläddra i källkod

* 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.
tags/v0.99.beta14
Sam Hocevar sam 19 år sedan
förälder
incheckning
b30948f044
1 ändrade filer med 20 tillägg och 7 borttagningar
  1. +20
    -7
      test/export.c

+ 20
- 7
test/export.c Visa fil

@@ -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 <format>\n", argv[0]);
fprintf(stderr, "where <format> is one of: ansi, html, html3, irc, ps, svg\n");
fprintf(stderr, "where <format> 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);


Laddar…
Avbryt
Spara