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
This commit is contained in:
Ali Alzyod 2019-12-16 19:10:36 +01:00 committed by Xavi Artigas
parent 16efc25ceb
commit 68e9bf9c14
3 changed files with 11 additions and 2 deletions

View File

@ -274,7 +274,7 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text,
"char" - Wraps at any character
"mixed" - Wrap at words if possible, if not at any character
"hyphenation" - Hyphenate if possible, if not wrap at words if possible, if not at any character
"" - Don't wrap
"none" - Don't wrap, this is the default value
wrap=<value or preset>
Left margin

View File

@ -2921,6 +2921,8 @@ _default_format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt,
wrap = EFL_TEXT_FORMAT_WRAP_MIXED;
else if (!strcmp("hyphenation", param))
wrap = EFL_TEXT_FORMAT_WRAP_HYPHENATION;
else if (!strcmp("none", param))
wrap = EFL_TEXT_FORMAT_WRAP_NONE;
if (_FMT_INFO(wrap) != wrap)
{
@ -3304,9 +3306,12 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt)
case EFL_TEXT_FORMAT_WRAP_HYPHENATION:
wrap_value_str = "hyphenation";
break;
default:
case EFL_TEXT_FORMAT_WRAP_WORD:
wrap_value_str = "word";
break;
default:
wrap_value_str = "none";
break;
}
PRINTF_APPEND_STR(wrapstr, wrap_value_str);

View File

@ -4628,6 +4628,7 @@ EFL_START_TEST(efl_canvas_textblock_style)
fail_if(!strstr(style, "font=DejaVuSans,UnDotum,malayalam"));
// default value
fail_if(!strstr(style, "font_width=normal"));
fail_if(!strstr(style, "wrap=none"));
// from functions
fail_if(!strstr(style, "font_weight=extrabold"));
@ -4641,6 +4642,9 @@ EFL_START_TEST(efl_canvas_textblock_style)
efl_canvas_textblock_style_apply(txt, "font_width=ultracondensed");
ck_assert_int_eq(efl_text_font_width_get(txt), EFL_TEXT_FONT_WIDTH_ULTRACONDENSED);
efl_canvas_textblock_style_apply(txt, "wrap=word");
ck_assert_int_eq(efl_text_wrap_get(txt), EFL_TEXT_FORMAT_WRAP_WORD);
efl_canvas_textblock_style_apply(txt, "wrap=none");
ck_assert_int_eq(efl_text_wrap_get(txt), EFL_TEXT_FORMAT_WRAP_NONE);