aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/test
diff options
context:
space:
mode:
Diffstat (limited to 'fontconfig/test')
-rw-r--r--fontconfig/test/4x6.pcfbin0 -> 70952 bytes
-rw-r--r--fontconfig/test/8x16.pcfbin0 -> 21320 bytes
-rw-r--r--fontconfig/test/Makefile.am9
-rw-r--r--fontconfig/test/fonts.conf.in4
-rw-r--r--fontconfig/test/out.expected8
-rw-r--r--fontconfig/test/run-test.sh92
6 files changed, 113 insertions, 0 deletions
diff --git a/fontconfig/test/4x6.pcf b/fontconfig/test/4x6.pcf
new file mode 100644
index 000000000..dc25510a6
--- /dev/null
+++ b/fontconfig/test/4x6.pcf
Binary files differ
diff --git a/fontconfig/test/8x16.pcf b/fontconfig/test/8x16.pcf
new file mode 100644
index 000000000..0babed164
--- /dev/null
+++ b/fontconfig/test/8x16.pcf
Binary files differ
diff --git a/fontconfig/test/Makefile.am b/fontconfig/test/Makefile.am
new file mode 100644
index 000000000..72da8d64a
--- /dev/null
+++ b/fontconfig/test/Makefile.am
@@ -0,0 +1,9 @@
+check_SCRIPTS=run-test.sh
+TESTS_ENVIRONMENT=src=${srcdir} sh
+TESTS=run-test.sh
+
+TESTDATA=4x6.pcf 8x16.pcf out.expected fonts.conf.in
+
+EXTRA_DIST=$(check_SCRIPTS) $(TESTDATA)
+
+CLEANFILES=
diff --git a/fontconfig/test/fonts.conf.in b/fontconfig/test/fonts.conf.in
new file mode 100644
index 000000000..95def72d4
--- /dev/null
+++ b/fontconfig/test/fonts.conf.in
@@ -0,0 +1,4 @@
+<fontconfig>
+<dir>@FONTDIR@</dir>
+<cachedir>@CACHEDIR@</cachedir>
+</fontconfig>
diff --git a/fontconfig/test/out.expected b/fontconfig/test/out.expected
new file mode 100644
index 000000000..39634c50a
--- /dev/null
+++ b/fontconfig/test/out.expected
@@ -0,0 +1,8 @@
+Fixed:pixelsize=16
+Fixed:pixelsize=6
+=
+Fixed:pixelsize=16
+Fixed:pixelsize=6
+=
+Fixed:pixelsize=16
+Fixed:pixelsize=6
diff --git a/fontconfig/test/run-test.sh b/fontconfig/test/run-test.sh
new file mode 100644
index 000000000..e7174b289
--- /dev/null
+++ b/fontconfig/test/run-test.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+TESTDIR=${srcdir-`pwd`}
+
+FONTDIR=`pwd`/fonts
+CACHEDIR=`pwd`/cache.dir
+
+ECHO=true
+
+FCLIST=../fc-list/fc-list
+FCCACHE=../fc-cache/fc-cache
+
+FONT1=$TESTDIR/4x6.pcf
+FONT2=$TESTDIR/8x16.pcf
+
+check () {
+ $FCLIST - family pixelsize | sort > out
+ echo "=" >> out
+ $FCLIST - family pixelsize | sort >> out
+ echo "=" >> out
+ $FCLIST - family pixelsize | sort >> out
+ tr -d '\015' <out >out.tmp; mv out.tmp out
+ if cmp out $TESTDIR/out.expected > /dev/null ; then : ; else
+ echo "*** Test failed: $TEST"
+ echo "*** output is in 'out', expected output in 'out.expected'"
+ exit 1
+ fi
+ rm out
+}
+
+prep() {
+ rm -rf $CACHEDIR
+ rm -rf $FONTDIR
+ mkdir $FONTDIR
+}
+
+dotest () {
+ TEST=$1
+ test x$VERBOSE = x || echo Running: $TEST
+}
+
+sed "s!@FONTDIR@!$FONTDIR!
+s!@CACHEDIR@!$CACHEDIR!" < $TESTDIR/fonts.conf.in > fonts.conf
+
+FONTCONFIG_FILE=`pwd`/fonts.conf
+export FONTCONFIG_FILE
+
+dotest "Basic check"
+prep
+cp $FONT1 $FONT2 $FONTDIR
+check
+
+dotest "With a subdir"
+prep
+cp $FONT1 $FONT2 $FONTDIR
+$FCCACHE $FONTDIR
+check
+
+dotest "Subdir with a cache file"
+prep
+mkdir $FONTDIR/a
+cp $FONT1 $FONT2 $FONTDIR/a
+$FCCACHE $FONTDIR/a
+check
+
+dotest "Complicated directory structure"
+prep
+mkdir $FONTDIR/a
+mkdir $FONTDIR/a/a
+mkdir $FONTDIR/b
+mkdir $FONTDIR/b/a
+cp $FONT1 $FONTDIR/a
+cp $FONT2 $FONTDIR/b/a
+check
+
+dotest "Subdir with an out-of-date cache file"
+prep
+mkdir $FONTDIR/a
+$FCCACHE $FONTDIR/a
+sleep 1
+cp $FONT1 $FONT2 $FONTDIR/a
+check
+
+dotest "Dir with an out-of-date cache file"
+prep
+cp $FONT1 $FONTDIR
+$FCCACHE $FONTDIR
+sleep 1
+mkdir $FONTDIR/a
+cp $FONT2 $FONTDIR/a
+check
+
+rm -rf $FONTDIR $CACHEFILE $CACHEDIR $FONTCONFIG_FILE out