diff options
author | duna.oh <duna.oh@samsung.com> | 2024-07-11 17:56:17 +0900 |
---|---|---|
committer | duna.oh <duna.oh@samsung.com> | 2024-07-11 17:58:39 +0900 |
commit | 6046af61f67f10c18ddc2a82b6bcac6d51b0a215 (patch) | |
tree | 0e171ea2366735c784558b0b9a5182d594b005cf | |
parent | e82fb39480a2bf50c49f0e92f8f27e4104638ccc (diff) | |
download | efl-util-6046af61f67f10c18ddc2a82b6bcac6d51b0a215.tar.gz efl-util-6046af61f67f10c18ddc2a82b6bcac6d51b0a215.tar.bz2 efl-util-6046af61f67f10c18ddc2a82b6bcac6d51b0a215.zip |
test: add gesture_grab, edge_swipe_cb_set etc.
Change-Id: I7e41e57e8a6eb64e73f13ee5859f5597571de760
-rw-r--r-- | test/tc-efl-util.cpp | 189 |
1 files changed, 189 insertions, 0 deletions
diff --git a/test/tc-efl-util.cpp b/test/tc-efl-util.cpp index ff0d12b..82011b8 100644 --- a/test/tc-efl-util.cpp +++ b/test/tc-efl-util.cpp @@ -2022,3 +2022,192 @@ TEST_F(EFLUtil, gesture_activate_set_on_window_n3) ret = efl_util_gesture_deinitialize(h_gesture); EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); } + +TEST_F(EFLUtil, gesture_grab) +{ + int ret = EFL_UTIL_ERROR_NONE; + efl_util_gesture_h h_gesture = NULL; + efl_util_gesture_data d_edge_swipe = NULL; + + h_gesture = efl_util_gesture_initialize(); + ret = get_last_result(); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + EXPECT_NE(h_gesture, nullptr); + + d_edge_swipe = efl_util_gesture_edge_swipe_new(h_gesture, 1, EFL_UTIL_GESTURE_EDGE_TOP); + ret = get_last_result(); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + EXPECT_NE(d_edge_swipe, nullptr); + + ret = efl_util_gesture_grab(h_gesture, d_edge_swipe); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_ungrab(h_gesture, d_edge_swipe); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_edge_swipe_free(h_gesture, d_edge_swipe); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_deinitialize(h_gesture); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); +} + +static void +cb_edge_swipe_gesture(void *data, int mode, int fingers, int sx, int sy, int edge) +{ +// +} + +TEST_F(EFLUtil, gesture_edge_swipe_cb_set) +{ + int ret = EFL_UTIL_ERROR_NONE; + efl_util_gesture_h h_gesture = NULL; + efl_util_gesture_data d_edge_swipe = NULL; + int flag = 0; + + h_gesture = efl_util_gesture_initialize(); + ret = get_last_result(); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + EXPECT_NE(h_gesture, nullptr); + + d_edge_swipe = efl_util_gesture_edge_swipe_new(h_gesture, 1, EFL_UTIL_GESTURE_EDGE_TOP); + ret = get_last_result(); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + EXPECT_NE(d_edge_swipe, nullptr); + + ret = efl_util_gesture_grab(h_gesture, d_edge_swipe); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_edge_swipe_cb_set(h_gesture, cb_edge_swipe_gesture, &flag); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + // EXPECT_EQ(flag, 1); + + ret = efl_util_gesture_ungrab(h_gesture, d_edge_swipe); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_edge_swipe_free(h_gesture, d_edge_swipe); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_deinitialize(h_gesture); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); +} + +static void +cb_edge_drag_gesture(void *data, int mode, int fingers, int cx, int cy, int edge) +{ +// +} + +TEST_F(EFLUtil, gesture_edge_drag_cb_set) +{ + int ret = EFL_UTIL_ERROR_NONE; + efl_util_gesture_h h_gesture = NULL; + efl_util_gesture_data d_edge_drag = NULL; + int flag = 0; + + h_gesture = efl_util_gesture_initialize(); + ret = get_last_result(); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + EXPECT_NE(h_gesture, nullptr); + + d_edge_drag = efl_util_gesture_edge_drag_new(h_gesture, 1, EFL_UTIL_GESTURE_EDGE_TOP); + ret = get_last_result(); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + EXPECT_NE(d_edge_drag, nullptr); + + ret = efl_util_gesture_grab(h_gesture, d_edge_drag); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_edge_drag_cb_set(h_gesture, cb_edge_drag_gesture, &flag); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + // EXPECT_EQ(flag, 1); + + ret = efl_util_gesture_ungrab(h_gesture, d_edge_drag); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_edge_drag_free(h_gesture, d_edge_drag); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_deinitialize(h_gesture); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); +} + +static void +cb_tap_gesture(void *data, int mode, int fingers, int repeats) +{ +// +} + +TEST_F(EFLUtil, gesture_tap_cb_set) +{ + int ret = EFL_UTIL_ERROR_NONE; + efl_util_gesture_h h_gesture = NULL; + efl_util_gesture_data d_tap = NULL; + int flag = 0; + + h_gesture = efl_util_gesture_initialize(); + ret = get_last_result(); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + EXPECT_NE(h_gesture, nullptr); + + d_tap = efl_util_gesture_tap_new(h_gesture, 2, 2); + ret = get_last_result(); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + EXPECT_NE(d_tap, nullptr); + + ret = efl_util_gesture_grab(h_gesture, d_tap); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_tap_cb_set(h_gesture, cb_tap_gesture, &flag); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + // EXPECT_EQ(flag, 1); + + ret = efl_util_gesture_ungrab(h_gesture, d_tap); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_tap_free(h_gesture, d_tap); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_deinitialize(h_gesture); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); +} + +static void +cb_palm_cover_gesture(void *data, int mode, int duration, int cx, int cy, int size, double pressure) +{ +// +} + +TEST_F(EFLUtil, gesture_palm_cover_cb_set) +{ + int ret = EFL_UTIL_ERROR_NONE; + efl_util_gesture_h h_gesture = NULL; + efl_util_gesture_data d_palm_cover = NULL; + int flag = 0; + + h_gesture = efl_util_gesture_initialize(); + ret = get_last_result(); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + EXPECT_NE(h_gesture, nullptr); + + d_palm_cover = efl_util_gesture_palm_cover_new(h_gesture); + ret = get_last_result(); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + EXPECT_NE(d_palm_cover, nullptr); + + ret = efl_util_gesture_grab(h_gesture, d_palm_cover); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_palm_cover_cb_set(h_gesture, cb_palm_cover_gesture, &flag); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + // EXPECT_EQ(flag, 1); + + ret = efl_util_gesture_ungrab(h_gesture, d_palm_cover); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_palm_cover_free(h_gesture, d_palm_cover); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); + + ret = efl_util_gesture_deinitialize(h_gesture); + EXPECT_EQ(ret, EFL_UTIL_ERROR_NONE); +} |