First start of MQTT buttons
This commit is contained in:
10
unittest/data/TestWidget-MQTT.json
Normal file
10
unittest/data/TestWidget-MQTT.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "heli_led_on",
|
||||
"x": 240,
|
||||
"y": 36,
|
||||
"w": 64,
|
||||
"h": 56,
|
||||
"label": "On",
|
||||
"type": 1,
|
||||
"mqtt": [ "/topic1 Hello", "/topic2 World" ]
|
||||
}
|
@ -5,6 +5,6 @@
|
||||
"w": 48,
|
||||
"h": 48,
|
||||
"label": "One",
|
||||
"type": 0
|
||||
"type": 0,
|
||||
"img": "/some/file.ext"
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ int assert_count=0;
|
||||
|
||||
int main() {
|
||||
test_widget();
|
||||
test_widget_mqtt();
|
||||
test_screen();
|
||||
|
||||
if (test_failures) {
|
||||
|
@ -21,6 +21,7 @@ extern int assert_count;
|
||||
|
||||
|
||||
int test_widget(void);
|
||||
int test_widget_mqtt(void);
|
||||
int test_screen(void);
|
||||
|
||||
#endif // __TEST_H
|
||||
|
@ -71,3 +71,15 @@ int test_widget() {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_widget_mqtt() {
|
||||
struct widget_t *w;
|
||||
|
||||
char *fn = "data/TestWidget-MQTT.json";
|
||||
LOG(LL_INFO, ("widget_create_from_file(%s)", fn));
|
||||
w = widget_create_from_file(fn);
|
||||
ASSERT(w, "widget_create_from_file()");
|
||||
ASSERT(w->x == 240, "'x' field is invalid");
|
||||
ASSERT(w->type == WIDGET_TYPE_MQTT_BUTTON, "'type' field is not WIDGET_TYPE_MQTT_BUTTON");
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user