Changeset 2ab8ab3 in mainline for uspace/lib/gfx/test/render.c


Ignore:
Timestamp:
2021-02-16T18:12:05Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
68a552f
Parents:
ef734b7
Message:

Client-side UI rendering

It is possible to turn on and off and if turned on, one can also
enable or disable window double buffering (currently both options
are build-time).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gfx/test/render.c

    ref734b7 r2ab8ab3  
    11/*
    2  * Copyright (c) 2019 Jiri Svoboda
     2 * Copyright (c) 2021 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3232#include <pcut/pcut.h>
    3333#include <mem.h>
     34#include <stdbool.h>
    3435
    3536PCUT_INIT;
     
    3940static errno_t testgc_set_color(void *, gfx_color_t *);
    4041static errno_t testgc_fill_rect(void *, gfx_rect_t *);
     42static errno_t testgc_update(void *);
    4143
    4244static gfx_context_ops_t ops = {
    4345        .set_color = testgc_set_color,
    44         .fill_rect = testgc_fill_rect
     46        .fill_rect = testgc_fill_rect,
     47        .update = testgc_update
    4548};
    4649
     
    4952        gfx_color_t *dclr;
    5053        gfx_rect_t *rect;
     54        bool updated;
    5155} test_gc_t;
    5256
     
    107111}
    108112
     113PCUT_TEST(update)
     114{
     115        errno_t rc;
     116        gfx_context_t *gc = NULL;
     117        test_gc_t tgc;
     118
     119        memset(&tgc, 0, sizeof(tgc));
     120
     121        rc = gfx_context_new(&ops, &tgc, &gc);
     122        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     123
     124        PCUT_ASSERT_FALSE(tgc.updated);
     125        gfx_update(gc);
     126        PCUT_ASSERT_TRUE(tgc.updated);
     127
     128        rc = gfx_context_delete(gc);
     129        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     130}
     131
    109132static errno_t testgc_set_color(void *arg, gfx_color_t *color)
    110133{
     
    125148}
    126149
     150static errno_t testgc_update(void *arg)
     151{
     152        test_gc_t *tgc = (test_gc_t *) arg;
     153
     154        tgc->updated = true;
     155        return EOK;
     156}
     157
    127158PCUT_EXPORT(render);
Note: See TracChangeset for help on using the changeset viewer.