]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | TESTDIR=${srcdir-`pwd`} | |
3 | ||
4 | FONTDIR=`pwd`/fonts | |
5 | CACHEFILE=`pwd`/fonts.cache | |
6 | CACHEDIR=`pwd`/cache.dir | |
7 | ||
8 | ECHO=true | |
9 | ||
10 | FCLIST=../fc-list/fc-list | |
11 | FCCACHE=../fc-cache/fc-cache | |
12 | ||
13 | FONT1=$TESTDIR/4x6.pcf | |
14 | FONT2=$TESTDIR/8x16.pcf | |
15 | ||
16 | check () { | |
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 | ||
31 | prep() { | |
32 | rm -rf $CACHEFILE | |
33 | rm -rf $FONTDIR | |
34 | mkdir $FONTDIR | |
35 | } | |
36 | ||
37 | dotest () { | |
38 | TEST=$1 | |
39 | test x$VERBOSE = x || echo Running: $TEST | |
40 | } | |
41 | ||
42 | sed "s!@FONTDIR@!$FONTDIR! | |
43 | s!@CACHEFILE@!$CACHEFILE! | |
44 | s!@CACHEDIR@!$CACHEDIR!" < $TESTDIR/fonts.conf.in > fonts.conf | |
45 | ||
46 | FONTCONFIG_FILE=`pwd`/fonts.conf | |
47 | export FONTCONFIG_FILE | |
48 | ||
49 | dotest "Basic check" | |
50 | prep | |
51 | cp $FONT1 $FONT2 $FONTDIR | |
52 | check | |
53 | ||
54 | dotest "With a subdir" | |
55 | prep | |
56 | cp $FONT1 $FONT2 $FONTDIR | |
57 | $FCCACHE $FONTDIR | |
58 | check | |
59 | ||
60 | dotest "Subdir with a cache file" | |
61 | prep | |
62 | mkdir $FONTDIR/a | |
63 | cp $FONT1 $FONT2 $FONTDIR/a | |
64 | $FCCACHE $FONTDIR/a | |
65 | check | |
66 | ||
67 | dotest "Complicated directory structure" | |
68 | prep | |
69 | mkdir $FONTDIR/a | |
70 | mkdir $FONTDIR/a/a | |
71 | mkdir $FONTDIR/b | |
72 | mkdir $FONTDIR/b/a | |
73 | cp $FONT1 $FONTDIR/a | |
74 | cp $FONT2 $FONTDIR/b/a | |
75 | check | |
76 | ||
77 | dotest "Subdir with an out-of-date cache file" | |
78 | prep | |
79 | mkdir $FONTDIR/a | |
80 | $FCCACHE $FONTDIR/a | |
81 | sleep 1 | |
82 | cp $FONT1 $FONT2 $FONTDIR/a | |
83 | check | |
84 | ||
85 | dotest "Dir with an out-of-date cache file" | |
86 | prep | |
87 | cp $FONT1 $FONTDIR | |
88 | $FCCACHE $FONTDIR | |
89 | sleep 1 | |
90 | mkdir $FONTDIR/a | |
91 | cp $FONT2 $FONTDIR/a | |
92 | check | |
93 | ||
94 | rm -rf $FONTDIR $CACHEFILE $CACHEDIR $FONTCONFIG_FILE out |