Changeset 1aa0e38 in mainline for uspace/lib/ui/test/resource.c
- Timestamp:
- 2021-04-09T22:01:35Z (4 years ago)
- Children:
- 6de45af0
- Parents:
- f5a6e25
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/resource.c
rf5a6e25 r1aa0e38 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 44 44 static errno_t testgc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *); 45 45 46 static void test_expose(void *); 47 46 48 static gfx_context_ops_t ops = { 47 49 .bitmap_create = testgc_bitmap_create, … … 68 70 } testgc_bitmap_t; 69 71 72 typedef struct { 73 bool expose; 74 } test_resp_t; 75 70 76 /** Create and destroy UI resource */ 71 77 PCUT_TEST(create_destroy) … … 97 103 { 98 104 ui_resource_destroy(NULL); 105 } 106 107 /** ui_resource_set_expose_cb() / ui_resource_expose() */ 108 PCUT_TEST(set_expose_cb_expose) 109 { 110 errno_t rc; 111 gfx_context_t *gc = NULL; 112 test_gc_t tgc; 113 ui_resource_t *resource = NULL; 114 test_resp_t resp; 115 116 memset(&tgc, 0, sizeof(tgc)); 117 rc = gfx_context_new(&ops, &tgc, &gc); 118 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 119 120 rc = ui_resource_create(gc, false, &resource); 121 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 122 PCUT_ASSERT_NOT_NULL(resource); 123 124 ui_resource_set_expose_cb(resource, test_expose, &resp); 125 126 resp.expose = false; 127 ui_resource_expose(resource); 128 PCUT_ASSERT_TRUE(resp.expose); 129 130 ui_resource_destroy(resource); 131 132 rc = gfx_context_delete(gc); 133 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 99 134 } 100 135 … … 161 196 } 162 197 198 static void test_expose(void *arg) 199 { 200 test_resp_t *resp = (test_resp_t *) arg; 201 202 resp->expose = true; 203 } 204 163 205 PCUT_EXPORT(resource);
Note:
See TracChangeset
for help on using the changeset viewer.