Changeset 06b8383 in mainline for uspace/lib/gfxfont/test/font.c
- Timestamp:
- 2020-08-18T11:32:59Z (5 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/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);
Note:
See TracChangeset
for help on using the changeset viewer.