Changes in uspace/srv/hid/display/test/clonegc.c [7470d97:5271e4c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/test/clonegc.c
r7470d97 r5271e4c 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 39 39 PCUT_TEST_SUITE(clonegc); 40 40 41 static errno_t testgc_set_clip_rect(void *, gfx_rect_t *);42 41 static errno_t testgc_set_color(void *, gfx_color_t *); 43 42 static errno_t testgc_fill_rect(void *, gfx_rect_t *); … … 49 48 50 49 static gfx_context_ops_t ops = { 51 .set_clip_rect = testgc_set_clip_rect,52 50 .set_color = testgc_set_color, 53 51 .fill_rect = testgc_fill_rect, … … 61 59 /** Error code to return */ 62 60 errno_t rc; 63 64 bool set_clip_rect_called;65 gfx_rect_t *set_clip_rect_rect;66 61 67 62 bool set_color_called; … … 100 95 rc = ds_clonegc_create(NULL, &cgc); 101 96 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 102 103 rc = ds_clonegc_delete(cgc);104 PCUT_ASSERT_ERRNO_VAL(EOK, rc);105 }106 107 /** Set clipping rectangle with two output GCs */108 PCUT_TEST(set_clip_rect)109 {110 ds_clonegc_t *cgc;111 gfx_context_t *gc;112 test_gc_t tgc1;113 gfx_context_t *gc1;114 test_gc_t tgc2;115 gfx_context_t *gc2;116 gfx_rect_t rect;117 errno_t rc;118 119 /* Create clone GC */120 rc = ds_clonegc_create(NULL, &cgc);121 PCUT_ASSERT_ERRNO_VAL(EOK, rc);122 123 gc = ds_clonegc_get_ctx(cgc);124 PCUT_ASSERT_NOT_NULL(gc);125 126 /* Add two output GCs */127 128 rc = gfx_context_new(&ops, &tgc1, &gc1);129 PCUT_ASSERT_ERRNO_VAL(EOK, rc);130 131 rc = ds_clonegc_add_output(cgc, gc1);132 PCUT_ASSERT_ERRNO_VAL(EOK, rc);133 134 rc = gfx_context_new(&ops, &tgc2, &gc2);135 PCUT_ASSERT_ERRNO_VAL(EOK, rc);136 137 rc = ds_clonegc_add_output(cgc, gc2);138 PCUT_ASSERT_ERRNO_VAL(EOK, rc);139 140 rect.p0.x = 1;141 rect.p0.y = 2;142 rect.p1.x = 3;143 rect.p1.y = 4;144 145 /* Set clipping rectangle returning error */146 147 tgc1.set_clip_rect_called = false;148 tgc2.set_clip_rect_called = false;149 tgc1.rc = EINVAL;150 tgc2.rc = EINVAL;151 152 rc = gfx_set_clip_rect(gc, &rect);153 PCUT_ASSERT_ERRNO_VAL(EINVAL, rc);154 155 PCUT_ASSERT_TRUE(tgc1.set_clip_rect_called);156 PCUT_ASSERT_EQUALS(&rect, tgc1.set_clip_rect_rect);157 PCUT_ASSERT_FALSE(tgc2.set_clip_rect_called);158 159 /* Set clipping rectangle returning success for all outputs */160 tgc1.set_clip_rect_called = false;161 tgc2.set_clip_rect_called = false;162 tgc1.rc = EOK;163 tgc2.rc = EOK;164 165 rc = gfx_set_clip_rect(gc, &rect);166 PCUT_ASSERT_ERRNO_VAL(EOK, rc);167 168 PCUT_ASSERT_TRUE(tgc1.set_clip_rect_called);169 PCUT_ASSERT_EQUALS(&rect, tgc1.set_clip_rect_rect);170 PCUT_ASSERT_TRUE(tgc2.set_clip_rect_called);171 PCUT_ASSERT_EQUALS(&rect, tgc2.set_clip_rect_rect);172 97 173 98 rc = ds_clonegc_delete(cgc); … … 703 628 } 704 629 705 static errno_t testgc_set_clip_rect(void *arg, gfx_rect_t *rect)706 {707 test_gc_t *tgc = (test_gc_t *) arg;708 709 tgc->set_clip_rect_called = true;710 tgc->set_clip_rect_rect = rect;711 712 return tgc->rc;713 }714 715 630 static errno_t testgc_set_color(void *arg, gfx_color_t *color) 716 631 {
Note:
See TracChangeset
for help on using the changeset viewer.