Ignore:
Timestamp:
Apr 17, 2006, 2:45:07 PM (15 years ago)
Author:
Sam Hocevar
Message:
  • 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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/test/export.c

    r777 r788  
    3838    cucul_dither_t *dither;
    3939    cucul_buffer_t *buffer;
     40    char const * const * exports, * const * p;
    4041    int x, y;
     42
     43    exports = cucul_get_export_list();
    4144
    4245    if(argc != 2)
     
    4447        fprintf(stderr, "%s: wrong argument count\n", argv[0]);
    4548        fprintf(stderr, "usage: %s <format>\n", argv[0]);
    46         fprintf(stderr, "where <format> is one of: ansi, html, html3, irc, ps, svg\n");
     49        fprintf(stderr, "where <format> is one of:\n");
     50        for(p = exports; *p; p += 2)
     51            fprintf(stderr, " \"%s\" (%s)\n", *p, *(p + 1));
    4752        exit(-1);
    4853    }
    4954
    50     if(strcasecmp(argv[1], "ansi")
    51         && strcasecmp(argv[1], "html")
    52         && strcasecmp(argv[1], "html3")
    53         && strcasecmp(argv[1], "irc")
    54         && strcasecmp(argv[1], "ps")
    55         && strcasecmp(argv[1], "svg"))
     55    for(p = exports; *p; p += 2)
     56        if(!strcasecmp(argv[1], *p))
     57            break;
     58
     59    if(!*p)
    5660    {
    5761        fprintf(stderr, "%s: unknown format `%s'\n", argv[0], argv[1]);
     62        fprintf(stderr, "please use one of:\n");
     63        for(p = exports; *p; p += 2)
     64            fprintf(stderr, " \"%s\" (%s)\n", *p, *(p + 1));
    5865        exit(-1);
    5966    }
     
    9097    cucul_putstr(qq, WIDTH / 2 - 7, HEIGHT / 2, "    LIBCACA    ");
    9198
     99    for(x = 0; x < 16; x++)
     100    {
     101        cucul_set_truecolor(qq, 0xff00 | x, 0xf00f | (x << 4));
     102        cucul_putstr(qq, WIDTH / 2 - 7 + x, HEIGHT / 2 + 5, "#");
     103    }
     104
    92105    buffer = cucul_create_export(qq, argv[1]);
    93106    fwrite(cucul_get_buffer_data(buffer),
Note: See TracChangeset for help on using the changeset viewer.