Canvas text: fix non-dirty paragraph width calculation
authorDaniel Hirt <hirt.danny@gmail.com>
Tue, 29 Aug 2017 10:05:01 +0000 (13:05 +0300)
committerDaniel Hirt <hirt.danny@gmail.com>
Tue, 29 Aug 2017 14:07:15 +0000 (17:07 +0300)
Follow-up fix for 1624417d9137b87826962e431d08dc591f83d5e5.
Changed for a max comparison, rather than just assigning the line's
width.
Also, added a test case.

Fixes T5939

@fix

src/lib/evas/canvas/evas_object_textblock.c
src/tests/evas/evas_test_textblock.c

index ae0ab26..57d54bc 100644 (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;
      }
index b3c60c9..57cc36e 100644 (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. */