aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2017-10-15 00:29:36 +0300
committerCedric BAIL <cedric@osg.samsung.com>2017-11-10 10:29:49 -0800
commit45d3614345dfd832a6332975960b75b51fb0afd1 (patch)
treec9d69f85e81c5a5bef7dfdca2a8f42ec0761b243 /src/tests
parentCanvas text: update style pad when no format nodes are present (diff)
downloadefl-45d3614345dfd832a6332975960b75b51fb0afd1.tar.gz
Canvas text: fix width calculation with style effects
There are multiple places in the code where both the padded item's width and the maximum style padding (at the edges) are accounted for. For the sake of making calculations for wrapping/ellipsis we should only use the maximum style padding. Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/evas/evas_test_textblock.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index 24f0d27135..e77b066a93 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -3559,6 +3559,7 @@ START_TEST(evas_textblock_style)
{
Evas_Coord w, h, nw, nh;
Evas_Coord l, r, t, b;
+ Evas_Coord bw;
START_TB_TEST();
Evas_Textblock_Style *newst;
const char *buf = "Test<ps/>Test2<ps/>נסיון";
@@ -3683,6 +3684,24 @@ START_TEST(evas_textblock_style)
evas_object_textblock_size_formatted_get(tb, &nw, &nh);
ck_assert_int_eq(w, nw);
ck_assert_int_eq(h, nh);
+
+ // Ellipsis style padding
+ // Should be consistent if style_pad is added
+ evas_object_textblock_text_markup_set(tb, "hello");
+ evas_object_textblock_size_native_get(tb, &w, &h);
+ evas_object_resize(tb, w - 1, 200);
+ evas_object_textblock_text_markup_set(tb,
+ "<ellipsis=1.0>hello");
+ evas_object_textblock_size_formatted_get(tb, &bw, NULL);
+ evas_object_textblock_text_markup_set(tb,
+ "<ellipsis=1.0 style=glow>hello</style>");
+ evas_object_textblock_style_insets_get(tb, &l, &r, NULL, NULL);
+ // Add padding to compensate for the style
+ evas_object_resize(tb, w - 1 + l + r, 200);
+ evas_object_textblock_size_formatted_get(tb, &nw, &nh);
+ ck_assert_int_eq(nw, bw);
+
+
END_TB_TEST();
}
END_TEST