meson: add tytest.{c,h} to improve testing with ENABLE_TEST_UI

terminology-1.7
Boris Faure 3 years ago
parent 00bb99f3f0
commit 3be01d8b8b
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
  1. 1
      src/bin/meson.build
  2. 4
      src/bin/termiointernals.c
  3. 8
      src/bin/termptyext.c
  4. 43
      src/bin/tytest.c
  5. 15
      src/bin/tytest.h

@ -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']

@ -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;

@ -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);

@ -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

@ -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

Loading…
Cancel
Save