Skip to content

Commit

Permalink
add test for iterator and version
Browse files Browse the repository at this point in the history
  • Loading branch information
dfrg committed Nov 28, 2023
1 parent fdf5a13 commit 2c9308a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions skrifa/src/color/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,25 @@ impl<'a> ColorOutlineCollection<'a> {
})
}
}

#[cfg(test)]
mod tests {
use crate::MetadataProvider;
use read_fonts::{types::GlyphId, FontRef};

#[test]
fn colr_outline_iter_and_version() {
let font = FontRef::new(font_test_data::COLRV0V1_VARIABLE).unwrap();
let outlines = font.color_outlines();
// This font contains one COLRv0 glyph:
// <GlyphID id="166" name="colored_circles_v0"/>
let colrv0_outlines = [GlyphId::new(166)];
for (gid, outline) in outlines.iter() {
let expected_version = if colrv0_outlines.contains(&gid) { 0 } else { 1 };
assert_eq!(outline.version(), expected_version);
}
// <!-- BaseGlyphRecordCount=1 -->
// <!-- BaseGlyphCount=157 -->
assert_eq!(outlines.iter().count(), 158);
}
}

0 comments on commit 2c9308a

Please sign in to comment.