Changeset 66a2becf in mainline for uspace/lib/ui/test/window.c


Ignore:
Timestamp:
2020-11-11T18:05:01Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b93ec7c0
Parents:
d942ca4
Message:

Application area GC / port font editor

Font editor and other 'non-GUI' applications typically assume that
0,0 is the top left of the 'screen'/application area. We provide
a special GC that meets this requirement.

File:
1 edited

Legend:

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

    rd942ca4 r66a2becf  
    2929#include <gfx/context.h>
    3030#include <gfx/coord.h>
     31#include <gfx/render.h>
    3132#include <io/kbd_event.h>
    3233#include <io/pos_event.h>
     
    207208}
    208209
     210/** ui_window_get_app_gc() return valid GC */
     211PCUT_TEST(get_app_gc)
     212{
     213        errno_t rc;
     214        ui_t *ui = NULL;
     215        ui_wnd_params_t params;
     216        ui_window_t *window = NULL;
     217        gfx_context_t *gc;
     218
     219        rc = ui_create_disp(NULL, &ui);
     220        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     221
     222        ui_wnd_params_init(&params);
     223        params.caption = "Hello";
     224        params.rect.p0.x = 0;
     225        params.rect.p0.y = 0;
     226        params.rect.p0.x = 10;
     227        params.rect.p0.y = 10;
     228
     229        rc = ui_window_create(ui, &params, &window);
     230        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     231        PCUT_ASSERT_NOT_NULL(window);
     232
     233        rc = ui_window_get_app_gc(window, &gc);
     234        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     235        PCUT_ASSERT_NOT_NULL(gc);
     236
     237        rc = gfx_fill_rect(gc, &params.rect);
     238        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     239
     240        ui_window_destroy(window);
     241        ui_destroy(ui);
     242}
     243
    209244/** Test ui_window_paint() */
    210245PCUT_TEST(paint)
Note: See TracChangeset for help on using the changeset viewer.