From ce28963654c953404ba6d03cbc365bdf46323555 Mon Sep 17 00:00:00 2001 From: "a.srour" Date: Tue, 24 Dec 2019 16:34:14 +0900 Subject: [PATCH] Efl.Text.Cursor: Fix line_jump_by return logic 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 | 2 +- src/tests/evas/evas_test_textblock.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/evas/canvas/efl_text_cursor.c b/src/lib/evas/canvas/efl_text_cursor.c index 9a8a4777a8..54c9ad5f85 100644 --- a/src/lib/evas/canvas/efl_text_cursor.c +++ b/src/lib/evas/canvas/efl_text_cursor.c @@ -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; } diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c index 56310f9f70..43be1fcd53 100644 --- a/src/tests/evas/evas_test_textblock.c +++ b/src/tests/evas/evas_test_textblock.c @@ -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);