add test_picture to grabbag tests
authorJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 17 Nov 2006 07:46:09 +0000 (07:46 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 17 Nov 2006 07:46:09 +0000 (07:46 +0000)
test/picture.ok [new file with mode: 0644]
test/test_grabbag.sh

diff --git a/test/picture.ok b/test/picture.ok
new file mode 100644 (file)
index 0000000..b26009c
--- /dev/null
@@ -0,0 +1,28 @@
+
++++ grabbag unit test: picture
+
+testing grabbag__picture_parse_specification("")... OK (failed as expected, error: invalid picture specification)
+testing grabbag__picture_parse_specification("||||")... OK (failed as expected: invalid MIME type)
+testing grabbag__picture_parse_specification("|image/gif|||")... OK (failed as expected: error opening picture file)
+testing grabbag__picture_parse_specification("|image/gif|desc|320|0.gif")... OK (failed as expected: invalid picture specification: can't parse resolution/color part)
+testing grabbag__picture_parse_specification("|image/gif|desc|320x240|0.gif")... OK (failed as expected: invalid picture specification: can't parse resolution/color part)
+testing grabbag__picture_parse_specification("|image/gif|desc|320x240x9|")... OK (failed as expected: error opening picture file)
+testing grabbag__picture_parse_specification("|image/gif|desc|320x240x9/2345|0.gif")... OK (failed as expected: invalid picture specification: can't parse resolution/color part)
+testing grabbag__picture_parse_specification("1|-->|desc|32x24x9|0.gif")... OK (failed as expected: type 1 icon must be a 32x32 pixel PNG)
+testing grabbag__picture_parse_specification("|-->|desc||http://blah.blah.blah/z.gif")... OK (failed as expected: unable to extract resolution and color info from URL, user must set explicitly)
+testing grabbag__picture_parse_specification("|-->|desc|320x240x9|http://blah.blah.blah/z.gif")... OK
+testing grabbag__picture_parse_specification("3|image/gif|||pictures/0.gif")... OK
+testing grabbag__picture_parse_specification("4|image/gif|||pictures/1.gif")... OK
+testing grabbag__picture_parse_specification("0|image/gif|||pictures/2.gif")... OK
+testing grabbag__picture_parse_specification("3|image/jpeg|||pictures/0.jpg")... OK
+testing grabbag__picture_parse_specification("3|image/jpeg|||pictures/4.jpg")... OK
+testing grabbag__picture_parse_specification("3|image/png|||pictures/0.png")... OK
+testing grabbag__picture_parse_specification("3|image/png|||pictures/1.png")... OK
+testing grabbag__picture_parse_specification("3|image/png|||pictures/2.png")... OK
+testing grabbag__picture_parse_specification("3|image/png|||pictures/3.png")... OK
+testing grabbag__picture_parse_specification("3|image/png|||pictures/4.png")... OK
+testing grabbag__picture_parse_specification("3|image/png|||pictures/5.png")... OK
+testing grabbag__picture_parse_specification("3|image/png|||pictures/6.png")... OK
+testing grabbag__picture_parse_specification("3|image/png|||pictures/7.png")... OK
+testing grabbag__picture_parse_specification("999|image/png|||pictures/8.png")... OK
+testing grabbag__picture_parse_specification("3|image/gif||320x240x3/2|pictures/0.gif")... OK
index f7bda57..1785b5f 100755 (executable)
@@ -35,9 +35,11 @@ LD_LIBRARY_PATH=../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH
 LD_LIBRARY_PATH=../obj/$BUILD/lib:$LD_LIBRARY_PATH
 export LD_LIBRARY_PATH
 PATH=../src/test_grabbag/cuesheet:$PATH
+PATH=../src/test_grabbag/picture:$PATH
 PATH=../obj/$BUILD/bin:$PATH
 
 test_cuesheet -h 1>/dev/null 2>/dev/null || die "ERROR can't find test_cuesheet executable"
+test_picture -h 1>/dev/null 2>/dev/null || die "ERROR can't find test_picture executable"
 
 run_test_cuesheet ()
 {
@@ -48,6 +50,15 @@ run_test_cuesheet ()
        fi
 }
 
+run_test_picture ()
+{
+       if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
+               valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 test_picture $* 4>>test_grabbag.valgrind.log
+       else
+               test_picture $*
+       fi
+}
+
 if [ `env | grep -ic '^comspec='` != 0 ] ; then
        is_win=yes
 else
@@ -56,6 +67,29 @@ fi
 
 ########################################################################
 #
+# test_picture
+#
+########################################################################
+
+log=picture.log
+picture_dir=pictures
+
+echo "Running test_picture..."
+
+rm -f $log
+
+run_test_picture $picture_dir >> $log 2>&1
+
+if [ $is_win = yes ] ; then
+       diff -w picture.ok $log > picture.diff || die "Error: .log file does not match .ok file, see picture.diff"
+else
+       diff picture.ok $log > picture.diff || die "Error: .log file does not match .ok file, see picture.diff"
+fi
+
+echo "PASSED (results are in $log)"
+
+########################################################################
+#
 # test_cuesheet
 #
 ########################################################################
@@ -66,6 +100,8 @@ good_cuesheets=cuesheets/good.*.cue
 good_leadout=`expr 80 \* 60 \* 44100`
 bad_leadout=`expr $good_leadout + 1`
 
+echo "Running test_cuesheet..."
+
 rm -f $log
 
 #