Changeset 1c6c3e1d in mainline for uspace/lib/ui/test/window.c


Ignore:
Timestamp:
2023-10-22T17:55:33Z (14 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
ticket/834-toolchain-update
Children:
350ec74
Parents:
315d487 (diff), 133461c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into ticket

File:
1 edited

Legend:

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

    r315d487 r1c6c3e1d  
    4545PCUT_TEST_SUITE(window);
    4646
     47static void test_window_sysmenu(ui_window_t *, void *, sysarg_t);
    4748static void test_window_minimize(ui_window_t *, void *);
    4849static void test_window_maximize(ui_window_t *, void *);
     
    5657
    5758static ui_window_cb_t test_window_cb = {
     59        .sysmenu = test_window_sysmenu,
    5860        .minimize = test_window_minimize,
    5961        .maximize = test_window_maximize,
     
    8284typedef struct {
    8385        errno_t rc;
     86        bool sysmenu;
     87        sysarg_t sysmenu_idev_id;
    8488        bool minimize;
    8589        bool maximize;
     
    544548}
    545549
     550/** ui_window_send_sysmenu() calls sysmenu callback set via ui_window_set_cb() */
     551PCUT_TEST(send_sysmenu)
     552{
     553        errno_t rc;
     554        ui_t *ui = NULL;
     555        ui_wnd_params_t params;
     556        ui_window_t *window = NULL;
     557        test_cb_resp_t resp;
     558
     559        rc = ui_create_disp(NULL, &ui);
     560        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     561
     562        ui_wnd_params_init(&params);
     563        params.caption = "Hello";
     564
     565        rc = ui_window_create(ui, &params, &window);
     566        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     567        PCUT_ASSERT_NOT_NULL(window);
     568
     569        /* Sysmenu callback with no callbacks set */
     570        ui_window_send_sysmenu(window, 42);
     571
     572        /* Sysmenu callback with sysmenu callback not implemented */
     573        ui_window_set_cb(window, &dummy_window_cb, NULL);
     574        ui_window_send_sysmenu(window, 42);
     575
     576        /* Sysmenu callback with real callback set */
     577        resp.sysmenu = false;
     578        resp.sysmenu_idev_id = 0;
     579        ui_window_set_cb(window, &test_window_cb, &resp);
     580        ui_window_send_sysmenu(window, 42);
     581        PCUT_ASSERT_TRUE(resp.sysmenu);
     582        PCUT_ASSERT_INT_EQUALS(42, resp.sysmenu_idev_id);
     583
     584        ui_window_destroy(window);
     585        ui_destroy(ui);
     586}
     587
    546588/** ui_window_send_minimize() calls minimize callback set via ui_window_set_cb() */
    547589PCUT_TEST(send_minimize)
     
    894936}
    895937
     938static void test_window_sysmenu(ui_window_t *window, void *arg, sysarg_t idev_id)
     939{
     940        test_cb_resp_t *resp = (test_cb_resp_t *) arg;
     941
     942        resp->sysmenu = true;
     943        resp->sysmenu_idev_id = idev_id;
     944}
     945
    896946static void test_window_minimize(ui_window_t *window, void *arg)
    897947{
Note: See TracChangeset for help on using the changeset viewer.