Changeset f2416ec3 in mainline for uspace/lib/ui/test/menubar.c
- Timestamp:
- 2021-05-26T07:40:59Z (4 years ago)
- Children:
- 6baab83
- Parents:
- 344f8b9
- git-author:
- Jiri Svoboda <jiri@…> (2021-05-25 18:40:50)
- git-committer:
- Jiri Svoboda <jiri@…> (2021-05-26 07:40:59)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/menubar.c
r344f8b9 rf2416ec3 27 27 */ 28 28 29 #include <gfx/context.h>30 29 #include <gfx/coord.h> 31 30 #include <mem.h> … … 35 34 #include <ui/menu.h> 36 35 #include <ui/menubar.h> 37 #include <ui/resource.h>38 36 #include <ui/ui.h> 39 #include "../private/dummygc.h"37 #include <ui/window.h> 40 38 #include "../private/menubar.h" 41 39 … … 84 82 { 85 83 errno_t rc; 86 dummy_gc_t *dgc; 87 gfx_context_t *gc; 88 ui_resource_t *resource = NULL; 89 ui_menu_bar_t *mbar = NULL; 90 gfx_rect_t rect; 91 92 rc = dummygc_create(&dgc); 93 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 94 95 gc = dummygc_get_ctx(dgc); 96 97 rc = ui_resource_create(gc, false, &resource); 98 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 99 PCUT_ASSERT_NOT_NULL(resource); 100 101 rc = ui_menu_bar_create(NULL, resource, &mbar); 84 ui_t *ui = NULL; 85 ui_window_t *window = NULL; 86 ui_wnd_params_t params; 87 ui_menu_bar_t *mbar = NULL; 88 gfx_rect_t rect; 89 90 rc = ui_create_disp(NULL, &ui); 91 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 92 93 ui_wnd_params_init(¶ms); 94 params.caption = "Hello"; 95 96 rc = ui_window_create(ui, ¶ms, &window); 97 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 98 PCUT_ASSERT_NOT_NULL(window); 99 100 rc = ui_menu_bar_create(ui, window, &mbar); 102 101 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 103 102 PCUT_ASSERT_NOT_NULL(mbar); … … 115 114 116 115 ui_menu_bar_destroy(mbar); 117 ui_ resource_destroy(resource);118 dummygc_destroy(dgc);116 ui_window_destroy(window); 117 ui_destroy(ui); 119 118 } 120 119 … … 122 121 PCUT_TEST(paint) 123 122 { 124 dummy_gc_t *dgc; 125 gfx_context_t *gc; 126 ui_resource_t *resource = NULL; 127 ui_menu_bar_t *mbar = NULL; 128 errno_t rc; 129 130 rc = dummygc_create(&dgc); 131 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 132 133 gc = dummygc_get_ctx(dgc); 134 135 rc = ui_resource_create(gc, false, &resource); 136 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 137 PCUT_ASSERT_NOT_NULL(resource); 138 139 rc = ui_menu_bar_create(NULL, resource, &mbar); 123 ui_t *ui = NULL; 124 ui_window_t *window = NULL; 125 ui_wnd_params_t params; 126 ui_menu_bar_t *mbar = NULL; 127 errno_t rc; 128 129 rc = ui_create_disp(NULL, &ui); 130 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 131 132 ui_wnd_params_init(¶ms); 133 params.caption = "Hello"; 134 135 rc = ui_window_create(ui, ¶ms, &window); 136 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 137 PCUT_ASSERT_NOT_NULL(window); 138 139 rc = ui_menu_bar_create(ui, window, &mbar); 140 140 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 141 141 PCUT_ASSERT_NOT_NULL(mbar); … … 145 145 146 146 ui_menu_bar_destroy(mbar); 147 ui_ resource_destroy(resource);148 dummygc_destroy(dgc);147 ui_window_destroy(window); 148 ui_destroy(ui); 149 149 } 150 150 … … 152 152 PCUT_TEST(pos_event_select) 153 153 { 154 dummy_gc_t *dgc; 155 gfx_context_t *gc; 156 ui_t *ui = NULL; 157 ui_resource_t *resource = NULL; 154 ui_t *ui = NULL; 155 ui_window_t *window = NULL; 156 ui_wnd_params_t params; 158 157 ui_menu_bar_t *mbar = NULL; 159 158 ui_menu_t *menu = NULL; … … 163 162 errno_t rc; 164 163 165 rc = dummygc_create(&dgc); 166 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 167 168 gc = dummygc_get_ctx(dgc); 169 170 rc = ui_create_disp(NULL, &ui); 171 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 172 173 rc = ui_resource_create(gc, false, &resource); 174 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 175 PCUT_ASSERT_NOT_NULL(resource); 176 177 rc = ui_menu_bar_create(ui, resource, &mbar); 164 rc = ui_create_disp(NULL, &ui); 165 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 166 167 ui_wnd_params_init(¶ms); 168 params.caption = "Hello"; 169 170 rc = ui_window_create(ui, ¶ms, &window); 171 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 172 PCUT_ASSERT_NOT_NULL(window); 173 174 rc = ui_menu_bar_create(ui, window, &mbar); 178 175 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 179 176 PCUT_ASSERT_NOT_NULL(mbar); … … 200 197 201 198 ui_menu_bar_destroy(mbar); 202 ui_resource_destroy(resource); 203 ui_destroy(ui); 204 dummygc_destroy(dgc); 199 ui_window_destroy(window); 200 ui_destroy(ui); 205 201 } 206 202 … … 208 204 PCUT_TEST(select_same) 209 205 { 210 dummy_gc_t *dgc; 211 gfx_context_t *gc; 212 ui_t *ui = NULL; 213 ui_resource_t *resource = NULL; 206 ui_t *ui = NULL; 207 ui_window_t *window = NULL; 208 ui_wnd_params_t params; 214 209 ui_menu_bar_t *mbar = NULL; 215 210 ui_menu_t *menu = NULL; … … 217 212 errno_t rc; 218 213 219 rc = dummygc_create(&dgc); 220 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 221 222 gc = dummygc_get_ctx(dgc); 223 224 rc = ui_create_disp(NULL, &ui); 225 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 226 227 rc = ui_resource_create(gc, false, &resource); 228 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 229 PCUT_ASSERT_NOT_NULL(resource); 230 231 rc = ui_menu_bar_create(ui, resource, &mbar); 214 rc = ui_create_disp(NULL, &ui); 215 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 216 217 ui_wnd_params_init(¶ms); 218 params.caption = "Hello"; 219 220 rc = ui_window_create(ui, ¶ms, &window); 221 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 222 PCUT_ASSERT_NOT_NULL(window); 223 224 rc = ui_menu_bar_create(ui, window, &mbar); 232 225 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 233 226 PCUT_ASSERT_NOT_NULL(mbar); … … 249 242 250 243 ui_menu_bar_destroy(mbar); 251 ui_resource_destroy(resource); 252 ui_destroy(ui); 253 dummygc_destroy(dgc); 244 ui_window_destroy(window); 245 ui_destroy(ui); 254 246 } 255 247 … … 257 249 PCUT_TEST(select_different) 258 250 { 259 dummy_gc_t *dgc; 260 gfx_context_t *gc; 261 ui_t *ui = NULL; 262 ui_resource_t *resource = NULL; 251 ui_t *ui = NULL; 252 ui_window_t *window = NULL; 253 ui_wnd_params_t params; 263 254 ui_menu_bar_t *mbar = NULL; 264 255 ui_menu_t *menu1 = NULL; … … 267 258 errno_t rc; 268 259 269 rc = dummygc_create(&dgc); 270 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 271 272 gc = dummygc_get_ctx(dgc); 273 274 rc = ui_create_disp(NULL, &ui); 275 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 276 277 rc = ui_resource_create(gc, false, &resource); 278 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 279 PCUT_ASSERT_NOT_NULL(resource); 280 281 rc = ui_menu_bar_create(ui, resource, &mbar); 260 rc = ui_create_disp(NULL, &ui); 261 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 262 263 ui_wnd_params_init(¶ms); 264 params.caption = "Hello"; 265 266 rc = ui_window_create(ui, ¶ms, &window); 267 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 268 PCUT_ASSERT_NOT_NULL(window); 269 270 rc = ui_menu_bar_create(ui, window, &mbar); 282 271 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 283 272 PCUT_ASSERT_NOT_NULL(mbar); … … 303 292 304 293 ui_menu_bar_destroy(mbar); 305 ui_resource_destroy(resource); 306 ui_destroy(ui); 307 dummygc_destroy(dgc); 294 ui_window_destroy(window); 295 ui_destroy(ui); 308 296 } 309 297
Note:
See TracChangeset
for help on using the changeset viewer.