Skip to content

Commit

Permalink
Add a test for features
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanUkhov committed May 20, 2024
1 parent 1f7c193 commit 1a8854a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ required-features = ["binary"]

[dependencies]
folder = "0.6"
font = "0.30"
font = { git = "https://github.com/bodoni/font.git" }
svg = "0.17"

arguments = { version = "0.7", optional = true }
Expand Down
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ test-internal-vectorize:
rm tests/fixtures/internal/vectorize/*.ttf
[ "$$(git diff tests/fixtures/internal/vectorize | wc -l | xargs)" = 0 ] || exit 1

.PHONY: test-external-features
test: test-external-features
test-external-features:
# https://github.com/google/fonts/issues/6888
# https://github.com/google/fonts/issues/6894
cargo run --bin founder-features -- \
--path tests/fixtures/external \
--exclude google-fonts/ofl/federant \
--exclude google-fonts/ofl/liujianmaocao \
--exclude google-fonts/ofl/londrina \
--exclude google-fonts/ofl/longcang \
--exclude google-fonts/ofl/mashanzheng \
--exclude google-fonts/ofl/notosans \
--exclude google-fonts/ofl/zhimangxing \
--exclude web-platform-tests/css/css-fonts/matching/resources/variabletest \
--workers "$$((4 * $$(nproc --all)))" \
> /dev/null

.PHONY: test-external-names
test: test-external-names
test-external-names:
Expand Down
4 changes: 2 additions & 2 deletions src/bin/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ fn subprocess(path: &Path) -> Result<String> {
for (feature, value) in fonts[0].features()? {
let feature = Tag::from(feature);
let feature = feature.as_str().unwrap_or("<none>");
for (script, value) in value.scripts {
for (script, value) in value {
let script = Tag::from(script);
let script = script.as_str().unwrap_or("<none>");
for language in value {
for (language, _) in value {
let language = language.map(Tag::from);
let language = language.as_ref().and_then(Tag::as_str).unwrap_or("<none>");
writeln!(string, "{feature: <10} {script: <10} {language}").unwrap();
Expand Down

0 comments on commit 1a8854a

Please sign in to comment.