Changeset 1eaead4 in mainline for uspace/lib/ui
- Timestamp:
- 2023-02-07T16:11:53Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0366d09d
- Parents:
- 7c5320c
- Location:
- uspace/lib/ui
- Files:
-
- 15 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/include/ui/paint.h
r7c5320c r1eaead4 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 71 71 extern errno_t ui_paint_unmaxicon(ui_resource_t *, gfx_coord2_t *, gfx_coord_t, 72 72 gfx_coord_t, gfx_coord_t, gfx_coord_t); 73 extern errno_t ui_paint_text_box_custom(ui_resource_t *, gfx_rect_t *, 74 ui_box_chars_t *, gfx_color_t *); 73 75 extern errno_t ui_paint_text_box(ui_resource_t *, gfx_rect_t *, 74 76 ui_box_style_t, gfx_color_t *); -
uspace/lib/ui/meson.build
r7c5320c r1eaead4 1 1 # 2 # Copyright (c) 202 2Jiri Svoboda2 # Copyright (c) 2023 Jiri Svoboda 3 3 # All rights reserved. 4 4 # … … 52 52 'src/scrollbar.c', 53 53 'src/slider.c', 54 'src/tab.c', 55 'src/tabset.c', 56 'src/testctl.c', 54 57 'src/ui.c', 55 58 'src/wdecor.c', … … 81 84 'test/scrollbar.c', 82 85 'test/slider.c', 86 'test/tab.c', 87 'test/tabset.c', 88 'test/testctl.c', 83 89 'test/ui.c', 84 90 'test/wdecor.c', -
uspace/lib/ui/src/paint.c
r7c5320c r1eaead4 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 632 632 } 633 633 634 /** Paint a text box. 634 /** Paint a custom text box. 635 * 636 * Paint a text box using user-provided box chars. 635 637 * 636 638 * @param resource UI resource 637 639 * @param rect Rectangle inside which to paint the box 638 640 * @param style Box style 641 * @param boxc Box characters 639 642 * @param color Color 640 643 * @return EOK on success or an error code 641 644 */ 642 errno_t ui_paint_text_box (ui_resource_t *resource, gfx_rect_t *rect,643 ui_box_ style_t style, gfx_color_t *color)645 errno_t ui_paint_text_box_custom(ui_resource_t *resource, gfx_rect_t *rect, 646 ui_box_chars_t *boxc, gfx_color_t *color) 644 647 { 645 648 errno_t rc; … … 653 656 gfx_coord_t y; 654 657 char *str = NULL; 655 ui_box_chars_t *boxc = NULL;656 658 657 659 gfx_rect_points_sort(rect, &srect); … … 661 663 if (dim.x < 2 || dim.y < 2) 662 664 return EOK; 665 666 gfx_text_fmt_init(&fmt); 667 fmt.font = resource->font; 668 fmt.color = color; 669 670 bufsz = str_size(boxc->c[0][0]) + 671 str_size(boxc->c[0][1]) * (dim.x - 2) + 672 str_size(boxc->c[0][2]) + 1; 673 674 str = malloc(bufsz); 675 if (str == NULL) 676 return ENOMEM; 677 678 /* Top edge and corners */ 679 680 str_cpy(str, bufsz, boxc->c[0][0]); 681 off = str_size(boxc->c[0][0]); 682 683 for (i = 1; i < dim.x - 1; i++) { 684 str_cpy(str + off, bufsz - off, boxc->c[0][1]); 685 off += str_size(boxc->c[0][1]); 686 } 687 688 str_cpy(str + off, bufsz - off, boxc->c[0][2]); 689 off += str_size(boxc->c[0][2]); 690 str[off] = '\0'; 691 692 pos = rect->p0; 693 rc = gfx_puttext(&pos, &fmt, str); 694 if (rc != EOK) 695 goto error; 696 697 /* Vertical edges */ 698 for (y = rect->p0.y + 1; y < rect->p1.y - 1; y++) { 699 pos.y = y; 700 701 pos.x = rect->p0.x; 702 rc = gfx_puttext(&pos, &fmt, boxc->c[1][0]); 703 if (rc != EOK) 704 goto error; 705 706 pos.x = rect->p1.x - 1; 707 rc = gfx_puttext(&pos, &fmt, boxc->c[1][2]); 708 if (rc != EOK) 709 goto error; 710 } 711 712 /* Bottom edge and corners */ 713 714 str_cpy(str, bufsz, boxc->c[2][0]); 715 off = str_size(boxc->c[2][0]); 716 717 for (i = 1; i < dim.x - 1; i++) { 718 str_cpy(str + off, bufsz - off, boxc->c[2][1]); 719 off += str_size(boxc->c[2][1]); 720 } 721 722 str_cpy(str + off, bufsz - off, boxc->c[2][2]); 723 off += str_size(boxc->c[2][2]); 724 str[off] = '\0'; 725 726 pos.x = rect->p0.x; 727 pos.y = rect->p1.y - 1; 728 rc = gfx_puttext(&pos, &fmt, str); 729 if (rc != EOK) 730 goto error; 731 732 free(str); 733 return EOK; 734 error: 735 if (str != NULL) 736 free(str); 737 return rc; 738 } 739 740 /** Paint a text box. 741 * 742 * Paint a text box with the specified style. 743 * 744 * @param resource UI resource 745 * @param rect Rectangle inside which to paint the box 746 * @param style Box style 747 * @param color Color 748 * @return EOK on success or an error code 749 */ 750 errno_t ui_paint_text_box(ui_resource_t *resource, gfx_rect_t *rect, 751 ui_box_style_t style, gfx_color_t *color) 752 { 753 ui_box_chars_t *boxc = NULL; 663 754 664 755 switch (style) { … … 674 765 return EINVAL; 675 766 676 gfx_text_fmt_init(&fmt); 677 fmt.font = resource->font; 678 fmt.color = color; 679 680 bufsz = str_size(boxc->c[0][0]) + 681 str_size(boxc->c[0][1]) * (dim.x - 2) + 682 str_size(boxc->c[0][2]) + 1; 683 684 str = malloc(bufsz); 685 if (str == NULL) 686 return ENOMEM; 687 688 /* Top edge and corners */ 689 690 str_cpy(str, bufsz, boxc->c[0][0]); 691 off = str_size(boxc->c[0][0]); 692 693 for (i = 1; i < dim.x - 1; i++) { 694 str_cpy(str + off, bufsz - off, boxc->c[0][1]); 695 off += str_size(boxc->c[0][1]); 696 } 697 698 str_cpy(str + off, bufsz - off, boxc->c[0][2]); 699 off += str_size(boxc->c[0][2]); 700 str[off] = '\0'; 701 702 pos = rect->p0; 703 rc = gfx_puttext(&pos, &fmt, str); 704 if (rc != EOK) 705 goto error; 706 707 /* Vertical edges */ 708 for (y = rect->p0.y + 1; y < rect->p1.y - 1; y++) { 709 pos.y = y; 710 711 pos.x = rect->p0.x; 712 rc = gfx_puttext(&pos, &fmt, boxc->c[1][0]); 713 if (rc != EOK) 714 goto error; 715 716 pos.x = rect->p1.x - 1; 717 rc = gfx_puttext(&pos, &fmt, boxc->c[1][2]); 718 if (rc != EOK) 719 goto error; 720 } 721 722 /* Bottom edge and corners */ 723 724 str_cpy(str, bufsz, boxc->c[2][0]); 725 off = str_size(boxc->c[2][0]); 726 727 for (i = 1; i < dim.x - 1; i++) { 728 str_cpy(str + off, bufsz - off, boxc->c[2][1]); 729 off += str_size(boxc->c[2][1]); 730 } 731 732 str_cpy(str + off, bufsz - off, boxc->c[2][2]); 733 off += str_size(boxc->c[2][2]); 734 str[off] = '\0'; 735 736 pos.x = rect->p0.x; 737 pos.y = rect->p1.y - 1; 738 rc = gfx_puttext(&pos, &fmt, str); 739 if (rc != EOK) 740 goto error; 741 742 free(str); 743 return EOK; 744 error: 745 if (str != NULL) 746 free(str); 747 return rc; 767 return ui_paint_text_box_custom(resource, rect, boxc, color); 748 768 } 749 769 -
uspace/lib/ui/src/window.c
r7c5320c r1eaead4 452 452 * @param window Window 453 453 * @param control Control 454 * @return EOK on success, ENOMEM if out of memory455 454 */ 456 455 void ui_window_add(ui_window_t *window, ui_control_t *control) -
uspace/lib/ui/test/control.c
r7c5320c r1eaead4 33 33 #include <pcut/pcut.h> 34 34 #include <ui/control.h> 35 #include <ui/testctl.h> 35 36 #include <stdbool.h> 36 37 #include <types/ui/event.h> 38 #include "../private/testctl.h" 37 39 38 40 PCUT_INIT; 39 41 40 42 PCUT_TEST_SUITE(control); 41 42 static void test_ctl_destroy(void *);43 static errno_t test_ctl_paint(void *);44 static ui_evclaim_t test_ctl_kbd_event(void *, kbd_event_t *);45 static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *);46 static void test_ctl_unfocus(void *, unsigned);47 48 static ui_control_ops_t test_ctl_ops = {49 .destroy = test_ctl_destroy,50 .paint = test_ctl_paint,51 .kbd_event = test_ctl_kbd_event,52 .pos_event = test_ctl_pos_event,53 .unfocus = test_ctl_unfocus54 };55 56 /** Test response */57 typedef struct {58 /** Claim to return */59 ui_evclaim_t claim;60 /** Result code to return */61 errno_t rc;62 63 /** @c true iff destroy was called */64 bool destroy;65 66 /** @c true iff paint was called */67 bool paint;68 69 /** @c true iff kbd_event was called */70 bool kbd;71 /** Keyboard event that was sent */72 kbd_event_t kevent;73 74 /** @c true iff pos_event was called */75 bool pos;76 /** Position event that was sent */77 pos_event_t pevent;78 79 /** @c true iff unfocus was called */80 bool unfocus;81 /** Number of remaining foci that was sent */82 unsigned unfocus_nfocus;83 } test_resp_t;84 43 85 44 /** Allocate and deallocate control */ … … 89 48 errno_t rc; 90 49 91 rc = ui_control_new(& test_ctl_ops, NULL, &control);50 rc = ui_control_new(&ui_test_ctl_ops, NULL, &control); 92 51 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 93 52 PCUT_ASSERT_NOT_NULL(control); … … 105 64 PCUT_TEST(destroy) 106 65 { 107 ui_ control_t *control = NULL;108 test_resp_t resp;66 ui_test_ctl_t *testctl = NULL; 67 ui_tc_resp_t resp; 109 68 errno_t rc; 110 69 111 rc = ui_ control_new(&test_ctl_ops, &resp, &control);70 rc = ui_test_ctl_create(&resp, &testctl); 112 71 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 113 PCUT_ASSERT_NOT_NULL( control);72 PCUT_ASSERT_NOT_NULL(testctl); 114 73 115 74 resp.rc = EOK; 116 75 resp.destroy = false; 117 76 118 ui_control_destroy( control);77 ui_control_destroy(ui_test_ctl_ctl(testctl)); 119 78 PCUT_ASSERT_TRUE(resp.destroy); 120 79 } … … 123 82 PCUT_TEST(paint) 124 83 { 125 ui_ control_t *control = NULL;126 test_resp_t resp;84 ui_test_ctl_t *testctl = NULL; 85 ui_tc_resp_t resp; 127 86 errno_t rc; 128 87 129 rc = ui_ control_new(&test_ctl_ops, &resp, &control);88 rc = ui_test_ctl_create(&resp, &testctl); 130 89 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 131 PCUT_ASSERT_NOT_NULL( control);90 PCUT_ASSERT_NOT_NULL(testctl); 132 91 133 92 resp.rc = EOK; 134 93 resp.paint = false; 135 94 136 rc = ui_control_paint( control);95 rc = ui_control_paint(ui_test_ctl_ctl(testctl)); 137 96 PCUT_ASSERT_ERRNO_VAL(resp.rc, rc); 138 97 PCUT_ASSERT_TRUE(resp.paint); … … 141 100 resp.paint = false; 142 101 143 rc = ui_control_paint( control);102 rc = ui_control_paint(ui_test_ctl_ctl(testctl)); 144 103 PCUT_ASSERT_ERRNO_VAL(resp.rc, rc); 145 104 PCUT_ASSERT_TRUE(resp.paint); 146 105 147 ui_ control_delete(control);106 ui_test_ctl_destroy(testctl); 148 107 } 149 108 … … 151 110 PCUT_TEST(kbd_event) 152 111 { 153 ui_ control_t *control = NULL;154 test_resp_t resp;112 ui_test_ctl_t *testctl = NULL; 113 ui_tc_resp_t resp; 155 114 kbd_event_t event; 156 115 ui_evclaim_t claim; 157 116 errno_t rc; 158 117 159 rc = ui_ control_new(&test_ctl_ops, &resp, &control);118 rc = ui_test_ctl_create(&resp, &testctl); 160 119 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 161 PCUT_ASSERT_NOT_NULL( control);120 PCUT_ASSERT_NOT_NULL(testctl); 162 121 163 122 resp.claim = ui_claimed; … … 168 127 event.c = '@'; 169 128 170 claim = ui_control_kbd_event( control, &event);129 claim = ui_control_kbd_event(ui_test_ctl_ctl(testctl), &event); 171 130 PCUT_ASSERT_EQUALS(resp.claim, claim); 172 131 PCUT_ASSERT_TRUE(resp.kbd); … … 176 135 PCUT_ASSERT_INT_EQUALS(resp.kevent.c, event.c); 177 136 178 ui_ control_delete(control);137 ui_test_ctl_destroy(testctl); 179 138 } 180 139 … … 182 141 PCUT_TEST(pos_event) 183 142 { 184 ui_ control_t *control = NULL;185 test_resp_t resp;143 ui_test_ctl_t *testctl = NULL; 144 ui_tc_resp_t resp; 186 145 pos_event_t event; 187 146 ui_evclaim_t claim; 188 147 errno_t rc; 189 148 190 rc = ui_ control_new(&test_ctl_ops, &resp, &control);149 rc = ui_test_ctl_create(&resp, &testctl); 191 150 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 192 PCUT_ASSERT_NOT_NULL( control);151 PCUT_ASSERT_NOT_NULL(testctl); 193 152 194 153 resp.claim = ui_claimed; … … 200 159 event.vpos = 4; 201 160 202 claim = ui_control_pos_event( control, &event);161 claim = ui_control_pos_event(ui_test_ctl_ctl(testctl), &event); 203 162 PCUT_ASSERT_EQUALS(resp.claim, claim); 204 163 PCUT_ASSERT_TRUE(resp.pos); … … 209 168 PCUT_ASSERT_INT_EQUALS(resp.pevent.vpos, event.vpos); 210 169 211 ui_ control_delete(control);170 ui_test_ctl_destroy(testctl); 212 171 } 213 172 … … 215 174 PCUT_TEST(unfocus) 216 175 { 217 ui_ control_t *control = NULL;218 test_resp_t resp;176 ui_test_ctl_t *testctl = NULL; 177 ui_tc_resp_t resp; 219 178 errno_t rc; 220 179 221 rc = ui_ control_new(&test_ctl_ops, &resp, &control);180 rc = ui_test_ctl_create(&resp, &testctl); 222 181 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 223 PCUT_ASSERT_NOT_NULL( control);182 PCUT_ASSERT_NOT_NULL(testctl); 224 183 225 184 resp.unfocus = false; 226 185 227 ui_control_unfocus( control, 42);186 ui_control_unfocus(ui_test_ctl_ctl(testctl), 42); 228 187 PCUT_ASSERT_TRUE(resp.unfocus); 229 188 PCUT_ASSERT_INT_EQUALS(42, resp.unfocus_nfocus); 230 189 231 ui_control_delete(control); 232 } 233 234 static void test_ctl_destroy(void *arg) 235 { 236 test_resp_t *resp = (test_resp_t *) arg; 237 238 resp->destroy = true; 239 } 240 241 static errno_t test_ctl_paint(void *arg) 242 { 243 test_resp_t *resp = (test_resp_t *) arg; 244 245 resp->paint = true; 246 return resp->rc; 247 } 248 249 static ui_evclaim_t test_ctl_kbd_event(void *arg, kbd_event_t *event) 250 { 251 test_resp_t *resp = (test_resp_t *) arg; 252 253 resp->kbd = true; 254 resp->kevent = *event; 255 256 return resp->claim; 257 } 258 259 static ui_evclaim_t test_ctl_pos_event(void *arg, pos_event_t *event) 260 { 261 test_resp_t *resp = (test_resp_t *) arg; 262 263 resp->pos = true; 264 resp->pevent = *event; 265 266 return resp->claim; 267 } 268 269 static void test_ctl_unfocus(void *arg, unsigned nfocus) 270 { 271 test_resp_t *resp = (test_resp_t *) arg; 272 273 resp->unfocus = true; 274 resp->unfocus_nfocus = nfocus; 190 ui_test_ctl_destroy(testctl); 275 191 } 276 192 -
uspace/lib/ui/test/main.c
r7c5320c r1eaead4 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 52 52 PCUT_IMPORT(scrollbar); 53 53 PCUT_IMPORT(slider); 54 PCUT_IMPORT(tab); 55 PCUT_IMPORT(tabset); 56 PCUT_IMPORT(testctl); 54 57 PCUT_IMPORT(ui); 55 58 PCUT_IMPORT(wdecor); -
uspace/lib/ui/test/paint.c
r7c5320c r1eaead4 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 75 75 } testgc_bitmap_t; 76 76 77 /** Test box characters */ 78 static ui_box_chars_t test_box_chars = { 79 { 80 { "A", "B", "C" }, 81 { "D", " ", "E" }, 82 { "F", "G", "H" } 83 } 84 }; 85 77 86 /** Paint bevel */ 78 87 PCUT_TEST(bevel) … … 466 475 /* Paint text box */ 467 476 rc = ui_paint_text_box(resource, &rect, ui_box_single, color); 477 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 478 479 gfx_color_delete(color); 480 ui_resource_destroy(resource); 481 rc = gfx_context_delete(gc); 482 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 483 } 484 485 /** Paint custom text box */ 486 PCUT_TEST(text_box_custom) 487 { 488 errno_t rc; 489 gfx_context_t *gc = NULL; 490 ui_resource_t *resource = NULL; 491 gfx_color_t *color = NULL; 492 test_gc_t tgc; 493 gfx_rect_t rect; 494 495 memset(&tgc, 0, sizeof(tgc)); 496 rc = gfx_context_new(&ops, &tgc, &gc); 497 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 498 499 rc = ui_resource_create(gc, false, &resource); 500 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 501 PCUT_ASSERT_NOT_NULL(resource); 502 503 rc = gfx_color_new_rgb_i16(1, 2, 3, &color); 504 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 505 506 rect.p0.x = 10; 507 rect.p0.y = 20; 508 rect.p1.x = 30; 509 rect.p1.y = 40; 510 511 /* Paint text box */ 512 rc = ui_paint_text_box_custom(resource, &rect, &test_box_chars, color); 468 513 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 469 514 -
uspace/lib/ui/test/wdecor.c
r7c5320c r1eaead4 137 137 PCUT_TEST(set_rect) 138 138 { 139 gfx_context_t *gc = NULL; 140 test_gc_t tgc; 141 ui_resource_t *resource = NULL; 139 142 ui_wdecor_t *wdecor; 140 143 gfx_rect_t rect; 141 144 errno_t rc; 142 145 143 rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor); 146 memset(&tgc, 0, sizeof(tgc)); 147 rc = gfx_context_new(&ops, &tgc, &gc); 148 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 149 150 rc = ui_resource_create(gc, false, &resource); 151 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 152 PCUT_ASSERT_NOT_NULL(resource); 153 154 rc = ui_wdecor_create(resource, "Hello", ui_wds_none, &wdecor); 144 155 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 145 156 … … 156 167 157 168 ui_wdecor_destroy(wdecor); 169 ui_resource_destroy(resource); 170 171 rc = gfx_context_delete(gc); 172 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 158 173 } 159 174 … … 445 460 PCUT_TEST(close_btn_clicked) 446 461 { 462 gfx_context_t *gc = NULL; 463 test_gc_t tgc; 464 ui_resource_t *resource = NULL; 447 465 ui_wdecor_t *wdecor; 448 466 gfx_rect_t rect; … … 450 468 errno_t rc; 451 469 452 rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor); 470 memset(&tgc, 0, sizeof(tgc)); 471 rc = gfx_context_new(&ops, &tgc, &gc); 472 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 473 474 rc = ui_resource_create(gc, false, &resource); 475 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 476 PCUT_ASSERT_NOT_NULL(resource); 477 478 rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor); 453 479 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 454 480 … … 468 494 469 495 ui_wdecor_destroy(wdecor); 496 ui_resource_destroy(resource); 497 498 rc = gfx_context_delete(gc); 499 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 470 500 } 471 501 … … 788 818 PCUT_TEST(get_rsztype) 789 819 { 820 gfx_context_t *gc = NULL; 821 test_gc_t tgc; 822 ui_resource_t *resource = NULL; 790 823 ui_wdecor_t *wdecor; 791 824 gfx_rect_t rect; … … 794 827 errno_t rc; 795 828 796 rc = ui_wdecor_create(NULL, "Hello", ui_wds_resizable, &wdecor); 829 memset(&tgc, 0, sizeof(tgc)); 830 rc = gfx_context_new(&ops, &tgc, &gc); 831 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 832 833 rc = ui_resource_create(gc, false, &resource); 834 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 835 PCUT_ASSERT_NOT_NULL(resource); 836 837 rc = ui_wdecor_create(resource, "Hello", ui_wds_resizable, &wdecor); 797 838 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 798 839 … … 874 915 /* Non-resizable window */ 875 916 876 rc = ui_wdecor_create( NULL, "Hello", ui_wds_none, &wdecor);917 rc = ui_wdecor_create(resource, "Hello", ui_wds_none, &wdecor); 877 918 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 878 919 … … 890 931 891 932 ui_wdecor_destroy(wdecor); 933 ui_resource_destroy(resource); 934 935 rc = gfx_context_delete(gc); 936 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 892 937 } 893 938 … … 918 963 PCUT_TEST(frame_pos_event) 919 964 { 965 gfx_context_t *gc = NULL; 966 test_gc_t tgc; 967 ui_resource_t *resource = NULL; 920 968 ui_wdecor_t *wdecor; 921 969 gfx_rect_t rect; … … 924 972 errno_t rc; 925 973 926 rc = ui_wdecor_create(NULL, "Hello", ui_wds_resizable, &wdecor); 974 memset(&tgc, 0, sizeof(tgc)); 975 rc = gfx_context_new(&ops, &tgc, &gc); 976 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 977 978 rc = ui_resource_create(gc, false, &resource); 979 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 980 PCUT_ASSERT_NOT_NULL(resource); 981 982 rc = ui_wdecor_create(resource, "Hello", ui_wds_resizable, &wdecor); 927 983 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 928 984 … … 960 1016 961 1017 ui_wdecor_destroy(wdecor); 1018 ui_resource_destroy(resource); 1019 1020 rc = gfx_context_delete(gc); 1021 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 962 1022 } 963 1023
Note:
See TracChangeset
for help on using the changeset viewer.