Skip to content

Commit 6933a8c

Browse files
committed
ot tests
1 parent 2f52b45 commit 6933a8c

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

  • crates/bridge_harfbuzz/src

crates/bridge_harfbuzz/src/ot.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,44 @@ impl Language<'_> {
297297
}
298298
}
299299
}
300+
301+
#[cfg(test)]
302+
mod tests {
303+
use super::*;
304+
use crate::test_util::test_faces;
305+
306+
#[test]
307+
fn test_ot_layout_tables() {
308+
for (_, face) in test_faces() {
309+
let layout = face.as_ref().ot_layout();
310+
for table in [layout.table(GTag::GSub), layout.table(GTag::GPos)] {
311+
assert_eq!(table.script_tags_len(), 3);
312+
}
313+
}
314+
}
315+
316+
#[test]
317+
fn test_ot_layout_table_scripts() {
318+
for (_, face) in test_faces() {
319+
let layout = face.as_ref().ot_layout();
320+
for table in [layout.table(GTag::GSub), layout.table(GTag::GPos)] {
321+
let script = table.script(0).unwrap();
322+
assert_eq!(script.tag(), Tag::from_str("DFLT"));
323+
assert_eq!(script.language_tags_len(), 0);
324+
assert_eq!(
325+
script.script,
326+
table.find_script(script.tag()).unwrap().script
327+
);
328+
329+
let script2 = table.script(1).unwrap();
330+
331+
assert_eq!(script2.tag(), Tag::from_str("cyrl"));
332+
assert_eq!(script2.language_tags_len(), 0);
333+
assert_eq!(
334+
script2.script,
335+
table.find_script(script2.tag()).unwrap().script
336+
);
337+
}
338+
}
339+
}
340+
}

0 commit comments

Comments
 (0)