Skip to content

Commit

Permalink
Finish fonttools test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV committed May 21, 2024
1 parent ff71eac commit 7863fc4
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mod font_tools;
type Result<T> = std::result::Result<T, Box<dyn Error>>;

const FONT_TOOLS_REF: bool = false;
const OVERWRITE_REFS: bool = false;

struct TestContext {
font: Vec<u8>,
Expand Down Expand Up @@ -92,7 +93,7 @@ fn test_font_tools(font_file: &str, gids: &str, num: u16) {
.unwrap();
}

if !ttx_path.exists() {
if !ttx_path.exists() || OVERWRITE_REFS {
Command::new("fonttools")
.args([
"ttx",
Expand All @@ -103,6 +104,20 @@ fn test_font_tools(font_file: &str, gids: &str, num: u16) {
])
.output()
.unwrap();
} else {
let output = Command::new("fonttools")
.args([
"ttx",
"-f",
"-o",
"-",
otf_path.clone().to_str().unwrap(),
])
.output()
.unwrap().stdout;

let reference = std::fs::read(ttx_path).unwrap();
assert_eq!(reference, output, "fonttools output didn't match.");
}
}

Expand Down

0 comments on commit 7863fc4

Please sign in to comment.