Changeset 4df6607 in mainline for uspace/lib/ui/test/control.c
- Timestamp:
- 2020-11-01T18:37:09Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c6f00b40
- Parents:
- 8009dc27
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/control.c
r8009dc27 r4df6607 27 27 */ 28 28 29 #include <errno.h> 29 30 #include <mem.h> 30 31 #include <io/pos_event.h> … … 38 39 PCUT_TEST_SUITE(control); 39 40 41 static errno_t test_ctl_paint(void *); 40 42 static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *); 41 43 42 44 static ui_control_ops_t test_ctl_ops = { 45 .paint = test_ctl_paint, 43 46 .pos_event = test_ctl_pos_event 44 47 }; … … 48 51 /** Claim to return */ 49 52 ui_evclaim_t claim; 53 /** Result code to return */ 54 errno_t rc; 55 56 /** @c true iff paint was called */ 57 bool paint; 50 58 51 59 /** @c true iff pos_event was called */ … … 72 80 { 73 81 ui_control_delete(NULL); 82 } 83 84 /** Test sending paint request to control */ 85 PCUT_TEST(paint) 86 { 87 ui_control_t *control = NULL; 88 test_resp_t resp; 89 errno_t rc; 90 91 rc = ui_control_new(&test_ctl_ops, &resp, &control); 92 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 93 PCUT_ASSERT_NOT_NULL(control); 94 95 resp.rc = EOK; 96 resp.paint = false; 97 98 rc = ui_control_paint(control); 99 PCUT_ASSERT_ERRNO_VAL(resp.rc, rc); 100 PCUT_ASSERT_TRUE(resp.paint); 101 102 resp.rc = EINVAL; 103 resp.paint = false; 104 105 rc = ui_control_paint(control); 106 PCUT_ASSERT_ERRNO_VAL(resp.rc, rc); 107 PCUT_ASSERT_TRUE(resp.paint); 108 109 ui_control_delete(control); 74 110 } 75 111 … … 107 143 } 108 144 145 static errno_t test_ctl_paint(void *arg) 146 { 147 test_resp_t *resp = (test_resp_t *) arg; 148 149 resp->paint = true; 150 return resp->rc; 151 } 152 109 153 static ui_evclaim_t test_ctl_pos_event(void *arg, pos_event_t *event) 110 154 {
Note:
See TracChangeset
for help on using the changeset viewer.