herdsman pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=74ad947ded6e1f3631d7c11cc6316aaf2c104391

commit 74ad947ded6e1f3631d7c11cc6316aaf2c104391
Author: Daniel Hirt <daniel.h...@samsung.com>
Date:   Tue Jul 14 14:44:38 2015 +0300

    Evas textblock: Clear unused paragraphs
    
    This fixes a scenario in which paragraphs in the current layout still
    store visual lines from the previous layout. This is possible if the
    text uses an ellipsis format, allowing the layout work to stop at a
    certain paragraph. This inconsistency affects some query functions that
    consider lines which may be irrelevant in the current layout.
    
    Test Case: see added test case to evas_suite.
    
    @fix
---
 src/lib/evas/canvas/evas_object_textblock.c |  3 ++-
 src/tests/evas/evas_test_textblock.c        | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/canvas/evas_object_textblock.c 
b/src/lib/evas/canvas/evas_object_textblock.c
index 4e8ffaa..62494e7 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -5706,7 +5706,7 @@ _layout(const Evas_Object *eo_obj, int w, int h, int 
*w_ret, int *h_ret)
              }
         }
 
-      /* Mark all the rest of the paragraphs as invisible */
+      /* Clear the rest of the paragraphs and mark as invisible */
       if (c->par)
         {
            c->par = (Evas_Object_Textblock_Paragraph *)
@@ -5714,6 +5714,7 @@ _layout(const Evas_Object *eo_obj, int w, int h, int 
*w_ret, int *h_ret)
            while (c->par)
              {
                 c->par->visible = 0;
+                _paragraph_clear(c->obj, c->par);
                 c->par = (Evas_Object_Textblock_Paragraph *)
                    EINA_INLIST_GET(c->par)->next;
              }
diff --git a/src/tests/evas/evas_test_textblock.c 
b/src/tests/evas/evas_test_textblock.c
index fe4dfe1..d15465c 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -1918,6 +1918,25 @@ START_TEST(evas_textblock_wrapping)
    evas_object_textblock_size_formatted_get(tb, &w, NULL);
    ck_assert_int_le(w, nw);
 
+     {
+        int bret, ret;
+        evas_object_textblock_text_markup_set(tb,
+              "<ellipsis=1.0>aaa<ps>bbb</ellipsis>");
+        evas_object_resize(tb, 1, 1);
+        evas_object_textblock_size_formatted_get(tb, NULL, NULL);
+        evas_textblock_cursor_line_set(cur, 1);
+        bret = evas_textblock_cursor_pos_get(cur);
+
+        evas_object_resize(tb, 500, 500);
+        evas_object_textblock_size_formatted_get(tb, NULL, NULL);
+        evas_object_resize(tb, 1, 1);
+        evas_object_textblock_size_formatted_get(tb, NULL, NULL);
+        evas_textblock_cursor_line_set(cur, 1);
+        ret = evas_textblock_cursor_pos_get(cur);
+
+        ck_assert_int_eq(bret, ret);
+     }
+
    END_TB_TEST();
 }
 END_TEST

-- 


Reply via email to