aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_data.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_data.lua b/test/test_data.lua
index ec2b6ed..549ce40 100644
--- a/test/test_data.lua
+++ b/test/test_data.lua
@@ -505,3 +505,19 @@ assert(gate(100.0) == true, 'gate: first call opens')
assert(gate(100.5) == false, 'gate: closed inside the interval')
assert(gate(101.95) == true, 'gate: opens after it')
assert(gate(102.0) == false, 'gate: interval restarts from the last open')
+
+-- Emoji fall back to card.FONT_EMOJI: the toy API has no per-glyph fallback,
+-- so without the run split "x🦷" measured a tofu box in Noto Sans.
+do
+ local s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 10, 10)
+ local cr = cairo_create(s)
+ card.font(cr, 'Noto Emoji', 20, false)
+ local tooth = card.advance(cr, '🦷')
+ card.font(cr, card.FONT_UI, 20, false)
+ local x = card.advance(cr, 'x')
+ assert(math.abs(card.advance(cr, 'x🦷') - (x + tooth)) < 0.01, 'emoji run uses FONT_EMOJI')
+ assert(card.advance(cr, 'x') == x, 'caller face restored after an emoji run')
+ assert(pcall(card.advance, cr, '\240\159'), 'invalid UTF-8 must not raise')
+ cairo_destroy(cr)
+ cairo_surface_destroy(s)
+end