Changeset 95a9cbc in mainline for uspace/lib/ui/test
- Timestamp:
- 2021-04-09T22:41:22Z (4 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d65accb
- Parents:
- 1746ede
- git-author:
- Jiri Svoboda <jiri@…> (2021-04-09 22:01:35)
- git-committer:
- jxsvoboda <5887334+jxsvoboda@…> (2021-04-09 22:41:22)
- Location:
- uspace/lib/ui/test
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/image.c
r1746ede r95a9cbc 43 43 PCUT_TEST_SUITE(image); 44 44 45 typedef struct {46 bool clicked;47 } test_cb_resp_t;48 49 45 /** Create and destroy image */ 50 46 PCUT_TEST(create_destroy) -
uspace/lib/ui/test/main.c
r1746ede r95a9cbc 37 37 PCUT_IMPORT(image); 38 38 PCUT_IMPORT(label); 39 PCUT_IMPORT(menu); 40 PCUT_IMPORT(menubar); 41 PCUT_IMPORT(menuentry); 39 42 PCUT_IMPORT(paint); 40 43 PCUT_IMPORT(pbutton); -
uspace/lib/ui/test/resource.c
r1746ede r95a9cbc 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.