Changeset f2416ec3 in mainline for uspace/lib/ui/test/menu.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/menu.c
r344f8b9 rf2416ec3 36 36 #include <ui/menu.h> 37 37 #include <ui/menubar.h> 38 #include <ui/resource.h>39 38 #include <ui/ui.h> 40 #include "../private/dummygc.h"39 #include <ui/window.h> 41 40 #include "../private/menu.h" 42 41 #include "../private/menubar.h" … … 78 77 PCUT_TEST(first_next) 79 78 { 80 dummy_gc_t *dgc;81 gfx_context_t *gc;82 ui_ resource_t *resource = NULL;79 ui_t *ui = NULL; 80 ui_window_t *window = NULL; 81 ui_wnd_params_t params; 83 82 ui_menu_bar_t *mbar = NULL; 84 83 ui_menu_t *menu1 = NULL; … … 87 86 errno_t rc; 88 87 89 rc = dummygc_create(&dgc); 90 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 91 92 gc = dummygc_get_ctx(dgc); 93 94 rc = ui_resource_create(gc, false, &resource); 95 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 96 PCUT_ASSERT_NOT_NULL(resource); 97 98 rc = ui_menu_bar_create(NULL, resource, &mbar); 88 rc = ui_create_disp(NULL, &ui); 89 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 90 91 ui_wnd_params_init(¶ms); 92 params.caption = "Hello"; 93 94 rc = ui_window_create(ui, ¶ms, &window); 95 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 96 PCUT_ASSERT_NOT_NULL(window); 97 98 rc = ui_menu_bar_create(ui, window, &mbar); 99 99 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 100 100 PCUT_ASSERT_NOT_NULL(mbar); … … 118 118 119 119 ui_menu_bar_destroy(mbar); 120 ui_ resource_destroy(resource);121 dummygc_destroy(dgc);120 ui_window_destroy(window); 121 ui_destroy(ui); 122 122 } 123 123 … … 125 125 PCUT_TEST(caption) 126 126 { 127 dummy_gc_t *dgc;128 gfx_context_t *gc;129 ui_ resource_t *resource = NULL;127 ui_t *ui = NULL; 128 ui_window_t *window = NULL; 129 ui_wnd_params_t params; 130 130 ui_menu_bar_t *mbar = NULL; 131 131 ui_menu_t *menu = NULL; … … 133 133 errno_t rc; 134 134 135 rc = dummygc_create(&dgc); 136 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 137 138 gc = dummygc_get_ctx(dgc); 139 140 rc = ui_resource_create(gc, false, &resource); 141 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 142 PCUT_ASSERT_NOT_NULL(resource); 143 144 rc = ui_menu_bar_create(NULL, resource, &mbar); 135 rc = ui_create_disp(NULL, &ui); 136 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 137 138 ui_wnd_params_init(¶ms); 139 params.caption = "Hello"; 140 141 rc = ui_window_create(ui, ¶ms, &window); 142 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 143 PCUT_ASSERT_NOT_NULL(window); 144 145 rc = ui_menu_bar_create(ui, window, &mbar); 145 146 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 146 147 PCUT_ASSERT_NOT_NULL(mbar); … … 156 157 157 158 ui_menu_bar_destroy(mbar); 158 ui_ resource_destroy(resource);159 dummygc_destroy(dgc);159 ui_window_destroy(window); 160 ui_destroy(ui); 160 161 } 161 162 … … 163 164 PCUT_TEST(get_rect) 164 165 { 165 dummy_gc_t *dgc;166 gfx_context_t *gc;167 ui_ resource_t *resource = NULL;166 ui_t *ui = NULL; 167 ui_window_t *window = NULL; 168 ui_wnd_params_t params; 168 169 ui_menu_bar_t *mbar = NULL; 169 170 ui_menu_t *menu = NULL; … … 173 174 errno_t rc; 174 175 175 rc = dummygc_create(&dgc); 176 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 177 178 gc = dummygc_get_ctx(dgc); 179 180 rc = ui_resource_create(gc, false, &resource); 181 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 182 PCUT_ASSERT_NOT_NULL(resource); 183 184 rc = ui_menu_bar_create(NULL, resource, &mbar); 176 rc = ui_create_disp(NULL, &ui); 177 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 178 179 ui_wnd_params_init(¶ms); 180 params.caption = "Hello"; 181 182 rc = ui_window_create(ui, ¶ms, &window); 183 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 184 PCUT_ASSERT_NOT_NULL(window); 185 186 rc = ui_menu_bar_create(ui, window, &mbar); 185 187 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 186 188 PCUT_ASSERT_NOT_NULL(mbar); … … 203 205 204 206 ui_menu_bar_destroy(mbar); 205 ui_ resource_destroy(resource);206 dummygc_destroy(dgc);207 ui_window_destroy(window); 208 ui_destroy(ui); 207 209 } 208 210 … … 210 212 PCUT_TEST(paint) 211 213 { 212 dummy_gc_t *dgc; 213 gfx_context_t *gc; 214 ui_t *ui = NULL; 215 ui_resource_t *resource = NULL; 214 ui_t *ui = NULL; 215 ui_window_t *window = NULL; 216 ui_wnd_params_t params; 216 217 ui_menu_bar_t *mbar = NULL; 217 218 ui_menu_t *menu = NULL; … … 220 221 errno_t rc; 221 222 222 rc = dummygc_create(&dgc); 223 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 224 225 gc = dummygc_get_ctx(dgc); 226 227 rc = ui_create_disp(NULL, &ui); 228 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 229 230 rc = ui_resource_create(gc, false, &resource); 231 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 232 PCUT_ASSERT_NOT_NULL(resource); 233 234 rc = ui_menu_bar_create(ui, resource, &mbar); 223 rc = ui_create_disp(NULL, &ui); 224 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 225 226 ui_wnd_params_init(¶ms); 227 params.caption = "Hello"; 228 229 rc = ui_window_create(ui, ¶ms, &window); 230 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 231 PCUT_ASSERT_NOT_NULL(window); 232 233 rc = ui_menu_bar_create(ui, window, &mbar); 235 234 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 236 235 PCUT_ASSERT_NOT_NULL(mbar); … … 255 254 256 255 ui_menu_bar_destroy(mbar); 257 ui_resource_destroy(resource); 258 ui_destroy(ui); 259 dummygc_destroy(dgc); 256 ui_window_destroy(window); 257 ui_destroy(ui); 260 258 } 261 259 … … 263 261 PCUT_TEST(pos_event_inside) 264 262 { 265 dummy_gc_t *dgc;266 gfx_context_t *gc;267 ui_ resource_t *resource = NULL;263 ui_t *ui = NULL; 264 ui_window_t *window = NULL; 265 ui_wnd_params_t params; 268 266 ui_menu_bar_t *mbar = NULL; 269 267 ui_menu_t *menu = NULL; … … 273 271 errno_t rc; 274 272 275 rc = dummygc_create(&dgc); 276 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 277 278 gc = dummygc_get_ctx(dgc); 279 280 rc = ui_resource_create(gc, false, &resource); 281 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 282 PCUT_ASSERT_NOT_NULL(resource); 283 284 rc = ui_menu_bar_create(NULL, resource, &mbar); 273 rc = ui_create_disp(NULL, &ui); 274 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 275 276 ui_wnd_params_init(¶ms); 277 params.caption = "Hello"; 278 279 rc = ui_window_create(ui, ¶ms, &window); 280 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 281 PCUT_ASSERT_NOT_NULL(window); 282 283 rc = ui_menu_bar_create(ui, window, &mbar); 285 284 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 286 285 PCUT_ASSERT_NOT_NULL(mbar); … … 299 298 300 299 ui_menu_bar_destroy(mbar); 301 ui_ resource_destroy(resource);302 dummygc_destroy(dgc);300 ui_window_destroy(window); 301 ui_destroy(ui); 303 302 } 304 303 … … 306 305 PCUT_TEST(get_geom) 307 306 { 308 dummy_gc_t *dgc;309 gfx_context_t *gc;310 ui_ resource_t *resource = NULL;307 ui_t *ui = NULL; 308 ui_window_t *window = NULL; 309 ui_wnd_params_t params; 311 310 ui_menu_bar_t *mbar = NULL; 312 311 ui_menu_t *menu = NULL; … … 315 314 errno_t rc; 316 315 317 rc = dummygc_create(&dgc); 318 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 319 320 gc = dummygc_get_ctx(dgc); 321 322 rc = ui_resource_create(gc, false, &resource); 323 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 324 PCUT_ASSERT_NOT_NULL(resource); 325 326 rc = ui_menu_bar_create(NULL, resource, &mbar); 316 rc = ui_create_disp(NULL, &ui); 317 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 318 319 ui_wnd_params_init(¶ms); 320 params.caption = "Hello"; 321 322 rc = ui_window_create(ui, ¶ms, &window); 323 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 324 PCUT_ASSERT_NOT_NULL(window); 325 326 rc = ui_menu_bar_create(ui, window, &mbar); 327 327 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 328 328 PCUT_ASSERT_NOT_NULL(mbar); … … 346 346 347 347 ui_menu_bar_destroy(mbar); 348 ui_ resource_destroy(resource);349 dummygc_destroy(dgc);348 ui_window_destroy(window); 349 ui_destroy(ui); 350 350 } 351 351
Note:
See TracChangeset
for help on using the changeset viewer.