Revision: 596 Author: christian.egli@xxxxxxxxxxxxxx Date: Mon May 7 05:46:39 2012 Log: Add a test case for the problem with unicode and lowercase http://code.google.com/p/liblouis/source/detail?r=596 Added: /trunk/tests/tables/lowercase_with_unicode.ctb /trunk/tests/tables/uplow_with_unicode.ctb /trunk/tests/uplow_with_unicode.c Modified: /trunk/ChangeLog /trunk/tests /trunk/tests/Makefile.am /trunk/tests/brl_checks.c ======================================= --- /dev/null +++ /trunk/tests/tables/lowercase_with_unicode.ctb Mon May 7 05:46:39 2012 @@ -0,0 +1,12 @@ +display ^ 2346 + +uplow Gg 1245 +uplow Rr 1235 +uplow Oo 135 +uplow Ss 234 +lowercase \x00df 2346 # LATIN LETTER SHARP S + + +word gross 1245-2346 +word gro\x00df 1245-2346 + ======================================= --- /dev/null +++ /trunk/tests/tables/uplow_with_unicode.ctb Mon May 7 05:46:39 2012 @@ -0,0 +1,11 @@ +display ^ 2346 + +uplow Gg 1245 +uplow Rr 1235 +uplow Oo 135 +uplow Ss 234 +uplow \x1e9e\x00df 2346 LATIN LETTER SHARP S + +word gross 1245-2346 +word gro\x00df 1245-2346 + ======================================= --- /dev/null +++ /trunk/tests/uplow_with_unicode.c Mon May 7 05:46:39 2012 @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "liblouis.h" +#include "brl_checks.h" + +int +main(int argc, char **argv) +{ + + int result = 0; + + const char *str1 = "gross"; + const char *str2 = "gro\\x00df"; + + const char *expected = "g^"; ++ result |= check_translation("uplow_with_unicode.ctb", str1, NULL, expected); + result |= check_translation("uplow_with_unicode.ctb", str2, NULL, expected);
++ result |= check_translation("lowercase_with_unicode.ctb", str1, NULL, expected); + result |= check_translation("lowercase_with_unicode.ctb", str2, NULL, expected);
+ + return result; +} ======================================= --- /trunk/ChangeLog Fri Apr 20 06:09:23 2012 +++ /trunk/ChangeLog Mon May 7 05:46:39 2012 @@ -1,3 +1,15 @@ +2012-05-07 Christian Egli <christian.egli@xxxxxx> + + * tests/brl_checks.c (check_translation): Enhance to be able to + handle \xhhhh encoded strings like the rest of liblouis. This is + to support unicode based test cases. + + * tests/uplow_with_unicode.c: + * tests/tables/uplow_with_unicode.ctb: + * tests/tables/lowercase_with_unicode.ctb: + * tests/Makefile.am (uplow_with_unicode_SOURCES): Add a test for + the problem with lowercase and unicode. + 2012-04-20 Christian Egli <christian.egli@xxxxxx> * tables/nl-BE.dis: ======================================= --- /trunk/tests/Makefile.am Wed Apr 18 13:36:21 2012 +++ /trunk/tests/Makefile.am Mon May 7 05:46:39 2012 @@ -49,9 +49,15 @@ brl_checks.h \ letterDefTest.c +uplow_with_unicode_SOURCES = \ + brl_checks.c \ + brl_checks.h \ + uplow_with_unicode.c + check_PROGRAMS = \ pass2 \ pass2_inpos \ + uplow_with_unicode \ present_progressive \ capitalized_word \ capitalized_with_sentance \ ======================================= --- /trunk/tests/brl_checks.c Wed Apr 18 13:36:21 2012 +++ /trunk/tests/brl_checks.c Mon May 7 05:46:39 2012 @@ -49,10 +49,10 @@ typeformbuf = malloc(outlen); strcpy(typeformbuf, typeform); } - - for (i = 0; i < inlen; i++) - { - inbuf[i] = str[i]; + if (!extParseChars(str, inbuf)) + { + printf("Cannot parse input string.\n"); + return 1; } if (!lou_translate(tableList, inbuf, &inlen, outbuf, &outlen, typeformbuf, NULL, NULL, NULL, NULL, 0)) For a description of the software, to download it and links to project pages go to http://www.abilitiessoft.com