tytest: add test_textgrid_cellrow_get()

to mock evas_object_textgrid_cellrow_get()
This commit is contained in:
Boris Faure 2019-02-11 22:44:16 +01:00
parent 904b3cf62e
commit 73f461e281
3 changed files with 40 additions and 1 deletions

View File

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

View File

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

View File

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