unit test 'img' and 'label' fields in widget

This commit is contained in:
Pim van Pelt
2017-11-26 18:38:59 +01:00
parent c6f5fc3b8f
commit a11336703e
2 changed files with 6 additions and 0 deletions

View File

@ -5,6 +5,7 @@ extern int _mgos_timers;
static int test_widget_create_from_file(void) {
struct widget_t *w;
int ret;
char *fn = "data/TestWidget.json";
LOG(LL_INFO, ("widget_create_from_file(%s)", fn));
@ -14,6 +15,10 @@ static int test_widget_create_from_file(void) {
ASSERT(w->y == 16, "'x' field is invalid");
ASSERT(w->w == 48, "'x' field is invalid");
ASSERT(w->h == 48, "'x' field is invalid");
ret = strncmp("/some/file.ext", w->img, strlen("/some/file.ext"));
ASSERT(ret == 0, "'img' field is invalid");
ret = strncmp("One", w->label, strlen("One"));
ASSERT(ret == 0, "'label' field is invalid");
LOG(LL_INFO, ("widget_set_timer()"));
widget_set_timer(w, 1000);