Evas textblock: fix ellipsis item at wrong place in RTL text 85/69785/3
authorYoungbok Shin <youngb.shin@samsung.com>
Tue, 17 May 2016 00:45:17 +0000 (09:45 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Tue, 17 May 2016 01:02:42 +0000 (10:02 +0900)
Summary:
An ellipsis item could be placed in wrong place in RTL text
with separated and short text items. Normally, an ellipsis
item has to be behind(in logical position) of previous item.
But, when the length of previos text item is 1, ellipsis
item could have same position with the previous item.
It was working fine for LTR text. But, wrong ellipsis could
be shown in RTL text.
@fix

Test Plan:
The test case included.
Run "make check"

Reviewers: tasn, minudf, woohyun, herdsman

Subscribers: Blackmole, z-wony, anand.km, cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3716

@tizen_fix

Change-Id: I17cee4742ca0e947b2aeb413cf4c1a6b89a15de7

src/lib/evas/canvas/evas_object_textblock.c
src/tests/evas/evas_test_textblock.c

index 20e8675..6ba2ce8 100644 (file)
@@ -4817,7 +4817,13 @@ _layout_ellipsis_item_new(Ctxt *c, const Evas_Object_Textblock_Item *cur_it)
 
    _text_item_update_sizes(c, ellip_ti);
 
+   /* TIZEN_ONLY(20160517): fix ellipsis item at wrong place in RTL text
+    * The text position for ellipsis item must be bigger than current item
    if (cur_it->type == EVAS_TEXTBLOCK_ITEM_TEXT)
+    */
+   if ((cur_it->type == EVAS_TEXTBLOCK_ITEM_TEXT) &&
+       (_ITEM_TEXT(cur_it)->text_props.text_len > 1))
+   /* END */
      {
         ellip_ti->parent.text_pos += _ITEM_TEXT(cur_it)->text_props.text_len
            - 1;
index 89b88d7..57d44b7 100644 (file)
@@ -2209,6 +2209,29 @@ START_TEST(evas_textblock_wrapping)
    evas_object_textblock_size_formatted_get(tb, NULL, &h);
    ck_assert_int_ge(h, bh);
 
+#ifdef HAVE_FRIBIDI
+   /* Check the ellipsis is placed at proper place
+    * in RTL text with formats */
+   evas_object_textblock_text_markup_set(tb, ")");
+   evas_object_textblock_size_native_get(tb, &bw, NULL);
+   bw++;
+
+   /* Expect to see: "...)ي" */
+   evas_object_textblock_text_markup_set(tb, "ي(ي)");
+   evas_textblock_cursor_format_prepend(cur, "+ ellipsis=1.0");
+   evas_object_textblock_size_native_get(tb, &nw, &nh);
+   evas_object_resize(tb, nw - bw, nh);
+   evas_object_textblock_size_formatted_get(tb, &bw, NULL);
+
+   /* Expect to see: "...)ي"
+    * But, Evas Textblock could put ellipsis item at wrong place: ")...ي"
+    * Then, formatted size could be different from the case without format. */
+   evas_object_textblock_text_markup_set(tb, "ي<color=#f00>(</color>ي)");
+   evas_textblock_cursor_format_prepend(cur, "+ ellipsis=1.0");
+   evas_object_textblock_size_formatted_get(tb, &w, NULL);
+   ck_assert_int_eq(bw, w);
+#endif
+
    END_TB_TEST();
 }
 END_TEST