Browse Source

* Fix the Unicode test.

* Add a test for fullwidth characters.
tags/v0.99.beta14
Sam Hocevar sam 18 years ago
parent
commit
8a316f40d6
3 changed files with 75 additions and 2 deletions
  1. +4
    -1
      test/Makefile.am
  2. +70
    -0
      test/fullwidth.c
  3. +1
    -1
      test/unicode.c

+ 4
- 1
test/Makefile.am View File

@@ -2,7 +2,7 @@

AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I$(top_srcdir)/caca -DDATADIR=\"$(pkgdatadir)\"

noinst_PROGRAMS = colors demo demo0 dithering event export font frames gamma hsv input spritedit font2tga text transform truecolor unicode import
noinst_PROGRAMS = colors demo demo0 dithering event export font frames fullwidth gamma hsv input spritedit font2tga text transform truecolor unicode import

colors_SOURCES = colors.c
colors_LDADD = ../caca/libcaca.la ../cucul/libcucul.la
@@ -33,6 +33,9 @@ font2tga_LDADD = ../cucul/libcucul.la
frames_SOURCES = frames.c
frames_LDADD = ../caca/libcaca.la ../cucul/libcucul.la

fullwidth_SOURCES = fullwidth.c
fullwidth_LDADD = ../caca/libcaca.la ../cucul/libcucul.la

gamma_SOURCES = gamma.c
gamma_LDADD = ../caca/libcaca.la ../cucul/libcucul.la
gamma_LDFLAGS = @MATH_LIBS@


+ 70
- 0
test/fullwidth.c View File

@@ -0,0 +1,70 @@
/*
* fullwidth libcaca fullwidth Unicode characters test program
* Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
* All Rights Reserved
*
* $Id$
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Do What The Fuck You Want To
* Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/

#include "config.h"
#include "common.h"

#if !defined(__KERNEL__)
# if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
# endif
# include <stdio.h>
#endif

#include "cucul.h"
#include "caca.h"

#define HOHO "ホホホホホホホホホホホホホホホ"

int main(int argc, char *argv[])
{
cucul_canvas_t *cv, *hoho;
caca_display_t *dp;

unsigned int i;

cv = cucul_create_canvas(0, 0);
dp = caca_create_display(cv);

hoho = cucul_create_canvas(6, 10);

for(i = 0; i < 10; i++)
{
cucul_set_color(hoho, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);
cucul_putstr(hoho, 0, i, HOHO);
cucul_set_color(hoho, CUCUL_COLOR_WHITE, CUCUL_COLOR_RED);
cucul_putchar(hoho, i - 2, i, 'x');
}

cucul_blit(cv, 1, 1, hoho, NULL);

for(i = 0; i < 10; i++)
{
cucul_set_color(hoho, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);
cucul_putstr(hoho, 0, i, HOHO);
cucul_set_color(hoho, CUCUL_COLOR_WHITE, CUCUL_COLOR_GREEN);
cucul_putstr(hoho, i - 2, i, "ホ");
}

cucul_blit(cv, 15, 1, hoho, NULL);

caca_refresh_display(dp);

caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);

caca_free_display(dp);
cucul_free_canvas(cv);

return 0;
}


+ 1
- 1
test/unicode.c View File

@@ -75,7 +75,7 @@ int main(int argc, char *argv[])
cucul_putstr(cv, 1, 16, "| ()()()() ()()() |");
cucul_set_color(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK);
cucul_putstr(cv, 1, 17, "| ドラゴン");
cucul_putstr(cv, 10, 17, "ボーレ |");
cucul_putstr(cv, 12, 17, "ボーレ |");

cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
cucul_putstr(cv, 1, 18, "If the three lines do not have the same length, there is a bug somewhere.");


Loading…
Cancel
Save