Evas textblock: Add a test for multiline ellipsis.
authorTom Hacohen <tom@stosb.com>
Wed, 20 Aug 2014 14:46:22 +0000 (15:46 +0100)
committerTom Hacohen <tom@stosb.com>
Wed, 20 Aug 2014 15:19:44 +0000 (16:19 +0100)
This tests that even with multiline ellipsis, the ellipsis in the second
line is not overdone (i.e it only does ellipsis as needed).

This is a test for something we found out when we applied D1311 (for T1213).

src/tests/evas/evas_test_textblock.c

index e7d8cc9..c740be2 100644 (file)
@@ -1752,6 +1752,10 @@ START_TEST(evas_textblock_wrapping)
 
 
    /* Ellipsis */
+   int ellip_w = 0;
+   evas_object_textblock_text_markup_set(tb, "…");
+   evas_object_textblock_size_native_get(tb, &ellip_w, NULL);
+
    evas_object_textblock_text_markup_set(tb, "aaaaaaaaaaaaaaaaaa<br/>b");
    evas_textblock_cursor_format_prepend(cur, "+ ellipsis=1.0 wrap=word");
    evas_object_textblock_size_native_get(tb, &nw, &nh);
@@ -1801,6 +1805,19 @@ START_TEST(evas_textblock_wrapping)
         }
    }
 
+   evas_object_textblock_text_markup_set(tb, "aaaaaaaaaaaaaaaaaa");
+   evas_object_textblock_size_native_get(tb, &nw, &nh);
+
+   evas_textblock_cursor_format_prepend(cur, "+ ellipsis=1.0 wrap=char");
+   nw /= 3;
+   nh *= 2;
+   evas_object_resize(tb, nw, nh);
+
+     {
+        evas_object_textblock_line_number_geometry_get(tb, 1, NULL, NULL, &w, NULL);
+        ck_assert_int_gt(w, ellip_w);
+     }
+
    /* Word wrap ending with whites. */
    evas_object_resize(tb, 322, 400);
    evas_object_textblock_text_markup_set(tb, "<wrap=word>This is an example text that should break at the end aaa     ");