diff options
author | John-Mark Bell <jmb@netsurf-browser.org> | 2022-05-22 21:51:03 +0100 |
---|---|---|
committer | John-Mark Bell <jmb@netsurf-browser.org> | 2022-05-22 21:51:03 +0100 |
commit | e25cd523d0336286dcb43b17de3864399a55fd42 (patch) | |
tree | e9738fad0d9ad5fd6a57cc0086182d232b4200c7 /test/harness.c | |
parent | 88b143b1c47cc32b25a9b97389553963e4c8a66e (diff) | |
download | librufl-e25cd523d0336286dcb43b17de3864399a55fd42.tar.gz librufl-e25cd523d0336286dcb43b17de3864399a55fd42.tar.bz2 |
Add test for symbol fonts
Diffstat (limited to 'test/harness.c')
-rw-r--r-- | test/harness.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/test/harness.c b/test/harness.c index eaf84a7..8f8ea9a 100644 --- a/test/harness.c +++ b/test/harness.c @@ -14,9 +14,9 @@ static void rufl_test_harness_free(void) free(h->encodings); if (h->encoding_filenames != NULL) { for (ni = 0; ni != h->n_font_names; ni++) { - for (ei = 0; ei != h->n_encodings; ei++) { + for (ei = 0; ei != h->n_encodings + 1; ei++) { free(h->encoding_filenames[ - (ni * h->n_encodings) + ei]); + (ni * (h->n_encodings + 1)) + ei]); } } } @@ -109,7 +109,7 @@ void rufl_test_harness_set_font_encoding(const char *fontname, if (h->encoding_filenames == NULL) { h->encoding_filenames = calloc( - h->n_font_names * h->n_encodings, + h->n_font_names * (h->n_encodings + 1), sizeof(*h->encoding_filenames)); assert(h->encoding_filenames != NULL); } @@ -122,14 +122,18 @@ void rufl_test_harness_set_font_encoding(const char *fontname, assert(ni != h->n_font_names); /* Find encoding index */ - for (ei = 0; ei < h->n_encodings; ei++) { - if (strcmp(h->encodings[ei], encoding) == 0) - break; + if (strcmp("Symbol", encoding) == 0) { + ei = h->n_encodings; + } else { + for (ei = 0; ei < h->n_encodings; ei++) { + if (strcmp(h->encodings[ei], encoding) == 0) + break; + } + assert(ei != h->n_encodings); } - assert(ei != h->n_encodings); - if (h->encoding_filenames[(ni * h->n_encodings) + ei] != NULL) - free(h->encoding_filenames[(ni * h->n_encodings) + ei]); - h->encoding_filenames[(ni * h->n_encodings) + ei] = strdup(path); - assert(h->encoding_filenames[(ni * h->n_encodings) + ei] != NULL); + if (h->encoding_filenames[(ni * (h->n_encodings + 1)) + ei] != NULL) + free(h->encoding_filenames[(ni * (h->n_encodings + 1)) + ei]); + h->encoding_filenames[(ni * (h->n_encodings + 1)) + ei] = strdup(path); + assert(h->encoding_filenames[(ni * (h->n_encodings + 1)) + ei] != NULL); } |