Changeset e022819 in mainline for uspace/srv/hid/display/test/client.c


Ignore:
Timestamp:
2020-03-14T00:30:53Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
03c8081
Parents:
1e4a937
Message:

Resizing windows

File:
1 edited

Legend:

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

    r1e4a937 re022819  
    369369}
    370370
     371/** Test ds_client_get_event(), ds_client_post_resize_event(). */
     372PCUT_TEST(client_get_post_resize_event)
     373{
     374        ds_display_t *disp;
     375        ds_client_t *client;
     376        ds_window_t *wnd;
     377        display_wnd_params_t params;
     378        gfx_rect_t rect;
     379        ds_window_t *rwindow;
     380        display_wnd_ev_t revent;
     381        bool called_cb = NULL;
     382        errno_t rc;
     383
     384        rc = ds_display_create(NULL, &disp);
     385        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     386
     387        rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
     388        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     389
     390        display_wnd_params_init(&params);
     391        params.rect.p0.x = params.rect.p0.y = 0;
     392        params.rect.p1.x = params.rect.p1.y = 1;
     393
     394        rc = ds_window_create(client, &params, &wnd);
     395        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     396
     397        rect.p0.x = 1;
     398        rect.p0.y = 2;
     399        rect.p1.x = 3;
     400        rect.p1.y = 4;
     401
     402        PCUT_ASSERT_FALSE(called_cb);
     403
     404        rc = ds_client_get_event(client, &rwindow, &revent);
     405        PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
     406
     407        rc = ds_client_post_resize_event(client, wnd, &rect);
     408        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     409        PCUT_ASSERT_TRUE(called_cb);
     410
     411        rc = ds_client_get_event(client, &rwindow, &revent);
     412        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     413        PCUT_ASSERT_EQUALS(wnd, rwindow);
     414        PCUT_ASSERT_EQUALS(wev_resize, revent.etype);
     415        PCUT_ASSERT_EQUALS(rect.p0.x, revent.ev.resize.rect.p0.x);
     416        PCUT_ASSERT_EQUALS(rect.p0.y, revent.ev.resize.rect.p0.y);
     417        PCUT_ASSERT_EQUALS(rect.p1.x, revent.ev.resize.rect.p1.x);
     418        PCUT_ASSERT_EQUALS(rect.p1.y, revent.ev.resize.rect.p1.y);
     419
     420        rc = ds_client_get_event(client, &rwindow, &revent);
     421        PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
     422
     423        ds_window_destroy(wnd);
     424        ds_client_destroy(client);
     425        ds_display_destroy(disp);
     426}
     427
    371428/** Test ds_client_get_event(), ds_client_post_unfocus_event(). */
    372429PCUT_TEST(client_get_post_unfocus_event)
Note: See TracChangeset for help on using the changeset viewer.