Canvas text: fix non-dirty paragraph width calculation

Follow-up fix for 1624417d91.
Changed for a max comparison, rather than just assigning the line's
width.
Also, added a test case.

Fixes T5939

@fix
This commit is contained in:
Daniel Hirt 2017-08-29 13:05:01 +03:00
parent 4337e77669
commit 048dcc3263
2 changed files with 12 additions and 1 deletions

View File

@ -3920,7 +3920,8 @@ loop_advance:
{
Evas_Coord new_wmax = c->ln->w +
c->marginl + c->marginr - (c->o->style_pad.l + c->o->style_pad.r);
c->par->last_fw = new_wmax;
if (new_wmax > c->par->last_fw)
c->par->last_fw = new_wmax;
if (new_wmax > c->wmax)
c->wmax = new_wmax;
}

View File

@ -3865,6 +3865,16 @@ START_TEST(evas_textblock_size)
evas_textblock_cursor_text_append(cur, "Y");
evas_object_textblock_size_formatted_get(tb, &w, &h);
ck_assert_int_eq(bw, w);
evas_object_textblock_text_markup_set(tb,
"XXXXXXXXXXXX<br>"
"X<ps>"
"YYY<br>");
evas_object_textblock_size_formatted_get(tb, &bw, &bh);
evas_textblock_cursor_paragraph_last(cur);
evas_textblock_cursor_text_append(cur, "Y");
evas_object_textblock_size_formatted_get(tb, &w, &h);
ck_assert_int_eq(bw, w);
}
/* FIXME: There is a lot more to be done. */