herdsman pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=0de8ebbb3a03797a188d34583b1eed94daea884b

commit 0de8ebbb3a03797a188d34583b1eed94daea884b
Author: Daniel Hirt <daniel.h...@samsung.com>
Date:   Sun Jun 28 15:02:28 2015 +0300

    Evas textblock: Fix infinite loop case
    
    This fixes a case with wrapping, where the text has a mixture of 'none'
    and 'word' wrapping modes, and the layout function decides to
    roll-back a few items.
    The test case is added to the evas_suite.
    This might not be a common case, or even a case we had defined a proper
    behavior to, but since it causes an infinite loop, it needs to be fixed.
    
    @fix
---
 src/lib/evas/canvas/evas_object_textblock.c | 2 +-
 src/tests/evas/evas_test_textblock.c        | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/canvas/evas_object_textblock.c 
b/src/lib/evas/canvas/evas_object_textblock.c
index 2352281..1325924 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -4904,7 +4904,7 @@ _layout_par(Ctxt *c)
                }
              /* If we want to wrap and it's worth checking for wrapping
               * (i.e there's actually text). */
-             else if ((it->format->wrap_word || it->format->wrap_char ||
+             else if (((wrap > 0) || it->format->wrap_word || 
it->format->wrap_char ||
                 it->format->wrap_mixed) && it->text_node)
                {
                   size_t line_start;
diff --git a/src/tests/evas/evas_test_textblock.c 
b/src/tests/evas/evas_test_textblock.c
index b52f35c..1c1d596 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -1911,6 +1911,13 @@ START_TEST(evas_textblock_wrapping)
 
    fail_if(w > h); /* FIXME: Not the best test, should be more strict. */
 
+   evas_object_textblock_text_markup_set(tb,
+         "<wrap=none>aaa bbbbbbbbbbb ccccc</wrap><wrap=word>dddddd</wrap>");
+   evas_object_textblock_size_native_get(tb, &nw, &nh);
+   evas_object_resize(tb, nw / 2, nh * 4);
+   evas_object_textblock_size_formatted_get(tb, &w, NULL);
+   ck_assert_int_le(w, nw);
+
    END_TB_TEST();
 }
 END_TEST

-- 


Reply via email to