Changeset 62223ec in mainline for uspace/lib/ui/test/control.c


Ignore:
Timestamp:
2021-04-09T22:41:22Z (4 years ago)
Author:
jxsvoboda <5887334+jxsvoboda@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f251883
Parents:
0262f16c
git-author:
Jiri Svoboda <jiri@…> (2021-04-01 21:04:11)
git-committer:
jxsvoboda <5887334+jxsvoboda@…> (2021-04-09 22:41:22)
Message:

Close menu when window is unfocused

This of course means we need to do all the plumbing for delivering
unfocus event to UI controls.

File:
1 edited

Legend:

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

    r0262f16c r62223ec  
    4242static errno_t test_ctl_paint(void *);
    4343static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *);
     44static void test_ctl_unfocus(void *);
    4445
    4546static ui_control_ops_t test_ctl_ops = {
    4647        .destroy = test_ctl_destroy,
    4748        .paint = test_ctl_paint,
    48         .pos_event = test_ctl_pos_event
     49        .pos_event = test_ctl_pos_event,
     50        .unfocus = test_ctl_unfocus
    4951};
    5052
     
    6668        /** Position event that was sent */
    6769        pos_event_t pevent;
     70
     71        /** @c true iff unfocus was called */
     72        bool unfocus;
    6873} test_resp_t;
    6974
     
    166171}
    167172
     173/** Test sending unfocus to control */
     174PCUT_TEST(unfocus)
     175{
     176        ui_control_t *control = NULL;
     177        test_resp_t resp;
     178        errno_t rc;
     179
     180        rc = ui_control_new(&test_ctl_ops, &resp, &control);
     181        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     182        PCUT_ASSERT_NOT_NULL(control);
     183
     184        resp.unfocus = false;
     185
     186        ui_control_unfocus(control);
     187        PCUT_ASSERT_TRUE(resp.unfocus);
     188
     189        ui_control_delete(control);
     190}
     191
    168192static void test_ctl_destroy(void *arg)
    169193{
     
    191215}
    192216
     217static void test_ctl_unfocus(void *arg)
     218{
     219        test_resp_t *resp = (test_resp_t *) arg;
     220
     221        resp->unfocus = true;
     222}
     223
    193224PCUT_EXPORT(control);
Note: See TracChangeset for help on using the changeset viewer.