Ignore:
File:
1 edited

Legend:

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

    r7470d97 r81ec7e1  
    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);
     
    141179}
    142180
     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);
     209
     210        ui_resource_destroy(resource);
     211        rc = gfx_context_delete(gc);
     212        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     213}
     214
    143215/** Paint filled circle */
    144216PCUT_TEST(filled_circle)
     
    165237        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    166238
     239        rc = gfx_context_delete(gc);
     240        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     241}
     242
     243/** Paint text box */
     244PCUT_TEST(text_box)
     245{
     246        errno_t rc;
     247        gfx_context_t *gc = NULL;
     248        ui_resource_t *resource = NULL;
     249        gfx_color_t *color = NULL;
     250        test_gc_t tgc;
     251        gfx_rect_t rect;
     252
     253        memset(&tgc, 0, sizeof(tgc));
     254        rc = gfx_context_new(&ops, &tgc, &gc);
     255        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     256
     257        rc = ui_resource_create(gc, false, &resource);
     258        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     259        PCUT_ASSERT_NOT_NULL(resource);
     260
     261        rc = gfx_color_new_rgb_i16(1, 2, 3, &color);
     262        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     263
     264        rect.p0.x = 10;
     265        rect.p0.y = 20;
     266        rect.p1.x = 30;
     267        rect.p1.y = 40;
     268
     269        /* Paint text box */
     270        rc = ui_paint_text_box(resource, &rect, ui_box_single, color);
     271        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     272
     273        gfx_color_delete(color);
     274        ui_resource_destroy(resource);
     275        rc = gfx_context_delete(gc);
     276        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     277}
     278
     279/** Paint text horizontal brace */
     280PCUT_TEST(text_hbrace)
     281{
     282        errno_t rc;
     283        gfx_context_t *gc = NULL;
     284        ui_resource_t *resource = NULL;
     285        gfx_color_t *color = NULL;
     286        test_gc_t tgc;
     287        gfx_rect_t rect;
     288
     289        memset(&tgc, 0, sizeof(tgc));
     290        rc = gfx_context_new(&ops, &tgc, &gc);
     291        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     292
     293        rc = ui_resource_create(gc, false, &resource);
     294        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     295        PCUT_ASSERT_NOT_NULL(resource);
     296
     297        rc = gfx_color_new_rgb_i16(1, 2, 3, &color);
     298        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     299
     300        rect.p0.x = 10;
     301        rect.p0.y = 20;
     302        rect.p1.x = 30;
     303        rect.p1.y = 40;
     304
     305        /* Paint text horizontal brace */
     306        rc = ui_paint_text_hbrace(resource, &rect, ui_box_single,
     307            color);
     308
     309        gfx_color_delete(color);
     310        ui_resource_destroy(resource);
    167311        rc = gfx_context_delete(gc);
    168312        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
Note: See TracChangeset for help on using the changeset viewer.