forked from enlightenment/efl
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
This commit is contained in:
parent
ce28963654
commit
79d95a289a
|
@ -105,10 +105,13 @@ _efl_text_cursor_compare(const Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, co
|
|||
EOLIAN static void
|
||||
_efl_text_cursor_copy(const Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, Efl_Text_Cursor *dst)
|
||||
{
|
||||
Efl_Text_Cursor_Data *pd_dest = efl_data_scope_safe_get(dst, MY_CLASS);
|
||||
EINA_SAFETY_ON_NULL_RETURN(pd_dest);
|
||||
if (!pd->handle) return;
|
||||
|
||||
Efl_Text_Cursor_Handle *handle = evas_object_textblock_cursor_new(pd->handle->obj);
|
||||
evas_textblock_cursor_copy(pd->handle, handle);
|
||||
pd_dest->text_obj = pd->text_obj;
|
||||
efl_text_cursor_handle_set(dst, handle);
|
||||
evas_textblock_cursor_unref(handle, NULL);
|
||||
}
|
||||
|
@ -432,7 +435,8 @@ efl_text_cursor_handle_get(const Eo *obj)
|
|||
|
||||
void efl_text_cursor_text_object_set(Eo *cursor, Eo *canvas_text_obj, Eo *text_obj)
|
||||
{
|
||||
Efl_Text_Cursor_Data *pd = efl_data_scope_get(cursor, MY_CLASS);
|
||||
Efl_Text_Cursor_Data *pd = efl_data_scope_safe_get(cursor, MY_CLASS);
|
||||
EINA_SAFETY_ON_NULL_RETURN(pd);
|
||||
Efl_Text_Cursor_Handle *handle = NULL;
|
||||
if (efl_isa(canvas_text_obj, EFL_CANVAS_TEXTBLOCK_CLASS))
|
||||
{
|
||||
|
|
|
@ -4516,6 +4516,12 @@ EFL_START_TEST(efl_canvas_textblock_cursor)
|
|||
|
||||
ck_assert_int_eq(changed_emit, 3);
|
||||
|
||||
Eo *cursor_temp = efl_add(EFL_TEXT_CURSOR_CLASS, txt);
|
||||
efl_text_cursor_copy(cursor1 ,cursor_temp);
|
||||
ck_assert_ptr_eq(
|
||||
efl_text_cursor_text_object_get(cursor1),
|
||||
efl_text_cursor_text_object_get(cursor_temp));
|
||||
|
||||
END_EFL_CANVAS_TEXTBLOCK_TEST();
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
|
Loading…
Reference in New Issue