acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

test_dropdown.c (15417B)

      1 #if LV_BUILD_TEST
      2 #include "../lvgl.h"
      3 
      4 #include "unity/unity.h"
      5 #include "lv_test_indev.h"
      6 
      7 void setUp(void)
      8 {
      9     /* Function run before every test */
     10 }
     11 
     12 void tearDown(void)
     13 {
     14     /* Function run after every test */
     15     lv_obj_clean(lv_scr_act());
     16 }
     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 
     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 
    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 
    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;
    155 static void dd_event(lv_event_t * e)
    156 {
    157     LV_UNUSED(e);
    158     event_cnt++;
    159 }
    160 
    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 
    263 
    264 void test_dropdown_encoder(void)
    265 {
    266     lv_obj_clean(lv_scr_act());
    267 
    268     lv_group_t * g = lv_group_create();
    269     lv_indev_set_group(lv_test_encoder_indev, g);
    270 
    271     lv_obj_t * dd1 = lv_dropdown_create(lv_scr_act());
    272     lv_obj_set_pos(dd1, 20, 20);
    273     lv_dropdown_set_options(dd1, "1\n2\n3\n4\n5\n6\n7\n8");
    274     lv_group_add_obj(g, dd1);
    275     lv_obj_add_event_cb(dd1, dd_event, LV_EVENT_VALUE_CHANGED, NULL);
    276 
    277     lv_obj_t * dd2 = lv_dropdown_create(lv_scr_act());
    278     lv_obj_set_pos(dd2, 300, 20);
    279     lv_group_add_obj(g, dd2);
    280 
    281     event_cnt = 0;
    282 
    283     TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
    284     TEST_ASSERT_FALSE(lv_dropdown_is_open(dd2));
    285     lv_test_encoder_click();
    286     TEST_ASSERT_TRUE(lv_dropdown_is_open(dd1));
    287     TEST_ASSERT_FALSE(lv_dropdown_is_open(dd2));
    288 
    289     lv_test_encoder_turn(5);
    290     lv_test_encoder_click();
    291     TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
    292     TEST_ASSERT_EQUAL(5, lv_dropdown_get_selected(dd1));
    293     TEST_ASSERT_EQUAL(1, event_cnt);
    294 
    295     lv_test_encoder_click();
    296     lv_test_encoder_turn(-1);
    297     lv_test_encoder_click();
    298     TEST_ASSERT_EQUAL(4, lv_dropdown_get_selected(dd1));
    299     TEST_ASSERT_EQUAL(2, event_cnt);
    300 
    301     lv_test_encoder_click();
    302     lv_test_encoder_turn(2);
    303     lv_test_encoder_press();
    304     lv_test_indev_wait(1000);  //Long press
    305     lv_test_encoder_release();
    306     lv_test_indev_wait(50);
    307     TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
    308     TEST_ASSERT_EQUAL(4, lv_dropdown_get_selected(dd1));
    309     TEST_ASSERT_EQUAL(2, event_cnt);
    310 
    311     lv_test_encoder_turn(1);
    312     lv_test_encoder_click();
    313     TEST_ASSERT_FALSE(lv_dropdown_is_open(dd1));
    314     TEST_ASSERT_TRUE(lv_dropdown_is_open(dd2));
    315 
    316     lv_indev_set_group(lv_test_encoder_indev, NULL);
    317     lv_group_del(g);
    318 }
    319 
    320 
    321 void test_dropdown_render_1(void)
    322 {
    323     lv_obj_clean(lv_scr_act());
    324 
    325     lv_obj_t * dd1 = lv_dropdown_create(lv_scr_act());
    326     lv_obj_set_pos(dd1, 10, 10);
    327     lv_dropdown_set_selected(dd1, 1);
    328 
    329     lv_obj_t * dd2 = lv_dropdown_create(lv_scr_act());
    330     lv_obj_set_pos(dd2, 200, 10);
    331     lv_obj_set_width(dd2, 200);
    332     lv_dropdown_set_selected(dd2, 2);
    333     lv_dropdown_open(dd2);
    334     TEST_ASSERT_TRUE(lv_dropdown_get_selected_highlight(dd2));
    335     lv_dropdown_set_selected_highlight(dd2, false);
    336     TEST_ASSERT_FALSE(lv_dropdown_get_selected_highlight(dd2));
    337 
    338     lv_obj_t * dd3 = lv_dropdown_create(lv_scr_act());
    339     lv_obj_set_style_pad_hor(dd3, 5, 0);
    340     lv_obj_set_style_pad_ver(dd3, 20, 0);
    341     lv_obj_set_pos(dd3, 500, 150);
    342     TEST_ASSERT_EQUAL_PTR(NULL, lv_dropdown_get_text(dd3));
    343     lv_dropdown_set_text(dd3, "A text");
    344     TEST_ASSERT_EQUAL_STRING("A text", lv_dropdown_get_text(dd3));
    345 
    346     lv_dropdown_set_selected(dd3, 2);
    347 
    348     TEST_ASSERT_EQUAL(LV_DIR_BOTTOM, lv_dropdown_get_dir(dd3));
    349     lv_dropdown_set_dir(dd3, LV_DIR_LEFT);
    350     TEST_ASSERT_EQUAL(LV_DIR_LEFT, lv_dropdown_get_dir(dd3));
    351 
    352     TEST_ASSERT_EQUAL_STRING(LV_SYMBOL_DOWN, lv_dropdown_get_symbol(dd3));
    353     lv_dropdown_set_symbol(dd3, LV_SYMBOL_LEFT);
    354     TEST_ASSERT_EQUAL_STRING(LV_SYMBOL_LEFT, lv_dropdown_get_symbol(dd3));
    355 
    356     lv_dropdown_set_options(dd3, "a0\na1\na2\na3\na4\na5\na6\na7\na8\na9\na10\na11\na12\na13\na14\na15\na16");
    357     lv_dropdown_open(dd3);
    358     lv_dropdown_set_selected(dd3, 3);
    359     lv_obj_t * list = lv_dropdown_get_list(dd3);
    360     lv_obj_set_style_text_line_space(list, 5, 0);
    361     lv_obj_set_style_bg_color(list, lv_color_hex3(0xf00), LV_PART_SELECTED | LV_STATE_CHECKED);
    362 
    363 
    364     TEST_ASSERT_EQUAL_SCREENSHOT("dropdown_1.png");
    365 }
    366 
    367 void test_dropdown_render_2(void)
    368 {
    369     lv_obj_clean(lv_scr_act());
    370     LV_IMG_DECLARE(img_caret_down);
    371     lv_obj_t * dd1 = lv_dropdown_create(lv_scr_act());
    372     lv_dropdown_set_text(dd1, "Short");
    373     lv_dropdown_set_options(dd1, "1\n2");
    374     lv_dropdown_set_symbol(dd1, &img_caret_down);
    375     lv_dropdown_open(dd1);
    376 
    377     lv_obj_t * dd2 = lv_dropdown_create(lv_scr_act());
    378     lv_dropdown_set_text(dd2, "Go Up");
    379     lv_dropdown_set_options(dd2, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15");
    380     lv_dropdown_set_symbol(dd2, NULL);
    381     lv_obj_align(dd2, LV_ALIGN_LEFT_MID, 150, 50);
    382     lv_dropdown_open(dd2);
    383 
    384     lv_obj_t * dd3 = lv_dropdown_create(lv_scr_act());
    385     lv_dropdown_set_text(dd3, "Limit Down");
    386     lv_dropdown_set_options(dd3, "1aaaaaaaaaaaaaaaa\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15");
    387     lv_obj_align(dd3, LV_ALIGN_LEFT_MID, 300, -10);
    388     lv_dropdown_open(dd3);
    389 
    390     lv_obj_t * dd4 = lv_dropdown_create(lv_scr_act());
    391     lv_dropdown_set_text(dd4, "Limit Top");
    392     lv_dropdown_set_options(dd4, "1aaaaaaaaaaaaaaaa\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15");
    393     lv_obj_align(dd4, LV_ALIGN_LEFT_MID, 450, 10);
    394     lv_dropdown_set_dir(dd4, LV_DIR_TOP);
    395     lv_dropdown_set_symbol(dd4, LV_SYMBOL_UP);
    396     lv_dropdown_open(dd4);
    397 
    398     lv_obj_t * dd5 = lv_dropdown_create(lv_scr_act());
    399     lv_dropdown_set_text(dd5, "Go Down");
    400     lv_dropdown_set_options(dd5, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15");
    401     lv_dropdown_set_dir(dd5, LV_DIR_TOP);
    402     lv_dropdown_set_symbol(dd5, LV_SYMBOL_UP);
    403     lv_obj_align(dd5, LV_ALIGN_LEFT_MID, 650, -200);
    404     lv_dropdown_open(dd5);
    405 
    406     lv_obj_t * dd6 = lv_dropdown_create(lv_scr_act());
    407     lv_dropdown_set_text(dd6, "Right");
    408     lv_dropdown_set_options(dd6, "1aaa\n2aa\n3aa");
    409     lv_dropdown_set_dir(dd6, LV_DIR_RIGHT);
    410     lv_dropdown_set_symbol(dd6, LV_SYMBOL_RIGHT);
    411     lv_obj_align(dd6, LV_ALIGN_BOTTOM_LEFT, 20, -20);
    412     lv_dropdown_open(dd6);
    413     lv_obj_set_style_text_align(lv_dropdown_get_list(dd6), LV_TEXT_ALIGN_RIGHT, 0);
    414 
    415     lv_obj_t * dd7 = lv_dropdown_create(lv_scr_act());
    416     lv_dropdown_set_text(dd7, "Left");
    417     lv_dropdown_set_options(dd7, "1aaa\n2\n3");
    418     lv_dropdown_set_dir(dd7, LV_DIR_LEFT);
    419     lv_dropdown_set_symbol(dd7, LV_SYMBOL_LEFT);
    420     lv_obj_align(dd7, LV_ALIGN_BOTTOM_RIGHT, -20, -20);
    421     lv_dropdown_open(dd7);
    422 
    423     TEST_ASSERT_EQUAL_SCREENSHOT("dropdown_2.png");
    424 }
    425 
    426 /* See #2893 */
    427 void test_dropdown_should_list_on_top(void)
    428 {
    429     lv_obj_t * cont1 = lv_obj_create(lv_scr_act());
    430     lv_obj_set_size(cont1, 200, 100);
    431 
    432     lv_obj_t * dd = lv_dropdown_create(cont1);
    433 
    434     lv_obj_t * cont2 = lv_obj_create(lv_scr_act());
    435     lv_obj_set_size(cont2, 200, 100);
    436     lv_obj_set_pos(cont2, 0, 100);
    437 
    438     lv_dropdown_open(dd);
    439     lv_obj_t * list = lv_dropdown_get_list(dd);
    440     TEST_ASSERT_EQUAL_PTR(lv_scr_act(), lv_obj_get_parent(list));
    441     TEST_ASSERT_EQUAL_INT(2, lv_obj_get_index(list));
    442 }
    443 
    444 
    445 #endif