Changeset 692c7f40 in mainline for uspace/app/nav/test/panel.c
- Timestamp:
- 2021-10-25T00:32:45Z (4 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1eb0fafe
- Parents:
- 2fb49522
- git-author:
- Jiri Svoboda <jiri@…> (2021-10-13 18:40:48)
- git-committer:
- jxsvoboda <5887334+jxsvoboda@…> (2021-10-25 00:32:45)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nav/test/panel.c
r2fb49522 r692c7f40 46 46 errno_t rc; 47 47 48 rc = panel_create(NULL, &panel);48 rc = panel_create(NULL, true, &panel); 49 49 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 50 50 … … 70 70 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 71 71 72 rc = panel_create(window, &panel);72 rc = panel_create(window, true, &panel); 73 73 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 74 74 … … 102 102 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 103 103 104 rc = panel_create(window, &panel);104 rc = panel_create(window, true, &panel); 105 105 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 106 106 … … 120 120 errno_t rc; 121 121 122 rc = panel_create(NULL, &panel);122 rc = panel_create(NULL, true, &panel); 123 123 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 124 124 … … 133 133 { 134 134 panel_t *panel; 135 ui_control_t *control;136 135 ui_evclaim_t claimed; 137 136 kbd_event_t event; 138 137 errno_t rc; 139 138 140 rc = panel_create(NULL, &panel); 141 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 142 143 control = panel_ctl(panel); 144 PCUT_ASSERT_NOT_NULL(control); 139 /* Active panel should claim events */ 140 141 rc = panel_create(NULL, true, &panel); 142 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 145 143 146 144 event.type = KEY_PRESS; … … 150 148 151 149 claimed = panel_kbd_event(panel, &event); 150 PCUT_ASSERT_EQUALS(ui_claimed, claimed); 151 152 panel_destroy(panel); 153 154 /* Inactive panel should not claim events */ 155 156 rc = panel_create(NULL, false, &panel); 157 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 158 159 event.type = KEY_PRESS; 160 event.key = KC_ENTER; 161 event.mods = 0; 162 event.c = '\0'; 163 164 claimed = panel_kbd_event(panel, &event); 152 165 PCUT_ASSERT_EQUALS(ui_unclaimed, claimed); 153 166 … … 159 172 { 160 173 panel_t *panel; 161 ui_control_t *control;162 174 ui_evclaim_t claimed; 163 175 pos_event_t event; 164 176 errno_t rc; 165 177 166 rc = panel_create(NULL, &panel); 167 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 168 169 control = panel_ctl(panel); 170 PCUT_ASSERT_NOT_NULL(control); 178 rc = panel_create(NULL, true, &panel); 179 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 171 180 172 181 event.pos_id = 0; … … 186 195 { 187 196 panel_t *panel; 188 ui_control_t *control;189 197 gfx_rect_t rect; 190 198 errno_t rc; 191 199 192 rc = panel_create(NULL, &panel); 193 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 194 195 control = panel_ctl(panel); 196 PCUT_ASSERT_NOT_NULL(control); 200 rc = panel_create(NULL, true, &panel); 201 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 197 202 198 203 rect.p0.x = 1; … … 214 219 { 215 220 panel_t *panel; 216 ui_control_t *control;217 221 gfx_rect_t rect; 218 222 errno_t rc; 219 223 220 rc = panel_create(NULL, &panel); 221 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 222 223 control = panel_ctl(panel); 224 PCUT_ASSERT_NOT_NULL(control); 224 rc = panel_create(NULL, true, &panel); 225 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 225 226 226 227 rect.p0.x = 10; … … 237 238 } 238 239 240 /** panel_is_active() returns panel activity state */ 241 PCUT_TEST(is_active) 242 { 243 panel_t *panel; 244 errno_t rc; 245 246 rc = panel_create(NULL, true, &panel); 247 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 248 PCUT_ASSERT_TRUE(panel_is_active(panel)); 249 panel_destroy(panel); 250 251 rc = panel_create(NULL, false, &panel); 252 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 253 PCUT_ASSERT_FALSE(panel_is_active(panel)); 254 panel_destroy(panel); 255 } 256 257 /** panel_activate() activates panel */ 258 PCUT_TEST(activate) 259 { 260 ui_t *ui; 261 ui_window_t *window; 262 ui_wnd_params_t params; 263 panel_t *panel; 264 errno_t rc; 265 266 rc = ui_create_disp(NULL, &ui); 267 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 268 269 ui_wnd_params_init(¶ms); 270 params.caption = "Test"; 271 272 rc = ui_window_create(ui, ¶ms, &window); 273 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 274 275 rc = panel_create(window, false, &panel); 276 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 277 278 PCUT_ASSERT_FALSE(panel_is_active(panel)); 279 panel_activate(panel); 280 PCUT_ASSERT_TRUE(panel_is_active(panel)); 281 282 panel_destroy(panel); 283 ui_window_destroy(window); 284 ui_destroy(ui); 285 } 286 287 /** panel_deactivate() deactivates panel */ 288 PCUT_TEST(deactivate) 289 { 290 ui_t *ui; 291 ui_window_t *window; 292 ui_wnd_params_t params; 293 panel_t *panel; 294 errno_t rc; 295 296 rc = ui_create_disp(NULL, &ui); 297 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 298 299 ui_wnd_params_init(¶ms); 300 params.caption = "Test"; 301 302 rc = ui_window_create(ui, ¶ms, &window); 303 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 304 305 rc = panel_create(window, true, &panel); 306 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 307 308 PCUT_ASSERT_TRUE(panel_is_active(panel)); 309 panel_deactivate(panel); 310 PCUT_ASSERT_FALSE(panel_is_active(panel)); 311 312 panel_destroy(panel); 313 ui_window_destroy(window); 314 ui_destroy(ui); 315 } 316 239 317 /** panel_entry_append() appends new entry */ 240 318 PCUT_TEST(entry_append) … … 243 321 errno_t rc; 244 322 245 rc = panel_create(NULL, &panel);323 rc = panel_create(NULL, true, &panel); 246 324 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 247 325 … … 266 344 errno_t rc; 267 345 268 rc = panel_create(NULL, &panel);346 rc = panel_create(NULL, true, &panel); 269 347 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 270 348 … … 296 374 errno_t rc; 297 375 298 rc = panel_create(NULL, &panel);376 rc = panel_create(NULL, true, &panel); 299 377 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 300 378 … … 345 423 PCUT_ASSERT_INT_EQUALS(0, rv); 346 424 347 rc = panel_create(NULL, &panel);425 rc = panel_create(NULL, true, &panel); 348 426 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 349 427 … … 375 453 errno_t rc; 376 454 377 rc = panel_create(NULL, &panel);455 rc = panel_create(NULL, true, &panel); 378 456 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 379 457 … … 411 489 errno_t rc; 412 490 413 rc = panel_create(NULL, &panel);491 rc = panel_create(NULL, true, &panel); 414 492 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 415 493 … … 447 525 errno_t rc; 448 526 449 rc = panel_create(NULL, &panel);527 rc = panel_create(NULL, true, &panel); 450 528 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 451 529 … … 484 562 errno_t rc; 485 563 486 rc = panel_create(NULL, &panel);564 rc = panel_create(NULL, true, &panel); 487 565 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 488 566 … … 538 616 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 539 617 540 rc = panel_create(window, &panel);618 rc = panel_create(window, true, &panel); 541 619 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 542 620 … … 619 697 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 620 698 621 rc = panel_create(window, &panel);699 rc = panel_create(window, true, &panel); 622 700 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 623 701 … … 702 780 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 703 781 704 rc = panel_create(window, &panel);782 rc = panel_create(window, true, &panel); 705 783 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 706 784 … … 763 841 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 764 842 765 rc = panel_create(window, &panel);843 rc = panel_create(window, true, &panel); 766 844 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 767 845 … … 825 903 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 826 904 827 rc = panel_create(window, &panel);905 rc = panel_create(window, true, &panel); 828 906 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 829 907 … … 913 991 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 914 992 915 rc = panel_create(window, &panel);993 rc = panel_create(window, true, &panel); 916 994 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 917 995
Note:
See TracChangeset
for help on using the changeset viewer.