summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Alzyod <ali198724@gmail.com>2019-12-16 19:10:36 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2019-12-16 19:11:33 +0100
commit68e9bf9c14b58c682d5151f73b21f920905bd320 (patch)
tree351f1d0023bf69840d9adf3de002d70f4c622d4b
parent16efc25ceb3a7fbf4605fb808748dcdbc004e6fb (diff)
efl_canvas_textblock: allow style_apply with wrap=none
Summary: 1- passing style_apply("wrap=none") had no effect previously, and now disable wraping 2- style_all_get() by default return "wrap=word", but now return "wrap=none" refer to T8523 Reviewers: segfaultxavi, woohyun, cedric Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10888
-rw-r--r--src/lib/evas/canvas/efl_canvas_textblock.eo2
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c7
-rw-r--r--src/tests/evas/evas_test_textblock.c4
3 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_textblock.eo b/src/lib/evas/canvas/efl_canvas_textblock.eo
index 2c00967374..7c6cf8e0e6 100644
--- a/src/lib/evas/canvas/efl_canvas_textblock.eo
+++ b/src/lib/evas/canvas/efl_canvas_textblock.eo
@@ -274,7 +274,7 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text,
274 "char" - Wraps at any character 274 "char" - Wraps at any character
275 "mixed" - Wrap at words if possible, if not at any character 275 "mixed" - Wrap at words if possible, if not at any character
276 "hyphenation" - Hyphenate if possible, if not wrap at words if possible, if not at any character 276 "hyphenation" - Hyphenate if possible, if not wrap at words if possible, if not at any character
277 "" - Don't wrap 277 "none" - Don't wrap, this is the default value
278 wrap=<value or preset> 278 wrap=<value or preset>
279 279
280 Left margin 280 Left margin
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index e68f70351a..63f725f00c 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -2921,6 +2921,8 @@ _default_format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt,
2921 wrap = EFL_TEXT_FORMAT_WRAP_MIXED; 2921 wrap = EFL_TEXT_FORMAT_WRAP_MIXED;
2922 else if (!strcmp("hyphenation", param)) 2922 else if (!strcmp("hyphenation", param))
2923 wrap = EFL_TEXT_FORMAT_WRAP_HYPHENATION; 2923 wrap = EFL_TEXT_FORMAT_WRAP_HYPHENATION;
2924 else if (!strcmp("none", param))
2925 wrap = EFL_TEXT_FORMAT_WRAP_NONE;
2924 2926
2925 if (_FMT_INFO(wrap) != wrap) 2927 if (_FMT_INFO(wrap) != wrap)
2926 { 2928 {
@@ -3304,9 +3306,12 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt)
3304 case EFL_TEXT_FORMAT_WRAP_HYPHENATION: 3306 case EFL_TEXT_FORMAT_WRAP_HYPHENATION:
3305 wrap_value_str = "hyphenation"; 3307 wrap_value_str = "hyphenation";
3306 break; 3308 break;
3307 default: 3309 case EFL_TEXT_FORMAT_WRAP_WORD:
3308 wrap_value_str = "word"; 3310 wrap_value_str = "word";
3309 break; 3311 break;
3312 default:
3313 wrap_value_str = "none";
3314 break;
3310 } 3315 }
3311 3316
3312 PRINTF_APPEND_STR(wrapstr, wrap_value_str); 3317 PRINTF_APPEND_STR(wrapstr, wrap_value_str);
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index 16fd38f437..94849a57e1 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -4628,6 +4628,7 @@ EFL_START_TEST(efl_canvas_textblock_style)
4628 fail_if(!strstr(style, "font=DejaVuSans,UnDotum,malayalam")); 4628 fail_if(!strstr(style, "font=DejaVuSans,UnDotum,malayalam"));
4629 // default value 4629 // default value
4630 fail_if(!strstr(style, "font_width=normal")); 4630 fail_if(!strstr(style, "font_width=normal"));
4631 fail_if(!strstr(style, "wrap=none"));
4631 4632
4632 // from functions 4633 // from functions
4633 fail_if(!strstr(style, "font_weight=extrabold")); 4634 fail_if(!strstr(style, "font_weight=extrabold"));
@@ -4641,6 +4642,9 @@ EFL_START_TEST(efl_canvas_textblock_style)
4641 efl_canvas_textblock_style_apply(txt, "font_width=ultracondensed"); 4642 efl_canvas_textblock_style_apply(txt, "font_width=ultracondensed");
4642 ck_assert_int_eq(efl_text_font_width_get(txt), EFL_TEXT_FONT_WIDTH_ULTRACONDENSED); 4643 ck_assert_int_eq(efl_text_font_width_get(txt), EFL_TEXT_FONT_WIDTH_ULTRACONDENSED);
4643 4644
4645 efl_canvas_textblock_style_apply(txt, "wrap=word");
4646 ck_assert_int_eq(efl_text_wrap_get(txt), EFL_TEXT_FORMAT_WRAP_WORD);
4647
4644 efl_canvas_textblock_style_apply(txt, "wrap=none"); 4648 efl_canvas_textblock_style_apply(txt, "wrap=none");
4645 ck_assert_int_eq(efl_text_wrap_get(txt), EFL_TEXT_FORMAT_WRAP_NONE); 4649 ck_assert_int_eq(efl_text_wrap_get(txt), EFL_TEXT_FORMAT_WRAP_NONE);
4646 4650