Add a simple unit test for widget_add_from_file()
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
#include "test.h"
|
||||
#include "widget.h"
|
||||
|
||||
int test_widget() {
|
||||
/*
|
||||
char *json;
|
||||
void *h = NULL;
|
||||
struct json_token key, val;
|
||||
@ -25,4 +26,26 @@ int test_widget() {
|
||||
exit:
|
||||
free(json);
|
||||
return 0;
|
||||
*/
|
||||
|
||||
static int test_widget_add_from_file(void) {
|
||||
struct widget_t *w;
|
||||
const char *fn = "data/TestWidget.json";
|
||||
|
||||
w = widget_add_from_file(fn, 0, NULL, NULL);
|
||||
if (!w) {
|
||||
LOG(LL_ERROR, ("Could not add %s", fn));
|
||||
return -1;
|
||||
}
|
||||
if (16 != w->x || 48 != w->w || 16 != w->y || 48 != w->h) {
|
||||
LOG(LL_ERROR, ("widget x, y, w, h incorrect"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_widget() {
|
||||
test_widget_add_from_file();
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user