Changeset 06b8383 in mainline for uspace/lib/gfxfont/test/glyph.c
- Timestamp:
- 2020-08-18T11:32:59Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 20d0098
- Parents:
- d2100e2
- git-author:
- Jiri Svoboda <jiri@…> (2020-08-17 18:32:40)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-08-18 11:32:59)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gfxfont/test/glyph.c
rd2100e2 r06b8383 32 32 #include <gfx/glyph.h> 33 33 #include <gfx/glyph_bmp.h> 34 #include <gfx/typeface.h> 34 35 #include <io/pixelmap.h> 35 36 #include <pcut/pcut.h> … … 75 76 PCUT_TEST(create_destroy) 76 77 { 77 gfx_font_metrics_t fmetrics; 78 gfx_font_t *font; 79 gfx_glyph_metrics_t gmetrics; 80 gfx_glyph_t *glyph; 81 gfx_context_t *gc; 82 test_gc_t tgc; 83 errno_t rc; 84 85 rc = gfx_context_new(&test_ops, (void *) &tgc, &gc); 86 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 87 88 gfx_font_metrics_init(&fmetrics); 89 rc = gfx_font_create(gc, &fmetrics, &font); 90 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 91 92 gfx_glyph_metrics_init(&gmetrics); 93 rc = gfx_glyph_create(font, &gmetrics, &glyph); 94 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 95 96 gfx_glyph_destroy(glyph); 97 98 gfx_font_destroy(font); 78 gfx_font_props_t fprops; 79 gfx_font_metrics_t fmetrics; 80 gfx_typeface_t *tface; 81 gfx_font_t *font; 82 gfx_glyph_metrics_t gmetrics; 83 gfx_glyph_t *glyph; 84 gfx_context_t *gc; 85 test_gc_t tgc; 86 errno_t rc; 87 88 rc = gfx_context_new(&test_ops, (void *) &tgc, &gc); 89 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 90 91 rc = gfx_typeface_create(gc, &tface); 92 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 93 94 gfx_font_props_init(&fprops); 95 gfx_font_metrics_init(&fmetrics); 96 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 97 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 98 99 gfx_glyph_metrics_init(&gmetrics); 100 rc = gfx_glyph_create(font, &gmetrics, &glyph); 101 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 102 103 gfx_glyph_destroy(glyph); 104 105 gfx_font_close(font); 106 gfx_typeface_destroy(tface); 99 107 rc = gfx_context_delete(gc); 100 108 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 104 112 PCUT_TEST(get_metrics) 105 113 { 106 gfx_font_metrics_t fmetrics; 114 gfx_font_props_t fprops; 115 gfx_font_metrics_t fmetrics; 116 gfx_typeface_t *tface; 107 117 gfx_font_t *font; 108 118 gfx_glyph_metrics_t gmetrics; … … 116 126 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 117 127 118 gfx_font_metrics_init(&fmetrics); 119 rc = gfx_font_create(gc, &fmetrics, &font); 128 rc = gfx_typeface_create(gc, &tface); 129 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 130 131 gfx_font_props_init(&fprops); 132 gfx_font_metrics_init(&fmetrics); 133 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 134 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 135 120 136 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 121 137 … … 131 147 gfx_glyph_destroy(glyph); 132 148 133 gfx_font_destroy(font); 149 gfx_font_close(font); 150 gfx_typeface_destroy(tface); 134 151 rc = gfx_context_delete(gc); 135 152 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 139 156 PCUT_TEST(set_metrics) 140 157 { 141 gfx_font_metrics_t fmetrics; 158 gfx_font_props_t fprops; 159 gfx_font_metrics_t fmetrics; 160 gfx_typeface_t *tface; 142 161 gfx_font_t *font; 143 162 gfx_glyph_metrics_t gmetrics1; … … 152 171 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 153 172 154 gfx_font_metrics_init(&fmetrics); 155 rc = gfx_font_create(gc, &fmetrics, &font); 173 rc = gfx_typeface_create(gc, &tface); 174 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 175 176 gfx_font_props_init(&fprops); 177 gfx_font_metrics_init(&fmetrics); 178 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 156 179 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 157 180 … … 172 195 gfx_glyph_destroy(glyph); 173 196 174 gfx_font_destroy(font); 197 gfx_font_close(font); 198 gfx_typeface_destroy(tface); 175 199 rc = gfx_context_delete(gc); 176 200 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 180 204 PCUT_TEST(set_pattern) 181 205 { 182 gfx_font_metrics_t fmetrics; 183 gfx_font_t *font; 184 gfx_glyph_metrics_t gmetrics; 185 gfx_glyph_t *glyph; 186 gfx_context_t *gc; 187 test_gc_t tgc; 188 errno_t rc; 189 190 rc = gfx_context_new(&test_ops, (void *) &tgc, &gc); 191 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 192 193 gfx_font_metrics_init(&fmetrics); 194 rc = gfx_font_create(gc, &fmetrics, &font); 206 gfx_font_props_t fprops; 207 gfx_font_metrics_t fmetrics; 208 gfx_typeface_t *tface; 209 gfx_font_t *font; 210 gfx_glyph_metrics_t gmetrics; 211 gfx_glyph_t *glyph; 212 gfx_context_t *gc; 213 test_gc_t tgc; 214 errno_t rc; 215 216 rc = gfx_context_new(&test_ops, (void *) &tgc, &gc); 217 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 218 219 rc = gfx_typeface_create(gc, &tface); 220 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 221 222 gfx_font_props_init(&fprops); 223 gfx_font_metrics_init(&fmetrics); 224 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 195 225 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 196 226 … … 215 245 gfx_glyph_destroy(glyph); 216 246 217 gfx_font_destroy(font); 247 gfx_font_close(font); 248 gfx_typeface_destroy(tface); 218 249 rc = gfx_context_delete(gc); 219 250 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 223 254 PCUT_TEST(clear_pattern) 224 255 { 225 gfx_font_metrics_t fmetrics; 226 gfx_font_t *font; 227 gfx_glyph_metrics_t gmetrics; 228 gfx_glyph_t *glyph; 229 gfx_context_t *gc; 230 test_gc_t tgc; 231 errno_t rc; 232 233 rc = gfx_context_new(&test_ops, (void *) &tgc, &gc); 234 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 235 236 gfx_font_metrics_init(&fmetrics); 237 rc = gfx_font_create(gc, &fmetrics, &font); 256 gfx_font_props_t fprops; 257 gfx_font_metrics_t fmetrics; 258 gfx_typeface_t *tface; 259 gfx_font_t *font; 260 gfx_glyph_metrics_t gmetrics; 261 gfx_glyph_t *glyph; 262 gfx_context_t *gc; 263 test_gc_t tgc; 264 errno_t rc; 265 266 rc = gfx_context_new(&test_ops, (void *) &tgc, &gc); 267 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 268 269 rc = gfx_typeface_create(gc, &tface); 270 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 271 272 gfx_font_props_init(&fprops); 273 gfx_font_metrics_init(&fmetrics); 274 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 238 275 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 239 276 … … 261 298 gfx_glyph_destroy(glyph); 262 299 263 gfx_font_destroy(font); 300 gfx_font_close(font); 301 gfx_typeface_destroy(tface); 264 302 rc = gfx_context_delete(gc); 265 303 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 269 307 PCUT_TEST(matches) 270 308 { 271 gfx_font_metrics_t fmetrics; 309 gfx_font_props_t fprops; 310 gfx_font_metrics_t fmetrics; 311 gfx_typeface_t *tface; 272 312 gfx_font_t *font; 273 313 gfx_glyph_metrics_t gmetrics; … … 282 322 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 283 323 284 gfx_font_metrics_init(&fmetrics); 285 rc = gfx_font_create(gc, &fmetrics, &font); 324 rc = gfx_typeface_create(gc, &tface); 325 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 326 327 gfx_font_props_init(&fprops); 328 gfx_font_metrics_init(&fmetrics); 329 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 286 330 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 287 331 … … 315 359 gfx_glyph_destroy(glyph); 316 360 317 gfx_font_destroy(font); 361 gfx_font_close(font); 362 gfx_typeface_destroy(tface); 318 363 rc = gfx_context_delete(gc); 319 364 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 323 368 PCUT_TEST(first_next_pattern) 324 369 { 325 gfx_font_metrics_t fmetrics; 370 gfx_font_props_t fprops; 371 gfx_font_metrics_t fmetrics; 372 gfx_typeface_t *tface; 326 373 gfx_font_t *font; 327 374 gfx_glyph_metrics_t gmetrics; … … 335 382 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 336 383 337 gfx_font_metrics_init(&fmetrics); 338 rc = gfx_font_create(gc, &fmetrics, &font); 384 rc = gfx_typeface_create(gc, &tface); 385 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 386 387 gfx_font_props_init(&fprops); 388 gfx_font_metrics_init(&fmetrics); 389 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 339 390 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 340 391 … … 360 411 gfx_glyph_destroy(glyph); 361 412 362 gfx_font_destroy(font); 413 gfx_font_close(font); 414 gfx_typeface_destroy(tface); 363 415 rc = gfx_context_delete(gc); 364 416 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 368 420 PCUT_TEST(pattern_str) 369 421 { 370 gfx_font_metrics_t fmetrics; 422 gfx_font_props_t fprops; 423 gfx_font_metrics_t fmetrics; 424 gfx_typeface_t *tface; 371 425 gfx_font_t *font; 372 426 gfx_glyph_metrics_t gmetrics; … … 381 435 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 382 436 383 gfx_font_metrics_init(&fmetrics); 384 rc = gfx_font_create(gc, &fmetrics, &font); 437 rc = gfx_typeface_create(gc, &tface); 438 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 439 440 gfx_font_props_init(&fprops); 441 gfx_font_metrics_init(&fmetrics); 442 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 385 443 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 386 444 … … 406 464 gfx_glyph_destroy(glyph); 407 465 408 gfx_font_destroy(font); 466 gfx_font_close(font); 467 gfx_typeface_destroy(tface); 409 468 rc = gfx_context_delete(gc); 410 469 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 414 473 PCUT_TEST(transfer) 415 474 { 416 gfx_font_metrics_t fmetrics; 475 gfx_font_props_t fprops; 476 gfx_font_metrics_t fmetrics; 477 gfx_typeface_t *tface; 417 478 gfx_font_t *font; 418 479 gfx_glyph_metrics_t gmetrics; … … 431 492 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 432 493 433 gfx_font_metrics_init(&fmetrics); 434 rc = gfx_font_create(gc, &fmetrics, &font); 494 rc = gfx_typeface_create(gc, &tface); 495 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 496 497 gfx_font_props_init(&fprops); 498 gfx_font_metrics_init(&fmetrics); 499 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 435 500 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 436 501 … … 498 563 gfx_glyph_destroy(glyph); 499 564 500 gfx_font_destroy(font); 565 gfx_font_close(font); 566 gfx_typeface_destroy(tface); 501 567 rc = gfx_context_delete(gc); 502 568 PCUT_ASSERT_ERRNO_VAL(EOK, rc);
Note:
See TracChangeset
for help on using the changeset viewer.