unit test 'img' and 'label' fields in widget
This commit is contained in:
@ -6,4 +6,5 @@
|
|||||||
"h": 48,
|
"h": 48,
|
||||||
"label": "One",
|
"label": "One",
|
||||||
"type": 0
|
"type": 0
|
||||||
|
"img": "/some/file.ext"
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ extern int _mgos_timers;
|
|||||||
|
|
||||||
static int test_widget_create_from_file(void) {
|
static int test_widget_create_from_file(void) {
|
||||||
struct widget_t *w;
|
struct widget_t *w;
|
||||||
|
int ret;
|
||||||
|
|
||||||
char *fn = "data/TestWidget.json";
|
char *fn = "data/TestWidget.json";
|
||||||
LOG(LL_INFO, ("widget_create_from_file(%s)", fn));
|
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->y == 16, "'x' field is invalid");
|
||||||
ASSERT(w->w == 48, "'x' field is invalid");
|
ASSERT(w->w == 48, "'x' field is invalid");
|
||||||
ASSERT(w->h == 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()"));
|
LOG(LL_INFO, ("widget_set_timer()"));
|
||||||
widget_set_timer(w, 1000);
|
widget_set_timer(w, 1000);
|
||||||
|
Reference in New Issue
Block a user