meson: add tytest.{c,h} to improve testing with ENABLE_TEST_UI
This commit is contained in:
parent
00bb99f3f0
commit
3be01d8b8b
|
@ -38,6 +38,7 @@ terminology_sources = ['private.h',
|
||||||
'extns.c', 'extns.h',
|
'extns.c', 'extns.h',
|
||||||
'gravatar.c', 'gravatar.h',
|
'gravatar.c', 'gravatar.h',
|
||||||
'tty_keys.h',
|
'tty_keys.h',
|
||||||
|
'tytest.c', 'tytest.h',
|
||||||
'sb.c', 'sb.h']
|
'sb.c', 'sb.h']
|
||||||
|
|
||||||
tybg_sources = ['tycommon.c', 'tycommon.h', 'tybg.c']
|
tybg_sources = ['tycommon.c', 'tycommon.h', 'tybg.c']
|
||||||
|
|
|
@ -2009,7 +2009,11 @@ _mouse_selection_scroll(void *data)
|
||||||
if (!sd->pty->selection.makesel)
|
if (!sd->pty->selection.makesel)
|
||||||
return EINA_FALSE;
|
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);
|
evas_pointer_canvas_xy_get(evas_object_evas_get(sd->self), NULL, &my);
|
||||||
|
#endif
|
||||||
termio_object_geometry_get(sd, NULL, &oy, NULL, NULL);
|
termio_object_geometry_get(sd, NULL, &oy, NULL, NULL);
|
||||||
fcy = (my - oy) / (float)sd->font.chh;
|
fcy = (my - oy) / (float)sd->font.chh;
|
||||||
cy = fcy;
|
cy = fcy;
|
||||||
|
|
|
@ -122,7 +122,7 @@ _handle_mouse_down(Termpty *ty,
|
||||||
_tytest_arg_get(buf, &value);
|
_tytest_arg_get(buf, &value);
|
||||||
ev.flags = 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);
|
test_set_mouse_pointer(ev.canvas.x, ev.canvas.y);
|
||||||
#endif
|
#endif
|
||||||
termio_internal_mouse_down(sd, &ev, modifiers);
|
termio_internal_mouse_down(sd, &ev, modifiers);
|
||||||
|
@ -159,7 +159,7 @@ _handle_mouse_up(Termpty *ty,
|
||||||
_tytest_arg_get(buf, &value);
|
_tytest_arg_get(buf, &value);
|
||||||
ev.flags = 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);
|
test_set_mouse_pointer(ev.canvas.x, ev.canvas.y);
|
||||||
#endif
|
#endif
|
||||||
termio_internal_mouse_up(sd, &ev, modifiers);
|
termio_internal_mouse_up(sd, &ev, modifiers);
|
||||||
|
@ -188,7 +188,7 @@ _handle_mouse_move(Termpty *ty,
|
||||||
/* MODIFIERS */
|
/* MODIFIERS */
|
||||||
_tytest_modifiers_get(buf, &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);
|
test_set_mouse_pointer(ev.cur.canvas.x, ev.cur.canvas.y);
|
||||||
#endif
|
#endif
|
||||||
termio_internal_mouse_move(sd, &ev, modifiers);
|
termio_internal_mouse_move(sd, &ev, modifiers);
|
||||||
|
@ -226,7 +226,7 @@ _handle_mouse_wheel(Termpty *ty,
|
||||||
/* MODIFIERS */
|
/* MODIFIERS */
|
||||||
_tytest_modifiers_get(buf, &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);
|
test_set_mouse_pointer(ev.canvas.x, ev.canvas.y);
|
||||||
#endif
|
#endif
|
||||||
termio_internal_mouse_wheel(sd, &ev, modifiers);
|
termio_internal_mouse_wheel(sd, &ev, modifiers);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
|
#include "private.h"
|
||||||
|
#if defined(ENABLE_TESTS)
|
||||||
#define TYTEST 1
|
#define TYTEST 1
|
||||||
#include "tyfuzz.c"
|
#include "tyfuzz.c"
|
||||||
|
|
||||||
static const char *_cursor_shape = "undefined";
|
static const char *_cursor_shape = "undefined";
|
||||||
static Evas_Textgrid_Cell *_cells;
|
static Evas_Textgrid_Cell *_cells;
|
||||||
static int _mx;
|
|
||||||
static int _my;
|
|
||||||
|
|
||||||
typedef struct _Termpty_Tests
|
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
|
static void
|
||||||
_termpty_to_termpty_tests(Termpty *ty, Termpty_Tests *tt)
|
_termpty_to_termpty_tests(Termpty *ty, Termpty_Tests *tt)
|
||||||
{
|
{
|
||||||
|
@ -206,3 +189,25 @@ tytest_shutdown(void)
|
||||||
{
|
{
|
||||||
free(_cells);
|
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
|
||||||
|
|
|
@ -16,19 +16,20 @@ test_textgrid_palette_get(const Evas_Object *obj,
|
||||||
Evas_Textgrid_Cell *
|
Evas_Textgrid_Cell *
|
||||||
test_textgrid_cellrow_get(Evas_Object *obj, int y);
|
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
|
void
|
||||||
tytest_termio_resize(int w, int h);
|
tytest_termio_resize(int w, int h);
|
||||||
|
|
||||||
void tytest_init(void);
|
void tytest_init(void);
|
||||||
void tytest_shutdown(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
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue