From: Daniel Hirt Date: Wed, 2 Dec 2015 12:37:58 +0000 (+0200) Subject: Evas textblock: fix height on line wrapping X-Git-Tag: upstream/1.20.0~8032 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=59e9e2ddc873dc8f0fd6fd8e1e68707d955c0401;p=platform%2Fupstream%2Fefl.git Evas textblock: fix height on line wrapping Line advance should finalize the line with its last item, and not the item we're currently wrapping. This fixes T1583, where some line wrapping cases would look different than their equivalent versions. @fix --- diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 879659c..30cfb91 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -3642,6 +3642,8 @@ loop_advance: static void _layout_line_advance(Ctxt *c, Evas_Object_Textblock_Format *fmt) { + Evas_Object_Textblock_Format *last_fmt = fmt; + if (c->hyphen_ti) { c->ln->items = (Evas_Object_Textblock_Item *) @@ -3652,7 +3654,11 @@ _layout_line_advance(Ctxt *c, Evas_Object_Textblock_Format *fmt) eina_list_append(c->o->hyphen_items, c->hyphen_ti); c->hyphen_ti = NULL; } - _layout_line_finalize(c, fmt); + if (c->ln->items) + { + last_fmt = _ITEM(EINA_INLIST_GET(c->ln->items)->last)->format; + } + _layout_line_finalize(c, last_fmt); _layout_line_new(c, fmt); } diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c index ad16793..a14f599 100644 --- a/src/tests/evas/evas_test_textblock.c +++ b/src/tests/evas/evas_test_textblock.c @@ -2162,6 +2162,15 @@ START_TEST(evas_textblock_wrapping) ck_assert_int_eq(bret, ret); } + /* Check that line wrap produces the same height values as paragraph break */ + evas_object_resize(tb, 1, 100); + evas_object_textblock_text_markup_set(tb, "hello world"); + evas_object_textblock_size_formatted_get(tb, NULL, &bh); + evas_object_textblock_text_markup_set(tb, "helloworld"); + evas_object_textblock_size_formatted_get(tb, NULL, &h); + + ck_assert_int_eq(bh, h); + END_TB_TEST(); } END_TEST