Changes in uspace/lib/ui/test/fixed.c [b71c0fc:46a47c0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/fixed.c
rb71c0fc r46a47c0 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 41 41 static errno_t test_ctl_paint(void *); 42 42 static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *); 43 static void test_ctl_unfocus(void *, unsigned); 43 44 44 45 static ui_control_ops_t test_ctl_ops = { 45 46 .destroy = test_ctl_destroy, 46 47 .paint = test_ctl_paint, 47 .pos_event = test_ctl_pos_event 48 .pos_event = test_ctl_pos_event, 49 .unfocus = test_ctl_unfocus 48 50 }; 49 51 … … 62 64 /** Position event that was sent */ 63 65 pos_event_t pevent; 66 /** @c true iff unfocus was called */ 67 bool unfocus; 68 /** Number of remaining foci */ 69 unsigned unfocus_nfocus; 64 70 } test_resp_t; 65 71 … … 230 236 } 231 237 238 /** ui_fixed_unfocus() delivers unfocus notification to control */ 239 PCUT_TEST(unfocus) 240 { 241 ui_fixed_t *fixed = NULL; 242 ui_control_t *control; 243 test_resp_t resp; 244 errno_t rc; 245 246 rc = ui_fixed_create(&fixed); 247 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 248 249 rc = ui_control_new(&test_ctl_ops, (void *) &resp, &control); 250 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 251 252 rc = ui_fixed_add(fixed, control); 253 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 254 255 resp.unfocus = false; 256 257 ui_fixed_unfocus(fixed, 42); 258 PCUT_ASSERT_TRUE(resp.unfocus); 259 PCUT_ASSERT_INT_EQUALS(42, resp.unfocus_nfocus); 260 261 ui_fixed_destroy(fixed); 262 } 263 232 264 static void test_ctl_destroy(void *arg) 233 265 { … … 255 287 } 256 288 289 static void test_ctl_unfocus(void *arg, unsigned nfocus) 290 { 291 test_resp_t *resp = (test_resp_t *) arg; 292 293 resp->unfocus = true; 294 resp->unfocus_nfocus = nfocus; 295 } 296 257 297 PCUT_EXPORT(fixed);
Note:
See TracChangeset
for help on using the changeset viewer.