1 #if LV_BUILD_TEST
2 #include "../lvgl.h"
3 
4 #include "unity/unity.h"
5 
setUp(void)6 void setUp(void)
7 {
8     /* Function run before every test */
9 }
10 
tearDown(void)11 void tearDown(void)
12 {
13     /* Function run after every test */
14     lv_obj_clean(lv_screen_active());
15 }
16 
test_xml_table_with_attrs(void)17 void test_xml_table_with_attrs(void)
18 {
19     lv_obj_t * scr = lv_screen_active();
20 
21     const char * table_attrs[] = {
22         "width", "content",
23         "style_border_side:items", "full",
24         NULL, NULL,
25     };
26 
27     lv_obj_t * table = lv_xml_create(scr, "lv_table", table_attrs);
28     lv_obj_center(table);
29 
30     const char * column_1_attrs[] = {
31         "column", "0",
32         "width", "80",
33         NULL, NULL,
34     };
35     lv_xml_create(table, "lv_table-column", column_1_attrs);
36 
37     const char * cell_1_2_attrs[] = {
38         "row", "1",
39         "column", "2",
40         "value", "A",
41         NULL, NULL,
42     };
43     lv_xml_create(table, "lv_table-cell", cell_1_2_attrs);
44 
45 
46     const char * cell_2_0_attrs[] = {
47         "row", "2",
48         "column", "0",
49         "value", "hello this a long text which should be cropped",
50         "ctrl", "text_crop merge_right",
51         NULL, NULL,
52     };
53 
54     lv_xml_create(table, "lv_table-cell", cell_2_0_attrs);
55 
56     const char * cell_3_0_attrs[] = {
57         "row", "3",
58         "column", "0",
59         "value", "wrap this text",
60         NULL, NULL,
61     };
62 
63     lv_xml_create(table, "lv_table-cell", cell_3_0_attrs);
64 
65 
66     TEST_ASSERT_EQUAL_SCREENSHOT("xml/lv_table.png");
67 }
68 
69 #endif
70