Ignore:
Timestamp:
2020-03-02T11:22:01Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a2e104e
Parents:
7bb45e3
git-author:
Jiri Svoboda <jiri@…> (2020-02-01 11:18:50)
git-committer:
Jiri Svoboda <jiri@…> (2020-03-02 11:22:01)
Message:

Closing windows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/test/window.c

    r7bb45e3 r338d0935  
    124124}
    125125
     126/** Test ds_window_post_kbd_event() with Alt-F4 sends close event */
     127PCUT_TEST(window_post_kbd_event_alt_f4)
     128{
     129        gfx_context_t *gc;
     130        ds_display_t *disp;
     131        ds_client_t *client;
     132        ds_window_t *wnd;
     133        ds_window_t *rwindow;
     134        display_wnd_ev_t revent;
     135        display_wnd_params_t params;
     136        kbd_event_t event;
     137        errno_t rc;
     138
     139        rc = gfx_context_new(&dummy_ops, NULL, &gc);
     140        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     141
     142        rc = ds_display_create(gc, &disp);
     143        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     144
     145        rc = ds_client_create(disp, NULL, NULL, &client);
     146        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     147
     148        display_wnd_params_init(&params);
     149        params.rect.p0.x = params.rect.p0.y = 0;
     150        params.rect.p1.x = params.rect.p1.y = 1;
     151
     152        rc = ds_window_create(client, &params, &wnd);
     153        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     154
     155        event.type = KEY_PRESS;
     156        event.mods = KM_ALT;
     157        event.key = KC_F4;
     158        rc = ds_window_post_kbd_event(wnd, &event);
     159        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     160
     161        rc = ds_client_get_event(client, &rwindow, &revent);
     162        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     163        PCUT_ASSERT_EQUALS(wnd, rwindow);
     164        PCUT_ASSERT_EQUALS(wev_close, revent.etype);
     165
     166        rc = ds_client_get_event(client, &rwindow, &revent);
     167        PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
     168
     169        ds_window_destroy(wnd);
     170        ds_client_destroy(client);
     171        ds_display_destroy(disp);
     172}
     173
    126174/** Test ds_window_post_pos_event() */
    127175PCUT_TEST(window_post_pos_event)
Note: See TracChangeset for help on using the changeset viewer.