Changeset 39ab17c in mainline for uspace/app/nav/test/panel.c
- Timestamp:
- 2021-10-25T00:32:45Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e0377075
- Parents:
- c632c96
- git-author:
- Jiri Svoboda <jiri@…> (2021-10-21 17:44:55)
- git-committer:
- jxsvoboda <5887334+jxsvoboda@…> (2021-10-25 00:32:45)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nav/test/panel.c
rc632c96 r39ab17c 40 40 PCUT_TEST_SUITE(panel); 41 41 42 /** Test response */ 43 typedef struct { 44 bool activate_req; 45 panel_t *activate_req_panel; 46 } test_resp_t; 47 48 static void test_panel_activate_req(void *, panel_t *); 49 50 static panel_cb_t test_cb = { 51 .activate_req = test_panel_activate_req 52 }; 53 42 54 /** Create and destroy panel. */ 43 55 PCUT_TEST(create_destroy) … … 48 60 rc = panel_create(NULL, true, &panel); 49 61 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 62 63 panel_destroy(panel); 64 } 65 66 /** panel_set_cb() sets callback */ 67 PCUT_TEST(set_cb) 68 { 69 panel_t *panel; 70 errno_t rc; 71 test_resp_t resp; 72 73 rc = panel_create(NULL, true, &panel); 74 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 75 76 panel_set_cb(panel, &test_cb, &resp); 77 PCUT_ASSERT_EQUALS(&test_cb, panel->cb); 78 PCUT_ASSERT_EQUALS(&resp, panel->cb_arg); 50 79 51 80 panel_destroy(panel); … … 1426 1455 } 1427 1456 1457 /** panel_activate_req() sends activation request */ 1458 PCUT_TEST(activate_req) 1459 { 1460 panel_t *panel; 1461 errno_t rc; 1462 test_resp_t resp; 1463 1464 rc = panel_create(NULL, true, &panel); 1465 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1466 1467 panel_set_cb(panel, &test_cb, &resp); 1468 1469 resp.activate_req = false; 1470 resp.activate_req_panel = NULL; 1471 1472 panel_activate_req(panel); 1473 PCUT_ASSERT_TRUE(resp.activate_req); 1474 PCUT_ASSERT_EQUALS(panel, resp.activate_req_panel); 1475 1476 panel_destroy(panel); 1477 } 1478 1479 static void test_panel_activate_req(void *arg, panel_t *panel) 1480 { 1481 test_resp_t *resp = (test_resp_t *)arg; 1482 1483 resp->activate_req = true; 1484 resp->activate_req_panel = panel; 1485 } 1486 1428 1487 PCUT_EXPORT(panel);
Note:
See TracChangeset
for help on using the changeset viewer.