Changeset 1c6c3e1d in mainline for uspace/lib/ui/test/window.c
- Timestamp:
- 2023-10-22T17:55:33Z (14 months ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/window.c
r315d487 r1c6c3e1d 45 45 PCUT_TEST_SUITE(window); 46 46 47 static void test_window_sysmenu(ui_window_t *, void *, sysarg_t); 47 48 static void test_window_minimize(ui_window_t *, void *); 48 49 static void test_window_maximize(ui_window_t *, void *); … … 56 57 57 58 static ui_window_cb_t test_window_cb = { 59 .sysmenu = test_window_sysmenu, 58 60 .minimize = test_window_minimize, 59 61 .maximize = test_window_maximize, … … 82 84 typedef struct { 83 85 errno_t rc; 86 bool sysmenu; 87 sysarg_t sysmenu_idev_id; 84 88 bool minimize; 85 89 bool maximize; … … 544 548 } 545 549 550 /** ui_window_send_sysmenu() calls sysmenu callback set via ui_window_set_cb() */ 551 PCUT_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(¶ms); 563 params.caption = "Hello"; 564 565 rc = ui_window_create(ui, ¶ms, &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 546 588 /** ui_window_send_minimize() calls minimize callback set via ui_window_set_cb() */ 547 589 PCUT_TEST(send_minimize) … … 894 936 } 895 937 938 static 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 896 946 static void test_window_minimize(ui_window_t *window, void *arg) 897 947 {
Note:
See TracChangeset
for help on using the changeset viewer.