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


Ignore:
Timestamp:
2022-03-11T17:28:10Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bd16113
Parents:
b987eb4
Message:

Use Alt-key accelerators to open menus

File:
1 edited

Legend:

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

    rb987eb4 rb3b48f4  
    198198}
    199199
    200 /** Press event on menu bar entry selects menu */
    201 PCUT_TEST(pos_event_select)
     200/** ui_menu_bar_press_accel() opens the corresponding menu */
     201PCUT_TEST(press_accel)
    202202{
    203203        ui_t *ui = NULL;
     
    206206        ui_menu_bar_t *mbar = NULL;
    207207        ui_menu_t *menu = NULL;
    208         ui_evclaim_t claimed;
    209         pos_event_t event;
    210208        gfx_rect_t rect;
    211209        errno_t rc;
     
    231229        ui_menu_bar_set_rect(mbar, &rect);
    232230
     231        rc = ui_menu_create(mbar, "~T~est", &menu);
     232        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     233        PCUT_ASSERT_NOT_NULL(menu);
     234
     235        PCUT_ASSERT_FALSE(ui_menu_is_open(menu));
     236
     237        ui_menu_bar_press_accel(mbar, 't');
     238
     239        PCUT_ASSERT_TRUE(ui_menu_is_open(menu));
     240
     241        ui_menu_bar_destroy(mbar);
     242        ui_window_destroy(window);
     243        ui_destroy(ui);
     244}
     245
     246/** Press event on menu bar entry selects menu */
     247PCUT_TEST(pos_event_select)
     248{
     249        ui_t *ui = NULL;
     250        ui_window_t *window = NULL;
     251        ui_wnd_params_t params;
     252        ui_menu_bar_t *mbar = NULL;
     253        ui_menu_t *menu = NULL;
     254        ui_evclaim_t claimed;
     255        pos_event_t event;
     256        gfx_rect_t rect;
     257        errno_t rc;
     258
     259        rc = ui_create_disp(NULL, &ui);
     260        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     261
     262        ui_wnd_params_init(&params);
     263        params.caption = "Hello";
     264
     265        rc = ui_window_create(ui, &params, &window);
     266        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     267        PCUT_ASSERT_NOT_NULL(window);
     268
     269        rc = ui_menu_bar_create(ui, window, &mbar);
     270        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     271        PCUT_ASSERT_NOT_NULL(mbar);
     272
     273        rect.p0.x = 0;
     274        rect.p0.y = 0;
     275        rect.p1.x = 50;
     276        rect.p1.y = 25;
     277        ui_menu_bar_set_rect(mbar, &rect);
     278
    233279        rc = ui_menu_create(mbar, "Test", &menu);
    234280        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
Note: See TracChangeset for help on using the changeset viewer.