efl.text.style: underline enum rename + underline method fix

Summary: underline methods was not working + fix enums names

Reviewers: woohyun, segfaultxavi, bu5hm4n, zmike

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7945

Differential Revision: https://phab.enlightenment.org/D10975
This commit is contained in:
Ali Alzyod 2019-12-30 13:27:13 +09:00 committed by WooHyun Jung
parent 7b105b33bb
commit 64d160da0a
3 changed files with 32 additions and 9 deletions

View File

@ -50,8 +50,7 @@ enum @beta Efl.Text_Style_Shadow_Direction
enum @beta Efl.Text_Style_Underline_Type
{
[[Type of underline of the displayed text.]]
off = 0, [[Text without underline.]]
on, [[Underline enabled.]]
none = 0, [[Text without underline.]]
single, [[Underlined with a single line.]]
double, [[Underlined with a double line.]]
dashed, [[Underlined with a dashed line.]]

View File

@ -16412,19 +16412,25 @@ static struct
};
static void
_efl_canvas_textblock_efl_text_style_text_underline_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, Efl_Text_Style_Underline_Type type EINA_UNUSED)
_efl_canvas_textblock_efl_text_style_text_underline_type_set(Eo *obj, Efl_Canvas_Textblock_Data *o, Efl_Text_Style_Underline_Type type)
{
ASYNC_BLOCK;
_FMT_SET(underline, _style_underline_map[type].underline_single);
_FMT_SET(underline2, _style_underline_map[type].underline_double);
_FMT_SET(underline_dash, _style_underline_map[type].underline_dashed);
if (efl_text_underline_type_get(obj) == type)
return;
ASYNC_BLOCK;
_FMT(underline) = _style_underline_map[type].underline_single;
_FMT(underline2) = _style_underline_map[type].underline_double;
_FMT(underline_dash) = _style_underline_map[type].underline_dashed;
_canvas_text_format_changed(obj, o);
}
static Efl_Text_Style_Underline_Type
_efl_canvas_textblock_efl_text_style_text_underline_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED)
_efl_canvas_textblock_efl_text_style_text_underline_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o)
{
return _FMT(underline);
if(_FMT(underline_dash)) return EFL_TEXT_STYLE_UNDERLINE_TYPE_DASHED;
else if (_FMT(underline2)) return EFL_TEXT_STYLE_UNDERLINE_TYPE_DOUBLE;
else if (_FMT(underline)) return EFL_TEXT_STYLE_UNDERLINE_TYPE_SINGLE;
else return EFL_TEXT_STYLE_UNDERLINE_TYPE_NONE;
}
static void

View File

@ -4936,6 +4936,23 @@ EFL_START_TEST(efl_canvas_textblock_style)
}
EFL_END_TEST
EFL_START_TEST(efl_text_style)
{
START_EFL_CANVAS_TEXTBLOCK_TEST();
efl_text_underline_type_set(txt, EFL_TEXT_STYLE_UNDERLINE_TYPE_NONE);
ck_assert_int_eq(efl_text_underline_type_get(txt), EFL_TEXT_STYLE_UNDERLINE_TYPE_NONE);
efl_text_underline_type_set(txt, EFL_TEXT_STYLE_UNDERLINE_TYPE_SINGLE);
ck_assert_int_eq(efl_text_underline_type_get(txt), EFL_TEXT_STYLE_UNDERLINE_TYPE_SINGLE);
efl_text_underline_type_set(txt, EFL_TEXT_STYLE_UNDERLINE_TYPE_DOUBLE);
ck_assert_int_eq(efl_text_underline_type_get(txt), EFL_TEXT_STYLE_UNDERLINE_TYPE_DOUBLE);
efl_text_underline_type_set(txt, EFL_TEXT_STYLE_UNDERLINE_TYPE_DASHED);
ck_assert_int_eq(efl_text_underline_type_get(txt), EFL_TEXT_STYLE_UNDERLINE_TYPE_DASHED);
END_EFL_CANVAS_TEXTBLOCK_TEST();
}
EFL_END_TEST
void evas_test_textblock(TCase *tc)
{
tcase_add_test(tc, evas_textblock_simple);
@ -4972,5 +4989,6 @@ void evas_test_textblock(TCase *tc)
tcase_add_test(tc, efl_canvas_textblock_markup_invalid_escape);
tcase_add_test(tc, efl_text_font);
tcase_add_test(tc, efl_canvas_textblock_style);
tcase_add_test(tc, efl_text_style);
}