forked from enlightenment/efl
evas textblock: fix evas test suite build errors
Summary: Fix build errors caused by recent patches for Text cursor. @fix Test Plan: run "make check" Reviewers: herdsman, jpeg, raster Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D4957
This commit is contained in:
parent
f5b1cb89a0
commit
f29dfe2789
|
@ -4166,7 +4166,7 @@ _test_check_annotation(Evas_Object *tb,
|
|||
evas_textblock_cursor_pos_set(end, end_pos);
|
||||
|
||||
Eina_Iterator *it =
|
||||
efl_canvas_text_range_annotations_get(tb, start, end);
|
||||
efl_text_range_annotations_get(tb, start, end);
|
||||
|
||||
evas_textblock_cursor_free(start);
|
||||
evas_textblock_cursor_free(end);
|
||||
|
@ -4174,7 +4174,7 @@ _test_check_annotation(Evas_Object *tb,
|
|||
size_t i = 0;
|
||||
EINA_ITERATOR_FOREACH(it, an)
|
||||
{
|
||||
const char *fmt = efl_canvas_text_annotation_get(tb,
|
||||
const char *fmt = efl_text_annotation_get(tb,
|
||||
an);
|
||||
ck_assert_msg((i < len),
|
||||
"No formats to check but current annotation is: %s\n", fmt);
|
||||
|
@ -4214,27 +4214,27 @@ START_TEST(evas_textblock_annotation)
|
|||
/* Check some trivial cases */
|
||||
evas_textblock_cursor_pos_set(start, 0);
|
||||
evas_textblock_cursor_pos_set(end, 3);
|
||||
ck_assert(!efl_canvas_text_annotation_insert(tb, start, end, NULL));
|
||||
ck_assert(!efl_text_annotation_insert(tb, start, end, NULL));
|
||||
evas_textblock_cursor_pos_set(start, 0);
|
||||
evas_textblock_cursor_pos_set(end, 3);
|
||||
ck_assert(!efl_canvas_text_annotation_insert(tb, start, end, ""));
|
||||
ck_assert(!efl_text_annotation_insert(tb, start, end, ""));
|
||||
evas_textblock_cursor_pos_set(start, 1);
|
||||
evas_textblock_cursor_pos_set(end, 0);
|
||||
ck_assert(!efl_canvas_text_annotation_insert(tb, start, end, "color=#fff"));
|
||||
ck_assert(!efl_text_annotation_insert(tb, start, end, "color=#fff"));
|
||||
|
||||
/* Insert and check correct positions */
|
||||
_test_check_annotation(tb, 0, 10, _COMP_PARAMS());
|
||||
|
||||
evas_textblock_cursor_pos_set(start, 0);
|
||||
evas_textblock_cursor_pos_set(end, 3);
|
||||
efl_canvas_text_annotation_insert(tb, start, end, "font_weight=bold");
|
||||
efl_text_annotation_insert(tb, start, end, "font_weight=bold");
|
||||
_test_check_annotation(tb, 0, 2, _COMP_PARAMS("font_weight=bold"));
|
||||
_test_check_annotation(tb, 0, 2, _COMP_PARAMS("font_weight=bold"));
|
||||
_test_check_annotation(tb, 4, 10, _COMP_PARAMS());
|
||||
|
||||
evas_textblock_cursor_pos_set(start, 50);
|
||||
evas_textblock_cursor_pos_set(end, 60);
|
||||
efl_canvas_text_annotation_insert(tb, start, end, "color=#0ff");
|
||||
efl_text_annotation_insert(tb, start, end, "color=#0ff");
|
||||
_test_check_annotation(tb, 0, 49, _COMP_PARAMS("font_weight=bold"));
|
||||
_test_check_annotation(tb, 0, 50, _COMP_PARAMS("font_weight=bold", "color=#0ff"));
|
||||
_test_check_annotation(tb, 0, 55, _COMP_PARAMS("font_weight=bold", "color=#0ff"));
|
||||
|
@ -4249,7 +4249,7 @@ START_TEST(evas_textblock_annotation)
|
|||
efl_text_set(tb, "hello");
|
||||
evas_textblock_cursor_pos_set(start, 0);
|
||||
evas_textblock_cursor_pos_set(end, 2);
|
||||
an = efl_canvas_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
an = efl_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
_test_check_annotation(tb, 2, 3, _COMP_PARAMS());
|
||||
evas_textblock_cursor_pos_set(cur, 0);
|
||||
evas_textblock_cursor_text_append(cur, "a");
|
||||
|
@ -4257,22 +4257,22 @@ START_TEST(evas_textblock_annotation)
|
|||
_test_check_annotation(tb, 3, 4, _COMP_PARAMS());
|
||||
|
||||
/* Replace annotations's format */
|
||||
efl_canvas_text_annotation_set(tb, an, "font_size=14");
|
||||
efl_text_annotation_set(tb, an, "font_size=14");
|
||||
_test_check_annotation(tb, 2, 3, _COMP_PARAMS("font_size=14"));
|
||||
_test_check_annotation(tb, 3, 4, _COMP_PARAMS());
|
||||
|
||||
efl_text_set(tb, "hello world");
|
||||
evas_textblock_cursor_pos_set(start, 0);
|
||||
evas_textblock_cursor_pos_set(end, 2);
|
||||
an = efl_canvas_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
an = efl_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
evas_textblock_cursor_pos_set(start, 2);
|
||||
evas_textblock_cursor_pos_set(end, 3);
|
||||
an2 = efl_canvas_text_annotation_insert(tb, start, end, "font_size=14");
|
||||
an2 = efl_text_annotation_insert(tb, start, end, "font_size=14");
|
||||
_test_check_annotation(tb, 0, 1, _COMP_PARAMS("color=#fff"));
|
||||
_test_check_annotation(tb, 2, 3, _COMP_PARAMS("font_size=14"));
|
||||
_test_check_annotation(tb, 0, 3, _COMP_PARAMS("color=#fff", "font_size=14"));
|
||||
efl_canvas_text_annotation_set(tb, an, "font_size=10");
|
||||
efl_canvas_text_annotation_set(tb, an2, "color=#000");
|
||||
efl_text_annotation_set(tb, an, "font_size=10");
|
||||
efl_text_annotation_set(tb, an2, "color=#000");
|
||||
_test_check_annotation(tb, 2, 3, _COMP_PARAMS("color=#000"));
|
||||
_test_check_annotation(tb, 0, 1, _COMP_PARAMS("font_size=10"));
|
||||
_test_check_annotation(tb, 0, 3, _COMP_PARAMS("font_size=10", "color=#000"));
|
||||
|
@ -4281,49 +4281,49 @@ START_TEST(evas_textblock_annotation)
|
|||
efl_text_set(tb, "hello world");
|
||||
evas_textblock_cursor_pos_set(start, 0);
|
||||
evas_textblock_cursor_pos_set(end, 2);
|
||||
an = efl_canvas_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
an = efl_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
evas_textblock_cursor_pos_set(start, 3);
|
||||
evas_textblock_cursor_pos_set(end, 4);
|
||||
an2 = efl_canvas_text_annotation_insert(tb, start, end, "font_size=14");
|
||||
efl_canvas_text_annotation_del(tb, an);
|
||||
an2 = efl_text_annotation_insert(tb, start, end, "font_size=14");
|
||||
efl_text_annotation_del(tb, an);
|
||||
_test_check_annotation(tb, 0, 3, _COMP_PARAMS("font_size=14"));
|
||||
efl_canvas_text_annotation_del(tb, an2);
|
||||
efl_text_annotation_del(tb, an2);
|
||||
_test_check_annotation(tb, 0, 3, _COMP_PARAMS());
|
||||
evas_textblock_cursor_pos_set(start, 0);
|
||||
evas_textblock_cursor_pos_set(end, 1);
|
||||
an = efl_canvas_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
an = efl_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
_test_check_annotation(tb, 1, 3, _COMP_PARAMS());
|
||||
_test_check_annotation(tb, 0, 0, _COMP_PARAMS("color=#fff"));
|
||||
efl_canvas_text_annotation_del(tb, an);
|
||||
efl_text_annotation_del(tb, an);
|
||||
_test_check_annotation(tb, 0, 0, _COMP_PARAMS());
|
||||
|
||||
/* Check blocking of "item formats" */
|
||||
efl_text_set(tb, "hello world");
|
||||
evas_textblock_cursor_pos_set(start, 0);
|
||||
evas_textblock_cursor_pos_set(end, 1);
|
||||
efl_canvas_text_annotation_insert(tb, start, end, "ps");
|
||||
efl_text_annotation_insert(tb, start, end, "ps");
|
||||
_test_check_annotation(tb, 0, 1, _COMP_PARAMS());
|
||||
evas_textblock_cursor_pos_set(start, 0);
|
||||
evas_textblock_cursor_pos_set(end, 1);
|
||||
efl_canvas_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
efl_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
_test_check_annotation(tb, 0, 1, _COMP_PARAMS("color=#fff"));
|
||||
evas_textblock_cursor_pos_set(start, 2);
|
||||
evas_textblock_cursor_pos_set(end, 3);
|
||||
efl_canvas_text_annotation_insert(tb, start, end, "br");
|
||||
efl_text_annotation_insert(tb, start, end, "br");
|
||||
evas_textblock_cursor_pos_set(start, 6);
|
||||
evas_textblock_cursor_pos_set(end, 7);
|
||||
efl_canvas_text_annotation_insert(tb, start, end, "item");
|
||||
efl_text_annotation_insert(tb, start, end, "item");
|
||||
_test_check_annotation(tb, 0, 8, _COMP_PARAMS("color=#fff"));
|
||||
|
||||
/* Check "item" annotations */
|
||||
efl_text_set(tb, "abcd");
|
||||
evas_textblock_cursor_pos_set(cur, 4);
|
||||
an = efl_canvas_text_cursor_object_item_insert(tb, cur, "size=16x16");
|
||||
an = efl_text_cursor_object_item_insert(tb, cur, "size=16x16");
|
||||
_test_check_annotation(tb, 4, 4, _COMP_PARAMS("size=16x16"));
|
||||
|
||||
/* Check that format is not extended if it's an "object item" */
|
||||
evas_textblock_cursor_pos_set(cur, 5);
|
||||
efl_canvas_text_cursor_text_insert(tb, cur, "a");
|
||||
efl_text_cursor_text_insert(tb, cur, "a");
|
||||
_test_check_annotation(tb, 5, 7, _COMP_PARAMS());
|
||||
_test_check_annotation(tb, 0, 3, _COMP_PARAMS());
|
||||
|
||||
|
@ -4332,7 +4332,7 @@ START_TEST(evas_textblock_annotation)
|
|||
int blen, len;
|
||||
evas_textblock_cursor_pos_set(cur, 5);
|
||||
blen = evas_textblock_cursor_paragraph_text_length_get(cur);
|
||||
efl_canvas_text_annotation_del(tb, an);
|
||||
efl_text_annotation_del(tb, an);
|
||||
len = evas_textblock_cursor_paragraph_text_length_get(cur);
|
||||
ck_assert_int_eq(len, blen - 1);
|
||||
_test_check_annotation(tb, 0, 5, _COMP_PARAMS());
|
||||
|
@ -4342,11 +4342,11 @@ START_TEST(evas_textblock_annotation)
|
|||
efl_text_set(tb, "hello");
|
||||
evas_textblock_cursor_pos_set(start, 0);
|
||||
evas_textblock_cursor_pos_set(end, 5);
|
||||
efl_canvas_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
efl_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
_test_check_annotation(tb, 3, 3, _COMP_PARAMS("color=#fff"));
|
||||
/* Old API */
|
||||
evas_textblock_cursor_pos_set(cur, 5);
|
||||
efl_canvas_text_cursor_text_insert(tb, cur, "a");
|
||||
efl_text_cursor_text_insert(tb, cur, "a");
|
||||
_test_check_annotation(tb, 0, 0, _COMP_PARAMS("color=#fff"));
|
||||
_test_check_annotation(tb, 5, 5, _COMP_PARAMS());
|
||||
|
||||
|
@ -4354,24 +4354,24 @@ START_TEST(evas_textblock_annotation)
|
|||
efl_text_set(tb, "hello\nworld");
|
||||
evas_textblock_cursor_pos_set(start, 0);
|
||||
evas_textblock_cursor_pos_set(end, 5);
|
||||
efl_canvas_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
efl_text_annotation_insert(tb, start, end, "color=#fff");
|
||||
_test_check_annotation(tb, 4, 4, _COMP_PARAMS("color=#fff"));
|
||||
evas_textblock_cursor_pos_set(cur, 4);
|
||||
/* Cursor position is now: hello|\nworld */
|
||||
efl_canvas_text_cursor_text_insert(tb, cur, "a");
|
||||
efl_text_cursor_text_insert(tb, cur, "a");
|
||||
_test_check_annotation(tb, 0, 0, _COMP_PARAMS("color=#fff"));
|
||||
_test_check_annotation(tb, 5, 5, _COMP_PARAMS("color=#fff"));
|
||||
|
||||
/* Test getting of object item */
|
||||
evas_textblock_cursor_pos_set(cur, 4);
|
||||
an = efl_canvas_text_cursor_object_item_annotation_get(tb, cur);
|
||||
an = efl_text_cursor_object_item_annotation_get(tb, cur);
|
||||
ck_assert(!an);
|
||||
|
||||
an = efl_canvas_text_cursor_object_item_insert(tb, cur, "size=16x16");
|
||||
an = efl_text_cursor_object_item_insert(tb, cur, "size=16x16");
|
||||
evas_textblock_cursor_pos_set(cur, 4);
|
||||
an = efl_canvas_text_cursor_object_item_annotation_get(tb, cur);
|
||||
an = efl_text_cursor_object_item_annotation_get(tb, cur);
|
||||
ck_assert(an);
|
||||
ck_assert_str_eq("size=16x16", efl_canvas_text_annotation_get(tb, an));
|
||||
ck_assert_str_eq("size=16x16", efl_text_annotation_get(tb, an));
|
||||
|
||||
END_TB_TEST();
|
||||
}
|
||||
|
@ -4395,8 +4395,8 @@ START_TEST(efl_canvas_text_cursor)
|
|||
|
||||
/* Logical cursor after "test " */
|
||||
evas_textblock_cursor_pos_set(cur, 6);
|
||||
fail_if(!efl_canvas_text_cursor_geometry_get(tb, cur,
|
||||
EFL_CANVAS_TEXT_CURSOR_TYPE_BEFORE, &cx, NULL, NULL, NULL, &cx2,
|
||||
fail_if(!efl_text_cursor_geometry_get(tb, cur,
|
||||
EFL_TEXT_CURSOR_TYPE_BEFORE, &cx, NULL, NULL, NULL, &cx2,
|
||||
NULL, NULL, NULL));
|
||||
evas_textblock_cursor_pos_set(cur, 18);
|
||||
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
|
||||
|
|
Loading…
Reference in New Issue