summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinwoo, Lee <minwoo47.lee@samsung.com>2015-11-13 12:17:37 +0000
committerTom Hacohen <tom@stosb.com>2015-11-13 12:27:59 +0000
commitc196422e634fc7dda6d0f168278305073007985f (patch)
treefc6d4e631a45d1447bd6cf3de0e8ec3dd9aa98ca
parentef14106416ff2e3f1b3229f1d5ae452c26aeb8be (diff)
evas textblock: fixed ascent/descent calculation
Summary: If textblock has linegap and multi language, ascent/descent calculation is incorrect. In _layout_format_ascent_descent_adjust(), descent is accumulated. (for example, for a line gap of 50, the first line gap is more than 100) Test Plan: Textblock has "linegap=50" and multi language (ex. "This is a test suite for line gap - ഈ ലൈൻ വിടവ് ടെസ്റ്റ് ടെസ്റ്റ് ടെസ്റ്റ് ടെസ്റ്റ് ഒരു പരീക്ഷണ വെയര് ") Added test suite in evas_test_textblock.c file. Reviewers: tasn Subscribers: subodh6129, cedric Differential Revision: https://phab.enlightenment.org/D3311
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c3
-rw-r--r--src/tests/evas/evas_test_textblock.c21
2 files changed, 22 insertions, 2 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 05d0050d0b..4bc0e8ee46 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -2744,11 +2744,10 @@ _layout_item_ascent_descent_adjust(const Evas_Object *eo_obj,
2744 desc = ENFN->font_descent_get(ENDT, fmt->font.font); 2744 desc = ENFN->font_descent_get(ENDT, fmt->font.font);
2745 } 2745 }
2746 } 2746 }
2747 if (fmt) _layout_format_ascent_descent_adjust(eo_obj, &asc, &desc, fmt);
2747 2748
2748 if (asc > *ascent) *ascent = asc; 2749 if (asc > *ascent) *ascent = asc;
2749 if (desc > *descent) *descent = desc; 2750 if (desc > *descent) *descent = desc;
2750
2751 if (fmt) _layout_format_ascent_descent_adjust(eo_obj, ascent, descent, fmt);
2752} 2751}
2753 2752
2754/** 2753/**
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index d15465c9fb..b3017fa2b9 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -2970,6 +2970,27 @@ START_TEST(evas_textblock_formats)
2970 evas_object_textblock_text_markup_set(tb, "f<color=#f00>i</color>f"); 2970 evas_object_textblock_text_markup_set(tb, "f<color=#f00>i</color>f");
2971 evas_object_textblock_size_formatted_get(tb, NULL, NULL); 2971 evas_object_textblock_size_formatted_get(tb, NULL, NULL);
2972 2972
2973 /* Line gap and multi language */
2974 {
2975 Evas_Coord h;
2976 Evas_Textblock_Style *newst;
2977 buf = "This is a test suite for line gap - ഈ ലൈൻ "
2978 "വിടവ് ടെസ്റ്റ് ടെസ്റ്റ് ടെസ്റ്റ് ടെസ്റ്റ് ഒരു പരീക്ഷണ വെയര് ";
2979 newst = evas_textblock_style_new();
2980 fail_if(!newst);
2981 evas_textblock_style_set(newst,
2982 "DEFAULT='" TEST_FONT " font_size=10 color=#000 wrap=word linegap=50'"
2983 "br='\n'"
2984 "ps='ps'"
2985 "tab='\t'");
2986 evas_object_textblock_style_set(tb, newst);
2987 evas_object_textblock_text_markup_set(tb, buf);
2988 fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf));
2989 evas_object_resize(tb, 400, 400);
2990 evas_object_textblock_size_formatted_get(tb, NULL, &h);
2991 fail_if(h > 150);
2992 }
2993
2973 END_TB_TEST(); 2994 END_TB_TEST();
2974} 2995}
2975END_TEST 2996END_TEST