1 #if LV_BUILD_TEST
2 #include "../lvgl.h"
3
4 #include "unity/unity.h"
5 #include "lv_test_indev.h"
6
setUp(void)7 void setUp(void)
8 {
9 /* Function run before every test */
10 }
11
tearDown(void)12 void tearDown(void)
13 {
14 /* Function run after every test */
15 lv_obj_clean(lv_scr_act());
16 }
test_dropdown_create_delete(void)17 void test_dropdown_create_delete(void)
18 {
19 lv_dropdown_create(lv_scr_act());
20 TEST_ASSERT_EQUAL(2, lv_obj_get_child_cnt(lv_scr_act()));
21
22 lv_obj_t * dd2 = lv_dropdown_create(lv_scr_act());
23 lv_obj_set_pos(dd2, 200, 0);
24 TEST_ASSERT_EQUAL(4, lv_obj_get_child_cnt(lv_scr_act()));
25 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd2));
26 lv_dropdown_open(dd2);
27 TEST_ASSERT_EQUAL(4, lv_obj_get_child_cnt(lv_scr_act()));
28 TEST_ASSERT_TRUE(lv_dropdown_is_open(dd2));
29 lv_dropdown_open(dd2); /*Try to open again*/
30 TEST_ASSERT_EQUAL(4, lv_obj_get_child_cnt(lv_scr_act()));
31
32 lv_obj_t * dd3 = lv_dropdown_create(lv_scr_act());
33 lv_obj_set_pos(dd3, 400, 0);
34 TEST_ASSERT_EQUAL(6, lv_obj_get_child_cnt(lv_scr_act()));
35 lv_dropdown_open(dd3);
36 TEST_ASSERT_EQUAL(6, lv_obj_get_child_cnt(lv_scr_act()));
37 lv_dropdown_close(dd3);
38 TEST_ASSERT_EQUAL(6, lv_obj_get_child_cnt(lv_scr_act()));
39 lv_dropdown_close(dd3); /*Try to close again*/
40 TEST_ASSERT_EQUAL(6, lv_obj_get_child_cnt(lv_scr_act()));
41
42 lv_obj_del(dd2);
43 TEST_ASSERT_EQUAL(4, lv_obj_get_child_cnt(lv_scr_act()));
44
45 lv_obj_clean(lv_scr_act());
46 TEST_ASSERT_EQUAL(0, lv_obj_get_child_cnt(lv_scr_act()));
47
48 }
49
test_dropdown_set_options(void)50 void test_dropdown_set_options(void)
51 {
52
53 lv_mem_monitor_t m1;
54 lv_mem_monitor(&m1);
55
56 lv_obj_t * dd1 = lv_dropdown_create(lv_scr_act());
57 TEST_ASSERT_EQUAL_STRING("Option 1\nOption 2\nOption 3", lv_dropdown_get_options(dd1));
58 TEST_ASSERT_EQUAL(3, lv_dropdown_get_option_cnt(dd1));
59
60 lv_dropdown_set_options(dd1, "a1\nb2\nc3\nd4\ne5\nf6");
61 TEST_ASSERT_EQUAL_STRING("a1\nb2\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
62 TEST_ASSERT_EQUAL(6, lv_dropdown_get_option_cnt(dd1));
63
64 lv_obj_set_width(dd1, 200);
65 lv_dropdown_open(dd1);
66 lv_obj_update_layout(dd1);
67 TEST_ASSERT_EQUAL(200, lv_obj_get_width(lv_dropdown_get_list(dd1)));
68
69 lv_dropdown_close(dd1);
70
71 lv_dropdown_add_option(dd1, "x0", 0);
72 TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
73 TEST_ASSERT_EQUAL(7, lv_dropdown_get_option_cnt(dd1));
74
75 lv_dropdown_add_option(dd1, "y0", 3);
76 TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\ny0\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
77 TEST_ASSERT_EQUAL(8, lv_dropdown_get_option_cnt(dd1));
78
79 lv_dropdown_add_option(dd1, "z0", LV_DROPDOWN_POS_LAST);
80 TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\ny0\nc3\nd4\ne5\nf6\nz0", lv_dropdown_get_options(dd1));
81 TEST_ASSERT_EQUAL(9, lv_dropdown_get_option_cnt(dd1));
82
83 lv_dropdown_clear_options(dd1);
84 TEST_ASSERT_EQUAL_STRING("", lv_dropdown_get_options(dd1));
85 TEST_ASSERT_EQUAL(0, lv_dropdown_get_option_cnt(dd1));
86
87 lv_dropdown_set_options(dd1, "o1\no2"); /*Just to add some content before lv_dropdown_set_options_static*/
88
89 lv_dropdown_set_options_static(dd1, "a1\nb2\nc3\nd4\ne5\nf6");
90 TEST_ASSERT_EQUAL_STRING("a1\nb2\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
91 TEST_ASSERT_EQUAL(6, lv_dropdown_get_option_cnt(dd1));
92
93 lv_dropdown_add_option(dd1, "x0", 0);
94 TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
95 TEST_ASSERT_EQUAL(7, lv_dropdown_get_option_cnt(dd1));
96
97 lv_dropdown_add_option(dd1, "y0", 3);
98 TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\ny0\nc3\nd4\ne5\nf6", lv_dropdown_get_options(dd1));
99 TEST_ASSERT_EQUAL(8, lv_dropdown_get_option_cnt(dd1));
100
101 lv_dropdown_add_option(dd1, "z0", LV_DROPDOWN_POS_LAST);
102 TEST_ASSERT_EQUAL_STRING("x0\na1\nb2\ny0\nc3\nd4\ne5\nf6\nz0", lv_dropdown_get_options(dd1));
103 TEST_ASSERT_EQUAL(9, lv_dropdown_get_option_cnt(dd1));
104
105 lv_dropdown_clear_options(dd1);
106 TEST_ASSERT_EQUAL_STRING("", lv_dropdown_get_options(dd1));
107 TEST_ASSERT_EQUAL(0, lv_dropdown_get_option_cnt(dd1));
108
109 lv_obj_del(dd1);
110
111 lv_mem_monitor_t m2;
112 lv_mem_monitor(&m2);
113 TEST_ASSERT_UINT32_WITHIN(48, m1.free_size, m2.free_size);
114 }
115
test_dropdown_select(void)116 void test_dropdown_select(void)
117 {
118 lv_obj_t * dd1 = lv_dropdown_create(lv_scr_act());
119 lv_dropdown_set_selected(dd1, 2);
120
121 TEST_ASSERT_EQUAL(2, lv_dropdown_get_selected(dd1));
122
123 char buf[32];
124 memset(buf, 0x00, sizeof(buf));
125 lv_dropdown_get_selected_str(dd1, buf, sizeof(buf));
126 TEST_ASSERT_EQUAL_STRING("Option 3", buf);
127
128 memset(buf, 0x00, sizeof(buf));
129 lv_dropdown_get_selected_str(dd1, buf, 4);
130 TEST_ASSERT_EQUAL_STRING("Opt", buf);
131
132 /*Out of range*/
133 lv_dropdown_set_selected(dd1, 3);
134 TEST_ASSERT_EQUAL(2, lv_dropdown_get_selected(dd1));
135 }
136
test_dropdown_click(void)137 void test_dropdown_click(void)
138 {
139 lv_obj_clean(lv_scr_act());
140 lv_obj_t * dd1 = lv_dropdown_create(lv_scr_act());
141 lv_obj_update_layout(dd1);
142
143 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
144 lv_test_mouse_click_at(dd1->coords.x1 + 5, dd1->coords.y1 + 5);
145 TEST_ASSERT_TRUE(lv_dropdown_is_open(dd1));
146
147 lv_obj_t * list = lv_dropdown_get_list(dd1);
148 TEST_ASSERT_EQUAL(0, lv_dropdown_get_selected(dd1));
149 lv_test_mouse_click_at(list->coords.x1 + 5, list->coords.y2 - 25);
150 TEST_ASSERT_EQUAL(2, lv_dropdown_get_selected(dd1));
151 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
152 }
153
154 static uint32_t event_cnt;
dd_event(lv_event_t * e)155 static void dd_event(lv_event_t * e)
156 {
157 LV_UNUSED(e);
158 event_cnt++;
159 }
160
test_dropdown_keypad(void)161 void test_dropdown_keypad(void)
162 {
163 lv_obj_clean(lv_scr_act());
164
165 lv_group_t * g = lv_group_create();
166 lv_indev_set_group(lv_test_keypad_indev, g);
167
168 lv_obj_t * dd1 = lv_dropdown_create(lv_scr_act());
169 lv_obj_set_pos(dd1, 20, 20);
170 lv_dropdown_set_options(dd1, "1\n2\n3\n4\n5\n6\n7\n8");
171 lv_group_add_obj(g, dd1);
172 lv_obj_add_event_cb(dd1, dd_event, LV_EVENT_VALUE_CHANGED, NULL);
173
174 lv_obj_t * dd2 = lv_dropdown_create(lv_scr_act());
175 lv_obj_set_pos(dd2, 300, 20);
176 lv_group_add_obj(g, dd2);
177
178 event_cnt = 0;
179
180 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
181 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd2));
182 lv_test_key_hit(LV_KEY_ENTER);
183 TEST_ASSERT_TRUE(lv_dropdown_is_open(dd1));
184 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd2));
185
186 lv_test_key_hit(LV_KEY_DOWN);
187 lv_test_key_hit(LV_KEY_RIGHT); /*Same as down*/
188 lv_test_key_hit(LV_KEY_ENTER);
189 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
190 TEST_ASSERT_EQUAL(2, lv_dropdown_get_selected(dd1));
191 TEST_ASSERT_EQUAL(1, event_cnt);
192
193 lv_test_key_hit(LV_KEY_DOWN); /*Open the list too*/
194 TEST_ASSERT_NOT_NULL(lv_dropdown_get_list(dd1));
195 lv_test_key_hit(LV_KEY_DOWN);
196 lv_test_key_hit(LV_KEY_ENTER);
197 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
198 TEST_ASSERT_EQUAL(3, lv_dropdown_get_selected(dd1));
199 TEST_ASSERT_EQUAL(2, event_cnt);
200
201 lv_test_key_hit(LV_KEY_RIGHT); /*Open the list too*/
202 TEST_ASSERT_NOT_NULL(lv_dropdown_get_list(dd1));
203 lv_test_key_hit(LV_KEY_RIGHT);
204 lv_test_key_hit(LV_KEY_ENTER);
205 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
206 TEST_ASSERT_EQUAL(4, lv_dropdown_get_selected(dd1));
207 TEST_ASSERT_EQUAL(3, event_cnt);
208
209 lv_test_key_hit(LV_KEY_LEFT); /*Open the list too*/
210 TEST_ASSERT_TRUE(lv_dropdown_is_open(dd1));
211 lv_test_key_hit(LV_KEY_LEFT);
212 lv_test_key_hit(LV_KEY_ENTER);
213 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
214 TEST_ASSERT_EQUAL(3, lv_dropdown_get_selected(dd1));
215 TEST_ASSERT_EQUAL(4, event_cnt);
216
217 lv_test_key_hit(LV_KEY_UP); /*Open the list too*/
218 TEST_ASSERT_NOT_NULL(lv_dropdown_get_list(dd1));
219 lv_test_key_hit(LV_KEY_UP);
220 lv_test_key_hit(LV_KEY_ENTER);
221 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
222 TEST_ASSERT_EQUAL(2, lv_dropdown_get_selected(dd1));
223 TEST_ASSERT_EQUAL(5, event_cnt);
224
225 lv_test_key_hit(LV_KEY_UP);
226 lv_test_key_hit(LV_KEY_UP);
227 lv_test_key_hit(LV_KEY_UP);
228 lv_test_key_hit(LV_KEY_UP);
229 lv_test_key_hit(LV_KEY_ENTER);
230 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
231 TEST_ASSERT_EQUAL(0, lv_dropdown_get_selected(dd1));
232 TEST_ASSERT_EQUAL(6, event_cnt);
233
234 lv_test_key_hit(LV_KEY_DOWN);
235 lv_test_key_hit(LV_KEY_DOWN);
236 lv_test_key_hit(LV_KEY_DOWN);
237 lv_test_key_hit(LV_KEY_DOWN);
238 lv_test_key_hit(LV_KEY_DOWN);
239 lv_test_key_hit(LV_KEY_DOWN);
240 lv_test_key_hit(LV_KEY_DOWN);
241 lv_test_key_hit(LV_KEY_DOWN);
242 lv_test_key_hit(LV_KEY_DOWN);
243 lv_test_key_hit(LV_KEY_ENTER);
244 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
245 TEST_ASSERT_EQUAL(7, lv_dropdown_get_selected(dd1));
246 TEST_ASSERT_EQUAL(7, event_cnt);
247
248 lv_test_key_hit(LV_KEY_ENTER);
249 TEST_ASSERT_TRUE(lv_dropdown_is_open(dd1));
250
251 lv_test_key_hit(LV_KEY_NEXT);
252 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
253 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd2));
254
255 lv_test_key_hit(LV_KEY_ENTER);
256 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
257 TEST_ASSERT_NOT_NULL(lv_dropdown_get_list(dd2));
258
259 lv_indev_set_group(lv_test_keypad_indev, NULL);
260 lv_group_del(g);
261 }
262
test_dropdown_encoder(void)263 void test_dropdown_encoder(void)
264 {
265 lv_obj_clean(lv_scr_act());
266
267 lv_group_t * g = lv_group_create();
268 lv_indev_set_group(lv_test_encoder_indev, g);
269
270 lv_obj_t * dd1 = lv_dropdown_create(lv_scr_act());
271 lv_obj_set_pos(dd1, 20, 20);
272 lv_dropdown_set_options(dd1, "1\n2\n3\n4\n5\n6\n7\n8");
273 lv_group_add_obj(g, dd1);
274 lv_obj_add_event_cb(dd1, dd_event, LV_EVENT_VALUE_CHANGED, NULL);
275
276 lv_obj_t * dd2 = lv_dropdown_create(lv_scr_act());
277 lv_obj_set_pos(dd2, 300, 20);
278 lv_group_add_obj(g, dd2);
279
280 event_cnt = 0;
281
282 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
283 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd2));
284 lv_test_encoder_click();
285 TEST_ASSERT_TRUE(lv_dropdown_is_open(dd1));
286 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd2));
287
288 lv_test_encoder_turn(5);
289 lv_test_encoder_click();
290 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
291 TEST_ASSERT_EQUAL(5, lv_dropdown_get_selected(dd1));
292 TEST_ASSERT_EQUAL(1, event_cnt);
293
294 lv_test_encoder_click();
295 lv_test_encoder_turn(-1);
296 lv_test_encoder_click();
297 TEST_ASSERT_EQUAL(4, lv_dropdown_get_selected(dd1));
298 TEST_ASSERT_EQUAL(2, event_cnt);
299
300 lv_test_encoder_click();
301 lv_test_encoder_turn(2);
302 lv_test_encoder_press();
303 lv_test_indev_wait(1000); //Long press
304 lv_test_encoder_release();
305 lv_test_indev_wait(50);
306 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
307 TEST_ASSERT_EQUAL(4, lv_dropdown_get_selected(dd1));
308 TEST_ASSERT_EQUAL(2, event_cnt);
309
310 lv_test_encoder_turn(1);
311 lv_test_encoder_click();
312 TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
313 TEST_ASSERT_TRUE(lv_dropdown_is_open(dd2));
314
315 lv_indev_set_group(lv_test_encoder_indev, NULL);
316 lv_group_del(g);
317 }
318
test_dropdown_render_1(void)319 void test_dropdown_render_1(void)
320 {
321 lv_obj_clean(lv_scr_act());
322
323 lv_obj_t * dd1 = lv_dropdown_create(lv_scr_act());
324 lv_obj_set_pos(dd1, 10, 10);
325 lv_dropdown_set_selected(dd1, 1);
326
327 lv_obj_t * dd2 = lv_dropdown_create(lv_scr_act());
328 lv_obj_set_pos(dd2, 200, 10);
329 lv_obj_set_width(dd2, 200);
330 lv_dropdown_set_selected(dd2, 2);
331 lv_dropdown_open(dd2);
332 TEST_ASSERT_TRUE(lv_dropdown_get_selected_highlight(dd2));
333 lv_dropdown_set_selected_highlight(dd2, false);
334 TEST_ASSERT_FALSE(lv_dropdown_get_selected_highlight(dd2));
335
336 lv_obj_t * dd3 = lv_dropdown_create(lv_scr_act());
337 lv_obj_set_style_pad_hor(dd3, 5, 0);
338 lv_obj_set_style_pad_ver(dd3, 20, 0);
339 lv_obj_set_pos(dd3, 500, 150);
340 TEST_ASSERT_EQUAL_PTR(NULL, lv_dropdown_get_text(dd3));
341 lv_dropdown_set_text(dd3, "A text");
342 TEST_ASSERT_EQUAL_STRING("A text", lv_dropdown_get_text(dd3));
343
344 lv_dropdown_set_selected(dd3, 2);
345
346 TEST_ASSERT_EQUAL(LV_DIR_BOTTOM, lv_dropdown_get_dir(dd3));
347 lv_dropdown_set_dir(dd3, LV_DIR_LEFT);
348 TEST_ASSERT_EQUAL(LV_DIR_LEFT, lv_dropdown_get_dir(dd3));
349
350 TEST_ASSERT_EQUAL_STRING(LV_SYMBOL_DOWN, lv_dropdown_get_symbol(dd3));
351 lv_dropdown_set_symbol(dd3, LV_SYMBOL_LEFT);
352 TEST_ASSERT_EQUAL_STRING(LV_SYMBOL_LEFT, lv_dropdown_get_symbol(dd3));
353
354 lv_dropdown_set_options(dd3, "a0\na1\na2\na3\na4\na5\na6\na7\na8\na9\na10\na11\na12\na13\na14\na15\na16");
355 lv_dropdown_open(dd3);
356 lv_obj_t * list = lv_dropdown_get_list(dd3);
357 lv_obj_set_style_text_line_space(list, 5, 0);
358 lv_obj_set_style_bg_color(list, lv_color_hex3(0xf00), LV_PART_SELECTED | LV_STATE_CHECKED);
359 lv_dropdown_set_selected(dd3, 3);
360
361 TEST_ASSERT_EQUAL_SCREENSHOT("dropdown_1.png");
362 }
363
test_dropdown_render_2(void)364 void test_dropdown_render_2(void)
365 {
366 lv_obj_clean(lv_scr_act());
367 LV_IMG_DECLARE(img_caret_down);
368 lv_obj_t * dd1 = lv_dropdown_create(lv_scr_act());
369 lv_dropdown_set_text(dd1, "Short");
370 lv_dropdown_set_options(dd1, "1\n2");
371 lv_dropdown_set_symbol(dd1, &img_caret_down);
372 lv_dropdown_open(dd1);
373
374 lv_obj_t * dd2 = lv_dropdown_create(lv_scr_act());
375 lv_dropdown_set_text(dd2, "Go Up");
376 lv_dropdown_set_options(dd2, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15");
377 lv_dropdown_set_symbol(dd2, NULL);
378 lv_obj_align(dd2, LV_ALIGN_LEFT_MID, 150, 50);
379 lv_dropdown_open(dd2);
380
381 lv_obj_t * dd3 = lv_dropdown_create(lv_scr_act());
382 lv_dropdown_set_text(dd3, "Limit Down");
383 lv_dropdown_set_options(dd3, "1aaaaaaaaaaaaaaaa\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15");
384 lv_obj_align(dd3, LV_ALIGN_LEFT_MID, 300, -10);
385 lv_dropdown_open(dd3);
386
387 lv_obj_t * dd4 = lv_dropdown_create(lv_scr_act());
388 lv_dropdown_set_text(dd4, "Limit Top");
389 lv_dropdown_set_options(dd4, "1aaaaaaaaaaaaaaaa\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15");
390 lv_obj_align(dd4, LV_ALIGN_LEFT_MID, 450, 10);
391 lv_dropdown_set_dir(dd4, LV_DIR_TOP);
392 lv_dropdown_set_symbol(dd4, LV_SYMBOL_UP);
393 lv_dropdown_open(dd4);
394
395 lv_obj_t * dd5 = lv_dropdown_create(lv_scr_act());
396 lv_dropdown_set_text(dd5, "Go Down");
397 lv_dropdown_set_options(dd5, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15");
398 lv_dropdown_set_dir(dd5, LV_DIR_TOP);
399 lv_dropdown_set_symbol(dd5, LV_SYMBOL_UP);
400 lv_obj_align(dd5, LV_ALIGN_LEFT_MID, 650, -200);
401 lv_dropdown_open(dd5);
402
403 lv_obj_t * dd6 = lv_dropdown_create(lv_scr_act());
404 lv_dropdown_set_text(dd6, "Right");
405 lv_dropdown_set_options(dd6, "1aaa\n2aa\n3aa");
406 lv_dropdown_set_dir(dd6, LV_DIR_RIGHT);
407 lv_dropdown_set_symbol(dd6, LV_SYMBOL_RIGHT);
408 lv_obj_align(dd6, LV_ALIGN_BOTTOM_LEFT, 20, -20);
409 lv_dropdown_open(dd6);
410 lv_obj_set_style_text_align(lv_dropdown_get_list(dd6), LV_TEXT_ALIGN_RIGHT, 0);
411
412 lv_obj_t * dd7 = lv_dropdown_create(lv_scr_act());
413 lv_dropdown_set_text(dd7, "Left");
414 lv_dropdown_set_options(dd7, "1aaa\n2\n3");
415 lv_dropdown_set_dir(dd7, LV_DIR_LEFT);
416 lv_dropdown_set_symbol(dd7, LV_SYMBOL_LEFT);
417 lv_obj_align(dd7, LV_ALIGN_BOTTOM_RIGHT, -20, -20);
418 lv_dropdown_open(dd7);
419
420 TEST_ASSERT_EQUAL_SCREENSHOT("dropdown_2.png");
421 }
422
423 /* See #2893 */
test_dropdown_should_list_on_top(void)424 void test_dropdown_should_list_on_top(void)
425 {
426 lv_obj_t * cont1 = lv_obj_create(lv_scr_act());
427 lv_obj_set_size(cont1, 200, 100);
428
429 lv_obj_t * dd = lv_dropdown_create(cont1);
430
431 lv_obj_t * cont2 = lv_obj_create(lv_scr_act());
432 lv_obj_set_size(cont2, 200, 100);
433 lv_obj_set_pos(cont2, 0, 100);
434
435 lv_dropdown_open(dd);
436 lv_obj_t * list = lv_dropdown_get_list(dd);
437 TEST_ASSERT_EQUAL_PTR(lv_scr_act(), lv_obj_get_parent(list));
438 TEST_ASSERT_EQUAL_INT(2, lv_obj_get_index(list));
439 }
440
441 #endif
442