• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3test "x$srcdir" = x && srcdir=.
4test "x$builddir" = x && builddir=.
5test "x$top_builddir" = x && top_builddir=../..
6
7hb_shape=$top_builddir/util/hb-shape$EXEEXT
8
9fails=0
10
11reference=false
12if test "x$1" = x--reference; then
13	reference=true
14	shift
15fi
16
17if test $# = 0; then
18	set /dev/stdin
19fi
20
21for f in "$@"; do
22	$reference || echo "Running tests in $f"
23	while IFS=: read fontfile options unicodes glyphs_expected; do
24		if echo "$fontfile" | grep -q '^#'; then
25			$reference || echo "Skipping $fontfile:$unicodes"
26			continue
27		fi
28		$reference || echo "Testing $fontfile:$unicodes"
29		glyphs=`$srcdir/hb-unicode-encode "$unicodes" | $hb_shape $options "$srcdir/$fontfile"`
30		if test $? != 0; then
31			echo "hb-shape failed." >&2
32			fails=$((fails+1))
33			continue
34		fi
35		if $reference; then
36			echo "$fontfile:$options:$unicodes:$glyphs"
37			continue
38		fi
39		if ! test "x$glyphs" = "x$glyphs_expected"; then
40			echo "Actual:   $glyphs" >&2
41			echo "Expected: $glyphs_expected" >&2
42			fails=$((fails+1))
43		fi
44	done < "$f"
45done
46
47if test $fails != 0; then
48	$reference || echo "$fails tests failed."
49	exit 1
50else
51	$reference || echo "All tests passed."
52fi
53