summaryrefslogtreecommitdiff
path: root/src/tests/evas/evas_test_textblock.c
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2016-04-08 11:17:51 +0100
committerTom Hacohen <tom@stosb.com>2016-04-08 11:24:32 +0100
commitf4f9753c201c569b1a31f0b394d9352c80a7d9d0 (patch)
tree8a097bab49da040019d0dd52c7a9ae720a72ee23 /src/tests/evas/evas_test_textblock.c
parentf7a4a2b2a04d3135f874bc0760db90a247b8f270 (diff)
downloadefl-f4f9753c201c569b1a31f0b394d9352c80a7d9d0.tar.gz
Evas: Add API to reinit the language and use it in elementary.
Summary: evas_common_language_from_locale_* functions kept static pointers inside of its functions. Once these function was called, it was never reset. It made big problems for harfbuzz and hyphenation. Also, Elementary provides elm_language_set() API. Then we need to support it fully. @fix Test Plan: Test case for hyphenation is included in Evas test suite. Reviewers: raster, tasn, herdsman, woohyun, z-wony, Blackmole, minudf Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3864
Diffstat (limited to 'src/tests/evas/evas_test_textblock.c')
-rw-r--r--src/tests/evas/evas_test_textblock.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index 1473f99354..9120b228da 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -3911,11 +3911,31 @@ _hyphenation_width_stress(Evas_Object *tb, Evas_Textblock_Cursor *cur)
START_TEST(evas_textblock_hyphenation)
{
START_TB_TEST();
+ Evas_Coord w, fw;
+
+ const char *buf = "Automati-";
+ evas_object_textblock_text_markup_set(tb, buf);
+ evas_object_textblock_size_formatted_get(tb, &w, NULL);
+ evas_object_resize(tb, w, 100);
+
+ setlocale(LC_MESSAGES, "en_US.UTF-8");
+ /* Language should be reinitialized after calling setlocale(). */
+ evas_language_reinit();
+
+ buf = "Automatically";
+ evas_object_textblock_text_markup_set(tb, buf);
+ evas_textblock_cursor_format_prepend(cur, "<wrap=hyphenation>");
+ evas_object_textblock_size_formatted_get(tb, &fw, NULL);
+ ck_assert_int_eq(w, fw);
+
+ /* Restore locale */
+ setlocale(LC_MESSAGES, "C");
+ evas_language_reinit();
/* SHY-HYPHEN (&shy;) */
/* Note: placing &shy; in a ligature is errornuos, so for the sake
* of this test, it was removed from the "officia" word */
- const char *buf =
+ buf =
"Lorem ipsum dolor sit amet, cons&shy;ectetur adipisicing elit,"
" sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
" Ut enim ad minim veniam, quis nostrud exer&shy;citation ullamco"
@@ -3928,7 +3948,8 @@ START_TEST(evas_textblock_hyphenation)
evas_object_textblock_text_markup_set(tb, buf);
/* Dictionary + locale fallback (en_US) */
- setlocale(LC_MESSAGES, "en_US.UTF8");
+ setlocale(LC_MESSAGES, "en_US.UTF-8");
+ evas_language_reinit();
/* Mixture of Dictionary with SHY-HYPHEN */
_hyphenation_width_stress(tb, cur);