Changeset f7fb2b21 in mainline for uspace/srv/hid/display/test


Ignore:
Timestamp:
2020-02-10T19:01:42Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b43edabe
Parents:
287688f2
Message:

Propagate position event to display clients

Location:
uspace/srv/hid/display/test
Files:
3 edited

Legend:

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

    r287688f2 rf7fb2b21  
    206206        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    207207        PCUT_ASSERT_EQUALS(wnd, rwindow);
    208         PCUT_ASSERT_EQUALS(event.type, revent.kbd_event.type);
    209         PCUT_ASSERT_EQUALS(event.key, revent.kbd_event.key);
    210         PCUT_ASSERT_EQUALS(event.mods, revent.kbd_event.mods);
    211         PCUT_ASSERT_EQUALS(event.c, revent.kbd_event.c);
     208        PCUT_ASSERT_EQUALS(wev_kbd, revent.etype);
     209        PCUT_ASSERT_EQUALS(event.type, revent.ev.kbd.type);
     210        PCUT_ASSERT_EQUALS(event.key, revent.ev.kbd.key);
     211        PCUT_ASSERT_EQUALS(event.mods, revent.ev.kbd.mods);
     212        PCUT_ASSERT_EQUALS(event.c, revent.ev.kbd.c);
     213
     214        rc = ds_client_get_event(client, &rwindow, &revent);
     215        PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
     216
     217        ds_window_destroy(wnd);
     218        ds_client_destroy(client);
     219        ds_display_destroy(disp);
     220}
     221
     222/** Test ds_client_get_event(), ds_client_post_pos_event(). */
     223PCUT_TEST(client_get_post_pos_event)
     224{
     225        ds_display_t *disp;
     226        ds_client_t *client;
     227        ds_window_t *wnd;
     228        display_wnd_params_t params;
     229        pos_event_t event;
     230        ds_window_t *rwindow;
     231        display_wnd_ev_t revent;
     232        bool called_cb = NULL;
     233        errno_t rc;
     234
     235        rc = ds_display_create(NULL, &disp);
     236        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     237
     238        rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
     239        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     240
     241        display_wnd_params_init(&params);
     242        params.rect.p0.x = params.rect.p0.y = 0;
     243        params.rect.p1.x = params.rect.p1.y = 1;
     244
     245        rc = ds_window_create(client, &params, &wnd);
     246        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     247
     248        event.type = POS_PRESS;
     249        event.hpos = 1;
     250        event.vpos = 2;
     251
     252        PCUT_ASSERT_FALSE(called_cb);
     253
     254        rc = ds_client_get_event(client, &rwindow, &revent);
     255        PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
     256
     257        rc = ds_client_post_pos_event(client, wnd, &event);
     258        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     259        PCUT_ASSERT_TRUE(called_cb);
     260
     261        rc = ds_client_get_event(client, &rwindow, &revent);
     262        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     263        PCUT_ASSERT_EQUALS(wnd, rwindow);
     264        PCUT_ASSERT_EQUALS(wev_pos, revent.etype);
     265        PCUT_ASSERT_EQUALS(event.type, revent.ev.pos.type);
     266        PCUT_ASSERT_EQUALS(event.hpos, revent.ev.pos.hpos);
     267        PCUT_ASSERT_EQUALS(event.vpos, revent.ev.pos.vpos);
    212268
    213269        rc = ds_client_get_event(client, &rwindow, &revent);
  • uspace/srv/hid/display/test/display.c

    r287688f2 rf7fb2b21  
    377377        w1->dpos.y = 400;
    378378
    379         PCUT_ASSERT_FALSE(called_cb);
    380 
    381379        ds_seat_set_focus(seat, w0);
    382380
     
    386384        rc = ds_display_post_ptd_event(disp, &event);
    387385        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    388         PCUT_ASSERT_FALSE(called_cb);
    389386
    390387        event.type = PTD_PRESS;
     
    392389        rc = ds_display_post_ptd_event(disp, &event);
    393390        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    394         PCUT_ASSERT_FALSE(called_cb);
    395391
    396392        PCUT_ASSERT_EQUALS(w1, seat->focus);
     
    400396        rc = ds_display_post_ptd_event(disp, &event);
    401397        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    402         PCUT_ASSERT_FALSE(called_cb);
    403398
    404399        event.type = PTD_MOVE;
     
    407402        rc = ds_display_post_ptd_event(disp, &event);
    408403        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    409         PCUT_ASSERT_FALSE(called_cb);
    410404
    411405        event.type = PTD_PRESS;
     
    413407        rc = ds_display_post_ptd_event(disp, &event);
    414408        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    415         PCUT_ASSERT_FALSE(called_cb);
    416409
    417410        PCUT_ASSERT_EQUALS(w0, seat->focus);
  • uspace/srv/hid/display/test/seat.c

    r287688f2 rf7fb2b21  
    232232        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    233233        PCUT_ASSERT_EQUALS(wnd, rwindow);
    234         PCUT_ASSERT_EQUALS(event.type, revent.kbd_event.type);
    235         PCUT_ASSERT_EQUALS(event.key, revent.kbd_event.key);
    236         PCUT_ASSERT_EQUALS(event.mods, revent.kbd_event.mods);
    237         PCUT_ASSERT_EQUALS(event.c, revent.kbd_event.c);
     234        PCUT_ASSERT_EQUALS(wev_kbd, revent.etype);
     235        PCUT_ASSERT_EQUALS(event.type, revent.ev.kbd.type);
     236        PCUT_ASSERT_EQUALS(event.key, revent.ev.kbd.key);
     237        PCUT_ASSERT_EQUALS(event.mods, revent.ev.kbd.mods);
     238        PCUT_ASSERT_EQUALS(event.c, revent.ev.kbd.c);
    238239
    239240        rc = ds_client_get_event(client, &rwindow, &revent);
Note: See TracChangeset for help on using the changeset viewer.