Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset f0ccb2a in mainline for uspace/lib/ui/test/image.c


Ignore:
Timestamp:
2021-04-09T22:41:22Z (8 months ago)
Author:
jxsvoboda <5887334+jxsvoboda@…>
Branches:
master
Children:
4d2a4cd
Parents:
f536a16
git-author:
Jiri Svoboda <jiri@…> (2021-04-02 17:35:19)
git-committer:
jxsvoboda <5887334+jxsvoboda@…> (2021-04-09 22:41:22)
Message:

Fix libui unit tests

File:
1 edited

Legend:

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

    rf536a16 rf0ccb2a  
    11/*
    2  * Copyright (c) 2020 Jiri Svoboda
     2 * Copyright (c) 2021 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3434#include <ui/control.h>
    3535#include <ui/image.h>
     36#include <ui/resource.h>
    3637#include <ui/ui.h>
    3738#include "../private/dummygc.h"
     
    8788PCUT_TEST(set_rect)
    8889{
     90        errno_t rc;
     91        dummy_gc_t *dgc;
     92        gfx_context_t *gc;
     93        ui_resource_t *resource = NULL;
    8994        ui_image_t *image = NULL;
    9095        gfx_rect_t brect;
    9196        gfx_rect_t rect;
    92         errno_t rc;
    93 
    94         rc = ui_image_create(NULL, NULL, &brect, &image);
     97
     98        rc = dummygc_create(&dgc);
     99        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     100
     101        gc = dummygc_get_ctx(dgc);
     102
     103        rc = ui_resource_create(gc, false, &resource);
     104        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     105        PCUT_ASSERT_NOT_NULL(resource);
     106
     107        rc = ui_image_create(resource, NULL, &brect, &image);
    95108        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    96109        PCUT_ASSERT_NOT_NULL(image);
     
    108121
    109122        ui_image_destroy(image);
     123        ui_resource_destroy(resource);
     124        dummygc_destroy(dgc);
    110125}
    111126
     
    139154        dummy_gc_t *dgc;
    140155        gfx_context_t *gc;
     156        ui_resource_t *resource = NULL;
    141157        errno_t rc;
    142158
     
    146162        gc = dummygc_get_ctx(dgc);
    147163
    148         rc = ui_image_create(NULL, NULL, &brect, &image);
     164        rc = ui_resource_create(gc, false, &resource);
     165        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     166        PCUT_ASSERT_NOT_NULL(resource);
     167
     168        rc = ui_image_create(resource, NULL, &brect, &image);
    149169        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    150170        PCUT_ASSERT_NOT_NULL(image);
     
    172192
    173193        ui_image_destroy(image);
     194        ui_resource_destroy(resource);
     195        dummygc_destroy(dgc);
    174196}
    175197
     
    181203        gfx_bitmap_params_t params;
    182204        gfx_bitmap_t *bitmap;
     205        ui_resource_t *resource = NULL;
    183206        ui_image_t *image = NULL;
    184207        gfx_rect_t brect;
     
    189212
    190213        gc = dummygc_get_ctx(dgc);
     214
     215        rc = ui_resource_create(gc, false, &resource);
     216        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     217        PCUT_ASSERT_NOT_NULL(resource);
    191218
    192219        gfx_bitmap_params_init(&params);
     
    194221        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    195222
    196         rc = ui_image_create(NULL, bitmap, &brect, &image);
     223        rc = ui_image_create(resource, bitmap, &brect, &image);
    197224        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    198225        PCUT_ASSERT_NOT_NULL(image);
     
    209236
    210237        ui_image_destroy(image);
     238        ui_resource_destroy(resource);
     239        dummygc_destroy(dgc);
    211240}
    212241
Note: See TracChangeset for help on using the changeset viewer.