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


Ignore:
Timestamp:
2022-04-04T14:48:41Z (2 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
86fff971
Parents:
0d1d0ea
git-author:
Jiri Svoboda <jiri@…> (2022-04-03 17:48:17)
git-committer:
Jiri Svoboda <jiri@…> (2022-04-04 14:48:41)
Message:

Scrollbar needs custom button decorations

Push button now allows setting a 'custom decoration' which means
instead of painting the button text a callback function is invoked
to paint the decoration.

File:
1 edited

Legend:

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

    r0d1d0ea rd68239a1  
    225225        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    226226
     227        center.x = 0;
     228        center.y = 0;
     229
    227230        /* Paint filled circle / upper-left half */
    228231        rc = ui_paint_filled_circle(gc, &center, 10, ui_fcircle_upleft);
     
    235238        /* Paint entire filled circle */
    236239        rc = ui_paint_filled_circle(gc, &center, 10, ui_fcircle_entire);
     240        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     241
     242        rc = gfx_context_delete(gc);
     243        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     244}
     245
     246/** Paint up pointing triangle */
     247PCUT_TEST(up_triangle)
     248{
     249        errno_t rc;
     250        gfx_context_t *gc = NULL;
     251        test_gc_t tgc;
     252        gfx_coord2_t center;
     253
     254        memset(&tgc, 0, sizeof(tgc));
     255        rc = gfx_context_new(&ops, &tgc, &gc);
     256        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     257
     258        center.x = 0;
     259        center.y = 0;
     260
     261        rc = ui_paint_up_triangle(gc, &center, 5);
     262        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     263
     264        rc = gfx_context_delete(gc);
     265        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     266}
     267
     268/** Paint down pointing triangle */
     269PCUT_TEST(down_triangle)
     270{
     271        errno_t rc;
     272        gfx_context_t *gc = NULL;
     273        test_gc_t tgc;
     274        gfx_coord2_t center;
     275
     276        memset(&tgc, 0, sizeof(tgc));
     277        rc = gfx_context_new(&ops, &tgc, &gc);
     278        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     279
     280        center.x = 0;
     281        center.y = 0;
     282
     283        rc = ui_paint_down_triangle(gc, &center, 5);
     284        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     285
     286        rc = gfx_context_delete(gc);
     287        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     288}
     289
     290/** Paint left pointing triangle */
     291PCUT_TEST(left_triangle)
     292{
     293        errno_t rc;
     294        gfx_context_t *gc = NULL;
     295        test_gc_t tgc;
     296        gfx_coord2_t center;
     297
     298        memset(&tgc, 0, sizeof(tgc));
     299        rc = gfx_context_new(&ops, &tgc, &gc);
     300        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     301
     302        center.x = 0;
     303        center.y = 0;
     304
     305        rc = ui_paint_left_triangle(gc, &center, 5);
     306        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     307
     308        rc = gfx_context_delete(gc);
     309        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     310}
     311
     312/** Paint right pointing triangle */
     313PCUT_TEST(right_triangle)
     314{
     315        errno_t rc;
     316        gfx_context_t *gc = NULL;
     317        test_gc_t tgc;
     318        gfx_coord2_t center;
     319
     320        memset(&tgc, 0, sizeof(tgc));
     321        rc = gfx_context_new(&ops, &tgc, &gc);
     322        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     323
     324        center.x = 0;
     325        center.y = 0;
     326
     327        rc = ui_paint_right_triangle(gc, &center, 5);
    237328        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    238329
Note: See TracChangeset for help on using the changeset viewer.