tytest: add test_textgrid_cellrow_get()

to mock evas_object_textgrid_cellrow_get()
terminology-1.4
Boris Faure 4 years ago
parent 904b3cf62e
commit 73f461e281
  1. 9
      src/bin/tyfuzz.c
  2. 24
      src/bin/tytest.c
  3. 8
      src/bin/tytest.h

@ -262,6 +262,11 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
eina_init();
#ifdef TYTEST
tytest_init();
#endif
_log_domain = eina_log_domain_register(
#ifdef TYTEST
"tytest",
@ -348,6 +353,10 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
_termpty_shutdown(&_ty);
#ifdef TYTEST
tytest_shutdown();
#endif
eina_shutdown();
free(_config);

@ -1,7 +1,8 @@
#define TYTEST 1
#include "tyfuzz.c"
const char *_cursor_shape = "undefined";
static const char *_cursor_shape = "undefined";
static Evas_Textgrid_Cell *_cells;
typedef struct _Termpty_Tests
{
@ -151,3 +152,24 @@ _tytest_checksum(Termpty *ty)
md5out[2 * MD5_HASHBYTES] = '\0';
printf("%s", md5out);
}
Evas_Textgrid_Cell *
test_textgrid_cellrow_get(Evas_Object *obj EINA_UNUSED, int y)
{
assert (y >= 0 && y < TY_H);
return &_cells[y * TY_W];
}
void
tytest_init(void)
{
_cells = calloc(TY_H * TY_W, sizeof(Evas_Textgrid_Cell));
assert(_cells != NULL);
}
void
tytest_shutdown(void)
{
free(_cells);
}

@ -11,5 +11,13 @@ test_textgrid_palette_get(const Evas_Object *obj,
int *g,
int *b,
int *a);
#define evas_object_textgrid_cellrow_get test_textgrid_cellrow_get
Evas_Textgrid_Cell *
test_textgrid_cellrow_get(Evas_Object *obj, int y);
void tytest_init(void);
void tytest_shutdown(void);
#endif
#endif

Loading…
Cancel
Save