summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Alzyod <ali198724@gmail.com>2019-12-24 17:17:31 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2019-12-24 17:17:31 +0900
commit79d95a289ad571d666c93c9f47f8557621175fe9 (patch)
tree931699c60024df082ce1034c1e714847f8dd8d7d
parentce28963654c953404ba6d03cbc365bdf46323555 (diff)
efl_text_cursor: assign source textobject to destination on cursor_copy
Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8454 Differential Revision: https://phab.enlightenment.org/D10951
-rw-r--r--src/lib/evas/canvas/efl_text_cursor.c6
-rw-r--r--src/tests/evas/evas_test_textblock.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/evas/canvas/efl_text_cursor.c b/src/lib/evas/canvas/efl_text_cursor.c
index 54c9ad5f85..b52298c1c0 100644
--- a/src/lib/evas/canvas/efl_text_cursor.c
+++ b/src/lib/evas/canvas/efl_text_cursor.c
@@ -105,10 +105,13 @@ _efl_text_cursor_compare(const Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, co
105EOLIAN static void 105EOLIAN static void
106_efl_text_cursor_copy(const Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, Efl_Text_Cursor *dst) 106_efl_text_cursor_copy(const Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, Efl_Text_Cursor *dst)
107{ 107{
108 Efl_Text_Cursor_Data *pd_dest = efl_data_scope_safe_get(dst, MY_CLASS);
109 EINA_SAFETY_ON_NULL_RETURN(pd_dest);
108 if (!pd->handle) return; 110 if (!pd->handle) return;
109 111
110 Efl_Text_Cursor_Handle *handle = evas_object_textblock_cursor_new(pd->handle->obj); 112 Efl_Text_Cursor_Handle *handle = evas_object_textblock_cursor_new(pd->handle->obj);
111 evas_textblock_cursor_copy(pd->handle, handle); 113 evas_textblock_cursor_copy(pd->handle, handle);
114 pd_dest->text_obj = pd->text_obj;
112 efl_text_cursor_handle_set(dst, handle); 115 efl_text_cursor_handle_set(dst, handle);
113 evas_textblock_cursor_unref(handle, NULL); 116 evas_textblock_cursor_unref(handle, NULL);
114} 117}
@@ -432,7 +435,8 @@ efl_text_cursor_handle_get(const Eo *obj)
432 435
433void efl_text_cursor_text_object_set(Eo *cursor, Eo *canvas_text_obj, Eo *text_obj) 436void efl_text_cursor_text_object_set(Eo *cursor, Eo *canvas_text_obj, Eo *text_obj)
434{ 437{
435 Efl_Text_Cursor_Data *pd = efl_data_scope_get(cursor, MY_CLASS); 438 Efl_Text_Cursor_Data *pd = efl_data_scope_safe_get(cursor, MY_CLASS);
439 EINA_SAFETY_ON_NULL_RETURN(pd);
436 Efl_Text_Cursor_Handle *handle = NULL; 440 Efl_Text_Cursor_Handle *handle = NULL;
437 if (efl_isa(canvas_text_obj, EFL_CANVAS_TEXTBLOCK_CLASS)) 441 if (efl_isa(canvas_text_obj, EFL_CANVAS_TEXTBLOCK_CLASS))
438 { 442 {
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index 43be1fcd53..f4806cb459 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -4516,6 +4516,12 @@ EFL_START_TEST(efl_canvas_textblock_cursor)
4516 4516
4517 ck_assert_int_eq(changed_emit, 3); 4517 ck_assert_int_eq(changed_emit, 3);
4518 4518
4519 Eo *cursor_temp = efl_add(EFL_TEXT_CURSOR_CLASS, txt);
4520 efl_text_cursor_copy(cursor1 ,cursor_temp);
4521 ck_assert_ptr_eq(
4522 efl_text_cursor_text_object_get(cursor1),
4523 efl_text_cursor_text_object_get(cursor_temp));
4524
4519 END_EFL_CANVAS_TEXTBLOCK_TEST(); 4525 END_EFL_CANVAS_TEXTBLOCK_TEST();
4520} 4526}
4521EFL_END_TEST 4527EFL_END_TEST