Changeset e7b32d7 in mainline for uspace/lib/ui/test/wdecor.c
- Timestamp:
- 2021-04-02T17:35:19Z (4 years ago)
- Children:
- 7a8af2f
- Parents:
- 2e1dbf7d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/wdecor.c
r2e1dbf7d re7b32d7 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.