From ea4834afcb0580b15e7653c58247f174d36234d7 Mon Sep 17 00:00:00 2001 From: tasn Date: Thu, 14 Jul 2011 14:25:42 +0000 Subject: [PATCH] Evas tests: Added more cursor tests, this time with bidi. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@61369 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/tests/evas_test_textblock.c | 80 +++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 19 deletions(-) diff --git a/src/tests/evas_test_textblock.c b/src/tests/evas_test_textblock.c index 86d8daa..0cf74ff 100644 --- a/src/tests/evas_test_textblock.c +++ b/src/tests/evas_test_textblock.c @@ -388,26 +388,71 @@ START_TEST(evas_textblock_cursor) fail_if(evas_textblock_cursor_compare(cur, main_cur)); /* Try positions beyond the left/right limits of lines. */ - evas_textblock_cursor_line_set(cur, 0); - evas_textblock_cursor_pen_geometry_get(cur, &x, &y, &w, &h); - evas_textblock_cursor_char_coord_set(main_cur, x - 50, y); - fail_if(evas_textblock_cursor_compare(main_cur, cur)); + for (i = 0 ; i < 2 ; i++) + { + evas_textblock_cursor_line_set(cur, i); + evas_textblock_cursor_pen_geometry_get(cur, &x, &y, &w, &h); + evas_textblock_cursor_pos_set(main_cur, 5); + evas_textblock_cursor_char_coord_set(main_cur, x - 50, y); + fail_if(evas_textblock_cursor_compare(main_cur, cur)); - evas_textblock_cursor_line_char_last(cur); - evas_textblock_cursor_pen_geometry_get(cur, &x, &y, &w, &h); - evas_textblock_cursor_char_coord_set(main_cur, x + 50, y); - fail_if(evas_textblock_cursor_compare(main_cur, cur)); + evas_textblock_cursor_line_char_last(cur); + evas_textblock_cursor_pen_geometry_get(cur, &x, &y, &w, &h); + evas_textblock_cursor_pos_set(main_cur, 5); + evas_textblock_cursor_char_coord_set(main_cur, x + 50, y); + fail_if(evas_textblock_cursor_compare(main_cur, cur)); + } - evas_textblock_cursor_line_set(cur, 1); - evas_textblock_cursor_pen_geometry_get(cur, &x, &y, &w, &h); - evas_textblock_cursor_char_coord_set(main_cur, x - 50, y); - fail_if(evas_textblock_cursor_compare(main_cur, cur)); +#ifdef HAVE_FRIBIDI + evas_object_textblock_text_markup_set(tb, + "testנסיוןtestנסיון" + "נסיוןtestנסיוןtest" + "testנסיוןtest" + "נסיוןtestנסיון" + "testנסיון
נסיון" + "נסיוןtest
test" + ); - evas_textblock_cursor_line_char_last(cur); - evas_textblock_cursor_pen_geometry_get(cur, &x, &y, &w, &h); - evas_textblock_cursor_char_coord_set(main_cur, x + 50, y); - fail_if(evas_textblock_cursor_compare(main_cur, cur)); + for (i = 0 ; i < 8 ; i++) + { + evas_textblock_cursor_line_set(cur, i); + evas_textblock_cursor_line_geometry_get(cur, &x, &y, &w, &h); + switch (i) + { + case 0: + case 2: + case 4: + case 5: + /* Ltr paragraph */ + evas_textblock_cursor_pos_set(main_cur, 7); + evas_textblock_cursor_char_coord_set(main_cur, x - 50, y); + fail_if(evas_textblock_cursor_compare(main_cur, cur)); + + evas_textblock_cursor_line_char_last(cur); + evas_textblock_cursor_pos_set(main_cur, 7); + evas_textblock_cursor_char_coord_set(main_cur, x + w + 50, y); + fail_if(evas_textblock_cursor_compare(main_cur, cur)); + break; + case 1: + case 3: + case 6: + case 7: + /* Rtl paragraph */ + evas_textblock_cursor_line_char_last(cur); + evas_textblock_cursor_pos_set(main_cur, 7); + evas_textblock_cursor_char_coord_set(main_cur, x - 50, y); + fail_if(evas_textblock_cursor_compare(main_cur, cur)); + + evas_textblock_cursor_line_char_first(cur); + evas_textblock_cursor_pos_set(main_cur, 7); + evas_textblock_cursor_char_coord_set(main_cur, x + w + 50, y); + fail_if(evas_textblock_cursor_compare(main_cur, cur)); + break; + } + } +#endif + evas_object_textblock_text_markup_set(tb, buf); /* Testing line geometry.*/ { Evas_Coord lx, ly, lw, lh; @@ -514,9 +559,6 @@ START_TEST(evas_textblock_cursor) fail_if(evas_textblock_cursor_compare(main_cur, cur)); } - - /* FIXME: Add tests that check positions left of/right of rtl lines. */ - END_TB_TEST(); } END_TEST -- 2.7.4