summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <daniel.hirt@samsung.com>2015-06-28 15:02:28 +0300
committerDaniel Hirt <daniel.hirt@samsung.com>2015-06-28 16:24:57 +0300
commit9c2a422b6437ee859f163fa8f098503b3448aa1f (patch)
tree0d6fee59027103ade267a700aba4671421bed260
parentd833722e6ee2fb2848ab28e940aac6dd2a4b2969 (diff)
downloadefl-devs/herdsman/tb_markup_loop_bug.tar.gz
Evas textblock: Fix infinite loop casedevs/herdsman/tb_markup_loop_bug
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
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c2
-rw-r--r--src/tests/evas/evas_test_textblock.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 23522812d4..132592427e 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 b52f35c8a5..1c1d5965c4 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