Changeset 4c4d6142 in mainline


Ignore:
Timestamp:
2020-05-19T13:04:32Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5480d5e
Parents:
4912dd59
git-author:
Jiri Svoboda <jiri@…> (2020-05-18 19:03:11)
git-committer:
Jiri Svoboda <jiri@…> (2020-05-19 13:04:32)
Message:

We should execute seat unit tests

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

Legend:

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

    r4912dd59 r4c4d6142  
    5555};
    5656
    57 
    5857typedef struct {
    5958        bool render_called;
     
    210209}
    211210
    212 
    213211PCUT_EXPORT(cursor);
  • uspace/srv/hid/display/test/main.c

    r4912dd59 r4c4d6142  
    3434PCUT_IMPORT(cursor);
    3535PCUT_IMPORT(display);
     36PCUT_IMPORT(seat);
    3637PCUT_IMPORT(window);
    3738
  • uspace/srv/hid/display/test/seat.c

    r4912dd59 r4c4d6142  
    5353        printf("test_ds_ev_pending\n");
    5454        *called_cb = true;
    55 
    5655}
    5756
     
    6463        ds_window_t *wnd;
    6564        display_wnd_params_t params;
    66         errno_t rc;
    67 
    68         rc = ds_display_create(NULL, &disp);
    69         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    70 
    71         rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client);
     65        bool called_cb = false;
     66        errno_t rc;
     67
     68        rc = ds_display_create(NULL, &disp);
     69        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     70
     71        rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
    7272        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    7373
     
    8484        ds_seat_set_focus(seat, wnd);
    8585        PCUT_ASSERT_EQUALS(wnd, seat->focus);
     86        PCUT_ASSERT_TRUE(called_cb);
    8687
    8788        ds_window_destroy(wnd);
     
    100101        ds_window_t *w1;
    101102        display_wnd_params_t params;
    102         errno_t rc;
    103 
    104         rc = ds_display_create(NULL, &disp);
    105         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    106 
    107         rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client);
     103        bool called_cb = false;
     104        errno_t rc;
     105
     106        rc = ds_display_create(NULL, &disp);
     107        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     108
     109        rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
    108110        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    109111
     
    123125        ds_seat_set_focus(seat, w1);
    124126        PCUT_ASSERT_EQUALS(w1, seat->focus);
     127        PCUT_ASSERT_TRUE(called_cb);
     128        called_cb = false;
    125129
    126130        ds_seat_evac_focus(seat, w1);
    127131        PCUT_ASSERT_EQUALS(w0, seat->focus);
     132        PCUT_ASSERT_TRUE(called_cb);
    128133
    129134        ds_window_destroy(w0);
     
    143148        ds_window_t *w1;
    144149        display_wnd_params_t params;
     150        bool called_cb = false;
    145151        kbd_event_t event;
    146152        errno_t rc;
     
    149155        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    150156
    151         rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client);
     157        rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
    152158        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    153159
     
    167173        ds_seat_set_focus(seat, w1);
    168174        PCUT_ASSERT_EQUALS(w1, seat->focus);
     175        PCUT_ASSERT_TRUE(called_cb);
     176        called_cb = false;
    169177
    170178        event.type = KEY_PRESS;
     
    174182        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    175183        PCUT_ASSERT_EQUALS(w0, seat->focus);
     184        PCUT_ASSERT_TRUE(called_cb);
    176185
    177186        ds_window_destroy(w0);
     
    193202        ds_window_t *rwindow;
    194203        display_wnd_ev_t revent;
    195         bool called_cb = NULL;
     204        bool called_cb = false;
    196205        errno_t rc;
    197206
     
    214223        ds_seat_set_focus(seat, wnd);
    215224        PCUT_ASSERT_EQUALS(wnd, seat->focus);
     225
     226        PCUT_ASSERT_TRUE(called_cb);
     227        rc = ds_client_get_event(client, &rwindow, &revent);
     228        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     229        called_cb = false;
    216230
    217231        event.type = KEY_PRESS;
     
    219233        event.mods = 0;
    220234        event.c = L'\0';
    221 
    222         PCUT_ASSERT_FALSE(called_cb);
    223235
    224236        rc = ds_client_get_event(client, &rwindow, &revent);
     
    242254
    243255        ds_window_destroy(wnd);
     256        ds_seat_destroy(seat);
    244257        ds_client_destroy(client);
    245258        ds_display_destroy(disp);
     
    267280        rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
    268281        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     282
     283        /* Set up display size to allow the pointer a range of movement */
     284        disp->rect.p1.x = 500;
     285        disp->rect.p1.y = 500;
    269286
    270287        display_wnd_params_init(&params);
     
    293310        rc = ds_seat_post_ptd_event(seat, &event);
    294311        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    295         PCUT_ASSERT_FALSE(called_cb);
     312
     313        PCUT_ASSERT_TRUE(called_cb);
     314        called_cb = false;
    296315
    297316        event.type = PTD_PRESS;
     
    299318        rc = ds_seat_post_ptd_event(seat, &event);
    300319        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    301         PCUT_ASSERT_FALSE(called_cb);
     320        PCUT_ASSERT_TRUE(called_cb);
     321        called_cb = false;
    302322
    303323        PCUT_ASSERT_EQUALS(w1, seat->focus);
     
    308328        rc = ds_seat_post_ptd_event(seat, &event);
    309329        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    310         PCUT_ASSERT_FALSE(called_cb);
     330        PCUT_ASSERT_TRUE(called_cb);
     331        called_cb = false;
    311332
    312333        event.type = PTD_PRESS;
     
    314335        rc = ds_seat_post_ptd_event(seat, &event);
    315336        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    316         PCUT_ASSERT_FALSE(called_cb);
     337        PCUT_ASSERT_TRUE(called_cb);
     338        called_cb = false;
    317339
    318340        PCUT_ASSERT_EQUALS(w0, seat->focus);
Note: See TracChangeset for help on using the changeset viewer.