Changeset 06b8383 in mainline for uspace/lib/gfxfont/test
- Timestamp:
- 2020-08-18T11:32:59Z (6 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)
- Location:
- uspace/lib/gfxfont/test
- Files:
-
- 1 added
- 4 edited
-
font.c (modified) (20 diffs)
-
glyph.c (modified) (24 diffs)
-
glyph_bmp.c (modified) (16 diffs)
-
main.c (modified) (1 diff)
-
typeface.c (added)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gfxfont/test/font.c
rd2100e2 r06b8383 30 30 #include <gfx/font.h> 31 31 #include <gfx/glyph.h> 32 #include <gfx/typeface.h> 32 33 #include <pcut/pcut.h> 33 34 #include "../private/font.h" 35 #include "../private/typeface.h" 34 36 35 37 PCUT_INIT; … … 70 72 PCUT_TEST(create_destroy) 71 73 { 74 gfx_font_props_t props; 72 75 gfx_font_metrics_t metrics; 73 gfx_font_t *font; 74 gfx_context_t *gc; 75 test_gc_t tgc; 76 errno_t rc; 77 78 rc = gfx_context_new(&test_ops, (void *)&tgc, &gc); 79 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 80 81 gfx_font_metrics_init(&metrics); 82 rc = gfx_font_create(gc, &metrics, &font); 83 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 84 85 gfx_font_destroy(font); 76 gfx_typeface_t *tface; 77 gfx_font_t *font; 78 gfx_context_t *gc; 79 test_gc_t tgc; 80 errno_t rc; 81 82 rc = gfx_context_new(&test_ops, (void *)&tgc, &gc); 83 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 84 85 rc = gfx_typeface_create(gc, &tface); 86 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 87 88 gfx_font_props_init(&props); 89 gfx_font_metrics_init(&metrics); 90 rc = gfx_font_create(tface, &props, &metrics, &font); 91 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 92 93 gfx_font_close(font); 94 gfx_typeface_destroy(tface); 95 86 96 rc = gfx_context_delete(gc); 87 97 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 91 101 PCUT_TEST(get_metrics) 92 102 { 103 gfx_font_props_t props; 93 104 gfx_font_metrics_t metrics; 94 105 gfx_font_metrics_t gmetrics; 106 gfx_typeface_t *tface; 95 107 gfx_font_t *font; 96 108 gfx_context_t *gc; … … 106 118 metrics.leading = 3; 107 119 108 rc = gfx_font_create(gc, &metrics, &font); 120 rc = gfx_typeface_create(gc, &tface); 121 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 122 123 gfx_font_props_init(&props); 124 gfx_font_metrics_init(&metrics); 125 rc = gfx_font_create(tface, &props, &metrics, &font); 109 126 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 110 127 … … 114 131 PCUT_ASSERT_INT_EQUALS(metrics.leading, gmetrics.leading); 115 132 116 gfx_font_destroy(font); 133 gfx_font_close(font); 134 gfx_typeface_destroy(tface); 117 135 rc = gfx_context_delete(gc); 118 136 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 122 140 PCUT_TEST(set_metrics) 123 141 { 142 gfx_font_props_t props; 124 143 gfx_font_metrics_t metrics1; 125 144 gfx_font_metrics_t metrics2; 126 145 gfx_font_metrics_t gmetrics; 127 gfx_font_t *font; 128 gfx_context_t *gc; 129 test_gc_t tgc; 130 errno_t rc; 131 132 rc = gfx_context_new(&test_ops, (void *)&tgc, &gc); 133 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 146 gfx_typeface_t *tface; 147 gfx_font_t *font; 148 gfx_context_t *gc; 149 test_gc_t tgc; 150 errno_t rc; 151 152 rc = gfx_context_new(&test_ops, (void *)&tgc, &gc); 153 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 154 155 rc = gfx_typeface_create(gc, &tface); 156 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 157 158 gfx_font_props_init(&props); 134 159 135 160 gfx_font_metrics_init(&metrics1); … … 138 163 metrics1.leading = 3; 139 164 140 rc = gfx_font_create( gc, &metrics1, &font);165 rc = gfx_font_create(tface, &props, &metrics1, &font); 141 166 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 142 167 … … 154 179 PCUT_ASSERT_INT_EQUALS(metrics2.leading, gmetrics.leading); 155 180 156 gfx_font_destroy(font); 181 gfx_font_close(font); 182 gfx_typeface_destroy(tface); 157 183 rc = gfx_context_delete(gc); 158 184 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 162 188 PCUT_TEST(first_glyph) 163 189 { 190 gfx_font_props_t props; 164 191 gfx_font_metrics_t metrics; 165 192 gfx_glyph_metrics_t gmetrics; 193 gfx_typeface_t *tface; 166 194 gfx_font_t *font; 167 195 gfx_context_t *gc; … … 176 204 gfx_font_metrics_init(&metrics); 177 205 178 rc = gfx_font_create(gc, &metrics, &font); 206 rc = gfx_typeface_create(gc, &tface); 207 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 208 209 gfx_font_props_init(&props); 210 gfx_font_metrics_init(&metrics); 211 rc = gfx_font_create(tface, &props, &metrics, &font); 179 212 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 180 213 … … 193 226 194 227 gfx_glyph_destroy(glyph); 195 gfx_font_destroy(font); 228 gfx_font_close(font); 229 gfx_typeface_destroy(tface); 196 230 rc = gfx_context_delete(gc); 197 231 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 201 235 PCUT_TEST(next_glyph) 202 236 { 237 gfx_font_props_t props; 203 238 gfx_font_metrics_t metrics; 204 239 gfx_glyph_metrics_t gmetrics; 240 gfx_typeface_t *tface; 205 241 gfx_font_t *font; 206 242 gfx_context_t *gc; … … 217 253 gfx_font_metrics_init(&metrics); 218 254 219 rc = gfx_font_create(gc, &metrics, &font); 255 rc = gfx_typeface_create(gc, &tface); 256 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 257 258 gfx_font_props_init(&props); 259 gfx_font_metrics_init(&metrics); 260 rc = gfx_font_create(tface, &props, &metrics, &font); 220 261 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 221 262 … … 240 281 gfx_glyph_destroy(glyph1); 241 282 gfx_glyph_destroy(glyph2); 242 gfx_font_destroy(font); 283 gfx_font_close(font); 284 gfx_typeface_destroy(tface); 243 285 rc = gfx_context_delete(gc); 244 286 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 248 290 PCUT_TEST(search_glyph) 249 291 { 292 gfx_font_props_t props; 250 293 gfx_font_metrics_t metrics; 294 gfx_typeface_t *tface; 251 295 gfx_font_t *font; 252 296 gfx_context_t *gc; … … 261 305 gfx_font_metrics_init(&metrics); 262 306 263 rc = gfx_font_create(gc, &metrics, &font); 307 rc = gfx_typeface_create(gc, &tface); 308 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 309 310 gfx_font_props_init(&props); 311 gfx_font_metrics_init(&metrics); 312 rc = gfx_font_create(tface, &props, &metrics, &font); 264 313 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 265 314 … … 267 316 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc); 268 317 269 gfx_font_destroy(font); 318 gfx_font_close(font); 319 gfx_typeface_destroy(tface); 270 320 rc = gfx_context_delete(gc); 271 321 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 275 325 PCUT_TEST(splice_at_glyph) 276 326 { 327 gfx_font_props_t props; 277 328 gfx_font_metrics_t fmetrics; 329 gfx_typeface_t *tface; 278 330 gfx_font_t *font; 279 331 gfx_glyph_metrics_t gmetrics; … … 286 338 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 287 339 340 rc = gfx_typeface_create(gc, &tface); 341 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 342 343 gfx_font_props_init(&props); 288 344 gfx_font_metrics_init(&fmetrics); 289 rc = gfx_font_create( gc, &fmetrics, &font);345 rc = gfx_font_create(tface, &props, &fmetrics, &font); 290 346 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 291 347 … … 299 355 gfx_glyph_destroy(glyph); 300 356 301 gfx_font_destroy(font); 357 gfx_font_close(font); 358 gfx_typeface_destroy(tface); 302 359 rc = gfx_context_delete(gc); 303 360 PCUT_ASSERT_ERRNO_VAL(EOK, rc); -
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); -
uspace/lib/gfxfont/test/glyph_bmp.c
rd2100e2 r06b8383 31 31 #include <gfx/glyph.h> 32 32 #include <gfx/glyph_bmp.h> 33 #include <gfx/typeface.h> 33 34 #include <pcut/pcut.h> 34 35 … … 70 71 PCUT_TEST(open_close) 71 72 { 73 gfx_font_props_t fprops; 72 74 gfx_font_metrics_t fmetrics; 75 gfx_typeface_t *tface; 73 76 gfx_font_t *font; 74 77 gfx_glyph_metrics_t gmetrics; … … 82 85 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 83 86 87 rc = gfx_typeface_create(gc, &tface); 88 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 89 90 gfx_font_props_init(&fprops); 84 91 gfx_font_metrics_init(&fmetrics); 85 rc = gfx_font_create( gc, &fmetrics, &font);92 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 86 93 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 87 94 … … 102 109 gfx_glyph_destroy(glyph); 103 110 104 gfx_font_destroy(font); 111 gfx_font_close(font); 112 gfx_typeface_destroy(tface); 105 113 rc = gfx_context_delete(gc); 106 114 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 110 118 PCUT_TEST(save) 111 119 { 120 gfx_font_props_t fprops; 112 121 gfx_font_metrics_t fmetrics; 122 gfx_typeface_t *tface; 113 123 gfx_font_t *font; 114 124 gfx_glyph_metrics_t gmetrics; … … 123 133 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 124 134 135 rc = gfx_typeface_create(gc, &tface); 136 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 137 138 gfx_font_props_init(&fprops); 125 139 gfx_font_metrics_init(&fmetrics); 126 rc = gfx_font_create( gc, &fmetrics, &font);140 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 127 141 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 128 142 … … 174 188 gfx_glyph_destroy(glyph); 175 189 176 gfx_font_destroy(font); 190 gfx_font_close(font); 191 gfx_typeface_destroy(tface); 177 192 rc = gfx_context_delete(gc); 178 193 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 182 197 PCUT_TEST(getpix) 183 198 { 199 gfx_font_props_t fprops; 184 200 gfx_font_metrics_t fmetrics; 201 gfx_typeface_t *tface; 185 202 gfx_font_t *font; 186 203 gfx_glyph_metrics_t gmetrics; … … 195 212 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 196 213 214 rc = gfx_typeface_create(gc, &tface); 215 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 216 217 gfx_font_props_init(&fprops); 197 218 gfx_font_metrics_init(&fmetrics); 198 rc = gfx_font_create( gc, &fmetrics, &font);219 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 199 220 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 200 221 … … 218 239 gfx_glyph_destroy(glyph); 219 240 220 gfx_font_destroy(font); 241 gfx_font_close(font); 242 gfx_typeface_destroy(tface); 221 243 rc = gfx_context_delete(gc); 222 244 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 226 248 PCUT_TEST(setpix_flip) 227 249 { 250 gfx_font_props_t fprops; 228 251 gfx_font_metrics_t fmetrics; 252 gfx_typeface_t *tface; 229 253 gfx_font_t *font; 230 254 gfx_glyph_metrics_t gmetrics; … … 239 263 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 240 264 265 rc = gfx_typeface_create(gc, &tface); 266 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 267 268 gfx_font_props_init(&fprops); 241 269 gfx_font_metrics_init(&fmetrics); 242 rc = gfx_font_create( gc, &fmetrics, &font);270 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 243 271 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 244 272 … … 274 302 gfx_glyph_destroy(glyph); 275 303 276 gfx_font_destroy(font); 304 gfx_font_close(font); 305 gfx_typeface_destroy(tface); 277 306 rc = gfx_context_delete(gc); 278 307 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 282 311 PCUT_TEST(setpix_externd) 283 312 { 313 gfx_font_props_t fprops; 284 314 gfx_font_metrics_t fmetrics; 315 gfx_typeface_t *tface; 285 316 gfx_font_t *font; 286 317 gfx_glyph_metrics_t gmetrics; … … 296 327 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 297 328 329 rc = gfx_typeface_create(gc, &tface); 330 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 331 332 gfx_font_props_init(&fprops); 298 333 gfx_font_metrics_init(&fmetrics); 299 rc = gfx_font_create( gc, &fmetrics, &font);334 rc = gfx_font_create(tface, &fprops, &fmetrics, &font); 300 335 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 301 336 … … 343 378 gfx_glyph_destroy(glyph); 344 379 345 gfx_font_destroy(font); 380 gfx_font_close(font); 381 gfx_typeface_destroy(tface); 346 382 rc = gfx_context_delete(gc); 347 383 PCUT_ASSERT_ERRNO_VAL(EOK, rc); -
uspace/lib/gfxfont/test/main.c
rd2100e2 r06b8383 34 34 PCUT_IMPORT(glyph); 35 35 PCUT_IMPORT(glyph_bmp); 36 PCUT_IMPORT(typeface); 36 37 37 38 PCUT_MAIN();
Note:
See TracChangeset
for help on using the changeset viewer.
