diff --git a/src/bin/meson.build b/src/bin/meson.build index 2910f06c..faf75e60 100644 --- a/src/bin/meson.build +++ b/src/bin/meson.build @@ -38,6 +38,7 @@ terminology_sources = ['private.h', 'extns.c', 'extns.h', 'gravatar.c', 'gravatar.h', 'tty_keys.h', + 'tytest.c', 'tytest.h', 'sb.c', 'sb.h'] tybg_sources = ['tycommon.c', 'tycommon.h', 'tybg.c'] diff --git a/src/bin/termiointernals.c b/src/bin/termiointernals.c index af6bc5fb..83e3e125 100644 --- a/src/bin/termiointernals.c +++ b/src/bin/termiointernals.c @@ -2009,7 +2009,11 @@ _mouse_selection_scroll(void *data) if (!sd->pty->selection.makesel) return EINA_FALSE; +#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) + test_pointer_canvas_xy_get(NULL, &my); +#else evas_pointer_canvas_xy_get(evas_object_evas_get(sd->self), NULL, &my); +#endif termio_object_geometry_get(sd, NULL, &oy, NULL, NULL); fcy = (my - oy) / (float)sd->font.chh; cy = fcy; diff --git a/src/bin/termptyext.c b/src/bin/termptyext.c index 5681e7a0..5dc78f1b 100644 --- a/src/bin/termptyext.c +++ b/src/bin/termptyext.c @@ -122,7 +122,7 @@ _handle_mouse_down(Termpty *ty, _tytest_arg_get(buf, &value); ev.flags = value; -#if defined(ENABLE_TESTS) +#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) test_set_mouse_pointer(ev.canvas.x, ev.canvas.y); #endif termio_internal_mouse_down(sd, &ev, modifiers); @@ -159,7 +159,7 @@ _handle_mouse_up(Termpty *ty, _tytest_arg_get(buf, &value); ev.flags = value; -#if defined(ENABLE_TESTS) +#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) test_set_mouse_pointer(ev.canvas.x, ev.canvas.y); #endif termio_internal_mouse_up(sd, &ev, modifiers); @@ -188,7 +188,7 @@ _handle_mouse_move(Termpty *ty, /* MODIFIERS */ _tytest_modifiers_get(buf, &modifiers); -#if defined(ENABLE_TESTS) +#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) test_set_mouse_pointer(ev.cur.canvas.x, ev.cur.canvas.y); #endif termio_internal_mouse_move(sd, &ev, modifiers); @@ -226,7 +226,7 @@ _handle_mouse_wheel(Termpty *ty, /* MODIFIERS */ _tytest_modifiers_get(buf, &modifiers); -#if defined(ENABLE_TESTS) +#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) test_set_mouse_pointer(ev.canvas.x, ev.canvas.y); #endif termio_internal_mouse_wheel(sd, &ev, modifiers); diff --git a/src/bin/tytest.c b/src/bin/tytest.c index ce8a2ba8..07dcaf40 100644 --- a/src/bin/tytest.c +++ b/src/bin/tytest.c @@ -1,10 +1,10 @@ +#include "private.h" +#if defined(ENABLE_TESTS) #define TYTEST 1 #include "tyfuzz.c" static const char *_cursor_shape = "undefined"; static Evas_Textgrid_Cell *_cells; -static int _mx; -static int _my; typedef struct _Termpty_Tests { @@ -73,23 +73,6 @@ termio_set_cursor_shape(Evas_Object *obj EINA_UNUSED, } } -void -test_set_mouse_pointer(int mx, int my) -{ - _mx = mx; - _my = my; -} - -void -test_pointer_canvas_xy_get(const Evas *e EINA_UNUSED, - int *mx, int *my) -{ - if (mx) - *mx = _mx; - if (my) - *my = _my; -} - static void _termpty_to_termpty_tests(Termpty *ty, Termpty_Tests *tt) { @@ -206,3 +189,25 @@ tytest_shutdown(void) { free(_cells); } +#endif + +#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +static int _mx; +static int _my; + +void +test_set_mouse_pointer(int mx, int my) +{ + _mx = mx; + _my = my; +} + +void +test_pointer_canvas_xy_get(int *mx, int *my) +{ + if (mx) + *mx = _mx; + if (my) + *my = _my; +} +#endif diff --git a/src/bin/tytest.h b/src/bin/tytest.h index 94d1b935..d6b3ca8e 100644 --- a/src/bin/tytest.h +++ b/src/bin/tytest.h @@ -16,19 +16,20 @@ test_textgrid_palette_get(const Evas_Object *obj, Evas_Textgrid_Cell * test_textgrid_cellrow_get(Evas_Object *obj, int y); -#define evas_pointer_canvas_xy_get test_pointer_canvas_xy_get -void -test_pointer_canvas_xy_get(const Evas *e, - int *mx, - int *my); - -void test_set_mouse_pointer(int mx, int my); void tytest_termio_resize(int w, int h); void tytest_init(void); void tytest_shutdown(void); +#endif + +#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +void +test_pointer_canvas_xy_get(int *mx, + int *my); + +void test_set_mouse_pointer(int mx, int my); +#endif #endif -#endif