Changeset 95a9cbc in mainline
- 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
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/meson.build
r1746ede r95a9cbc 57 57 'test/label.c', 58 58 'test/main.c', 59 'test/menu.c', 60 'test/menubar.c', 61 'test/menuentry.c', 59 62 'test/paint.c', 60 63 'test/pbutton.c', -
uspace/lib/ui/private/menu.h
r1746ede r95a9cbc 39 39 40 40 #include <adt/list.h> 41 #include <gfx/coord.h> 41 42 #include <stdbool.h> 43 #include <types/ui/menu.h> 42 44 43 45 /** Actual structure of menu. -
uspace/lib/ui/private/menubar.h
r1746ede r95a9cbc 40 40 #include <adt/list.h> 41 41 #include <gfx/coord.h> 42 #include <types/ui/menu.h> 42 43 #include <types/ui/menubar.h> 43 44 -
uspace/lib/ui/private/menuentry.h
r1746ede r95a9cbc 76 76 extern void ui_menu_entry_get_geom(ui_menu_entry_t *, gfx_coord2_t *, 77 77 ui_menu_entry_geom_t *); 78 extern void ui_menu_entry_cb(ui_menu_entry_t *); 78 79 79 80 #endif -
uspace/lib/ui/src/menuentry.c
r1746ede r95a9cbc 286 286 287 287 /* Call back */ 288 if (mentry->cb != NULL) 289 mentry->cb(mentry, mentry->arg); 290 } 288 ui_menu_entry_cb(mentry); 289 } 290 } 291 292 /** Call menu entry callback. 293 * 294 * @param mentry Menu entry 295 */ 296 void ui_menu_entry_cb(ui_menu_entry_t *mentry) 297 { 298 if (mentry->cb != NULL) 299 mentry->cb(mentry, mentry->arg); 291 300 } 292 301 -
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.