woohyun pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=64d160da0a2479abd250d404bda775bc4fb680ba

commit 64d160da0a2479abd250d404bda775bc4fb680ba
Author: ali <[email protected]>
Date:   Mon Dec 30 13:27:13 2019 +0900

    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
---
 src/lib/efl/interfaces/efl_text_style.eo    |  3 +--
 src/lib/evas/canvas/evas_object_textblock.c | 20 +++++++++++++-------
 src/tests/evas/evas_test_textblock.c        | 18 ++++++++++++++++++
 3 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/src/lib/efl/interfaces/efl_text_style.eo 
b/src/lib/efl/interfaces/efl_text_style.eo
index 7ecd7afeb4..8807e047ac 100644
--- a/src/lib/efl/interfaces/efl_text_style.eo
+++ b/src/lib/efl/interfaces/efl_text_style.eo
@@ -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.]]
diff --git a/src/lib/evas/canvas/evas_object_textblock.c 
b/src/lib/evas/canvas/evas_object_textblock.c
index 48857a5a32..2347961759 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -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
diff --git a/src/tests/evas/evas_test_textblock.c 
b/src/tests/evas/evas_test_textblock.c
index 6ade455ddc..ef830e8507 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -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);
 }
 

-- 


Reply via email to