Evas textblock: Support self-closing formats, i.e <br/>.

Also updated tests to follow this. Using <br>, although will work, is
discouraged, please use <br/> instead.

SVN revision: 66023
This commit is contained in:
Tom Hacohen 2011-12-08 12:05:56 +00:00
parent 7f8dca2fda
commit 0ec467892d
2 changed files with 97 additions and 87 deletions

View File

@ -4988,6 +4988,8 @@ _markup_get_format_append(Eina_Strbuf *txt, Evas_Object_Textblock_Node_Format *f
if (!fnode->opener && !fnode->own_closer) if (!fnode->opener && !fnode->own_closer)
eina_strbuf_append_char(txt, '/'); eina_strbuf_append_char(txt, '/');
eina_strbuf_append(txt, s); eina_strbuf_append(txt, s);
if (fnode->own_closer)
eina_strbuf_append_char(txt, '/');
} }
eina_strbuf_append_char(txt, '>'); eina_strbuf_append_char(txt, '>');
} }
@ -6858,8 +6860,16 @@ _evas_textblock_node_format_new(Evas_Object_Textblock *o, const char *_format)
format++; /* Advance after '<' */ format++; /* Advance after '<' */
format_len = strlen(format); format_len = strlen(format);
if (format[format_len - 1] == '>') if ((format_len > 0) && format[format_len - 1] == '>')
format_len--; /* We don't care about '>' */ {
format_len--; /* We don't care about '>' */
/* Check if it closes itself. Skip the </> case. */
if ((format_len > 1) && format[format_len - 1] == '/')
{
format_len--; /* We don't care about '/' */
n->own_closer = EINA_TRUE;
}
}
match = _style_match_tag(o->style, format, format_len, &replace_len); match = _style_match_tag(o->style, format, format_len, &replace_len);
if (match) if (match)

View File

@ -61,7 +61,7 @@ while (0)
START_TEST(evas_textblock_simple) START_TEST(evas_textblock_simple)
{ {
START_TB_TEST(); START_TB_TEST();
const char *buf = "Th<i>i</i>s is a <br> te<b>s</b>t."; const char *buf = "Th<i>i</i>s is a <br/> te<b>s</b>t.";
evas_object_textblock_text_markup_set(tb, buf); evas_object_textblock_text_markup_set(tb, buf);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf)); fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf));
END_TB_TEST(); END_TB_TEST();
@ -95,12 +95,12 @@ START_TEST(evas_textblock_cursor)
Evas_Coord x, y, w, h; Evas_Coord x, y, w, h;
size_t i, len; size_t i, len;
Evas_Coord nw, nh; Evas_Coord nw, nh;
const char *buf = "This is a<br> test.<ps>Lets see if this works.<ps>עוד פסקה."; const char *buf = "This is a<br/> test.<ps/>Lets see if this works.<ps/>עוד פסקה.";
/* Walk the textblock using cursor_char_next */ /* Walk the textblock using cursor_char_next */
evas_object_textblock_text_markup_set(tb, buf); evas_object_textblock_text_markup_set(tb, buf);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf)); fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf));
len = eina_unicode_utf8_get_len(buf) - 9; /* 9 because len(<br>) == 1 and len(<ps>) == 1 */ len = eina_unicode_utf8_get_len(buf) - 12; /* 12 because len(<br/>) == 1 and len(<ps/>) == 1 */
for (i = 0 ; i < len ; i++) for (i = 0 ; i < len ; i++)
{ {
_CHECK_CURSOR_COORDS(); _CHECK_CURSOR_COORDS();
@ -284,7 +284,7 @@ START_TEST(evas_textblock_cursor)
/* Paragraph text get */ /* Paragraph text get */
evas_textblock_cursor_paragraph_first(cur); evas_textblock_cursor_paragraph_first(cur);
fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur), fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur),
"This is a<br> test.")); "This is a<br/> test."));
evas_textblock_cursor_paragraph_next(cur); evas_textblock_cursor_paragraph_next(cur);
fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur), fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur),
"Lets see if this works.")); "Lets see if this works."));
@ -294,9 +294,9 @@ START_TEST(evas_textblock_cursor)
/* Paragraph length get */ /* Paragraph length get */
evas_textblock_cursor_paragraph_first(cur); evas_textblock_cursor_paragraph_first(cur);
/* -3 because len(<br>) == 1 */ /* -4 because len(<br/>) == 1 */
fail_if(evas_textblock_cursor_paragraph_text_length_get(cur) != fail_if(evas_textblock_cursor_paragraph_text_length_get(cur) !=
eina_unicode_utf8_get_len("This is a<br> test.") - 3); eina_unicode_utf8_get_len("This is a<br/> test.") - 4);
evas_textblock_cursor_paragraph_next(cur); evas_textblock_cursor_paragraph_next(cur);
fail_if(evas_textblock_cursor_paragraph_text_length_get(cur) != fail_if(evas_textblock_cursor_paragraph_text_length_get(cur) !=
eina_unicode_utf8_get_len("Lets see if this works.")); eina_unicode_utf8_get_len("Lets see if this works."));
@ -308,7 +308,7 @@ START_TEST(evas_textblock_cursor)
evas_textblock_cursor_pos_set(cur, 0); evas_textblock_cursor_pos_set(cur, 0);
fail_if(strcmp(evas_textblock_cursor_content_get(cur), "T")); fail_if(strcmp(evas_textblock_cursor_content_get(cur), "T"));
evas_textblock_cursor_pos_set(cur, 9); evas_textblock_cursor_pos_set(cur, 9);
fail_if(strcmp(evas_textblock_cursor_content_get(cur), "<br>")); fail_if(strcmp(evas_textblock_cursor_content_get(cur), "<br/>"));
evas_textblock_cursor_pos_set(cur, 43); evas_textblock_cursor_pos_set(cur, 43);
fail_if(strcmp(evas_textblock_cursor_content_get(cur), "ד")); fail_if(strcmp(evas_textblock_cursor_content_get(cur), "ד"));
@ -414,12 +414,12 @@ START_TEST(evas_textblock_cursor)
#ifdef HAVE_FRIBIDI #ifdef HAVE_FRIBIDI
evas_object_textblock_text_markup_set(tb, evas_object_textblock_text_markup_set(tb,
"testנסיוןtestנסיון<ps>" "testנסיוןtestנסיון<ps/>"
"נסיוןtestנסיוןtest<ps>" "נסיוןtestנסיוןtest<ps/>"
"testנסיוןtest<ps>" "testנסיוןtest<ps/>"
"נסיוןtestנסיון<ps>" "נסיוןtestנסיון<ps/>"
"testנסיון<br>נסיון<ps>" "testנסיון<br/>נסיון<ps/>"
"נסיוןtest<br>test" "נסיוןtest<br/>test"
); );
for (i = 0 ; i < 8 ; i++) for (i = 0 ; i < 8 ; i++)
@ -723,7 +723,7 @@ START_TEST(evas_textblock_format_removal)
/* Range deletion across paragraphs */ /* Range deletion across paragraphs */
evas_object_textblock_text_markup_set(tb, evas_object_textblock_text_markup_set(tb,
"Th<b>is a<a>te<ps>" "Th<b>is a<a>te<ps/>"
"s</a>st</b>."); "s</a>st</b>.");
evas_textblock_cursor_pos_set(cur, 6); evas_textblock_cursor_pos_set(cur, 6);
evas_textblock_cursor_pos_set(main_cur, 10); evas_textblock_cursor_pos_set(main_cur, 10);
@ -749,14 +749,14 @@ START_TEST(evas_textblock_format_removal)
fail_if (fnode); fail_if (fnode);
/* Two formats across different paragraphs with notihng in between. */ /* Two formats across different paragraphs with notihng in between. */
evas_object_textblock_text_markup_set(tb, "<b><ps></b>"); evas_object_textblock_text_markup_set(tb, "<b><ps/></b>");
evas_textblock_cursor_pos_set(cur, 0); evas_textblock_cursor_pos_set(cur, 0);
evas_textblock_cursor_char_delete(cur); evas_textblock_cursor_char_delete(cur);
fnode = evas_textblock_node_format_first_get(tb); fnode = evas_textblock_node_format_first_get(tb);
fail_if (fnode); fail_if (fnode);
/* Try with range */ /* Try with range */
evas_object_textblock_text_markup_set(tb, "<b><ps></b>"); evas_object_textblock_text_markup_set(tb, "<b><ps/></b>");
evas_textblock_cursor_pos_set(cur, 0); evas_textblock_cursor_pos_set(cur, 0);
evas_textblock_cursor_pos_set(main_cur, 1); evas_textblock_cursor_pos_set(main_cur, 1);
evas_textblock_cursor_range_delete(cur, main_cur); evas_textblock_cursor_range_delete(cur, main_cur);
@ -765,7 +765,7 @@ START_TEST(evas_textblock_format_removal)
/* Verify fmt position and REP_CHAR positions are the same */ /* Verify fmt position and REP_CHAR positions are the same */
evas_object_textblock_text_markup_set(tb, evas_object_textblock_text_markup_set(tb,
"This is<ps>an <item absize=93x152 vsize=ascent></>a."); "This is<ps/>an <item absize=93x152 vsize=ascent></>a.");
evas_textblock_cursor_pos_set(cur, 7); evas_textblock_cursor_pos_set(cur, 7);
evas_textblock_cursor_char_delete(cur); evas_textblock_cursor_char_delete(cur);
fnode = evas_textblock_node_format_first_get(tb); fnode = evas_textblock_node_format_first_get(tb);
@ -1091,9 +1091,9 @@ START_TEST(evas_textblock_wrapping)
evas_object_textblock_text_markup_set(tb, "a"); evas_object_textblock_text_markup_set(tb, "a");
evas_object_textblock_size_formatted_get(tb, &bw, &bh); evas_object_textblock_size_formatted_get(tb, &bw, &bh);
evas_object_textblock_text_markup_set(tb, evas_object_textblock_text_markup_set(tb,
"aaaa aaaa aaa aa aaa<ps>" "aaaa aaaa aaa aa aaa<ps/>"
"aaaa aaa aaa aaa aaa<ps>" "aaaa aaa aaa aaa aaa<ps/>"
"a aaaaa aaaaaaaaaaaaaa<br>aaaaa<ps>" "a aaaaa aaaaaaaaaaaaaa<br/>aaaaa<ps/>"
"aaaaaa" "aaaaaa"
); );
evas_textblock_cursor_format_prepend(cur, "+ wrap=char"); evas_textblock_cursor_format_prepend(cur, "+ wrap=char");
@ -1113,9 +1113,9 @@ START_TEST(evas_textblock_wrapping)
evas_object_textblock_text_markup_set(tb, "aaaaaa"); evas_object_textblock_text_markup_set(tb, "aaaaaa");
evas_object_textblock_size_formatted_get(tb, &bw, &bh); evas_object_textblock_size_formatted_get(tb, &bw, &bh);
evas_object_textblock_text_markup_set(tb, evas_object_textblock_text_markup_set(tb,
"aaaa aaaa aaa aa aaa<ps>" "aaaa aaaa aaa aa aaa<ps/>"
"aaaa aaa aaa aaa aaa<ps>" "aaaa aaa aaa aaa aaa<ps/>"
"a aaaaa aaaaaa<br>aaaaa<ps>" "a aaaaa aaaaaa<br/>aaaaa<ps/>"
"aaaaa" "aaaaa"
); );
evas_textblock_cursor_format_prepend(cur, "+ wrap=word"); evas_textblock_cursor_format_prepend(cur, "+ wrap=word");
@ -1134,9 +1134,9 @@ START_TEST(evas_textblock_wrapping)
evas_object_textblock_text_markup_set(tb, "a"); evas_object_textblock_text_markup_set(tb, "a");
evas_object_textblock_size_formatted_get(tb, &bw, &bh); evas_object_textblock_size_formatted_get(tb, &bw, &bh);
evas_object_textblock_text_markup_set(tb, evas_object_textblock_text_markup_set(tb,
"aaaa aaaa aaa aa aaa<ps>" "aaaa aaaa aaa aa aaa<ps/>"
"aaaa aaa aaa aaa aaa<ps>" "aaaa aaa aaa aaa aaa<ps/>"
"a aaaaa aaaaaa<br>aaaaa<ps>" "a aaaaa aaaaaa<br/>aaaaa<ps/>"
"aaaaa" "aaaaa"
); );
evas_textblock_cursor_format_prepend(cur, "+ wrap=mixed"); evas_textblock_cursor_format_prepend(cur, "+ wrap=mixed");
@ -1156,26 +1156,26 @@ START_TEST(evas_textblock_wrapping)
int wrap_items = sizeof(wrap_style) / sizeof(*wrap_style); int wrap_items = sizeof(wrap_style) / sizeof(*wrap_style);
evas_object_textblock_text_markup_set(tb, evas_object_textblock_text_markup_set(tb,
"This is an entry widget in this window that<br>" "This is an entry widget in this window that<br/>"
"uses markup <b>like this</> for styling and<br>" "uses markup <b>like this</> for styling and<br/>"
"formatting <em>like this</>, as well as<br>" "formatting <em>like this</>, as well as<br/>"
"<a href=X><link>links in the text</></a>, so enter text<br>" "<a href=X><link>links in the text</></a>, so enter text<br/>"
"in here to edit it. By the way, links are<br>" "in here to edit it. By the way, links are<br/>"
"called <a href=anc-02>Anchors</a> so you will need<br>" "called <a href=anc-02>Anchors</a> so you will need<br/>"
"to refer to them this way.<br>" "to refer to them this way.<br/>"
"<br>" "<br/>"
"Also you can stick in items with (relsize + ascent): " "Also you can stick in items with (relsize + ascent): "
"<item relsize=16x16 vsize=ascent href=emoticon/evil-laugh></item>" "<item relsize=16x16 vsize=ascent href=emoticon/evil-laugh></item>"
" (full) " " (full) "
"<item relsize=16x16 vsize=full href=emoticon/guilty-smile></item>" "<item relsize=16x16 vsize=full href=emoticon/guilty-smile></item>"
" (to the left)<br>" " (to the left)<br/>"
"Also (size + ascent): " "Also (size + ascent): "
"<item size=16x16 vsize=ascent href=emoticon/haha></item>" "<item size=16x16 vsize=ascent href=emoticon/haha></item>"
" (full) " " (full) "
"<item size=16x16 vsize=full href=emoticon/happy-panting></item>" "<item size=16x16 vsize=full href=emoticon/happy-panting></item>"
" (before this)<br>" " (before this)<br/>"
"And as well (absize + ascent): " "And as well (absize + ascent): "
"<item absize=64x64 vsize=ascent href=emoticon/knowing-grin></item>" "<item absize=64x64 vsize=ascent href=emoticon/knowing-grin></item>"
@ -1223,7 +1223,7 @@ START_TEST(evas_textblock_various)
{ {
Evas_Coord w, h, bw, bh; Evas_Coord w, h, bw, bh;
START_TB_TEST(); START_TB_TEST();
const char *buf = "This<ps>textblock<ps>has<ps>a<ps>lot<ps>of<ps>lines<ps>."; const char *buf = "This<ps/>textblock<ps/>has<ps/>a<ps/>lot<ps/>of<ps/>lines<ps/>.";
evas_object_textblock_text_markup_set(tb, buf); evas_object_textblock_text_markup_set(tb, buf);
evas_object_textblock_size_formatted_get(tb, &w, &h); evas_object_textblock_size_formatted_get(tb, &w, &h);
/* Move outside of the screen so it'll have to search for the correct /* Move outside of the screen so it'll have to search for the correct
@ -1241,15 +1241,15 @@ START_TEST(evas_textblock_various)
/* Items have correct text node information */ /* Items have correct text node information */
evas_object_textblock_text_markup_set(tb, ""); evas_object_textblock_text_markup_set(tb, "");
fail_if(!_evas_textblock_check_item_node_link(tb)); fail_if(!_evas_textblock_check_item_node_link(tb));
evas_object_textblock_text_markup_set(tb, "<ps>"); evas_object_textblock_text_markup_set(tb, "<ps/>");
fail_if(!_evas_textblock_check_item_node_link(tb)); fail_if(!_evas_textblock_check_item_node_link(tb));
evas_object_textblock_text_markup_set(tb, "a<ps>"); evas_object_textblock_text_markup_set(tb, "a<ps/>");
fail_if(!_evas_textblock_check_item_node_link(tb)); fail_if(!_evas_textblock_check_item_node_link(tb));
evas_object_textblock_text_markup_set(tb, "a<ps>a"); evas_object_textblock_text_markup_set(tb, "a<ps/>a");
fail_if(!_evas_textblock_check_item_node_link(tb)); fail_if(!_evas_textblock_check_item_node_link(tb));
evas_object_textblock_text_markup_set(tb, "a<ps>a<ps>"); evas_object_textblock_text_markup_set(tb, "a<ps/>a<ps/>");
fail_if(!_evas_textblock_check_item_node_link(tb)); fail_if(!_evas_textblock_check_item_node_link(tb));
evas_object_textblock_text_markup_set(tb, "a<ps>a<ps>a"); evas_object_textblock_text_markup_set(tb, "a<ps/>a<ps/>a");
fail_if(!_evas_textblock_check_item_node_link(tb)); fail_if(!_evas_textblock_check_item_node_link(tb));
END_TB_TEST(); END_TB_TEST();
@ -1260,7 +1260,7 @@ END_TEST
START_TEST(evas_textblock_geometries) START_TEST(evas_textblock_geometries)
{ {
START_TB_TEST(); START_TB_TEST();
const char *buf = "This is a <br> test."; const char *buf = "This is a <br/> test.";
evas_object_textblock_text_markup_set(tb, buf); evas_object_textblock_text_markup_set(tb, buf);
/* Single line range */ /* Single line range */
@ -1327,7 +1327,7 @@ END_TEST
START_TEST(evas_textblock_editing) START_TEST(evas_textblock_editing)
{ {
START_TB_TEST(); START_TB_TEST();
const char *buf = "First par.<ps>Second par."; const char *buf = "First par.<ps/>Second par.";
evas_object_textblock_text_markup_set(tb, buf); evas_object_textblock_text_markup_set(tb, buf);
Evas_Textblock_Cursor *main_cur = evas_object_textblock_cursor_get(tb); Evas_Textblock_Cursor *main_cur = evas_object_textblock_cursor_get(tb);
@ -1346,7 +1346,7 @@ START_TEST(evas_textblock_editing)
evas_textblock_cursor_paragraph_first(cur); evas_textblock_cursor_paragraph_first(cur);
evas_textblock_cursor_char_delete(cur); evas_textblock_cursor_char_delete(cur);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb), fail_if(strcmp(evas_object_textblock_text_markup_get(tb),
"irst par.<ps>Second par.")); "irst par.<ps/>Second par."));
/* Delete some arbitrary char */ /* Delete some arbitrary char */
evas_textblock_cursor_char_next(cur); evas_textblock_cursor_char_next(cur);
@ -1354,14 +1354,14 @@ START_TEST(evas_textblock_editing)
evas_textblock_cursor_char_next(cur); evas_textblock_cursor_char_next(cur);
evas_textblock_cursor_char_delete(cur); evas_textblock_cursor_char_delete(cur);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb), fail_if(strcmp(evas_object_textblock_text_markup_get(tb),
"irs par.<ps>Second par.")); "irs par.<ps/>Second par."));
/* Delete a range */ /* Delete a range */
evas_textblock_cursor_pos_set(main_cur, 1); evas_textblock_cursor_pos_set(main_cur, 1);
evas_textblock_cursor_pos_set(cur, 6); evas_textblock_cursor_pos_set(cur, 6);
evas_textblock_cursor_range_delete(cur, main_cur); evas_textblock_cursor_range_delete(cur, main_cur);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb), fail_if(strcmp(evas_object_textblock_text_markup_get(tb),
"ir.<ps>Second par.")); "ir.<ps/>Second par."));
evas_textblock_cursor_paragraph_char_first(main_cur); evas_textblock_cursor_paragraph_char_first(main_cur);
evas_textblock_cursor_paragraph_char_last(cur); evas_textblock_cursor_paragraph_char_last(cur);
evas_textblock_cursor_char_next(cur); evas_textblock_cursor_char_next(cur);
@ -1376,7 +1376,7 @@ START_TEST(evas_textblock_editing)
evas_textblock_cursor_paragraph_char_first(main_cur); evas_textblock_cursor_paragraph_char_first(main_cur);
evas_textblock_cursor_range_delete(cur, main_cur); evas_textblock_cursor_range_delete(cur, main_cur);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb), fail_if(strcmp(evas_object_textblock_text_markup_get(tb),
"First par.<ps>")); "First par.<ps/>"));
/* Merging paragraphs */ /* Merging paragraphs */
evas_object_textblock_text_markup_set(tb, buf); evas_object_textblock_text_markup_set(tb, buf);
@ -1416,13 +1416,13 @@ END_TEST
START_TEST(evas_textblock_text_getters) START_TEST(evas_textblock_text_getters)
{ {
START_TB_TEST(); START_TB_TEST();
const char *buf = "This is a <br> test.<ps>" const char *buf = "This is a <br/> test.<ps/>"
"טקסט בעברית<ps>and now in english."; "טקסט בעברית<ps/>and now in english.";
evas_object_textblock_text_markup_set(tb, buf); evas_object_textblock_text_markup_set(tb, buf);
evas_textblock_cursor_paragraph_first(cur); evas_textblock_cursor_paragraph_first(cur);
fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur), fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur),
"This is a <br> test.")); "This is a <br/> test."));
evas_textblock_cursor_paragraph_next(cur); evas_textblock_cursor_paragraph_next(cur);
fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur), fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur),
@ -1447,17 +1447,17 @@ START_TEST(evas_textblock_text_getters)
evas_textblock_cursor_pos_set(main_cur, 5); evas_textblock_cursor_pos_set(main_cur, 5);
evas_textblock_cursor_pos_set(cur, 14); evas_textblock_cursor_pos_set(cur, 14);
fail_if(strcmp(evas_textblock_cursor_range_text_get(main_cur, cur, fail_if(strcmp(evas_textblock_cursor_range_text_get(main_cur, cur,
EVAS_TEXTBLOCK_TEXT_MARKUP), "is a <br> te")); EVAS_TEXTBLOCK_TEXT_MARKUP), "is a <br/> te"));
evas_textblock_cursor_pos_set(main_cur, 14); evas_textblock_cursor_pos_set(main_cur, 14);
evas_textblock_cursor_pos_set(cur, 20); evas_textblock_cursor_pos_set(cur, 20);
fail_if(strcmp(evas_textblock_cursor_range_text_get(main_cur, cur, fail_if(strcmp(evas_textblock_cursor_range_text_get(main_cur, cur,
EVAS_TEXTBLOCK_TEXT_MARKUP), "st.<ps>טק")); EVAS_TEXTBLOCK_TEXT_MARKUP), "st.<ps/>טק"));
evas_textblock_cursor_pos_set(main_cur, 14); evas_textblock_cursor_pos_set(main_cur, 14);
evas_textblock_cursor_pos_set(cur, 32); evas_textblock_cursor_pos_set(cur, 32);
fail_if(strcmp(evas_textblock_cursor_range_text_get(main_cur, cur, fail_if(strcmp(evas_textblock_cursor_range_text_get(main_cur, cur,
EVAS_TEXTBLOCK_TEXT_MARKUP), "st.<ps>טקסט בעברית<ps>an")); EVAS_TEXTBLOCK_TEXT_MARKUP), "st.<ps/>טקסט בעברית<ps/>an"));
/* Backward range get */ /* Backward range get */
evas_textblock_cursor_pos_set(main_cur, 2); evas_textblock_cursor_pos_set(main_cur, 2);
@ -1473,17 +1473,17 @@ START_TEST(evas_textblock_text_getters)
evas_textblock_cursor_pos_set(main_cur, 5); evas_textblock_cursor_pos_set(main_cur, 5);
evas_textblock_cursor_pos_set(cur, 14); evas_textblock_cursor_pos_set(cur, 14);
fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur, fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur,
EVAS_TEXTBLOCK_TEXT_MARKUP), "is a <br> te")); EVAS_TEXTBLOCK_TEXT_MARKUP), "is a <br/> te"));
evas_textblock_cursor_pos_set(main_cur, 14); evas_textblock_cursor_pos_set(main_cur, 14);
evas_textblock_cursor_pos_set(cur, 20); evas_textblock_cursor_pos_set(cur, 20);
fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur, fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur,
EVAS_TEXTBLOCK_TEXT_MARKUP), "st.<ps>טק")); EVAS_TEXTBLOCK_TEXT_MARKUP), "st.<ps/>טק"));
evas_textblock_cursor_pos_set(main_cur, 14); evas_textblock_cursor_pos_set(main_cur, 14);
evas_textblock_cursor_pos_set(cur, 32); evas_textblock_cursor_pos_set(cur, 32);
fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur, fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur,
EVAS_TEXTBLOCK_TEXT_MARKUP), "st.<ps>טקסט בעברית<ps>an")); EVAS_TEXTBLOCK_TEXT_MARKUP), "st.<ps/>טקסט בעברית<ps/>an"));
/* Uninit cursors and other weird cases */ /* Uninit cursors and other weird cases */
evas_object_textblock_clear(tb); evas_object_textblock_clear(tb);
@ -1500,7 +1500,7 @@ END_TEST
START_TEST(evas_textblock_formats) START_TEST(evas_textblock_formats)
{ {
START_TB_TEST(); START_TB_TEST();
const char *buf = "Th<b>i<font_size=15 wrap=none>s i</font_size=13>s</> a <br> te<ps>st<item></>."; const char *buf = "Th<b>i<font_size=15 wrap=none>s i</font_size=13>s</> a <br/> te<ps/>st<item></>.";
const Evas_Object_Textblock_Node_Format *fnode; const Evas_Object_Textblock_Node_Format *fnode;
evas_object_textblock_text_markup_set(tb, buf); evas_object_textblock_text_markup_set(tb, buf);
@ -1652,25 +1652,25 @@ START_TEST(evas_textblock_formats)
* verify them visually, well, we can some of them. Possibly in the * verify them visually, well, we can some of them. Possibly in the
* future we will */ * future we will */
evas_object_textblock_text_markup_set(tb, evas_object_textblock_text_markup_set(tb,
"<font_size=40>font_size=40</><ps>" "<font_size=40>font_size=40</><ps/>"
"<color=#F210B3FF>color=#F210B3FF</><ps>" "<color=#F210B3FF>color=#F210B3FF</><ps/>"
"<underline=single underline_color=#A2B3C4>underline=single underline_color=#A2B3C4</><ps>" "<underline=single underline_color=#A2B3C4>underline=single underline_color=#A2B3C4</><ps/>"
"<underline=double underline_color=#F00 underline2_color=#00F>underline=double underline_color=#F00 underline2_color=#00F</><ps>" "<underline=double underline_color=#F00 underline2_color=#00F>underline=double underline_color=#F00 underline2_color=#00F</><ps/>"
"<underline=dashed underline_dash_color=#0F0 underline_dash_width=2 underline_dash_gap=1>underline=dashed underline_dash_color=#0F0 underline_dash_width=2 underline_dash_gap=1</><ps>" "<underline=dashed underline_dash_color=#0F0 underline_dash_width=2 underline_dash_gap=1>underline=dashed underline_dash_color=#0F0 underline_dash_width=2 underline_dash_gap=1</><ps/>"
"<style=outline outline_color=#F0FA>style=outline outline_color=#F0FA</><ps>" "<style=outline outline_color=#F0FA>style=outline outline_color=#F0FA</><ps/>"
"<style=shadow shadow_color=#F0F>style=shadow shadow_color=#F0F</><ps>" "<style=shadow shadow_color=#F0F>style=shadow shadow_color=#F0F</><ps/>"
"<style=glow glow_color=#BBB>style=glow glow_color=#BBB</><ps>" "<style=glow glow_color=#BBB>style=glow glow_color=#BBB</><ps/>"
"<style=glow glow2_color=#0F0>style=glow glow2_color=#0F0</><ps>" "<style=glow glow2_color=#0F0>style=glow glow2_color=#0F0</><ps/>"
"<style=glow color=#fff glow2_color=#fe87 glow_color=#f214>style=glow color=#fff glow2_color=#fe87 glow_color=#f214</><ps>" "<style=glow color=#fff glow2_color=#fe87 glow_color=#f214>style=glow color=#fff glow2_color=#fe87 glow_color=#f214</><ps/>"
"<backing=on backing_color=#00F>backing=on backing_color=#00F</><ps>" "<backing=on backing_color=#00F>backing=on backing_color=#00F</><ps/>"
"<strikethrough=on strikethrough_color=#FF0>strikethrough=on strikethrough_color=#FF0</><ps>" "<strikethrough=on strikethrough_color=#FF0>strikethrough=on strikethrough_color=#FF0</><ps/>"
"<align=right>align=right</><ps>" "<align=right>align=right</><ps/>"
"<backing=on backing_color=#F008 valign=0.0>valign=0.0</><ps>" "<backing=on backing_color=#F008 valign=0.0>valign=0.0</><ps/>"
"<backing=on backing_color=#0F08 tabstops=50>tabstops=<\\t></>50</><ps>" "<backing=on backing_color=#0F08 tabstops=50>tabstops=<\\t></>50</><ps/>"
"<backing=on backing_color=#00F8 linesize=40>linesize=40</><ps>" "<backing=on backing_color=#00F8 linesize=40>linesize=40</><ps/>"
"<backing=on backing_color=#F0F8 linerelsize=200%>linerelsize=200%</><ps>" "<backing=on backing_color=#F0F8 linerelsize=200%>linerelsize=200%</><ps/>"
"<backing=on backing_color=#0FF8 linegap=20>linegap=20</><ps>" "<backing=on backing_color=#0FF8 linegap=20>linegap=20</><ps/>"
"<backing=on backing_color=#FF08 linerelgap=100%>linerelgap=100%</><ps>"); "<backing=on backing_color=#FF08 linerelgap=100%>linerelgap=100%</><ps/>");
/* Force a relayout */ /* Force a relayout */
evas_object_textblock_size_formatted_get(tb, NULL, NULL); evas_object_textblock_size_formatted_get(tb, NULL, NULL);
@ -1714,22 +1714,22 @@ START_TEST(evas_textblock_formats)
} }
/* Make sure we get all the types of visible formats correctly. */ /* Make sure we get all the types of visible formats correctly. */
evas_object_textblock_text_markup_set(tb, "<ps>a<br>a<tab>a<item></>"); evas_object_textblock_text_markup_set(tb, "<ps/>a<br/>a<tab/>a<item></>");
fail_if(strcmp(evas_textblock_node_format_text_get( fail_if(strcmp(evas_textblock_node_format_text_get(
evas_textblock_cursor_format_get(cur)), "ps")); evas_textblock_cursor_format_get(cur)), "ps"));
fail_if(strcmp(evas_textblock_cursor_content_get(cur), "<ps>")); fail_if(strcmp(evas_textblock_cursor_content_get(cur), "<ps/>"));
fail_if(!evas_textblock_cursor_format_is_visible_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(!evas_textblock_cursor_char_next(cur)); fail_if(!evas_textblock_cursor_char_next(cur));
fail_if(strcmp(evas_textblock_node_format_text_get( fail_if(strcmp(evas_textblock_node_format_text_get(
evas_textblock_cursor_format_get(cur)), "br")); evas_textblock_cursor_format_get(cur)), "br"));
fail_if(strcmp(evas_textblock_cursor_content_get(cur), "<br>")); fail_if(strcmp(evas_textblock_cursor_content_get(cur), "<br/>"));
fail_if(!evas_textblock_cursor_format_is_visible_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(!evas_textblock_cursor_char_next(cur)); fail_if(!evas_textblock_cursor_char_next(cur));
fail_if(strcmp(evas_textblock_node_format_text_get( fail_if(strcmp(evas_textblock_node_format_text_get(
evas_textblock_cursor_format_get(cur)), "tab")); evas_textblock_cursor_format_get(cur)), "tab"));
fail_if(strcmp(evas_textblock_cursor_content_get(cur), "<tab>")); fail_if(strcmp(evas_textblock_cursor_content_get(cur), "<tab/>"));
fail_if(!evas_textblock_cursor_format_is_visible_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(!evas_textblock_cursor_char_next(cur)); fail_if(!evas_textblock_cursor_char_next(cur));
@ -1749,7 +1749,7 @@ START_TEST(evas_textblock_style)
Evas_Coord l, r, t, b; Evas_Coord l, r, t, b;
START_TB_TEST(); START_TB_TEST();
Evas_Textblock_Style *newst; Evas_Textblock_Style *newst;
const char *buf = "Test<ps>Test2<ps>נסיון"; const char *buf = "Test<ps/>Test2<ps/>נסיון";
evas_object_textblock_text_markup_set(tb, buf); evas_object_textblock_text_markup_set(tb, buf);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf)); fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf));
@ -1850,7 +1850,7 @@ START_TEST(evas_textblock_set_get)
fail_if(strcmp(evas_object_textblock_bidi_delimiters_get(tb), ",|")); fail_if(strcmp(evas_object_textblock_bidi_delimiters_get(tb), ",|"));
/* Hinting */ /* Hinting */
evas_object_textblock_text_markup_set(tb, "This is<ps>a test<br>bla"); evas_object_textblock_text_markup_set(tb, "This is<ps/>a test<br/>bla");
/* Force relayout */ /* Force relayout */
evas_object_textblock_size_formatted_get(tb, NULL, NULL); evas_object_textblock_size_formatted_get(tb, NULL, NULL);
evas_font_hinting_set(evas, EVAS_FONT_HINTING_NONE); evas_font_hinting_set(evas, EVAS_FONT_HINTING_NONE);
@ -1923,7 +1923,7 @@ START_TEST(evas_textblock_size)
{ {
START_TB_TEST(); START_TB_TEST();
Evas_Coord w, h, h2, nw, nh; Evas_Coord w, h, h2, nw, nh;
const char *buf = "This is a <br> test.<br>גם בעברית"; const char *buf = "This is a <br/> test.<br/>גם בעברית";
/* When wrapping is off, native size should be the same as formatted /* When wrapping is off, native size should be the same as formatted
* size */ * size */
@ -1932,7 +1932,7 @@ START_TEST(evas_textblock_size)
fail_if((w != nw) || (h != nh)); fail_if((w != nw) || (h != nh));
fail_if(w != 0); fail_if(w != 0);
evas_object_textblock_text_markup_set(tb, "a<br>a"); evas_object_textblock_text_markup_set(tb, "a<br/>a");
evas_object_textblock_size_formatted_get(tb, &w, &h2); evas_object_textblock_size_formatted_get(tb, &w, &h2);
evas_object_textblock_size_native_get(tb, &nw, &nh); evas_object_textblock_size_native_get(tb, &nw, &nh);
fail_if((w != nw) || (h2 != nh)); fail_if((w != nw) || (h2 != nh));