forked from enlightenment/efl
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:
parent
16efc25ceb
commit
68e9bf9c14
|
@ -274,7 +274,7 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text,
|
||||||
"char" - Wraps at any character
|
"char" - Wraps at any character
|
||||||
"mixed" - Wrap at words if possible, if not 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
|
"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>
|
wrap=<value or preset>
|
||||||
|
|
||||||
Left margin
|
Left margin
|
||||||
|
|
|
@ -2921,6 +2921,8 @@ _default_format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt,
|
||||||
wrap = EFL_TEXT_FORMAT_WRAP_MIXED;
|
wrap = EFL_TEXT_FORMAT_WRAP_MIXED;
|
||||||
else if (!strcmp("hyphenation", param))
|
else if (!strcmp("hyphenation", param))
|
||||||
wrap = EFL_TEXT_FORMAT_WRAP_HYPHENATION;
|
wrap = EFL_TEXT_FORMAT_WRAP_HYPHENATION;
|
||||||
|
else if (!strcmp("none", param))
|
||||||
|
wrap = EFL_TEXT_FORMAT_WRAP_NONE;
|
||||||
|
|
||||||
if (_FMT_INFO(wrap) != wrap)
|
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:
|
case EFL_TEXT_FORMAT_WRAP_HYPHENATION:
|
||||||
wrap_value_str = "hyphenation";
|
wrap_value_str = "hyphenation";
|
||||||
break;
|
break;
|
||||||
default:
|
case EFL_TEXT_FORMAT_WRAP_WORD:
|
||||||
wrap_value_str = "word";
|
wrap_value_str = "word";
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
wrap_value_str = "none";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINTF_APPEND_STR(wrapstr, wrap_value_str);
|
PRINTF_APPEND_STR(wrapstr, wrap_value_str);
|
||||||
|
|
|
@ -4628,6 +4628,7 @@ EFL_START_TEST(efl_canvas_textblock_style)
|
||||||
fail_if(!strstr(style, "font=DejaVuSans,UnDotum,malayalam"));
|
fail_if(!strstr(style, "font=DejaVuSans,UnDotum,malayalam"));
|
||||||
// default value
|
// default value
|
||||||
fail_if(!strstr(style, "font_width=normal"));
|
fail_if(!strstr(style, "font_width=normal"));
|
||||||
|
fail_if(!strstr(style, "wrap=none"));
|
||||||
|
|
||||||
// from functions
|
// from functions
|
||||||
fail_if(!strstr(style, "font_weight=extrabold"));
|
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");
|
efl_canvas_textblock_style_apply(txt, "font_width=ultracondensed");
|
||||||
ck_assert_int_eq(efl_text_font_width_get(txt), EFL_TEXT_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");
|
efl_canvas_textblock_style_apply(txt, "wrap=none");
|
||||||
ck_assert_int_eq(efl_text_wrap_get(txt), EFL_TEXT_FORMAT_WRAP_NONE);
|
ck_assert_int_eq(efl_text_wrap_get(txt), EFL_TEXT_FORMAT_WRAP_NONE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue