mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-08 03:41:28 +00:00
Tests: the Devanagari fallback-glyph test passes when the fallback face substitutes the vowel sign
`the_fallback_glyph_of_a_consonant_after_its_vowel_sign_is_reported` expected the fallback face's cmap glyph for the vowel sign I. On the Ubuntu runner the fallback face is Noto Sans Devanagari, whose shaping draws the sign with another glyph (545 instead of 32), so the test failed on `main`. It now checks that two glyphs are drawn in Ka's cluster, the first is not Ka's and the second is, and keeps the `text.glyphAlternates` checks. Fixes #5750
This commit is contained in:
@@ -2823,9 +2823,11 @@ fn the_fallback_glyph_of_a_consonant_after_its_vowel_sign_is_reported() {
|
||||
let glyphs = vectorcraft_text::layout(db, &obj(&s, open)).glyphs;
|
||||
let fallback = db.face_by_id(glyphs[0].font_id).expect("the fallback face");
|
||||
assert_ne!(fallback.id(), requested.id());
|
||||
let (ka, sign) = (fallback.glyph_for('क'), fallback.glyph_for('\u{93F}'));
|
||||
let ka = fallback.glyph_for('क');
|
||||
let drawn: Vec<_> = glyphs.iter().map(|g| (g.gid, g.byte)).collect();
|
||||
assert_eq!(drawn, [(sign, 0), (ka, 0)], "the vowel sign is drawn first, in Ka's cluster ({} or {MATRA_FAMILY})", fallback.family);
|
||||
// A face may draw the vowel sign with a glyph other than its own, so only its place is checked.
|
||||
let sign_first = matches!(drawn[..], [(sign, 0), (k, 0)] if sign != 0 && sign != ka && k == ka);
|
||||
assert!(sign_first, "the vowel sign is drawn first, in Ka's cluster ({} or {MATRA_FAMILY}): {drawn:?}", fallback.family);
|
||||
let query = s.execute("text.glyphAlternates", &json!({"id": open.0, "start": 0})).unwrap();
|
||||
assert_eq!(query["chosen"], json!(ka), "the fallback face's glyph for Ka");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user