tests: store mouse pointer and fallback evas_pointer_canvas_xy_get()

terminology-1.7
Boris Faure 3 years ago
parent 0df36aefc9
commit 00bb99f3f0
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
  1. 12
      src/bin/termptyext.c
  2. 19
      src/bin/tytest.c
  3. 13
      src/bin/tytest.h

@ -122,6 +122,9 @@ _handle_mouse_down(Termpty *ty,
_tytest_arg_get(buf, &value);
ev.flags = value;
#if defined(ENABLE_TESTS)
test_set_mouse_pointer(ev.canvas.x, ev.canvas.y);
#endif
termio_internal_mouse_down(sd, &ev, modifiers);
}
@ -156,6 +159,9 @@ _handle_mouse_up(Termpty *ty,
_tytest_arg_get(buf, &value);
ev.flags = value;
#if defined(ENABLE_TESTS)
test_set_mouse_pointer(ev.canvas.x, ev.canvas.y);
#endif
termio_internal_mouse_up(sd, &ev, modifiers);
}
@ -182,6 +188,9 @@ _handle_mouse_move(Termpty *ty,
/* MODIFIERS */
_tytest_modifiers_get(buf, &modifiers);
#if defined(ENABLE_TESTS)
test_set_mouse_pointer(ev.cur.canvas.x, ev.cur.canvas.y);
#endif
termio_internal_mouse_move(sd, &ev, modifiers);
}
@ -217,6 +226,9 @@ _handle_mouse_wheel(Termpty *ty,
/* MODIFIERS */
_tytest_modifiers_get(buf, &modifiers);
#if defined(ENABLE_TESTS)
test_set_mouse_pointer(ev.canvas.x, ev.canvas.y);
#endif
termio_internal_mouse_wheel(sd, &ev, modifiers);
}

@ -3,6 +3,8 @@
static const char *_cursor_shape = "undefined";
static Evas_Textgrid_Cell *_cells;
static int _mx;
static int _my;
typedef struct _Termpty_Tests
{
@ -71,6 +73,23 @@ 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)
{

@ -2,7 +2,7 @@
#define _TYTEST_H__ 1
#if defined(ENABLE_TESTS)
#define evas_object_textgrid_palette_get test_textgrid_palette_get
#define evas_object_textgrid_palette_get test_textgrid_palette_get
void
test_textgrid_palette_get(const Evas_Object *obj,
Evas_Textgrid_Palette pal,
@ -12,9 +12,18 @@ test_textgrid_palette_get(const Evas_Object *obj,
int *b,
int *a);
#define evas_object_textgrid_cellrow_get test_textgrid_cellrow_get
#define evas_object_textgrid_cellrow_get test_textgrid_cellrow_get
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);

Loading…
Cancel
Save