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
This commit is contained in:
Daniel Hirt 2015-06-28 15:02:28 +03:00
parent e14c002aed
commit 0de8ebbb3a
2 changed files with 8 additions and 1 deletions

View File

@ -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;

View File

@ -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