Changeset 96c6a00 in mainline for uspace/lib/ui/test/menubar.c


Ignore:
Timestamp:
2022-03-10T13:44:10Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c88d7f99
Parents:
ca2680d
git-author:
Jiri Svoboda <jiri@…> (2022-03-09 18:44:00)
git-committer:
Jiri Svoboda <jiri@…> (2022-03-10 13:44:10)
Message:

Menu accelerators

Open a menu by pressing F10, then accelerator key (e.g. 'F').

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/test/menubar.c

    rca2680d r96c6a00  
    187187
    188188        event.type = KEY_PRESS;
    189         event.key = KC_ESCAPE;
     189        event.key = KC_F10;
     190        event.mods = 0;
    190191        claimed = ui_menu_bar_kbd_event(mbar, &event);
    191192        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     
    249250}
    250251
    251 /** Calling ui_menu_bar_select() with the same menu twice deselects it */
    252 PCUT_TEST(select_same)
    253 {
    254         ui_t *ui = NULL;
    255         ui_window_t *window = NULL;
    256         ui_wnd_params_t params;
    257         ui_menu_bar_t *mbar = NULL;
    258         ui_menu_t *menu = NULL;
    259         errno_t rc;
    260 
    261         rc = ui_create_disp(NULL, &ui);
    262         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    263 
    264         ui_wnd_params_init(&params);
    265         params.caption = "Hello";
    266 
    267         rc = ui_window_create(ui, &params, &window);
    268         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    269         PCUT_ASSERT_NOT_NULL(window);
    270 
    271         rc = ui_menu_bar_create(ui, window, &mbar);
    272         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    273         PCUT_ASSERT_NOT_NULL(mbar);
    274 
    275         rc = ui_menu_create(mbar, "Test", &menu);
    276         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    277         PCUT_ASSERT_NOT_NULL(menu);
    278 
    279         ui_menu_bar_select(mbar, menu, true);
    280         PCUT_ASSERT_EQUALS(menu, mbar->selected);
    281 
    282         /* Selecting again should unselect the menu */
    283         ui_menu_bar_select(mbar, menu, true);
    284         PCUT_ASSERT_NULL(mbar->selected);
    285 
    286         ui_menu_bar_destroy(mbar);
    287         ui_window_destroy(window);
    288         ui_destroy(ui);
    289 }
    290 
    291252/** Calling ui_menu_bar_select() with another menu selects it */
    292253PCUT_TEST(select_different)
Note: See TracChangeset for help on using the changeset viewer.