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


Ignore:
Timestamp:
2021-07-16T17:45:12Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4afb6c9
Parents:
61bf9dd9
Message:

Seeking in entry text using mouse

File:
1 edited

Legend:

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

    r61bf9dd9 rd63623f  
    9696        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    9797
     98        rect.p0.x = 10;
     99        rect.p0.y = 20;
     100        rect.p1.x = 30;
     101        rect.p1.y = 40;
     102
    98103        /* Paint bevel with NULL 'inside' output parameter */
    99104        rc = ui_paint_bevel(gc, &rect, color1, color2, 2, NULL);
     
    110115}
    111116
     117/** Get bevel inside */
     118PCUT_TEST(get_bevel_inside)
     119{
     120        errno_t rc;
     121        gfx_context_t *gc = NULL;
     122        test_gc_t tgc;
     123        gfx_rect_t rect;
     124        gfx_rect_t inside;
     125
     126        memset(&tgc, 0, sizeof(tgc));
     127        rc = gfx_context_new(&ops, &tgc, &gc);
     128        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     129
     130        rect.p0.x = 10;
     131        rect.p0.y = 20;
     132        rect.p1.x = 30;
     133        rect.p1.y = 40;
     134
     135        ui_paint_get_bevel_inside(gc, &rect, 2, &inside);
     136        PCUT_ASSERT_INT_EQUALS(12, inside.p0.x);
     137        PCUT_ASSERT_INT_EQUALS(22, inside.p0.y);
     138        PCUT_ASSERT_INT_EQUALS(28, inside.p1.x);
     139        PCUT_ASSERT_INT_EQUALS(38, inside.p1.y);
     140
     141        rc = gfx_context_delete(gc);
     142        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     143}
     144
    112145/** Paint inset frame */
    113146PCUT_TEST(inset_frame)
     
    128161        PCUT_ASSERT_NOT_NULL(resource);
    129162
     163        rect.p0.x = 10;
     164        rect.p0.y = 20;
     165        rect.p1.x = 30;
     166        rect.p1.y = 40;
     167
    130168        /* Paint inset frame with NULL 'inside' output parameter */
    131169        rc = ui_paint_inset_frame(resource, &rect, NULL);
     
    135173        rc = ui_paint_inset_frame(resource, &rect, &inside);
    136174        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     175
     176        ui_resource_destroy(resource);
     177        rc = gfx_context_delete(gc);
     178        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     179}
     180
     181/** Get inset frame inside */
     182PCUT_TEST(get_inset_frame_inside)
     183{
     184        errno_t rc;
     185        gfx_context_t *gc = NULL;
     186        ui_resource_t *resource = NULL;
     187        test_gc_t tgc;
     188        gfx_rect_t rect;
     189        gfx_rect_t inside;
     190
     191        memset(&tgc, 0, sizeof(tgc));
     192        rc = gfx_context_new(&ops, &tgc, &gc);
     193        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     194
     195        rc = ui_resource_create(gc, false, &resource);
     196        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     197        PCUT_ASSERT_NOT_NULL(resource);
     198
     199        rect.p0.x = 10;
     200        rect.p0.y = 20;
     201        rect.p1.x = 30;
     202        rect.p1.y = 40;
     203
     204        ui_paint_get_inset_frame_inside(resource, &rect, &inside);
     205        PCUT_ASSERT_INT_EQUALS(12, inside.p0.x);
     206        PCUT_ASSERT_INT_EQUALS(22, inside.p0.y);
     207        PCUT_ASSERT_INT_EQUALS(28, inside.p1.x);
     208        PCUT_ASSERT_INT_EQUALS(38, inside.p1.y);
    137209
    138210        ui_resource_destroy(resource);
Note: See TracChangeset for help on using the changeset viewer.