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