Efl.Text.Cursor: Fix line_jump_by return logic
authora.srour <a.srour@samsung.com>
Tue, 24 Dec 2019 07:34:14 +0000 (16:34 +0900)
committerJongmin Lee <jm105.lee@samsung.com>
Wed, 25 Dec 2019 21:12:14 +0000 (06:12 +0900)
Summary:
From documentation `line_jump_by` should return `EINA_TRUE` if cursor moved, and `EINA_FALSE` if not moved.
But the current behaviour is reversed, so this should fix it.

Reviewers: ali.alzyod, segfaultxavi, woohyun

Subscribers: AbdullehGhujeh, #committers, cedric, #reviewers

Tags: #efl

Maniphest Tasks: T8454

Differential Revision: https://phab.enlightenment.org/D10946

src/lib/evas/canvas/efl_text_cursor.c
src/tests/evas/evas_test_textblock.c

index 9a8a477..54c9ad5 100644 (file)
@@ -203,7 +203,7 @@ _efl_text_cursor_line_jump_by(Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, int
    Eina_Bool moved = EINA_FALSE;
    int pos = evas_textblock_cursor_pos_get(pd->handle);
    evas_textblock_cursor_line_jump_by(pd->handle, by);
-   moved = (pos == evas_textblock_cursor_pos_get(pd->handle));
+   moved = (pos != evas_textblock_cursor_pos_get(pd->handle));
    return moved;
 }
 
index 56310f9..43be1fc 100644 (file)
@@ -4488,12 +4488,12 @@ EFL_START_TEST(efl_canvas_textblock_cursor)
    efl_event_callback_add(txt, EFL_CANVAS_TEXTBLOCK_EVENT_CHANGED, _increment_int_changed, &changed_emit);
    const char *buf = "abcdefghij";
    efl_text_set(txt, buf);
-   fail_if(strcmp(efl_text_get(txt), buf));
+   ck_assert_int_eq(strcmp(efl_text_get(txt), buf), 0);
 
-   efl_text_cursor_line_jump_by(cur_obj, -1);
+   ck_assert(!efl_text_cursor_line_jump_by(cur_obj, -1));
    pos = efl_text_cursor_position_get(cur_obj);
    ck_assert_int_eq(pos, 0);
-   efl_text_cursor_line_jump_by(cur_obj, 1);
+   ck_assert(efl_text_cursor_line_jump_by(cur_obj, 1));
    pos = efl_text_cursor_position_get(cur_obj);
    ck_assert_int_eq(pos, 10);