Changeset 8a9a41e in mainline for uspace/lib/ui/test/paint.c
- Timestamp:
- 2021-10-24T08:28:43Z (2 years ago)
- Children:
- fcb4e15
- Parents:
- 2ce943a (diff), cd981f2a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Erik Kučák <35500848+Riko196@…> (2021-10-24 08:28:43)
- git-committer:
- GitHub <noreply@…> (2021-10-24 08:28:43)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/paint.c
r2ce943a r8a9a41e 96 96 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 97 97 98 rect.p0.x = 10; 99 rect.p0.y = 20; 100 rect.p1.x = 30; 101 rect.p1.y = 40; 102 98 103 /* Paint bevel with NULL 'inside' output parameter */ 99 104 rc = ui_paint_bevel(gc, &rect, color1, color2, 2, NULL); … … 110 115 } 111 116 117 /** Get bevel inside */ 118 PCUT_TEST(get_bevel_inside) 119 { 120 errno_t rc; 121 gfx_context_t *gc = NULL; 122 test_gc_t tgc; 123 gfx_rect_t rect; 124 gfx_rect_t inside; 125 126 memset(&tgc, 0, sizeof(tgc)); 127 rc = gfx_context_new(&ops, &tgc, &gc); 128 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 129 130 rect.p0.x = 10; 131 rect.p0.y = 20; 132 rect.p1.x = 30; 133 rect.p1.y = 40; 134 135 ui_paint_get_bevel_inside(gc, &rect, 2, &inside); 136 PCUT_ASSERT_INT_EQUALS(12, inside.p0.x); 137 PCUT_ASSERT_INT_EQUALS(22, inside.p0.y); 138 PCUT_ASSERT_INT_EQUALS(28, inside.p1.x); 139 PCUT_ASSERT_INT_EQUALS(38, inside.p1.y); 140 141 rc = gfx_context_delete(gc); 142 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 143 } 144 112 145 /** Paint inset frame */ 113 146 PCUT_TEST(inset_frame) … … 128 161 PCUT_ASSERT_NOT_NULL(resource); 129 162 163 rect.p0.x = 10; 164 rect.p0.y = 20; 165 rect.p1.x = 30; 166 rect.p1.y = 40; 167 130 168 /* Paint inset frame with NULL 'inside' output parameter */ 131 169 rc = ui_paint_inset_frame(resource, &rect, NULL); … … 141 179 } 142 180 181 /** Get inset frame inside */ 182 PCUT_TEST(get_inset_frame_inside) 183 { 184 errno_t rc; 185 gfx_context_t *gc = NULL; 186 ui_resource_t *resource = NULL; 187 test_gc_t tgc; 188 gfx_rect_t rect; 189 gfx_rect_t inside; 190 191 memset(&tgc, 0, sizeof(tgc)); 192 rc = gfx_context_new(&ops, &tgc, &gc); 193 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 194 195 rc = ui_resource_create(gc, false, &resource); 196 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 197 PCUT_ASSERT_NOT_NULL(resource); 198 199 rect.p0.x = 10; 200 rect.p0.y = 20; 201 rect.p1.x = 30; 202 rect.p1.y = 40; 203 204 ui_paint_get_inset_frame_inside(resource, &rect, &inside); 205 PCUT_ASSERT_INT_EQUALS(12, inside.p0.x); 206 PCUT_ASSERT_INT_EQUALS(22, inside.p0.y); 207 PCUT_ASSERT_INT_EQUALS(28, inside.p1.x); 208 PCUT_ASSERT_INT_EQUALS(38, inside.p1.y); 209 210 ui_resource_destroy(resource); 211 rc = gfx_context_delete(gc); 212 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 213 } 214 143 215 /** Paint filled circle */ 144 216 PCUT_TEST(filled_circle) … … 165 237 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 166 238 239 rc = gfx_context_delete(gc); 240 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 241 } 242 243 /** Paint text box */ 244 PCUT_TEST(text_box) 245 { 246 errno_t rc; 247 gfx_context_t *gc = NULL; 248 ui_resource_t *resource = NULL; 249 gfx_color_t *color = NULL; 250 test_gc_t tgc; 251 gfx_rect_t rect; 252 253 memset(&tgc, 0, sizeof(tgc)); 254 rc = gfx_context_new(&ops, &tgc, &gc); 255 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 256 257 rc = ui_resource_create(gc, false, &resource); 258 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 259 PCUT_ASSERT_NOT_NULL(resource); 260 261 rc = gfx_color_new_rgb_i16(1, 2, 3, &color); 262 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 263 264 rect.p0.x = 10; 265 rect.p0.y = 20; 266 rect.p1.x = 30; 267 rect.p1.y = 40; 268 269 /* Paint text box */ 270 rc = ui_paint_text_box(resource, &rect, ui_box_single, color); 271 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 272 273 gfx_color_delete(color); 274 ui_resource_destroy(resource); 275 rc = gfx_context_delete(gc); 276 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 277 } 278 279 /** Paint text horizontal brace */ 280 PCUT_TEST(text_hbrace) 281 { 282 errno_t rc; 283 gfx_context_t *gc = NULL; 284 ui_resource_t *resource = NULL; 285 gfx_color_t *color = NULL; 286 test_gc_t tgc; 287 gfx_rect_t rect; 288 289 memset(&tgc, 0, sizeof(tgc)); 290 rc = gfx_context_new(&ops, &tgc, &gc); 291 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 292 293 rc = ui_resource_create(gc, false, &resource); 294 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 295 PCUT_ASSERT_NOT_NULL(resource); 296 297 rc = gfx_color_new_rgb_i16(1, 2, 3, &color); 298 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 299 300 rect.p0.x = 10; 301 rect.p0.y = 20; 302 rect.p1.x = 30; 303 rect.p1.y = 40; 304 305 /* Paint text horizontal brace */ 306 rc = ui_paint_text_hbrace(resource, &rect, ui_box_single, 307 color); 308 309 gfx_color_delete(color); 310 ui_resource_destroy(resource); 167 311 rc = gfx_context_delete(gc); 168 312 PCUT_ASSERT_ERRNO_VAL(EOK, rc);
Note:
See TracChangeset
for help on using the changeset viewer.