blob: 6eb02a97eaf543909fe1afccac2fb27b2a5cfe87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#if LV_BUILD_TEST
#include "../lvgl.h"
#include "unity/unity.h"
void test_obj_id_should_match_class_name(void)
{
char buf[128];
lv_obj_t * obj = lv_obj_create(NULL);
lv_obj_stringify_id(obj, buf, sizeof(buf));
TEST_ASSERT_TRUE(strncmp("obj", buf, strlen("obj")) == 0);
lv_obj_t * img = lv_image_create(NULL);
lv_obj_stringify_id(img, buf, sizeof(buf));
TEST_ASSERT_TRUE(strncmp("image", buf, strlen("image")) == 0);
}
void test_obj_id_should_grow_by_one(void)
{
uint32_t id1, id2;
lv_obj_t * obj1 = lv_label_create(NULL);
id1 = (lv_uintptr_t)obj1->id;
lv_obj_t * obj2 = lv_label_create(NULL);
id2 = (lv_uintptr_t)obj2->id;
TEST_ASSERT_EQUAL(id1 + 1, id2);
}
#endif
|