Changeset 379cd75f in mainline for uspace/lib/ui/test/window.c
- Timestamp:
- 2021-04-01T21:04:11Z (4 years ago)
- Children:
- 0563982
- Parents:
- cd62879
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/window.c
rcd62879 r379cd75f 66 66 static errno_t test_ctl_paint(void *); 67 67 static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *); 68 static void test_ctl_unfocus(void *); 68 69 69 70 static ui_control_ops_t test_ctl_ops = { 70 71 .paint = test_ctl_paint, 71 .pos_event = test_ctl_pos_event 72 .pos_event = test_ctl_pos_event, 73 .unfocus = test_ctl_unfocus 72 74 }; 73 75 … … 90 92 bool pos; 91 93 pos_event_t pos_event; 94 bool unfocus; 92 95 } test_ctl_resp_t; 93 96 … … 388 391 PCUT_ASSERT_INT_EQUALS(event.hpos, resp.pos_event.hpos); 389 392 PCUT_ASSERT_INT_EQUALS(event.vpos, resp.pos_event.vpos); 393 394 /* Need to remove first because we didn't implement the destructor */ 395 ui_window_remove(window, control); 396 397 ui_window_destroy(window); 398 ui_destroy(ui); 399 } 400 401 /** ui_window_def_unfocus() delivers unfocus event to control in window */ 402 PCUT_TEST(def_unfocus) 403 { 404 errno_t rc; 405 ui_t *ui = NULL; 406 ui_wnd_params_t params; 407 ui_window_t *window = NULL; 408 ui_control_t *control = NULL; 409 test_ctl_resp_t resp; 410 411 rc = ui_create_disp(NULL, &ui); 412 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 413 414 ui_wnd_params_init(¶ms); 415 params.caption = "Hello"; 416 417 rc = ui_window_create(ui, ¶ms, &window); 418 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 419 420 rc = ui_control_new(&test_ctl_ops, &resp, &control); 421 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 422 423 ui_window_add(window, control); 424 425 resp.unfocus = false; 426 427 ui_window_def_unfocus(window); 428 PCUT_ASSERT_TRUE(resp.unfocus); 390 429 391 430 /* Need to remove first because we didn't implement the destructor */ … … 701 740 } 702 741 742 static void test_ctl_unfocus(void *arg) 743 { 744 test_ctl_resp_t *resp = (test_ctl_resp_t *) arg; 745 746 resp->unfocus = true; 747 } 748 703 749 PCUT_EXPORT(window);
Note:
See TracChangeset
for help on using the changeset viewer.