summaryrefslogtreecommitdiffstats
path: root/test/test_examples.sh.in
blob: f4c18e8c695d44899bfdd5163c5148e3bfeebf7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash

unset ERR

DIR="@abs_top_srcdir@"
ZBARIMG="@abs_top_builddir@/zbarimg/zbarimg --nodbus"

test()
{
	if [ "$2" != "" ]; then
	        i="$DIR/examples/$2"
		j="$1 $2"
	else
	        i="$DIR/examples/$1"
		j="$1"
	fi;
	if [ "$2" != "" ]; then
		CMD="$ZBARIMG $1"
	else
		CMD="$ZBARIMG"
	fi
	CK=`$CMD "$i" 2>/dev/null|sha1sum|cut -d" " -f1`
	ORG=`grep "zbarimg $j" "$DIR/examples/sha1sum"|cut -d " " -f1`

	if [ "$CK" != "$ORG" ]; then
		echo "FAILED: $i ($CK instead of $ORG)"
		echo -e "\tcmd: $CMD '$i'"
		echo -en "\tresults: "
		$CMD "$i" 2>/dev/null
		ERR=1
	fi
}

if [ "@ENABLE_CODE128@" == "1" ]; then
	test code-128.png
fi

if [ "@ENABLE_CODE93@" == "1" ]; then
        test code-93.png
fi

if [ "@ENABLE_CODE39@" == "1" ]; then
        test code-39.png
fi

if [ "@ENABLE_CODABAR@" == "1" ]; then
        test codabar.png
fi

if [ "@ENABLE_DATABAR@" == "1" ]; then
        test databar.png
        test databar-exp.png
fi

if [ "@ENABLE_EAN@" == "1" ]; then
        test -Sean2.enable ean-2.png
        test -Sean5.enable ean-5.png
        test ean-8.png
        test ean-13.png
        test -Sisbn10.enable ean-13.png
        test -Sisbn13.enable ean-13.png
        test -Supca.enable code-upc-a.png
fi

if [ "@ENABLE_I25@" == "1" ]; then
        test i2-5.png
fi

if [ "@ENABLE_QRCODE@" == "1" ]; then
        test qr-code.png
        test -Stest-inverted qr-code-inverted.png
        test '--raw --oneshot -Sbinary' qr-code-binary.png
fi

if [ "@ENABLE_SQCODE@" == "1" ]; then
        test sqcode1-generated.png
        test sqcode1-scanned.png
fi

# The pdf417 code is incomplete: it doesn't output any results
#
#if [ "@ENABLE_PDF417@" == "1" ]; then
#        test code-pdf417.png
#fi

if [ "$ERR" == "" ]; then
	echo "zbarimg PASSED."
else
	exit 1
fi