Evas textblock: fix split cursor tests; FIXME ligatures tests

- re-enabling split BiDi cursor tests, disabled in 0d68ffbe;
    ligatures tests are still disabled;
  - change "fail_if" to "ck_assert_int_*",
    because it prints error message with values;
  - fixing usage of embedding LTR/RTL codes in tests;

Signed-off-by: Yakov Goldberg <yakov.g@samsung.com>
This commit is contained in:
Yakov Goldberg 2013-04-11 19:47:51 +03:00
parent 8d7fdf94ed
commit 0389d46014
1 changed files with 124 additions and 131 deletions

View File

@ -618,12 +618,14 @@ START_TEST(evas_textblock_cursor)
evas_textblock_cursor_char_next(cur); evas_textblock_cursor_char_next(cur);
for (i = 0 ; i < 3 ; i++) for (i = 0 ; i < 2 ; i++)
{ {
evas_textblock_cursor_pen_geometry_get(cur, NULL, NULL, &w, NULL); evas_textblock_cursor_pen_geometry_get(cur, NULL, NULL, &w, NULL);
ck_assert_int_eq(w, 3); ck_assert_int_eq(w, 3);
evas_textblock_cursor_char_next(cur); evas_textblock_cursor_char_next(cur);
} }
evas_textblock_cursor_pen_geometry_get(cur, NULL, NULL, &w, NULL);
ck_assert_int_eq(w, 3);
#else #else
/* FIXME: Disabled because fails on jenkins */ /* FIXME: Disabled because fails on jenkins */
#if 0 #if 0
@ -651,66 +653,67 @@ START_TEST(evas_textblock_cursor)
} }
END_TEST END_TEST
/* FIXME: Disabled because fails on jenkins */ #ifdef HAVE_FRIBIDI
#if 0
START_TEST(evas_textblock_split_cursor) START_TEST(evas_textblock_split_cursor)
{ {
#ifdef HAVE_FRIBIDI
START_TB_TEST(); START_TB_TEST();
Evas_Coord x, w, x2, w2; Evas_Coord x, w, x2, w2;
Evas_Coord nw, nh; Evas_Coord nw, nh;
Evas_Coord cx, cy, cx2, cy2; Evas_Coord cx, cy, cx2, cy2;
/* Split cursor in LTR paragraph. */ /* Split cursor in LTR paragraph.
/*0123456789 10 123 14 5678901234 */ * Russian 't' in the beginnning to create additional item.*/
evas_object_textblock_text_markup_set(tb, "test נסיון\u202babc\u202cנסיון bang"); /*01234 5 6789012345678 19 01234 */
evas_object_textblock_text_markup_set(tb, "тest \u202bנסיוןabcנסיון\u202c bang");
evas_object_textblock_size_native_get(tb, &nw, &nh); evas_object_textblock_size_native_get(tb, &nw, &nh);
evas_object_resize(tb, nw, nh); evas_object_resize(tb, nw, nh);
/* Logical cursor after "test " */ /* Logical cursor after "test " */
evas_textblock_cursor_pos_set(cur, 5); evas_textblock_cursor_pos_set(cur, 6);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL, fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, &cx2, NULL, NULL, NULL, NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 4); evas_textblock_cursor_pos_set(cur, 18);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL);
evas_textblock_cursor_pos_set(cur, 5);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, &w2, NULL);
fail_if(cx != (x + w));
fail_if(cx2 != (x2 + w2));
/* Logical cursor before " bang" */
evas_textblock_cursor_pos_set(cur, 20);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL, evas_textblock_cursor_pos_set(cur, 20);
NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 19);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
fail_if(cx != x); ck_assert_int_eq(cx, x);
fail_if(cx2 != x2); ck_assert_int_eq(cx2, x2);
/* Logical cursor before "a" */ /* Logical cursor before "a" */
evas_textblock_cursor_pos_set(cur, 11); evas_textblock_cursor_pos_set(cur, 11);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL, fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, &cx2, NULL, NULL, NULL, NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 9); evas_textblock_cursor_pos_set(cur, 11);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
evas_textblock_cursor_pos_set(cur, 10);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
fail_if(cx != x); ck_assert_int_eq(cx, x);
fail_if(cx2 != x2); ck_assert_int_eq(cx2, x2);
/* Logical cursor after "c" */ /* Logical cursor after "c" */
evas_textblock_cursor_pos_set(cur, 15); evas_textblock_cursor_pos_set(cur, 14);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, &w2, NULL);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL, fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, &cx2, NULL, NULL, NULL, NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 13); evas_textblock_cursor_pos_set(cur, 10);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
fail_if(cx != (x + w)); evas_textblock_cursor_pos_set(cur, 11);
fail_if(cx2 != (x2 + w2)); evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
ck_assert_int_eq(cx, x);
ck_assert_int_eq(cx2, x2);
/* Logical cursor before " bang" */
evas_textblock_cursor_pos_set(cur, 20);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
evas_textblock_cursor_pos_set(cur, 19);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
ck_assert_int_eq(cx, x);
ck_assert_int_eq(cx2, x2);
/* Logical cursor in the beginning */ /* Logical cursor in the beginning */
evas_textblock_cursor_line_char_first(cur); evas_textblock_cursor_line_char_first(cur);
@ -718,80 +721,77 @@ START_TEST(evas_textblock_split_cursor)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
fail_if(cx != x); ck_assert_int_eq(cx, x);
/* Logical cursor in the end */ /* Logical cursor in the end */
evas_textblock_cursor_line_char_last(cur); evas_textblock_cursor_line_char_last(cur);
fail_if(evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL, fail_if(evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 24); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL); ck_assert_int_eq(cx, x);
fail_if(cx != (x + w));
/* Logical cursor on the first pos */ /* Logical cursor on the second pos */
evas_textblock_cursor_pos_set(cur, 1); evas_textblock_cursor_pos_set(cur, 2);
fail_if(evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL, fail_if(evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
fail_if(cx != x); ck_assert_int_eq(cx, x);
/* Split cursor in RTL paragraph. */ /* Split cursor in RTL paragraph. */
/* 1 2 /* 1 2
0123456789 0 12345 6 7890123456 */ 01234 5 67890123456789 0 123456 */
evas_object_textblock_text_markup_set(tb, "שלום test \u202aעברית\u202c efl נסיון"); evas_object_textblock_text_markup_set(tb, "שלום \u202atest עברית efl\u202c נסיון");
evas_object_textblock_size_native_get(tb, &nw, &nh); evas_object_textblock_size_native_get(tb, &nw, &nh);
evas_object_resize(tb, nw, nh); evas_object_resize(tb, nw, nh);
/* Logical cursor before "test" */ /* Logical cursor before "test" */
evas_textblock_cursor_pos_set(cur, 6);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 4); evas_textblock_cursor_pos_set(cur, 4);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
evas_textblock_cursor_pos_set(cur, 5); evas_textblock_cursor_pos_set(cur, 6);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 5);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
fail_if(cx != x); ck_assert_int_eq(cx, x);
fail_if(cx2 != x2); ck_assert_int_eq(cx2, x2);
/* Logical cursor after " efl" */
evas_textblock_cursor_pos_set(cur, 21);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 20);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, &w2, NULL);
fail_if(cx != (x + w));
fail_if(cx2 != (x2 + w2));
/* Logical cursor before " efl" */
evas_textblock_cursor_pos_set(cur, 17);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 15);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
fail_if(cx != x2);
fail_if(cx2 != x);
/* Logical cursor after "test " */ /* Logical cursor after "test " */
evas_textblock_cursor_pos_set(cur, 11); evas_textblock_cursor_pos_set(cur, 11);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL, fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, &cx2, NULL, NULL, NULL, NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 9); evas_textblock_cursor_pos_set(cur, 16);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, &w2, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
fail_if(cx != (x + w)); evas_textblock_cursor_pos_set(cur, 15);
fail_if(cx2 != (x2 + w2)); evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
ck_assert_int_eq(cx, x);
ck_assert_int_eq(cx2, x2);
/* Logical cursor before " efl" */
evas_textblock_cursor_pos_set(cur, 16);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
evas_textblock_cursor_pos_set(cur, 15);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
ck_assert_int_eq(cx, x);
ck_assert_int_eq(cx2, x2);
/* Logical cursor after " efl" */
evas_textblock_cursor_pos_set(cur, 21);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 6);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
evas_textblock_cursor_pos_set(cur, 4);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
ck_assert_int_eq(cx, x);
ck_assert_int_eq(cx2, x2);
/* Logical cursor in the beginning */ /* Logical cursor in the beginning */
evas_textblock_cursor_line_char_first(cur); evas_textblock_cursor_line_char_first(cur);
@ -799,7 +799,7 @@ START_TEST(evas_textblock_split_cursor)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL);
fail_if(cx != (x + w)); ck_assert_int_eq(cx, (x + w));
/* Logical cursor in the end */ /* Logical cursor in the end */
evas_textblock_cursor_line_char_last(cur); evas_textblock_cursor_line_char_last(cur);
@ -808,16 +808,14 @@ START_TEST(evas_textblock_split_cursor)
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 26); evas_textblock_cursor_pos_set(cur, 26);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
fail_if(cx != x); ck_assert_int_eq(cx, x);
/* Corner cases for split cursor. */ /* Corner cases for split cursor. */
/* End of line in LTR paragraph */ /* End of line in LTR paragraph with embedding*/
/* 1 /* 1
01234567890123 4 567 */ 01234 5 678901234567 */
evas_object_textblock_text_markup_set(tb, "test נסיוןشسيب\u202babc"); evas_object_textblock_text_markup_set(tb, "test \u202bנסיוןشسيبabc");
evas_textblock_cursor_line_char_last(cur);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, &w2, NULL);
evas_object_textblock_size_native_get(tb, &nw, &nh); evas_object_textblock_size_native_get(tb, &nw, &nh);
evas_object_resize(tb, nw, nh); evas_object_resize(tb, nw, nh);
@ -825,17 +823,17 @@ START_TEST(evas_textblock_split_cursor)
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL, fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, &cx2, NULL, NULL, NULL, NULL, &cx2, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 4); evas_textblock_cursor_pos_set(cur, 15);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, &w2, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
evas_textblock_cursor_pos_set(cur, 5); evas_textblock_cursor_pos_set(cur, 6);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL);
fail_if(cx != (x + w)); ck_assert_int_eq(cx, (x + w));
fail_if(cx2 != (x2 + w2)); ck_assert_int_eq(cx2, x2);
/* End of line in RTL paragraph */ /* End of line in RTL paragraph */
/* 1 2 /* 1 2
0123456789012345678 9 0123 */ 012345678 9 01234567890123 */
evas_object_textblock_text_markup_set(tb, "נסיוןشسي testпривет\u202aשלום"); evas_object_textblock_text_markup_set(tb, "נסיוןشسي \u202atestприветשלום");
evas_object_textblock_size_native_get(tb, &nw, &nh); evas_object_textblock_size_native_get(tb, &nw, &nh);
evas_object_resize(tb, nw, nh); evas_object_resize(tb, nw, nh);
@ -845,18 +843,18 @@ START_TEST(evas_textblock_split_cursor)
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 8); evas_textblock_cursor_pos_set(cur, 8);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
evas_textblock_cursor_pos_set(cur, 9); evas_textblock_cursor_pos_set(cur, 10);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
fail_if(cx != x); ck_assert_int_eq(cx, x);
fail_if(cx2 != x2); ck_assert_int_eq(cx2, x2);
/* Cursor is between items of the same direction */ /* Cursor is between items of the same direction */
evas_textblock_cursor_pos_set(cur, 13); evas_textblock_cursor_pos_set(cur, 14);
fail_if(evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL, fail_if(evas_textblock_cursor_geometry_bidi_get(cur, &cx, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
fail_if(cx != x); ck_assert_int_eq(cx, x);
/* Cursor type is UNDER */ /* Cursor type is UNDER */
evas_textblock_cursor_pos_set(cur, 0); evas_textblock_cursor_pos_set(cur, 0);
@ -864,7 +862,7 @@ START_TEST(evas_textblock_split_cursor)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_UNDER)); EVAS_TEXTBLOCK_CURSOR_UNDER));
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
fail_if(cx != x); ck_assert_int_eq(cx, x);
/* Multiline */ /* Multiline */
Evas_Coord ly; Evas_Coord ly;
@ -884,14 +882,14 @@ START_TEST(evas_textblock_split_cursor)
NULL, &cx2, &cy2, NULL, NULL, NULL, &cx2, &cy2, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL); evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL);
fail_if(cy != ly); ck_assert_int_eq(cy, ly);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
fail_if(cx != x); ck_assert_int_eq(cx, x);
evas_textblock_cursor_pos_set(cur, 11); evas_textblock_cursor_pos_set(cur, 11);
evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL); evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL);
fail_if(cy2 != ly); ck_assert_int_eq(cy2, ly);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
fail_if(cx2 != x2); ck_assert_int_eq(cx2, x2);
} }
/* 01234567890123456789 */ /* 01234567890123456789 */
evas_object_textblock_text_markup_set(tb, "<wrap=char>נסיוןhelloприветשלום"); evas_object_textblock_text_markup_set(tb, "<wrap=char>נסיוןhelloприветשלום");
@ -902,27 +900,25 @@ START_TEST(evas_textblock_split_cursor)
for (i = 0; i < nw; i++) for (i = 0; i < nw; i++)
{ {
evas_object_resize(tb, i, nh); evas_object_resize(tb, i, nh);
evas_textblock_cursor_pos_set(cur, 16); evas_textblock_cursor_pos_set(cur, 16);
fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, &cy, NULL, fail_if(!evas_textblock_cursor_geometry_bidi_get(cur, &cx, &cy, NULL,
NULL, &cx2, &cy2, NULL, NULL, NULL, &cx2, &cy2, NULL, NULL,
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL); evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL);
fail_if(cy != ly); ck_assert_int_eq(cy, ly);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL);
fail_if(cx != (x + w)); ck_assert_int_eq(cx, (x + w));
evas_textblock_cursor_pos_set(cur, 15); evas_textblock_cursor_pos_set(cur, 15);
evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL); evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL);
fail_if(cy2 != ly); ck_assert_int_eq(cy2, ly);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, &w2, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, &w2, NULL);
fail_if(cx2 != (x2 + w2)); ck_assert_int_eq(cx2, (x2 + w2));
} }
/* Testing multiline, when only RTL item is in the line. */ /* Testing multiline, when only RTL item is in the line. */
/* 012345678901234567890123 */ /* 012345678901234567890123 */
evas_object_textblock_text_markup_set(tb, "<wrap=char>testtesttestтестשלוםشسيب"); evas_object_textblock_text_markup_set(tb, "<wrap=char>testtesttestтестשלוםشسيب");
evas_object_textblock_size_native_get(tb, &nw, &nh); evas_object_textblock_size_native_get(tb, &nw, &nh);
nh = nh * 23;
evas_object_resize(tb, nw, nh); evas_object_resize(tb, nw, nh);
evas_textblock_cursor_pos_set(cur, 15); evas_textblock_cursor_pos_set(cur, 15);
@ -936,21 +932,20 @@ START_TEST(evas_textblock_split_cursor)
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 16); evas_textblock_cursor_pos_set(cur, 16);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, &w, NULL);
fail_if(cx != (x + w)); ck_assert_int_eq(cx, (x + w));
evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL); evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL);
fail_if(cy != ly); ck_assert_int_eq(cy, ly);
evas_textblock_cursor_pos_set(cur, 23); evas_textblock_cursor_pos_set(cur, 23);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
fail_if(cx2 != x2); ck_assert_int_eq(cx2, x2);
evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL); evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL);
fail_if(cy2 != ly); ck_assert_int_eq(cy2, ly);
/* Testing multiline, when only LTR item is in the line. */ /* Testing multiline, when only LTR item is in the line. */
/* 012345678901234567890123 */ /* 012345678901234567890123 */
evas_object_textblock_text_markup_set(tb, "<wrap=char>שלוםשלוםשלוםشسيبtestтест"); evas_object_textblock_text_markup_set(tb, "<wrap=char>שלוםשלוםשלוםشسيبtestтест");
evas_object_textblock_size_native_get(tb, &nw, &nh); evas_object_textblock_size_native_get(tb, &nw, &nh);
nh = nh * 23;
evas_object_resize(tb, nw, nh); evas_object_resize(tb, nw, nh);
evas_textblock_cursor_pos_set(cur, 15); evas_textblock_cursor_pos_set(cur, 15);
@ -964,18 +959,17 @@ START_TEST(evas_textblock_split_cursor)
EVAS_TEXTBLOCK_CURSOR_BEFORE)); EVAS_TEXTBLOCK_CURSOR_BEFORE));
evas_textblock_cursor_pos_set(cur, 16); evas_textblock_cursor_pos_set(cur, 16);
evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
fail_if(cx != x); ck_assert_int_eq(cx, x);
evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL); evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL);
fail_if(cy != ly); ck_assert_int_eq(cy, ly);
evas_textblock_cursor_pos_set(cur, 23); evas_textblock_cursor_line_char_last(cur);
evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, &w2, NULL); evas_textblock_cursor_pen_geometry_get(cur, &x2, NULL, NULL, NULL);
fail_if(cx2 != (x2 + w2)); ck_assert_int_eq(cx2, x2);
evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL); evas_textblock_cursor_line_geometry_get(cur, NULL, &ly, NULL, NULL);
fail_if(cy2 != ly); ck_assert_int_eq(cy2, ly);
END_TB_TEST(); END_TB_TEST();
#endif
} }
END_TEST END_TEST
#endif #endif
@ -1452,7 +1446,7 @@ START_TEST(evas_textblock_items)
fail_if((w >= 93) || (h >= 152)); fail_if((w >= 93) || (h >= 152));
evas_textblock_cursor_pos_set(cur, 11); evas_textblock_cursor_pos_set(cur, 11);
evas_textblock_cursor_format_item_geometry_get(cur, NULL, NULL, &w, &ih); evas_textblock_cursor_format_item_geometry_get(cur, NULL, NULL, &w, &ih);
fail_if((w > 90) || (h != ih)); fail_if((w > 108) || (h != ih));
buf = "This is an <item relize=93x152 vsize=ascent></>."; buf = "This is an <item relize=93x152 vsize=ascent></>.";
evas_object_textblock_text_markup_set(tb, buf); evas_object_textblock_text_markup_set(tb, buf);
@ -1460,7 +1454,7 @@ START_TEST(evas_textblock_items)
fail_if((w >= 93) || (h >= 152)); fail_if((w >= 93) || (h >= 152));
evas_textblock_cursor_pos_set(cur, 11); evas_textblock_cursor_pos_set(cur, 11);
evas_textblock_cursor_format_item_geometry_get(cur, NULL, NULL, &w, &ih); evas_textblock_cursor_format_item_geometry_get(cur, NULL, NULL, &w, &ih);
fail_if((w > 90) || (h <= ih)); fail_if((w > 108) || (h <= ih));
/* Relsize and abs size in the same line, all should be the same size */ /* Relsize and abs size in the same line, all should be the same size */
buf = "<item relsize=64x64 vsize=ascent href=emoticon/knowing-grin></item><item absize=64x64 vsize=ascent href=emoticon/knowing-grin></item><item relsize=64x64 vsize=ascent href=emoticon/knowing-grin></item>"; buf = "<item relsize=64x64 vsize=ascent href=emoticon/knowing-grin></item><item absize=64x64 vsize=ascent href=emoticon/knowing-grin></item><item relsize=64x64 vsize=ascent href=emoticon/knowing-grin></item>";
@ -2435,7 +2429,7 @@ START_TEST(evas_textblock_style)
newst = evas_textblock_style_new(); newst = evas_textblock_style_new();
fail_if(!newst); fail_if(!newst);
evas_textblock_style_set(newst, evas_textblock_style_set(newst,
"DEFAULT='" TEST_FONT " font_size=20 color=#000 text_class=entry'" "DEFAULT='" TEST_FONT " font_size=50 color=#000 text_class=entry'"
"br='\n'" "br='\n'"
"ps='ps'" "ps='ps'"
"tab='\t'"); "tab='\t'");
@ -2657,8 +2651,7 @@ void evas_test_textblock(TCase *tc)
{ {
tcase_add_test(tc, evas_textblock_simple); tcase_add_test(tc, evas_textblock_simple);
tcase_add_test(tc, evas_textblock_cursor); tcase_add_test(tc, evas_textblock_cursor);
/* FIXME: Disabled because fails on jenkins */ #ifdef HAVE_FRIBIDI
#if 0
tcase_add_test(tc, evas_textblock_split_cursor); tcase_add_test(tc, evas_textblock_split_cursor);
#endif #endif
tcase_add_test(tc, evas_textblock_size); tcase_add_test(tc, evas_textblock_size);