aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/tests
diff options
context:
space:
mode:
authorGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-15 14:58:53 +0000
committerGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-15 14:58:53 +0000
commita2b793c4d159ccaffbf921a0339096f2c9c35560 (patch)
tree3033f269677268735ff05fbb10cc720e97cd2ec5 /tools/tests
parent415e76a76091d06a3eeb4087c378bfa76947bc58 (diff)
Add self-test for skdiff, and remove date/time from skdiff output so it passes.
Diffstat (limited to 'tools/tests')
-rwxr-xr-xtools/tests/run.sh27
-rw-r--r--tools/tests/skdiff/output-expected/different-bits-identical-pixels-diff.pngbin0 -> 2461 bytes
-rw-r--r--tools/tests/skdiff/output-expected/different-bits-identical-pixels-white.pngbin0 -> 2461 bytes
-rw-r--r--tools/tests/skdiff/output-expected/different-pixels-same-size-diff.pngbin0 -> 118646 bytes
-rw-r--r--tools/tests/skdiff/output-expected/different-pixels-same-size-white.pngbin0 -> 4378 bytes
-rw-r--r--tools/tests/skdiff/output-expected/different-sizes-diff.pngbin0 -> 6531 bytes
-rw-r--r--tools/tests/skdiff/output-expected/different-sizes-white.pngbin0 -> 2461 bytes
-rw-r--r--tools/tests/skdiff/output-expected/identical-bits-diff.pngbin0 -> 2461 bytes
-rw-r--r--tools/tests/skdiff/output-expected/identical-bits-white.pngbin0 -> 2461 bytes
-rw-r--r--tools/tests/skdiff/output-expected/index.html21
-rw-r--r--tools/tests/skdiff/output-expected/stdout12
11 files changed, 60 insertions, 0 deletions
diff --git a/tools/tests/run.sh b/tools/tests/run.sh
new file mode 100755
index 0000000000..d88740f399
--- /dev/null
+++ b/tools/tests/run.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# Tests for our tools.
+# TODO: for now, it only tests skdiff
+# TODO: for now, assumes that it is being run from .../trunk
+
+# TODO: make it look in Release and/or Debug
+SKDIFF_BINARY=out/Debug/skdiff
+
+function compare_directories {
+ diff --exclude=.* $1 $2
+ if [ $? != 0 ]; then
+ echo "failed in: compare_directories $1 $2"
+ exit 1
+ fi
+}
+
+# Test skdiff...
+#
+SKDIFF_TESTDIR=tools/tests/skdiff
+SKDIFF_OUTPUT_DIR=$SKDIFF_TESTDIR/output-actual
+mkdir -p $SKDIFF_OUTPUT_DIR
+$SKDIFF_BINARY $SKDIFF_TESTDIR/baseDir $SKDIFF_TESTDIR/comparisonDir \
+ $SKDIFF_OUTPUT_DIR &>$SKDIFF_OUTPUT_DIR/stdout
+compare_directories $SKDIFF_TESTDIR/output-expected $SKDIFF_OUTPUT_DIR
+
+echo "All tests passed."
diff --git a/tools/tests/skdiff/output-expected/different-bits-identical-pixels-diff.png b/tools/tests/skdiff/output-expected/different-bits-identical-pixels-diff.png
new file mode 100644
index 0000000000..170092865a
--- /dev/null
+++ b/tools/tests/skdiff/output-expected/different-bits-identical-pixels-diff.png
Binary files differ
diff --git a/tools/tests/skdiff/output-expected/different-bits-identical-pixels-white.png b/tools/tests/skdiff/output-expected/different-bits-identical-pixels-white.png
new file mode 100644
index 0000000000..170092865a
--- /dev/null
+++ b/tools/tests/skdiff/output-expected/different-bits-identical-pixels-white.png
Binary files differ
diff --git a/tools/tests/skdiff/output-expected/different-pixels-same-size-diff.png b/tools/tests/skdiff/output-expected/different-pixels-same-size-diff.png
new file mode 100644
index 0000000000..dbd706349d
--- /dev/null
+++ b/tools/tests/skdiff/output-expected/different-pixels-same-size-diff.png
Binary files differ
diff --git a/tools/tests/skdiff/output-expected/different-pixels-same-size-white.png b/tools/tests/skdiff/output-expected/different-pixels-same-size-white.png
new file mode 100644
index 0000000000..10d8c55a56
--- /dev/null
+++ b/tools/tests/skdiff/output-expected/different-pixels-same-size-white.png
Binary files differ
diff --git a/tools/tests/skdiff/output-expected/different-sizes-diff.png b/tools/tests/skdiff/output-expected/different-sizes-diff.png
new file mode 100644
index 0000000000..ecba8036f9
--- /dev/null
+++ b/tools/tests/skdiff/output-expected/different-sizes-diff.png
Binary files differ
diff --git a/tools/tests/skdiff/output-expected/different-sizes-white.png b/tools/tests/skdiff/output-expected/different-sizes-white.png
new file mode 100644
index 0000000000..170092865a
--- /dev/null
+++ b/tools/tests/skdiff/output-expected/different-sizes-white.png
Binary files differ
diff --git a/tools/tests/skdiff/output-expected/identical-bits-diff.png b/tools/tests/skdiff/output-expected/identical-bits-diff.png
new file mode 100644
index 0000000000..170092865a
--- /dev/null
+++ b/tools/tests/skdiff/output-expected/identical-bits-diff.png
Binary files differ
diff --git a/tools/tests/skdiff/output-expected/identical-bits-white.png b/tools/tests/skdiff/output-expected/identical-bits-white.png
new file mode 100644
index 0000000000..170092865a
--- /dev/null
+++ b/tools/tests/skdiff/output-expected/identical-bits-white.png
Binary files differ
diff --git a/tools/tests/skdiff/output-expected/index.html b/tools/tests/skdiff/output-expected/index.html
new file mode 100644
index 0000000000..07ffc2f72f
--- /dev/null
+++ b/tools/tests/skdiff/output-expected/index.html
@@ -0,0 +1,21 @@
+<html>
+<body>
+<table>
+<tr><th>4 of 8 images matched exactly.<br></th>
+<th>every different pixel shown in white</th>
+<th>color difference at each pixel</th>
+<th>tools/tests/skdiff/baseDir/</th>
+<th>tools/tests/skdiff/comparisonDir/</th>
+</tr>
+<tr>
+<td>different-sizes.png<br>Image sizes differ</td><td align=center>[image size mismatch, so no diff to display]</td><td align=center>[image size mismatch, so no diff to display]</td><td><a href="../../../../tools/tests/skdiff/baseDir/different-sizes.png"><img src="../../../../tools/tests/skdiff/baseDir/different-sizes.png" height="240px"></a></td><td><a href="../../../../tools/tests/skdiff/comparisonDir/different-sizes.png"><img src="../../../../tools/tests/skdiff/comparisonDir/different-sizes.png" height="240px"></a></td></tr>
+<tr>
+<td>different-pixels-same-size.png<br> 97.9926% of pixels differ
+ ( 42.8911% weighted)<br>Average color mismatch 89<br>Max color mismatch 239</td><td><a href="different-pixels-same-size-white.png"><img src="different-pixels-same-size-white.png" height="240px"></a></td><td><a href="different-pixels-same-size-diff.png"><img src="different-pixels-same-size-diff.png" height="240px"></a></td><td><a href="../../../../tools/tests/skdiff/baseDir/different-pixels-same-size.png"><img src="../../../../tools/tests/skdiff/baseDir/different-pixels-same-size.png" height="240px"></a></td><td><a href="../../../../tools/tests/skdiff/comparisonDir/different-pixels-same-size.png"><img src="../../../../tools/tests/skdiff/comparisonDir/different-pixels-same-size.png" height="240px"></a></td></tr>
+<tr>
+<td>missing-from-baseDir.png<br></td><td>N/A</td><td>N/A</td><td>N/A</td><td><a href="../../../../tools/tests/skdiff/comparisonDir/missing-from-baseDir.png"><img src="../../../../tools/tests/skdiff/comparisonDir/missing-from-baseDir.png" height="240px"></a></td></tr>
+<tr>
+<td>missing-from-comparisonDir.png<br></td><td>N/A</td><td>N/A</td><td><a href="../../../../tools/tests/skdiff/baseDir/missing-from-comparisonDir.png"><img src="../../../../tools/tests/skdiff/baseDir/missing-from-comparisonDir.png" height="240px"></a></td><td>N/A</td></tr>
+</table>
+</body>
+</html>
diff --git a/tools/tests/skdiff/output-expected/stdout b/tools/tests/skdiff/output-expected/stdout
new file mode 100644
index 0000000000..90abea3fc5
--- /dev/null
+++ b/tools/tests/skdiff/output-expected/stdout
@@ -0,0 +1,12 @@
+ERROR: no codec found for <tools/tests/skdiff/baseDir/different-bits-unknown-format.xyz>
+ERROR: no codec found for <tools/tests/skdiff/baseDir/identical-bits-unknown-format.xyz>
+baseDir is [tools/tests/skdiff/baseDir/]
+comparisonDir is [tools/tests/skdiff/comparisonDir/]
+writing diffs to outputDir is [tools/tests/skdiff/output-actual/]
+Missing in baseDir:
+ missing-from-baseDir.png
+Missing in comparisonDir:
+ missing-from-comparisonDir.png
+4 of 8 images matched.
+Maximum pixel intensity mismatch 239
+Largest area mismatch was 100.00% of pixels