From 825a3d837a33f226c879cd02ad15c3fba57e8b2c Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 23 Jan 2012 23:30:42 +1000 Subject: Update the EFL to what I'm actually using, coz I'm using some stuff not yet released. --- libraries/evas/src/tests/Makefile.in | 8 +- libraries/evas/src/tests/evas_test_callbacks.c | 6 +- libraries/evas/src/tests/evas_test_textblock.c | 319 ++++++++++++++++++------- 3 files changed, 240 insertions(+), 93 deletions(-) (limited to 'libraries/evas/src/tests') diff --git a/libraries/evas/src/tests/Makefile.in b/libraries/evas/src/tests/Makefile.in index c598c3d..8790c33 100644 --- a/libraries/evas/src/tests/Makefile.in +++ b/libraries/evas/src/tests/Makefile.in @@ -203,8 +203,6 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_LIBS = @PNG_LIBS@ RANLIB = @RANLIB@ @@ -221,6 +219,8 @@ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ VALGRIND_LIBS = @VALGRIND_LIBS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ XCB_CFLAGS = @XCB_CFLAGS@ @@ -302,6 +302,10 @@ evas_engine_software_xcb_cflags = @evas_engine_software_xcb_cflags@ evas_engine_software_xcb_libs = @evas_engine_software_xcb_libs@ evas_engine_software_xlib_cflags = @evas_engine_software_xlib_cflags@ evas_engine_software_xlib_libs = @evas_engine_software_xlib_libs@ +evas_engine_wayland_egl_cflags = @evas_engine_wayland_egl_cflags@ +evas_engine_wayland_egl_libs = @evas_engine_wayland_egl_libs@ +evas_engine_wayland_shm_cflags = @evas_engine_wayland_shm_cflags@ +evas_engine_wayland_shm_libs = @evas_engine_wayland_shm_libs@ evas_image_loader_bmp_cflags = @evas_image_loader_bmp_cflags@ evas_image_loader_bmp_libs = @evas_image_loader_bmp_libs@ evas_image_loader_edb_cflags = @evas_image_loader_edb_cflags@ diff --git a/libraries/evas/src/tests/evas_test_callbacks.c b/libraries/evas/src/tests/evas_test_callbacks.c index 675ee1c..164851e 100644 --- a/libraries/evas/src/tests/evas_test_callbacks.c +++ b/libraries/evas/src/tests/evas_test_callbacks.c @@ -28,7 +28,7 @@ do \ } \ while (0) -static int counter = 1; +static uintptr_t counter = 1; static void _obj_event_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) @@ -37,7 +37,7 @@ _obj_event_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) (void) obj; (void) event_info; - fail_if(((int) data) != counter); + fail_if(((uintptr_t) data) != counter); counter++; } @@ -83,7 +83,7 @@ _event_cb(void *data, Evas *e, void *event_info) (void) e; (void) event_info; - fail_if(((int) data) != counter); + fail_if(((uintptr_t) data) != counter); counter++; } diff --git a/libraries/evas/src/tests/evas_test_textblock.c b/libraries/evas/src/tests/evas_test_textblock.c index 6a28353..cf6a78b 100644 --- a/libraries/evas/src/tests/evas_test_textblock.c +++ b/libraries/evas/src/tests/evas_test_textblock.c @@ -21,9 +21,7 @@ _evas_textblock_format_offset_get(const Evas_Object_Textblock_Node_Format *n); static const char *style_buf = "DEFAULT='font=Sans font_size=10 color=#000 text_class=entry'" - "br='\n'" - "ps='ps'" - "tab='\t'" + "newline='br'" "b='+ font=Sans:style=bold'"; #define START_TB_TEST() \ @@ -61,7 +59,7 @@ while (0) START_TEST(evas_textblock_simple) { START_TB_TEST(); - const char *buf = "This is a
test."; + const char *buf = "This is a
test."; evas_object_textblock_text_markup_set(tb, buf); fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf)); END_TB_TEST(); @@ -95,12 +93,12 @@ START_TEST(evas_textblock_cursor) Evas_Coord x, y, w, h; size_t i, len; Evas_Coord nw, nh; - const char *buf = "This is a
test.Lets see if this works.עוד פסקה."; + const char *buf = "This is a
test.Lets see if this works.עוד פסקה."; /* Walk the textblock using cursor_char_next */ evas_object_textblock_text_markup_set(tb, buf); fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf)); - len = eina_unicode_utf8_get_len(buf) - 9; /* 9 because len(
) == 1 and len() == 1 */ + len = eina_unicode_utf8_get_len(buf) - 12; /* 12 because len(
) == 1 and len() == 1 */ for (i = 0 ; i < len ; i++) { _CHECK_CURSOR_COORDS(); @@ -284,7 +282,7 @@ START_TEST(evas_textblock_cursor) /* Paragraph text get */ evas_textblock_cursor_paragraph_first(cur); fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur), - "This is a
test.")); + "This is a
test.")); evas_textblock_cursor_paragraph_next(cur); fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur), "Lets see if this works.")); @@ -294,9 +292,9 @@ START_TEST(evas_textblock_cursor) /* Paragraph length get */ evas_textblock_cursor_paragraph_first(cur); - /* -3 because len(
) == 1 */ + /* -4 because len(
) == 1 */ fail_if(evas_textblock_cursor_paragraph_text_length_get(cur) != - eina_unicode_utf8_get_len("This is a
test.") - 3); + eina_unicode_utf8_get_len("This is a
test.") - 4); evas_textblock_cursor_paragraph_next(cur); fail_if(evas_textblock_cursor_paragraph_text_length_get(cur) != eina_unicode_utf8_get_len("Lets see if this works.")); @@ -308,7 +306,7 @@ START_TEST(evas_textblock_cursor) evas_textblock_cursor_pos_set(cur, 0); fail_if(strcmp(evas_textblock_cursor_content_get(cur), "T")); evas_textblock_cursor_pos_set(cur, 9); - fail_if(strcmp(evas_textblock_cursor_content_get(cur), "
")); + fail_if(strcmp(evas_textblock_cursor_content_get(cur), "
")); evas_textblock_cursor_pos_set(cur, 43); fail_if(strcmp(evas_textblock_cursor_content_get(cur), "ד")); @@ -414,12 +412,12 @@ START_TEST(evas_textblock_cursor) #ifdef HAVE_FRIBIDI evas_object_textblock_text_markup_set(tb, - "testנסיוןtestנסיון" - "נסיוןtestנסיוןtest" - "testנסיוןtest" - "נסיוןtestנסיון" - "testנסיון
נסיון" - "נסיוןtest
test" + "testנסיוןtestנסיון" + "נסיוןtestנסיוןtest" + "testנסיוןtest" + "נסיוןtestנסיון" + "testנסיון
נסיון" + "נסיוןtest
test" ); for (i = 0 ; i < 8 ; i++) @@ -568,6 +566,32 @@ START_TEST(evas_textblock_cursor) fail_if(evas_textblock_cursor_compare(main_cur, cur)); } + { + const char *buf_wb = "a This is_a t:e.s't a"; + evas_object_textblock_text_markup_set(tb, buf_wb); + + /* Word start/end */ + evas_textblock_cursor_pos_set(cur, 3); + evas_textblock_cursor_word_start(cur); + fail_if(2 != evas_textblock_cursor_pos_get(cur)); + evas_textblock_cursor_word_end(cur); + fail_if(5 != evas_textblock_cursor_pos_get(cur)); + + evas_textblock_cursor_pos_set(cur, 13); + evas_textblock_cursor_word_end(cur); + fail_if(18 != evas_textblock_cursor_pos_get(cur)); + evas_textblock_cursor_word_start(cur); + fail_if(12 != evas_textblock_cursor_pos_get(cur)); + evas_textblock_cursor_word_start(cur); + fail_if(12 != evas_textblock_cursor_pos_get(cur)); + evas_textblock_cursor_word_start(cur); + fail_if(12 != evas_textblock_cursor_pos_get(cur)); + evas_textblock_cursor_word_end(cur); + fail_if(18 != evas_textblock_cursor_pos_get(cur)); + evas_textblock_cursor_word_end(cur); + fail_if(18 != evas_textblock_cursor_pos_get(cur)); + } + END_TB_TEST(); } END_TEST @@ -723,7 +747,7 @@ START_TEST(evas_textblock_format_removal) /* Range deletion across paragraphs */ evas_object_textblock_text_markup_set(tb, - "This ate" + "This ate" "sst."); evas_textblock_cursor_pos_set(cur, 6); evas_textblock_cursor_pos_set(main_cur, 10); @@ -749,14 +773,14 @@ START_TEST(evas_textblock_format_removal) fail_if (fnode); /* Two formats across different paragraphs with notihng in between. */ - evas_object_textblock_text_markup_set(tb, ""); + evas_object_textblock_text_markup_set(tb, ""); evas_textblock_cursor_pos_set(cur, 0); evas_textblock_cursor_char_delete(cur); fnode = evas_textblock_node_format_first_get(tb); fail_if (fnode); /* Try with range */ - evas_object_textblock_text_markup_set(tb, ""); + evas_object_textblock_text_markup_set(tb, ""); evas_textblock_cursor_pos_set(cur, 0); evas_textblock_cursor_pos_set(main_cur, 1); evas_textblock_cursor_range_delete(cur, main_cur); @@ -765,7 +789,7 @@ START_TEST(evas_textblock_format_removal) /* Verify fmt position and REP_CHAR positions are the same */ evas_object_textblock_text_markup_set(tb, - "This isan a."); + "This isan a."); evas_textblock_cursor_pos_set(cur, 7); evas_textblock_cursor_char_delete(cur); fnode = evas_textblock_node_format_first_get(tb); @@ -1091,9 +1115,9 @@ START_TEST(evas_textblock_wrapping) evas_object_textblock_text_markup_set(tb, "a"); evas_object_textblock_size_formatted_get(tb, &bw, &bh); evas_object_textblock_text_markup_set(tb, - "aaaa aaaa aaa aa aaa" - "aaaa aaa aaa aaa aaa" - "a aaaaa aaaaaaaaaaaaaa
aaaaa" + "aaaa aaaa aaa aa aaa" + "aaaa aaa aaa aaa aaa" + "a aaaaa aaaaaaaaaaaaaa
aaaaa" "aaaaaa" ); evas_textblock_cursor_format_prepend(cur, "+ wrap=char"); @@ -1113,9 +1137,9 @@ START_TEST(evas_textblock_wrapping) evas_object_textblock_text_markup_set(tb, "aaaaaa"); evas_object_textblock_size_formatted_get(tb, &bw, &bh); evas_object_textblock_text_markup_set(tb, - "aaaa aaaa aaa aa aaa" - "aaaa aaa aaa aaa aaa" - "a aaaaa aaaaaa
aaaaa" + "aaaa aaaa aaa aa aaa" + "aaaa aaa aaa aaa aaa" + "a aaaaa aaaaaa
aaaaa" "aaaaa" ); evas_textblock_cursor_format_prepend(cur, "+ wrap=word"); @@ -1134,9 +1158,9 @@ START_TEST(evas_textblock_wrapping) evas_object_textblock_text_markup_set(tb, "a"); evas_object_textblock_size_formatted_get(tb, &bw, &bh); evas_object_textblock_text_markup_set(tb, - "aaaa aaaa aaa aa aaa" - "aaaa aaa aaa aaa aaa" - "a aaaaa aaaaaa
aaaaa" + "aaaa aaaa aaa aa aaa" + "aaaa aaa aaa aaa aaa" + "a aaaaa aaaaaa
aaaaa" "aaaaa" ); evas_textblock_cursor_format_prepend(cur, "+ wrap=mixed"); @@ -1156,26 +1180,26 @@ START_TEST(evas_textblock_wrapping) int wrap_items = sizeof(wrap_style) / sizeof(*wrap_style); evas_object_textblock_text_markup_set(tb, - "This is an entry widget in this window that
" - "uses markup like this for styling and
" - "formatting like this, as well as
" - "links in the text, so enter text
" - "in here to edit it. By the way, links are
" - "called Anchors so you will need
" - "to refer to them this way.
" - "
" + "This is an entry widget in this window that
" + "uses markup like this for styling and
" + "formatting like this, as well as
" + "links in the text, so enter text
" + "in here to edit it. By the way, links are
" + "called Anchors so you will need
" + "to refer to them this way.
" + "
" "Also you can stick in items with (relsize + ascent): " "" " (full) " "" - " (to the left)
" + " (to the left)
" "Also (size + ascent): " "" " (full) " "" - " (before this)
" + " (before this)
" "And as well (absize + ascent): " "" @@ -1214,6 +1238,13 @@ START_TEST(evas_textblock_wrapping) evas_object_textblock_size_formatted_get(tb, &w, &h); fail_if((w > (nw / 2)) || (h != nh)); + evas_object_textblock_text_markup_set(tb, "aaaaaaaaaaaaaaaaaa
b"); + evas_textblock_cursor_format_prepend(cur, "+ ellipsis=1.0 wrap=word"); + evas_object_textblock_size_native_get(tb, &nw, &nh); + evas_object_resize(tb, nw / 2, nh * 2); + evas_object_textblock_size_formatted_get(tb, &w, &h); + fail_if(w > (nw / 2)); + END_TB_TEST(); } END_TEST @@ -1223,7 +1254,7 @@ START_TEST(evas_textblock_various) { Evas_Coord w, h, bw, bh; START_TB_TEST(); - const char *buf = "Thistextblockhasalotoflines."; + const char *buf = "Thistextblockhasalotoflines."; evas_object_textblock_text_markup_set(tb, buf); evas_object_textblock_size_formatted_get(tb, &w, &h); /* Move outside of the screen so it'll have to search for the correct @@ -1241,15 +1272,15 @@ START_TEST(evas_textblock_various) /* Items have correct text node information */ evas_object_textblock_text_markup_set(tb, ""); fail_if(!_evas_textblock_check_item_node_link(tb)); - evas_object_textblock_text_markup_set(tb, ""); + evas_object_textblock_text_markup_set(tb, ""); fail_if(!_evas_textblock_check_item_node_link(tb)); - evas_object_textblock_text_markup_set(tb, "a"); + evas_object_textblock_text_markup_set(tb, "a"); fail_if(!_evas_textblock_check_item_node_link(tb)); - evas_object_textblock_text_markup_set(tb, "aa"); + evas_object_textblock_text_markup_set(tb, "aa"); fail_if(!_evas_textblock_check_item_node_link(tb)); - evas_object_textblock_text_markup_set(tb, "aa"); + evas_object_textblock_text_markup_set(tb, "aa"); fail_if(!_evas_textblock_check_item_node_link(tb)); - evas_object_textblock_text_markup_set(tb, "aaa"); + evas_object_textblock_text_markup_set(tb, "aaa"); fail_if(!_evas_textblock_check_item_node_link(tb)); END_TB_TEST(); @@ -1260,7 +1291,7 @@ END_TEST START_TEST(evas_textblock_geometries) { START_TB_TEST(); - const char *buf = "This is a
test."; + const char *buf = "This is a
test."; evas_object_textblock_text_markup_set(tb, buf); /* Single line range */ @@ -1327,7 +1358,7 @@ END_TEST START_TEST(evas_textblock_editing) { START_TB_TEST(); - const char *buf = "First par.Second par."; + const char *buf = "First par.Second par."; evas_object_textblock_text_markup_set(tb, buf); Evas_Textblock_Cursor *main_cur = evas_object_textblock_cursor_get(tb); @@ -1346,7 +1377,7 @@ START_TEST(evas_textblock_editing) evas_textblock_cursor_paragraph_first(cur); evas_textblock_cursor_char_delete(cur); fail_if(strcmp(evas_object_textblock_text_markup_get(tb), - "irst par.Second par.")); + "irst par.Second par.")); /* Delete some arbitrary char */ evas_textblock_cursor_char_next(cur); @@ -1354,14 +1385,14 @@ START_TEST(evas_textblock_editing) evas_textblock_cursor_char_next(cur); evas_textblock_cursor_char_delete(cur); fail_if(strcmp(evas_object_textblock_text_markup_get(tb), - "irs par.Second par.")); + "irs par.Second par.")); /* Delete a range */ evas_textblock_cursor_pos_set(main_cur, 1); evas_textblock_cursor_pos_set(cur, 6); evas_textblock_cursor_range_delete(cur, main_cur); fail_if(strcmp(evas_object_textblock_text_markup_get(tb), - "ir.Second par.")); + "ir.Second par.")); evas_textblock_cursor_paragraph_char_first(main_cur); evas_textblock_cursor_paragraph_char_last(cur); evas_textblock_cursor_char_next(cur); @@ -1376,7 +1407,7 @@ START_TEST(evas_textblock_editing) evas_textblock_cursor_paragraph_char_first(main_cur); evas_textblock_cursor_range_delete(cur, main_cur); fail_if(strcmp(evas_object_textblock_text_markup_get(tb), - "First par.")); + "First par.")); /* Merging paragraphs */ evas_object_textblock_text_markup_set(tb, buf); @@ -1406,6 +1437,27 @@ START_TEST(evas_textblock_editing) evas_textblock_cursor_paragraph_first(cur); fail_if(evas_textblock_cursor_paragraph_next(cur)); + /* Insert illegal characters inside the format. */ + { + const char *content; + evas_object_textblock_text_markup_set(tb, "a\n"); + evas_textblock_cursor_pos_set(cur, 1); + content = evas_textblock_cursor_content_get(cur); + + evas_object_textblock_text_markup_set(tb, "a\t"); + evas_textblock_cursor_pos_set(cur, 1); + content = evas_textblock_cursor_content_get(cur); + + evas_object_textblock_text_markup_set(tb, "a\xEF\xBF\xBC"); + evas_textblock_cursor_pos_set(cur, 1); + content = evas_textblock_cursor_content_get(cur); + + evas_object_textblock_text_markup_set(tb, "a\xE2\x80\xA9"); + evas_textblock_cursor_pos_set(cur, 1); + content = evas_textblock_cursor_content_get(cur); + (void) content; + } + /* FIXME: Also add text appending/prepending */ END_TB_TEST(); @@ -1416,13 +1468,13 @@ END_TEST START_TEST(evas_textblock_text_getters) { START_TB_TEST(); - const char *buf = "This is a
test." - "טקסט בעבריתand now in english."; + const char *buf = "This is a
test." + "טקסט בעבריתand now in english."; evas_object_textblock_text_markup_set(tb, buf); evas_textblock_cursor_paragraph_first(cur); fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur), - "This is a
test.")); + "This is a
test.")); evas_textblock_cursor_paragraph_next(cur); fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur), @@ -1447,17 +1499,17 @@ START_TEST(evas_textblock_text_getters) evas_textblock_cursor_pos_set(main_cur, 5); evas_textblock_cursor_pos_set(cur, 14); fail_if(strcmp(evas_textblock_cursor_range_text_get(main_cur, cur, - EVAS_TEXTBLOCK_TEXT_MARKUP), "is a
te")); + EVAS_TEXTBLOCK_TEXT_MARKUP), "is a
te")); evas_textblock_cursor_pos_set(main_cur, 14); evas_textblock_cursor_pos_set(cur, 20); fail_if(strcmp(evas_textblock_cursor_range_text_get(main_cur, cur, - EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טק")); + EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טק")); evas_textblock_cursor_pos_set(main_cur, 14); evas_textblock_cursor_pos_set(cur, 32); fail_if(strcmp(evas_textblock_cursor_range_text_get(main_cur, cur, - EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טקסט בעבריתan")); + EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טקסט בעבריתan")); /* Backward range get */ evas_textblock_cursor_pos_set(main_cur, 2); @@ -1473,17 +1525,17 @@ START_TEST(evas_textblock_text_getters) evas_textblock_cursor_pos_set(main_cur, 5); evas_textblock_cursor_pos_set(cur, 14); fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur, - EVAS_TEXTBLOCK_TEXT_MARKUP), "is a
te")); + EVAS_TEXTBLOCK_TEXT_MARKUP), "is a
te")); evas_textblock_cursor_pos_set(main_cur, 14); evas_textblock_cursor_pos_set(cur, 20); fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur, - EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טק")); + EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טק")); evas_textblock_cursor_pos_set(main_cur, 14); evas_textblock_cursor_pos_set(cur, 32); fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur, - EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טקסט בעבריתan")); + EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טקסט בעבריתan")); /* Uninit cursors and other weird cases */ evas_object_textblock_clear(tb); @@ -1492,6 +1544,97 @@ START_TEST(evas_textblock_text_getters) fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur, EVAS_TEXTBLOCK_TEXT_MARKUP), "aaa")); + /* Markup to plain and vice versa */ + { + char *tmp, *tmp2; + + /* Real textblock object */ + tmp = evas_textblock_text_markup_to_utf8(tb, "
aa<\n/>bb<\t/>"); + fail_if(strcmp(tmp, "\naa\nbb\t")); + tmp2 = evas_textblock_text_utf8_to_markup(tb, tmp); + fail_if(strcmp(tmp2, "
aa
bb")); + free(tmp2); + free(tmp); + + tmp = evas_textblock_text_markup_to_utf8(tb, "a"); + fail_if(strcmp(tmp, "a\xEF\xBF\xBC")); + tmp2 = evas_textblock_text_utf8_to_markup(tb, tmp); + fail_if(strcmp(tmp2, "a")); + free(tmp2); + free(tmp); + + tmp = evas_textblock_text_markup_to_utf8(tb, "a "); + fail_if(strcmp(tmp, "a\xC2\xA0")); + tmp2 = evas_textblock_text_utf8_to_markup(tb, tmp); + fail_if(strcmp(tmp2, "a\xC2\xA0")); + free(tmp2); + free(tmp); + + tmp = evas_textblock_text_markup_to_utf8(tb, "aba"); + fail_if(strcmp(tmp, "aba")); + tmp2 = evas_textblock_text_utf8_to_markup(tb, tmp); + fail_if(strcmp(tmp2, "aba")); + free(tmp2); + free(tmp); + + tmp = evas_textblock_text_markup_to_utf8(tb, "a&a"); + fail_if(strcmp(tmp, "a&a")); + tmp2 = evas_textblock_text_utf8_to_markup(tb, tmp); + fail_if(strcmp(tmp2, "a&a")); + free(tmp2); + free(tmp); + + tmp = evas_textblock_text_markup_to_utf8(tb, "aa"); + fail_if(strcmp(tmp, "a\na")); + tmp2 = evas_textblock_text_utf8_to_markup(tb, tmp); + fail_if(strcmp(tmp2, "a
a")); + free(tmp2); + free(tmp); + + /* NULL textblock object */ + tmp = evas_textblock_text_markup_to_utf8(NULL, "
aa<\n/>bb<\t/>"); + fail_if(strcmp(tmp, "\naa\nbb\t")); + tmp2 = evas_textblock_text_utf8_to_markup(NULL, tmp); + fail_if(strcmp(tmp2, "
aa
bb")); + free(tmp2); + free(tmp); + + tmp = evas_textblock_text_markup_to_utf8(NULL, "a"); + fail_if(strcmp(tmp, "a\xEF\xBF\xBC")); + tmp2 = evas_textblock_text_utf8_to_markup(NULL, tmp); + fail_if(strcmp(tmp2, "a")); + free(tmp2); + free(tmp); + + tmp = evas_textblock_text_markup_to_utf8(NULL, "a "); + fail_if(strcmp(tmp, "a\xC2\xA0")); + tmp2 = evas_textblock_text_utf8_to_markup(NULL, tmp); + fail_if(strcmp(tmp2, "a\xC2\xA0")); + free(tmp2); + free(tmp); + + tmp = evas_textblock_text_markup_to_utf8(NULL, "aba"); + fail_if(strcmp(tmp, "aba")); + tmp2 = evas_textblock_text_utf8_to_markup(NULL, tmp); + fail_if(strcmp(tmp2, "aba")); + free(tmp2); + free(tmp); + + tmp = evas_textblock_text_markup_to_utf8(tb, "a&a"); + fail_if(strcmp(tmp, "a&a")); + tmp2 = evas_textblock_text_utf8_to_markup(tb, tmp); + fail_if(strcmp(tmp2, "a&a")); + free(tmp2); + free(tmp); + + tmp = evas_textblock_text_markup_to_utf8(NULL, "aa"); + fail_if(strcmp(tmp, "aa")); + tmp2 = evas_textblock_text_utf8_to_markup(NULL, tmp); + fail_if(strcmp(tmp2, "aa")); + free(tmp2); + free(tmp); + } + END_TB_TEST(); } END_TEST @@ -1500,7 +1643,7 @@ END_TEST START_TEST(evas_textblock_formats) { START_TB_TEST(); - const char *buf = "This is a
test."; + const char *buf = "This is a
test."; const Evas_Object_Textblock_Node_Format *fnode; evas_object_textblock_text_markup_set(tb, buf); @@ -1652,25 +1795,25 @@ START_TEST(evas_textblock_formats) * verify them visually, well, we can some of them. Possibly in the * future we will */ evas_object_textblock_text_markup_set(tb, - "font_size=40" - "color=#F210B3FF" - "underline=single underline_color=#A2B3C4" - "underline=double underline_color=#F00 underline2_color=#00F" - "underline=dashed underline_dash_color=#0F0 underline_dash_width=2 underline_dash_gap=1" - "style=outline outline_color=#F0FA" - "style=shadow shadow_color=#F0F" - "style=glow glow_color=#BBB" - "style=glow glow2_color=#0F0" - "style=glow color=#fff glow2_color=#fe87 glow_color=#f214" - "backing=on backing_color=#00F" - "strikethrough=on strikethrough_color=#FF0" - "align=right" - "valign=0.0" - "tabstops=<\\t>50" - "linesize=40" - "linerelsize=200%" - "linegap=20" - "linerelgap=100%"); + "font_size=40" + "color=#F210B3FF" + "underline=single underline_color=#A2B3C4" + "underline=double underline_color=#F00 underline2_color=#00F" + "underline=dashed underline_dash_color=#0F0 underline_dash_width=2 underline_dash_gap=1" + "style=outline outline_color=#F0FA" + "style=shadow shadow_color=#F0F" + "style=glow glow_color=#BBB" + "style=glow glow2_color=#0F0" + "style=glow color=#fff glow2_color=#fe87 glow_color=#f214" + "backing=on backing_color=#00F" + "strikethrough=on strikethrough_color=#FF0" + "align=right" + "valign=0.0" + "tabstops=<\\t>50" + "linesize=40" + "linerelsize=200%" + "linegap=20" + "linerelgap=100%"); /* Force a relayout */ evas_object_textblock_size_formatted_get(tb, NULL, NULL); @@ -1714,22 +1857,22 @@ START_TEST(evas_textblock_formats) } /* Make sure we get all the types of visible formats correctly. */ - evas_object_textblock_text_markup_set(tb, "a
aa"); + evas_object_textblock_text_markup_set(tb, "a
aa"); fail_if(strcmp(evas_textblock_node_format_text_get( evas_textblock_cursor_format_get(cur)), "ps")); - fail_if(strcmp(evas_textblock_cursor_content_get(cur), "")); + fail_if(strcmp(evas_textblock_cursor_content_get(cur), "")); fail_if(!evas_textblock_cursor_format_is_visible_get(cur)); fail_if(!evas_textblock_cursor_char_next(cur)); fail_if(!evas_textblock_cursor_char_next(cur)); fail_if(strcmp(evas_textblock_node_format_text_get( evas_textblock_cursor_format_get(cur)), "br")); - fail_if(strcmp(evas_textblock_cursor_content_get(cur), "
")); + fail_if(strcmp(evas_textblock_cursor_content_get(cur), "
")); fail_if(!evas_textblock_cursor_format_is_visible_get(cur)); fail_if(!evas_textblock_cursor_char_next(cur)); fail_if(!evas_textblock_cursor_char_next(cur)); fail_if(strcmp(evas_textblock_node_format_text_get( evas_textblock_cursor_format_get(cur)), "tab")); - fail_if(strcmp(evas_textblock_cursor_content_get(cur), "")); + fail_if(strcmp(evas_textblock_cursor_content_get(cur), "")); fail_if(!evas_textblock_cursor_format_is_visible_get(cur)); fail_if(!evas_textblock_cursor_char_next(cur)); fail_if(!evas_textblock_cursor_char_next(cur)); @@ -1749,7 +1892,7 @@ START_TEST(evas_textblock_style) Evas_Coord l, r, t, b; START_TB_TEST(); Evas_Textblock_Style *newst; - const char *buf = "TestTest2נסיון"; + const char *buf = "TestTest2נסיון"; evas_object_textblock_text_markup_set(tb, buf); fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf)); @@ -1850,7 +1993,7 @@ START_TEST(evas_textblock_set_get) fail_if(strcmp(evas_object_textblock_bidi_delimiters_get(tb), ",|")); /* Hinting */ - evas_object_textblock_text_markup_set(tb, "This isa test
bla"); + evas_object_textblock_text_markup_set(tb, "This isa test
bla"); /* Force relayout */ evas_object_textblock_size_formatted_get(tb, NULL, NULL); evas_font_hinting_set(evas, EVAS_FONT_HINTING_NONE); @@ -1923,7 +2066,7 @@ START_TEST(evas_textblock_size) { START_TB_TEST(); Evas_Coord w, h, h2, nw, nh; - const char *buf = "This is a
test.
גם בעברית"; + const char *buf = "This is a
test.
גם בעברית"; /* When wrapping is off, native size should be the same as formatted * size */ @@ -1932,7 +2075,7 @@ START_TEST(evas_textblock_size) fail_if((w != nw) || (h != nh)); fail_if(w != 0); - evas_object_textblock_text_markup_set(tb, "a
a"); + evas_object_textblock_text_markup_set(tb, "a
a"); evas_object_textblock_size_formatted_get(tb, &w, &h2); evas_object_textblock_size_native_get(tb, &nw, &nh); fail_if((w != nw) || (h2 != nh)); -- cgit v1.1