summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Alzyod <ali198724@gmail.com>2020-01-07 08:32:19 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-01-13 11:33:14 +0100
commitd6649ad80a70a8d9e9d73c0cdd48ef4a459072a1 (patch)
tree7007cb081b9e2efab639b1e181fbceaf11ccc6ec
parent3249b53d1cc9f9e82f33e84151d9b6775ad9c184 (diff)
evas_textblock: emit change event on markup_set
Markup_set will emit change events, if user set empty string. This Change is related to D10985, where markup_prepend will not emit events if empty string was added Reviewed-by: Al Poole <netstar@gmail.com> Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11020
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c9
-rw-r--r--src/tests/evas/evas_test_textblock.c26
2 files changed, 35 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index f4d6cfb88f..9010558887 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -8503,6 +8503,15 @@ _evas_object_textblock_text_markup_set(Eo *eo_obj, Efl_Canvas_Textblock_Data *o,
8503 evas_textblock_cursor_paragraph_first(o->cursor); 8503 evas_textblock_cursor_paragraph_first(o->cursor);
8504 8504
8505 evas_object_textblock_text_markup_prepend(o->cursor, text); 8505 evas_object_textblock_text_markup_prepend(o->cursor, text);
8506
8507 /*If there was no text markup_prepend will not call change function
8508 So we will call it inside markup_set*/
8509 if (!text || !*text)
8510 {
8511 efl_event_callback_call(eo_obj, EFL_CANVAS_TEXTBLOCK_EVENT_CHANGED, NULL);
8512 _evas_textblock_changed(o, eo_obj);
8513 }
8514
8506 efl_event_freeze(eo_obj); 8515 efl_event_freeze(eo_obj);
8507 /* Point all the cursors to the starrt */ 8516 /* Point all the cursors to the starrt */
8508 { 8517 {
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index b51f149174..8560e36e7c 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -4942,6 +4942,31 @@ EFL_START_TEST(efl_text_style)
4942{ 4942{
4943 START_EFL_CANVAS_TEXTBLOCK_TEST(); 4943 START_EFL_CANVAS_TEXTBLOCK_TEST();
4944 4944
4945 int changed_emit = 0;
4946 efl_event_callback_add(txt, EFL_CANVAS_TEXTBLOCK_EVENT_CHANGED, _increment_int_changed, &changed_emit);
4947 efl_text_set(txt, "Hello");
4948 ck_assert_int_eq(changed_emit, 1);
4949 efl_text_set(txt, "");
4950 ck_assert_int_eq(changed_emit, 2);
4951 efl_text_set(txt, "");
4952 ck_assert_int_eq(changed_emit, 2);
4953
4954 changed_emit = 0;
4955 efl_text_markup_set(txt, "&quot;Hello&quot;");
4956 ck_assert_int_eq(changed_emit, 1);
4957 efl_text_markup_set(txt, "");
4958 ck_assert_int_eq(changed_emit, 2);
4959 efl_text_markup_set(txt, "");
4960 ck_assert_int_eq(changed_emit, 2);
4961
4962 END_EFL_CANVAS_TEXTBLOCK_TEST();
4963}
4964EFL_END_TEST
4965
4966EFL_START_TEST(efl_text_markup)
4967{
4968 START_EFL_CANVAS_TEXTBLOCK_TEST();
4969
4945 efl_text_underline_type_set(txt, EFL_TEXT_STYLE_UNDERLINE_TYPE_NONE); 4970 efl_text_underline_type_set(txt, EFL_TEXT_STYLE_UNDERLINE_TYPE_NONE);
4946 ck_assert_int_eq(efl_text_underline_type_get(txt), EFL_TEXT_STYLE_UNDERLINE_TYPE_NONE); 4971 ck_assert_int_eq(efl_text_underline_type_get(txt), EFL_TEXT_STYLE_UNDERLINE_TYPE_NONE);
4947 efl_text_underline_type_set(txt, EFL_TEXT_STYLE_UNDERLINE_TYPE_SINGLE); 4972 efl_text_underline_type_set(txt, EFL_TEXT_STYLE_UNDERLINE_TYPE_SINGLE);
@@ -4992,5 +5017,6 @@ void evas_test_textblock(TCase *tc)
4992 tcase_add_test(tc, efl_text_font); 5017 tcase_add_test(tc, efl_text_font);
4993 tcase_add_test(tc, efl_canvas_textblock_style); 5018 tcase_add_test(tc, efl_canvas_textblock_style);
4994 tcase_add_test(tc, efl_text_style); 5019 tcase_add_test(tc, efl_text_style);
5020 tcase_add_test(tc, efl_text_markup);
4995} 5021}
4996 5022