From 0543e1bcfbb4c0df33322f31819b824e9ac4bf2b Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Sun, 4 Nov 2018 00:00:56 +0100 Subject: [PATCH] Added a few more failure tests to improve test coverage. --- test/check-add-tags.sh | 6 ++++++ test/check-show-description.sh | 25 ++++++++++++++++++------- test/check-thumbnail.sh | 8 ++++++++ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/test/check-add-tags.sh b/test/check-add-tags.sh index b7ecdb7..50b5221 100755 --- a/test/check-add-tags.sh +++ b/test/check-add-tags.sh @@ -142,6 +142,12 @@ $EXIFEXE --no-fixup --ifd=0 --tag=XResolution --set-value='12 2 3' -o "$dstimg" check_result append_image +echo Create invalid ASCII--too large +$EXIFEXE --no-fixup --ifd=0 --tag=ImageDescription --set-value="`printf '%66000s' foo`" -o "$dstimg" "$srcimg" >/dev/null +test "$?" -eq 1 +check_result +append_image + # Check the resulting EXIF file $EXIFEXE -m -i "$srcimg" >"$tmpfile" "$DIFFEXE" - "$tmpfile" < "$tmpfile" +$EXIFEXE --ifd=Interoperability --tag=InteroperabilityIndex --show-description > "$tmpfile" 2>&1 test $? -eq 0 || { echo Incorrect return code; exit 1; } $DIFFEXE - "$tmpfile" < "$tmpfile" +$EXIFEXE --ifd GPS -t1 -s > "$tmpfile" 2>&1 test $? -eq 0 || { echo Incorrect return code; exit 1; } $DIFFEXE - "$tmpfile" < "$tmpfile" +$EXIFEXE --ifd=GPS --tag=0 --show-description > "$tmpfile" 2>&1 test $? -eq 0 || { echo Incorrect return code; exit 1; } $DIFFEXE - "$tmpfile" <. The version is given as 2.0.0.0. This tag is mandatory when tag is present. (Note: The tag is given in bytes, unlike the tag. When the version is 2.0.0.0, the tag value is 02000000.H). @@ -34,7 +34,7 @@ EOF test $? -eq 0 || exit 1 echo Test --machine-readable using hexadecimal tag -$EXIFEXE --ifd=1 --tag=0x103 --show-description --machine-readable > "$tmpfile" +$EXIFEXE --ifd=1 --tag=0x103 --show-description --machine-readable > "$tmpfile" 2>&1 test $? -eq 0 || { echo Incorrect return code; exit 1; } $DIFFEXE - "$tmpfile" < "$tmpfile" +$EXIFEXE --ifd=EXIF --tag=1 --show-description > "$tmpfile" 2>&1 test $? -eq 1 || { echo Incorrect return code; exit 1; } $DIFFEXE - "$tmpfile" < 65535 -$EXIFEXE --ifd=GPS --tag=65537 --show-description > "$tmpfile" +$EXIFEXE --ifd=GPS --tag=65537 --show-description > "$tmpfile" 2>&1 test $? -eq 1 || { echo Incorrect return code; exit 1; } $DIFFEXE - "$tmpfile" < "$tmpfile" 2>&1 +test $? -eq 1 || { echo Incorrect return code; exit 1; } +$DIFFEXE - "$tmpfile" < "$tmpfile" +$EXIFEXE --ifd=XYZZY --tag=0x100 --show-description > "$tmpfile" 2>&1 test $? -eq 1 || { echo Incorrect return code; exit 1; } $DIFFEXE - "$tmpfile" < "$tmpfile" 2>&1 +test $? -eq 1 || { echo Incorrect return code; exit 1; } +$DIFFEXE - "$tmpfile" <&1 | sed -e "/Date and Time/s/|.*$/|/" > "$tmpfile" test $? -eq 0 || { echo Incorrect return code; exit 1; }