]> git.wh0rd.org - fontconfig.git/blame_incremental - test/run-test.sh
2006-08-04 Keith Packard (keithp@keithp.com) reviewed by: plam
[fontconfig.git] / test / run-test.sh
... / ...
CommitLineData
1#!/bin/sh
2TESTDIR=${srcdir-`pwd`}
3
4FONTDIR=`pwd`/fonts
5CACHEFILE=`pwd`/fonts.cache
6CACHEDIR=`pwd`/cache.dir
7
8ECHO=true
9
10FCLIST=../fc-list/fc-list
11FCCACHE=../fc-cache/fc-cache
12
13FONT1=$TESTDIR/4x6.pcf
14FONT2=$TESTDIR/8x16.pcf
15
16check () {
17 $FCLIST - family pixelsize | sort > out
18 echo "=" >> out
19 $FCLIST - family pixelsize | sort >> out
20 echo "=" >> out
21 $FCLIST - family pixelsize | sort >> out
22 tr -d '\015' <out >out.tmp; mv out.tmp out
23 if cmp out $TESTDIR/out.expected > /dev/null ; then : ; else
24 echo "*** Test failed: $TEST"
25 echo "*** output is in 'out', expected output in 'out.expected'"
26 exit 1
27 fi
28 rm out
29}
30
31prep() {
32 rm -rf $CACHEFILE
33 rm -rf $FONTDIR
34 mkdir $FONTDIR
35}
36
37dotest () {
38 TEST=$1
39 test x$VERBOSE = x || echo Running: $TEST
40}
41
42sed "s!@FONTDIR@!$FONTDIR!
43s!@CACHEFILE@!$CACHEFILE!
44s!@CACHEDIR@!$CACHEDIR!" < $TESTDIR/fonts.conf.in > fonts.conf
45
46FONTCONFIG_FILE=`pwd`/fonts.conf
47export FONTCONFIG_FILE
48
49dotest "Basic check"
50prep
51cp $FONT1 $FONT2 $FONTDIR
52check
53
54dotest "With a subdir"
55prep
56cp $FONT1 $FONT2 $FONTDIR
57$FCCACHE $FONTDIR
58check
59
60dotest "Subdir with a cache file"
61prep
62mkdir $FONTDIR/a
63cp $FONT1 $FONT2 $FONTDIR/a
64$FCCACHE $FONTDIR/a
65check
66
67dotest "Complicated directory structure"
68prep
69mkdir $FONTDIR/a
70mkdir $FONTDIR/a/a
71mkdir $FONTDIR/b
72mkdir $FONTDIR/b/a
73cp $FONT1 $FONTDIR/a
74cp $FONT2 $FONTDIR/b/a
75check
76
77dotest "Subdir with an out-of-date cache file"
78prep
79mkdir $FONTDIR/a
80$FCCACHE $FONTDIR/a
81sleep 1
82cp $FONT1 $FONT2 $FONTDIR/a
83check
84
85dotest "Dir with an out-of-date cache file"
86prep
87cp $FONT1 $FONTDIR
88$FCCACHE $FONTDIR
89sleep 1
90mkdir $FONTDIR/a
91cp $FONT2 $FONTDIR/a
92check
93
94rm -rf $FONTDIR $CACHEFILE $CACHEDIR $FONTCONFIG_FILE out