diff options
author | John-Mark Bell <jmb@netsurf-browser.org> | 2022-05-22 22:31:56 +0100 |
---|---|---|
committer | John-Mark Bell <jmb@netsurf-browser.org> | 2022-05-22 22:32:16 +0100 |
commit | 12748b1ee8019b24761d36fa7da555c500e83c33 (patch) | |
tree | 645d50dce1e2b86a006d8c0c755c3310eeecc19c | |
parent | 193969427f9b515fef02db45b9382cb576afdbe5 (diff) | |
download | librufl-12748b1ee8019b24761d36fa7da555c500e83c33.tar.gz librufl-12748b1ee8019b24761d36fa7da555c500e83c33.tar.bz2 |
Add checks for replacement character generation
Two variants, as astral characters require an additional pair of
hex digits.
-rw-r--r-- | test/oldfminit.c | 8 | ||||
-rw-r--r-- | test/olducsinit.c | 8 | ||||
-rw-r--r-- | test/ucsinit.c | 8 |
3 files changed, 24 insertions, 0 deletions
diff --git a/test/oldfminit.c b/test/oldfminit.c index 4350949..99726c1 100644 --- a/test/oldfminit.c +++ b/test/oldfminit.c @@ -305,6 +305,14 @@ int main(int argc, const char **argv) assert(3 == offset); assert(50 == x); + /* Compute width of replacement character */ + assert(rufl_OK == rufl_width("Corpus", rufl_WEIGHT_500, 160, + (const uint8_t *) "\xef\xbf\xbd", 3, &width)); + assert(17 == width); + assert(rufl_OK == rufl_width("Corpus", rufl_WEIGHT_500, 160, + (const uint8_t *) "\xf0\xa0\x80\xa5", 4, &width)); + assert(26 == width); + rufl_dump_state(true); rufl_quit(); diff --git a/test/olducsinit.c b/test/olducsinit.c index aa2d874..813c541 100644 --- a/test/olducsinit.c +++ b/test/olducsinit.c @@ -92,6 +92,14 @@ int main(int argc, const char **argv) assert(3 == offset); assert(50 == x); + /* Compute width of replacement character */ + assert(rufl_OK == rufl_width("Corpus", rufl_WEIGHT_500, 160, + (const uint8_t *) "\xef\xbf\xbd", 3, &width)); + assert(17 == width); + assert(rufl_OK == rufl_width("Corpus", rufl_WEIGHT_500, 160, + (const uint8_t *) "\xf0\xa0\x80\xa5", 4, &width)); + assert(26 == width); + rufl_dump_state(true); rufl_quit(); diff --git a/test/ucsinit.c b/test/ucsinit.c index c0fc06f..0308b54 100644 --- a/test/ucsinit.c +++ b/test/ucsinit.c @@ -92,6 +92,14 @@ int main(int argc, const char **argv) assert(3 == offset); assert(50 == x); + /* Compute width of replacement character */ + assert(rufl_OK == rufl_width("Corpus", rufl_WEIGHT_500, 160, + (const uint8_t *) "\xef\xbf\xbd", 3, &width)); + assert(17 == width); + assert(rufl_OK == rufl_width("Corpus", rufl_WEIGHT_500, 160, + (const uint8_t *) "\xf0\xa0\x80\xa5", 4, &width)); + assert(26 == width); + rufl_dump_state(true); rufl_quit(); |