From: Enlightenment S. <no-...@en...> - 2011-05-08 11:54:02
|
Log: Tests textblock: added "load as plain utf8" mode. Author: tasn Date: 2011-05-08 04:53:56 -0700 (Sun, 08 May 2011) New Revision: 59275 Trac: http://trac.enlightenment.org/e/changeset/59275 Modified: trunk/TEST/evas/textblock/test.c Modified: trunk/TEST/evas/textblock/test.c =================================================================== --- trunk/TEST/evas/textblock/test.c 2011-05-08 11:20:19 UTC (rev 59274) +++ trunk/TEST/evas/textblock/test.c 2011-05-08 11:53:56 UTC (rev 59275) @@ -51,6 +51,23 @@ return text; } +static char * +_load_plain(const char *file) +{ + char *text; + + text = _load_file(file); + if (text) + { + char *text2; + + text2 = elm_entry_utf8_to_markup(text); + free(text); + return text2; + } + return NULL; +} + int main(int argc, char *argv[]) { @@ -64,10 +81,11 @@ Elm_Wrap_Type wrap = ELM_WRAP_WORD; const char *wrapt = "word"; /* end of wrap mode */ + Eina_Unicode plain_utf8 = EINA_FALSE; opterr = 0; - while ((c = getopt (argc, argv, "w:h:f:l:r:")) != -1) + while ((c = getopt (argc, argv, "w:h:f:l:r:p")) != -1) { switch (c) { @@ -106,6 +124,9 @@ return 1; } break; + case 'p': + plain_utf8 = EINA_TRUE; + break; case '?': print_usage(argv[0]); if (isprint (optopt)) @@ -186,8 +207,13 @@ /* Set the text */ { - char *buf = _load_file(filename); + char *buf; + if (plain_utf8) + buf = _load_plain(filename); + else + buf = _load_file(filename); + if (!strcmp(type, "evas")) { evas_object_textblock_text_markup_set (tb, buf); @@ -213,9 +239,10 @@ print_usage(const char *bin) { fprintf(stderr, - "Usage: %s [-w width] [-h height] [-f filename] [-l lib] [-r wrap]\n" + "Usage: %s [-p] [-w width] [-h height] [-f filename] [-l lib] [-r wrap]\n" "-w,-h = size of window in pixels.\n" "-f = filename to use\n" "-l = lib to use: evas, edje, or elm.\n" - "-r = wrap type: none, char, word, or mixed.\n", bin); + "-r = wrap type: none, char, word, or mixed.\n" + "-p = load as plain utf8 instead of markup.\n", bin); } |