This repository has been archived by the owner on Nov 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linux: Add tests.sh to validate fontconfig
For #29
- Loading branch information
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Font: sans | ||
Vera.ttf: "Bitstream Vera Sans" "Roman" | ||
EmojiOneColor-SVGinOT.ttf: "Emoji One Color" "Regular" | ||
|
||
Font: sans-serif | ||
Vera.ttf: "Bitstream Vera Sans" "Roman" | ||
EmojiOneColor-SVGinOT.ttf: "Emoji One Color" "Regular" | ||
|
||
Font: serif | ||
VeraSe.ttf: "Bitstream Vera Serif" "Roman" | ||
EmojiOneColor-SVGinOT.ttf: "Emoji One Color" "Regular" | ||
|
||
Font: mono | ||
VeraMono.ttf: "Bitstream Vera Sans Mono" "Roman" | ||
EmojiOneColor-SVGinOT.ttf: "Emoji One Color" "Regular" | ||
|
||
Font: monospace | ||
VeraMono.ttf: "Bitstream Vera Sans Mono" "Roman" | ||
EmojiOneColor-SVGinOT.ttf: "Emoji One Color" "Regular" | ||
|
||
Font: Bitstream Vera Sans | ||
Vera.ttf: "Bitstream Vera Sans" "Roman" | ||
EmojiOneColor-SVGinOT.ttf: "Emoji One Color" "Regular" | ||
|
||
Font: Bitstream Vera Serif | ||
VeraSe.ttf: "Bitstream Vera Serif" "Roman" | ||
EmojiOneColor-SVGinOT.ttf: "Emoji One Color" "Regular" | ||
|
||
Font: Bitstream Vera Sans Mono | ||
VeraMono.ttf: "Bitstream Vera Sans Mono" "Roman" | ||
EmojiOneColor-SVGinOT.ttf: "Emoji One Color" "Regular" | ||
|
||
Font: Emoji One Color | ||
EmojiOneColor-SVGinOT.ttf: "Emoji One Color" "Regular" | ||
Vera.ttf: "Bitstream Vera Sans" "Roman" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
# Tests of fontconfig configuration for Bitstream Vera and Emoji One Color. | ||
# | ||
# The first two lines of the results of fc-match for each font request are | ||
# are compared to known correct results. Any differences are shown. | ||
|
||
# The test result file | ||
TMP=current-results.test | ||
# The expected test result file | ||
EXPECTED=expected-results.test | ||
|
||
FONTS[0]='sans' | ||
FONTS[1]="sans-serif" | ||
FONTS[2]="serif" | ||
FONTS[3]="mono" | ||
FONTS[4]="monospace" | ||
FONTS[5]="Bitstream Vera Sans" | ||
FONTS[6]="Bitstream Vera Serif" | ||
FONTS[7]="Bitstream Vera Sans Mono" | ||
FONTS[8]="Emoji One Color" | ||
|
||
rm -f $TMP | ||
|
||
# Run fc-match against all font values | ||
for FONT in "${FONTS[@]}"; do | ||
echo "Font: $FONT" >> $TMP | ||
fc-match -s "$FONT" | head -n2 >> $TMP | ||
echo >> $TMP | ||
done | ||
|
||
# Create expected results if missing, aka delete to update. | ||
if [ ! -f $EXPECTED ]; then | ||
cp $TMP $EXPECTED | ||
echo "Fontconfig tests: UPDATE" | ||
exit 1 | ||
fi | ||
# Compare current results to expected results | ||
echo diff $TMP $EXPECTED | ||
diff -yt $TMP $EXPECTED | ||
RESULT=$? | ||
rm $TMP | ||
|
||
if [ $RESULT -eq 0 ]; then | ||
echo "Fontconfig tests: PASS" | ||
exit 0 | ||
else | ||
echo "Fontconfig tests: FAIL" | ||
exit 1 | ||
fi |