Ignore:
File:
1 edited

Legend:

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

    r46a47c0 rb71c0fc  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2020 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4141static errno_t test_ctl_paint(void *);
    4242static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *);
    43 static void test_ctl_unfocus(void *, unsigned);
    4443
    4544static ui_control_ops_t test_ctl_ops = {
    4645        .destroy = test_ctl_destroy,
    4746        .paint = test_ctl_paint,
    48         .pos_event = test_ctl_pos_event,
    49         .unfocus = test_ctl_unfocus
     47        .pos_event = test_ctl_pos_event
    5048};
    5149
     
    6462        /** Position event that was sent */
    6563        pos_event_t pevent;
    66         /** @c true iff unfocus was called */
    67         bool unfocus;
    68         /** Number of remaining foci */
    69         unsigned unfocus_nfocus;
    7064} test_resp_t;
    7165
     
    236230}
    237231
    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 
    264232static void test_ctl_destroy(void *arg)
    265233{
     
    287255}
    288256
    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 
    297257PCUT_EXPORT(fixed);
Note: See TracChangeset for help on using the changeset viewer.