Changeset f0ccb2a 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:
- 4d2a4cd
- Parents:
- f536a16
- git-author:
- Jiri Svoboda <jiri@…> (2021-04-02 17:35:19)
- git-committer:
- jxsvoboda <5887334+jxsvoboda@…> (2021-04-09 22:41:22)
- Location:
- uspace/lib/ui
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/dummygc.c
rf536a16 rf0ccb2a 43 43 static errno_t dummygc_set_color(void *, gfx_color_t *); 44 44 static errno_t dummygc_fill_rect(void *, gfx_rect_t *); 45 static errno_t dummygc_update(void *); 45 46 static errno_t dummygc_bitmap_create(void *, gfx_bitmap_params_t *, 46 47 gfx_bitmap_alloc_t *, void **); … … 53 54 .set_color = dummygc_set_color, 54 55 .fill_rect = dummygc_fill_rect, 56 .update = dummygc_update, 55 57 .bitmap_create = dummygc_bitmap_create, 56 58 .bitmap_destroy = dummygc_bitmap_destroy, … … 128 130 (void) arg; 129 131 (void) rect; 132 return EOK; 133 } 134 135 /** Update dummy GC 136 * 137 * @param arg Argument (dummy_gc_t) 138 * @return EOK on success or an error code 139 */ 140 static errno_t dummygc_update(void *arg) 141 { 142 (void) arg; 130 143 return EOK; 131 144 } -
uspace/lib/ui/test/checkbox.c
rf536a16 rf0ccb2a 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 43 43 static errno_t testgc_set_color(void *, gfx_color_t *); 44 44 static errno_t testgc_fill_rect(void *, gfx_rect_t *); 45 static errno_t testgc_update(void *); 45 46 static errno_t testgc_bitmap_create(void *, gfx_bitmap_params_t *, 46 47 gfx_bitmap_alloc_t *, void **); … … 52 53 .set_color = testgc_set_color, 53 54 .fill_rect = testgc_fill_rect, 55 .update = testgc_update, 54 56 .bitmap_create = testgc_bitmap_create, 55 57 .bitmap_destroy = testgc_bitmap_destroy, … … 492 494 (void) arg; 493 495 (void) rect; 496 return EOK; 497 } 498 499 static errno_t testgc_update(void *arg) 500 { 501 (void) arg; 494 502 return EOK; 495 503 } -
uspace/lib/ui/test/entry.c
rf536a16 rf0ccb2a 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 43 43 static errno_t testgc_set_color(void *, gfx_color_t *); 44 44 static errno_t testgc_fill_rect(void *, gfx_rect_t *); 45 static errno_t testgc_update(void *); 45 46 static errno_t testgc_bitmap_create(void *, gfx_bitmap_params_t *, 46 47 gfx_bitmap_alloc_t *, void **); … … 52 53 .set_color = testgc_set_color, 53 54 .fill_rect = testgc_fill_rect, 55 .update = testgc_update, 54 56 .bitmap_create = testgc_bitmap_create, 55 57 .bitmap_destroy = testgc_bitmap_destroy, … … 220 222 (void) arg; 221 223 (void) rect; 224 return EOK; 225 } 226 227 static errno_t testgc_update(void *arg) 228 { 229 (void) arg; 222 230 return EOK; 223 231 } -
uspace/lib/ui/test/image.c
rf536a16 rf0ccb2a 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 34 34 #include <ui/control.h> 35 35 #include <ui/image.h> 36 #include <ui/resource.h> 36 37 #include <ui/ui.h> 37 38 #include "../private/dummygc.h" … … 87 88 PCUT_TEST(set_rect) 88 89 { 90 errno_t rc; 91 dummy_gc_t *dgc; 92 gfx_context_t *gc; 93 ui_resource_t *resource = NULL; 89 94 ui_image_t *image = NULL; 90 95 gfx_rect_t brect; 91 96 gfx_rect_t rect; 92 errno_t rc; 93 94 rc = ui_image_create(NULL, NULL, &brect, &image); 97 98 rc = dummygc_create(&dgc); 99 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 100 101 gc = dummygc_get_ctx(dgc); 102 103 rc = ui_resource_create(gc, false, &resource); 104 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 105 PCUT_ASSERT_NOT_NULL(resource); 106 107 rc = ui_image_create(resource, NULL, &brect, &image); 95 108 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 96 109 PCUT_ASSERT_NOT_NULL(image); … … 108 121 109 122 ui_image_destroy(image); 123 ui_resource_destroy(resource); 124 dummygc_destroy(dgc); 110 125 } 111 126 … … 139 154 dummy_gc_t *dgc; 140 155 gfx_context_t *gc; 156 ui_resource_t *resource = NULL; 141 157 errno_t rc; 142 158 … … 146 162 gc = dummygc_get_ctx(dgc); 147 163 148 rc = ui_image_create(NULL, NULL, &brect, &image); 164 rc = ui_resource_create(gc, false, &resource); 165 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 166 PCUT_ASSERT_NOT_NULL(resource); 167 168 rc = ui_image_create(resource, NULL, &brect, &image); 149 169 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 150 170 PCUT_ASSERT_NOT_NULL(image); … … 172 192 173 193 ui_image_destroy(image); 194 ui_resource_destroy(resource); 195 dummygc_destroy(dgc); 174 196 } 175 197 … … 181 203 gfx_bitmap_params_t params; 182 204 gfx_bitmap_t *bitmap; 205 ui_resource_t *resource = NULL; 183 206 ui_image_t *image = NULL; 184 207 gfx_rect_t brect; … … 189 212 190 213 gc = dummygc_get_ctx(dgc); 214 215 rc = ui_resource_create(gc, false, &resource); 216 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 217 PCUT_ASSERT_NOT_NULL(resource); 191 218 192 219 gfx_bitmap_params_init(¶ms); … … 194 221 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 195 222 196 rc = ui_image_create( NULL, bitmap, &brect, &image);223 rc = ui_image_create(resource, bitmap, &brect, &image); 197 224 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 198 225 PCUT_ASSERT_NOT_NULL(image); … … 209 236 210 237 ui_image_destroy(image); 238 ui_resource_destroy(resource); 239 dummygc_destroy(dgc); 211 240 } 212 241 -
uspace/lib/ui/test/label.c
rf536a16 rf0ccb2a 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 43 43 static errno_t testgc_set_color(void *, gfx_color_t *); 44 44 static errno_t testgc_fill_rect(void *, gfx_rect_t *); 45 static errno_t testgc_update(void *); 45 46 static errno_t testgc_bitmap_create(void *, gfx_bitmap_params_t *, 46 47 gfx_bitmap_alloc_t *, void **); … … 52 53 .set_color = testgc_set_color, 53 54 .fill_rect = testgc_fill_rect, 55 .update = testgc_update, 54 56 .bitmap_create = testgc_bitmap_create, 55 57 .bitmap_destroy = testgc_bitmap_destroy, … … 220 222 (void) arg; 221 223 (void) rect; 224 return EOK; 225 } 226 227 static errno_t testgc_update(void *arg) 228 { 229 (void) arg; 222 230 return EOK; 223 231 } -
uspace/lib/ui/test/pbutton.c
rf536a16 rf0ccb2a 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 43 43 static errno_t testgc_set_color(void *, gfx_color_t *); 44 44 static errno_t testgc_fill_rect(void *, gfx_rect_t *); 45 static errno_t testgc_update(void *); 45 46 static errno_t testgc_bitmap_create(void *, gfx_bitmap_params_t *, 46 47 gfx_bitmap_alloc_t *, void **); … … 52 53 .set_color = testgc_set_color, 53 54 .fill_rect = testgc_fill_rect, 55 .update = testgc_update, 54 56 .bitmap_create = testgc_bitmap_create, 55 57 .bitmap_destroy = testgc_bitmap_destroy, … … 499 501 (void) arg; 500 502 (void) rect; 503 return EOK; 504 } 505 506 static errno_t testgc_update(void *arg) 507 { 508 (void) arg; 501 509 return EOK; 502 510 } -
uspace/lib/ui/test/rbutton.c
rf536a16 rf0ccb2a 43 43 static errno_t testgc_set_color(void *, gfx_color_t *); 44 44 static errno_t testgc_fill_rect(void *, gfx_rect_t *); 45 static errno_t testgc_update(void *); 45 46 static errno_t testgc_bitmap_create(void *, gfx_bitmap_params_t *, 46 47 gfx_bitmap_alloc_t *, void **); … … 52 53 .set_color = testgc_set_color, 53 54 .fill_rect = testgc_fill_rect, 55 .update = testgc_update, 54 56 .bitmap_create = testgc_bitmap_create, 55 57 .bitmap_destroy = testgc_bitmap_destroy, … … 564 566 (void) arg; 565 567 (void) rect; 568 return EOK; 569 } 570 571 static errno_t testgc_update(void *arg) 572 { 573 (void) arg; 566 574 return EOK; 567 575 } -
uspace/lib/ui/test/slider.c
rf536a16 rf0ccb2a 43 43 static errno_t testgc_set_color(void *, gfx_color_t *); 44 44 static errno_t testgc_fill_rect(void *, gfx_rect_t *); 45 static errno_t testgc_update(void *); 45 46 static errno_t testgc_bitmap_create(void *, gfx_bitmap_params_t *, 46 47 gfx_bitmap_alloc_t *, void **); … … 52 53 .set_color = testgc_set_color, 53 54 .fill_rect = testgc_fill_rect, 55 .update = testgc_update, 54 56 .bitmap_create = testgc_bitmap_create, 55 57 .bitmap_destroy = testgc_bitmap_destroy, … … 439 441 (void) arg; 440 442 (void) rect; 443 return EOK; 444 } 445 446 static errno_t testgc_update(void *arg) 447 { 448 (void) arg; 441 449 return EOK; 442 450 } -
uspace/lib/ui/test/wdecor.c
rf536a16 rf0ccb2a 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 43 43 static errno_t testgc_set_color(void *, gfx_color_t *); 44 44 static errno_t testgc_fill_rect(void *, gfx_rect_t *); 45 static errno_t testgc_update(void *); 45 46 static errno_t testgc_bitmap_create(void *, gfx_bitmap_params_t *, 46 47 gfx_bitmap_alloc_t *, void **); … … 52 53 .set_color = testgc_set_color, 53 54 .fill_rect = testgc_fill_rect, 55 .update = testgc_update, 54 56 .bitmap_create = testgc_bitmap_create, 55 57 .bitmap_destroy = testgc_bitmap_destroy, … … 354 356 PCUT_TEST(pos_event_move) 355 357 { 356 ui_wdecor_t *wdecor;358 errno_t rc; 357 359 gfx_rect_t rect; 358 360 pos_event_t event; 361 gfx_context_t *gc = NULL; 362 test_gc_t tgc; 359 363 test_cb_resp_t resp; 360 errno_t rc; 361 362 rc = ui_wdecor_create(NULL, "Hello", ui_wds_decorated, &wdecor); 364 ui_resource_t *resource = NULL; 365 ui_wdecor_t *wdecor; 366 367 memset(&tgc, 0, sizeof(tgc)); 368 rc = gfx_context_new(&ops, &tgc, &gc); 369 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 370 371 rc = ui_resource_create(gc, false, &resource); 372 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 373 PCUT_ASSERT_NOT_NULL(resource); 374 375 rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor); 363 376 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 364 377 … … 386 399 387 400 ui_wdecor_destroy(wdecor); 401 ui_resource_destroy(resource); 402 403 rc = gfx_context_delete(gc); 404 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 388 405 } 389 406 … … 391 408 PCUT_TEST(get_geom_none) 392 409 { 410 gfx_context_t *gc = NULL; 411 test_gc_t tgc; 412 ui_resource_t *resource = NULL; 393 413 ui_wdecor_t *wdecor; 394 414 gfx_rect_t rect; … … 396 416 errno_t rc; 397 417 398 rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor); 418 memset(&tgc, 0, sizeof(tgc)); 419 rc = gfx_context_new(&ops, &tgc, &gc); 420 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 421 422 rc = ui_resource_create(gc, false, &resource); 423 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 424 PCUT_ASSERT_NOT_NULL(resource); 425 426 rc = ui_wdecor_create(resource, "Hello", ui_wds_none, &wdecor); 399 427 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 400 428 … … 428 456 429 457 ui_wdecor_destroy(wdecor); 458 ui_resource_destroy(resource); 459 460 rc = gfx_context_delete(gc); 461 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 430 462 } 431 463 … … 433 465 PCUT_TEST(get_geom_frame) 434 466 { 467 gfx_context_t *gc = NULL; 468 test_gc_t tgc; 469 ui_resource_t *resource = NULL; 435 470 ui_wdecor_t *wdecor; 436 471 gfx_rect_t rect; … … 438 473 errno_t rc; 439 474 440 rc = ui_wdecor_create(NULL, "Hello", ui_wds_frame, &wdecor); 475 memset(&tgc, 0, sizeof(tgc)); 476 rc = gfx_context_new(&ops, &tgc, &gc); 477 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 478 479 rc = ui_resource_create(gc, false, &resource); 480 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 481 PCUT_ASSERT_NOT_NULL(resource); 482 483 rc = ui_wdecor_create(resource, "Hello", ui_wds_frame, &wdecor); 441 484 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 442 485 … … 470 513 471 514 ui_wdecor_destroy(wdecor); 515 ui_resource_destroy(resource); 516 517 rc = gfx_context_delete(gc); 518 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 472 519 } 473 520 … … 475 522 PCUT_TEST(get_geom_frame_titlebar) 476 523 { 524 gfx_context_t *gc = NULL; 525 test_gc_t tgc; 526 ui_resource_t *resource = NULL; 477 527 ui_wdecor_t *wdecor; 478 528 gfx_rect_t rect; … … 480 530 errno_t rc; 481 531 482 rc = ui_wdecor_create(NULL, "Hello", ui_wds_frame | ui_wds_titlebar, 532 memset(&tgc, 0, sizeof(tgc)); 533 rc = gfx_context_new(&ops, &tgc, &gc); 534 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 535 536 rc = ui_resource_create(gc, false, &resource); 537 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 538 PCUT_ASSERT_NOT_NULL(resource); 539 540 rc = ui_wdecor_create(resource, "Hello", ui_wds_frame | ui_wds_titlebar, 483 541 &wdecor); 484 542 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 513 571 514 572 ui_wdecor_destroy(wdecor); 573 ui_resource_destroy(resource); 574 575 rc = gfx_context_delete(gc); 576 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 515 577 } 516 578 … … 518 580 PCUT_TEST(get_geom_decorated) 519 581 { 582 gfx_context_t *gc = NULL; 583 test_gc_t tgc; 584 ui_resource_t *resource = NULL; 520 585 ui_wdecor_t *wdecor; 521 586 gfx_rect_t rect; … … 523 588 errno_t rc; 524 589 525 rc = ui_wdecor_create(NULL, "Hello", ui_wds_decorated, &wdecor); 590 memset(&tgc, 0, sizeof(tgc)); 591 rc = gfx_context_new(&ops, &tgc, &gc); 592 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 593 594 rc = ui_resource_create(gc, false, &resource); 595 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 596 PCUT_ASSERT_NOT_NULL(resource); 597 598 rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor); 526 599 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 527 600 … … 555 628 556 629 ui_wdecor_destroy(wdecor); 630 ui_resource_destroy(resource); 631 632 rc = gfx_context_delete(gc); 633 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 557 634 } 558 635 … … 782 859 } 783 860 861 static errno_t testgc_update(void *arg) 862 { 863 (void) arg; 864 return EOK; 865 } 866 784 867 static errno_t testgc_bitmap_create(void *arg, gfx_bitmap_params_t *params, 785 868 gfx_bitmap_alloc_t *alloc, void **rbm)
Note:
See TracChangeset
for help on using the changeset viewer.