Changeset 0d1d0ea in mainline for uspace/lib/ui/test/paint.c


Ignore:
Timestamp:
2022-03-31T14:37:31Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d68239a1
Parents:
7ca7215
git-author:
Jiri Svoboda <jiri@…> (2022-03-30 17:37:11)
git-committer:
Jiri Svoboda <jiri@…> (2022-03-31 14:37:31)
Message:

Routine to fill rectangle with character

Use it to simplify scrollbar rendering.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/test/paint.c

    r7ca7215 r0d1d0ea  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    313313}
    314314
     315/** Paint text rectangle */
     316PCUT_TEST(text_rect)
     317{
     318        errno_t rc;
     319        gfx_context_t *gc = NULL;
     320        ui_resource_t *resource = NULL;
     321        gfx_color_t *color = NULL;
     322        test_gc_t tgc;
     323        gfx_rect_t rect;
     324
     325        memset(&tgc, 0, sizeof(tgc));
     326        rc = gfx_context_new(&ops, &tgc, &gc);
     327        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     328
     329        rc = ui_resource_create(gc, false, &resource);
     330        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     331        PCUT_ASSERT_NOT_NULL(resource);
     332
     333        rc = gfx_color_new_rgb_i16(1, 2, 3, &color);
     334        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     335
     336        rect.p0.x = 10;
     337        rect.p0.y = 20;
     338        rect.p1.x = 30;
     339        rect.p1.y = 40;
     340
     341        /* Paint text box */
     342        rc = ui_paint_text_rect(resource, &rect, color, "A");
     343        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     344
     345        gfx_color_delete(color);
     346        ui_resource_destroy(resource);
     347        rc = gfx_context_delete(gc);
     348        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     349}
     350
    315351static errno_t testgc_set_clip_rect(void *arg, gfx_rect_t *rect)
    316352{
Note: See TracChangeset for help on using the changeset viewer.