From aab016adfed07d088fbd233cf63c870645020fca Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Sun, 27 Jun 2004 05:25:22 +0000 Subject: [PATCH] Added testcases --- src/write-test.cpp | 48 ++++++++++++++++-- src/write-test.out | 118 ++++++++++++++++++++++++++++++++++++++++++++- src/write-test.sh | 89 ++++++++++++++-------------------- 3 files changed, 196 insertions(+), 59 deletions(-) diff --git a/src/write-test.cpp b/src/write-test.cpp index 6ca02464..24eb7be5 100644 --- a/src/write-test.cpp +++ b/src/write-test.cpp @@ -3,7 +3,7 @@ Abstract : ExifData write unit tests Author(s): Andreas Huggel (ahu) - Version : $Name: $ $Revision: 1.6 $ + Version : $Name: $ $Revision: 1.7 $ Test procedure: $ rm -f test.jpg thumb.jpg iii ttt; @@ -44,7 +44,7 @@ try { if (argc != 3) { std::cout << "Usage: write-test file case\n\n" - << "where case is an integer between 1 and 6\n"; + << "where case is an integer between 1 and 11\n"; return 1; } @@ -85,7 +85,7 @@ try { break; case 5: std::cerr << "Case 5: "; - std::cerr << "Intrusive change to the makernote metadata\n"; + std::cerr << "Intrusive change to the Canon makernote metadata\n"; testCase(testFile, "test5.jpg", "thumb5", "Makernote.Canon.OwnerName", "Frau Chan YeeSend und Herr Andreas Huggel"); @@ -97,9 +97,49 @@ try { "Image.DateTime.DateTimeOriginal", "1999:11:22 00:11:22 and twenty seconds"); break; + case 7: + std::cerr << "Case 7: "; + std::cerr << "Intrusive change to the Fujifilm makernote metadata\n"; + testCase(testFile, "test7.jpg", "thumb7", + "Makernote.Fujifilm.Quality", + "Typical Fujifilm Quality"); + break; + case 8: + std::cerr << "Case 8: "; + std::cerr << "Intrusive change to the Sigma makernote metadata\n"; + testCase(testFile, "test8.jpg", "thumb8", + "Makernote.Sigma.ResolutionMode", + "Sigma HI resolution"); + break; + case 9: + std::cerr << "Case 9: "; + std::cerr << "Intrusive change to the Nikon1 makernote metadata\n"; + testCase(testFile, "test9.jpg", "thumb9", + "Makernote.Nikon1.Quality", + "Typical Nikon1 Quality"); + break; + case 10: + std::cerr << "Case 10: "; + std::cerr << "Intrusive change to the Nikon2 makernote metadata\n"; + testCase(testFile, "test10.jpg", "thumb10", + "Makernote.Nikon2.0x0002", + "Nikon2 Version 2"); + break; + case 11: + std::cerr << "Case 11: "; + std::cerr << "Intrusive change to the Nikon3 makernote metadata\n"; + testCase(testFile, "test11.jpg", "thumb11", + "Makernote.Nikon3.Quality", + "Typical Nikon3 Quality"); + break; + + // ToDo: Erase Sigma thumbnail + + // ToDo: Write to a broken (truncated) IFD entry + default: std::cout << "Usage: exiftest file case\n\n" - << "where case is an integer between 1 and 6\n"; + << "where case is an integer between 1 and 11\n"; rc = 1; break; } diff --git a/src/write-test.out b/src/write-test.out index a107265f..af213413 100644 --- a/src/write-test.out +++ b/src/write-test.out @@ -59,7 +59,7 @@ Case 4: Intrusive change to the standard Exif metadata --- > Thumbnail.RecordingOffset.JPEGInterchangeFormat 0x0201 1571 ------------------------------------------------------------ -Case 5: Intrusive change to the makernote metadata +Case 5: Intrusive change to the Canon makernote metadata ---> Reading file ../test/img_1771.jpg ---> Modifying Exif data ---> Writing Exif data to file test5.jpg @@ -102,3 +102,119 @@ Case 6: Intrusive change to the Exif metadata (w/o makernote) < Thumbnail.RecordingOffset.StripOffsets 0x0111 928 --- > Thumbnail.RecordingOffset.StripOffsets 0x0111 765 +------------------------------------------------------------ +Case 7: Intrusive change to the Fujifilm makernote metadata +---> Reading file ../test/dscf0176.jpg +---> Modifying Exif data +---> Writing Exif data to file test7.jpg +->>>>>> writing from metadata <<<<<<- +---> Reading file test7.jpg +---> Writing Exif thumbnail to file thumb7.* +11c11 +< Image.ExifFormat.ExifTag 0x8769 248 +--- +> Image.ExifFormat.ExifTag 0x8769 245 +33c33 +< Image.ExifFormat.InteroperabilityTag 0xa005 1056 +--- +> Image.ExifFormat.InteroperabilityTag 0xa005 1070 +50c50 +< Makernote.Fujifilm.Quality 0x1000 NORMAL +--- +> Makernote.Fujifilm.Quality 0x1000 Typical Fujifilm Quality +72c72 +< Thumbnail.RecordingOffset.JPEGInterchangeFormat 0x0201 1204 +--- +> Thumbnail.RecordingOffset.JPEGInterchangeFormat 0x0201 1218 +------------------------------------------------------------ +Case 8: Intrusive change to the Sigma makernote metadata +---> Reading file ../test/sigma-d10-IMG10086.jpg +---> Modifying Exif data +---> Writing Exif data to file test8.jpg +->>>>>> writing from metadata <<<<<<- +---> Reading file test8.jpg +---> Writing Exif thumbnail to file thumb8.* +10c10 +< Image.ExifFormat.ExifTag 0x8769 12317 +--- +> Image.ExifFormat.ExifTag 0x8769 213 +38c38 +< Makernote.Sigma.ResolutionMode 0x0004 HI +--- +> Makernote.Sigma.ResolutionMode 0x0004 Sigma HI resolution +63c63 +< Thumbnail.RecordingOffset.JPEGInterchangeFormat 0x0201 303 +--- +> Thumbnail.RecordingOffset.JPEGInterchangeFormat 0x0201 1239 +------------------------------------------------------------ +Case 9: Intrusive change to the Nikon1 makernote metadata +---> Reading file ../test/nikon-coolpix-990-DSCN1180.jpg +---> Modifying Exif data +---> Writing Exif data to file test9.jpg +->>>>>> writing from metadata <<<<<<- +---> Reading file test9.jpg +---> Writing Exif thumbnail to file thumb9.* +11c11 +< Image.ExifFormat.ExifTag 0x8769 284 +--- +> Image.ExifFormat.ExifTag 0x8769 213 +32c32 +< Image.ExifFormat.InteroperabilityTag 0xa005 886 +--- +> Image.ExifFormat.InteroperabilityTag 0xa005 1214 +38c38 +< Makernote.Nikon1.Quality 0x0004 FINE +--- +> Makernote.Nikon1.Quality 0x0004 Typical Nikon1 Quality +57c57 +< Thumbnail.RecordingOffset.JPEGInterchangeFormat 0x0201 4084 +--- +> Thumbnail.RecordingOffset.JPEGInterchangeFormat 0x0201 1338 +------------------------------------------------------------ +Case 10: Intrusive change to the Nikon2 makernote metadata +---> Reading file ../test/nikon-e950.jpg +---> Modifying Exif data +---> Writing Exif data to file test10.jpg +->>>>>> writing from metadata <<<<<<- +---> Reading file test10.jpg +---> Writing Exif thumbnail to file thumb10.* +11c11 +< Image.ExifFormat.ExifTag 0x8769 284 +--- +> Image.ExifFormat.ExifTag 0x8769 212 +32c32 +< Image.ExifFormat.InteroperabilityTag 0xa005 886 +--- +> Image.ExifFormat.InteroperabilityTag 0xa005 1038 +35c35 +< Makernote.Nikon2.0x0002 0x0002 08.00 +--- +> Makernote.Nikon2.0x0002 0x0002 Nikon2 Version 2 +52c52 +< Thumbnail.RecordingOffset.JPEGInterchangeFormat 0x0201 2036 +--- +> Thumbnail.RecordingOffset.JPEGInterchangeFormat 0x0201 1162 +------------------------------------------------------------ +Case 11: Intrusive change to the Nikon3 makernote metadata +---> Reading file ../test/nikon-d70-dsc_0063.jpg +---> Modifying Exif data +---> Writing Exif data to file test11.jpg +->>>>>> writing from metadata <<<<<<- +---> Reading file test11.jpg +---> Writing Exif thumbnail to file thumb11.* +13c13 +< Image.ExifFormat.ExifTag 0x8769 340 +--- +> Image.ExifFormat.ExifTag 0x8769 332 +36c36 +< Image.ExifFormat.InteroperabilityTag 0xa005 30306 +--- +> Image.ExifFormat.InteroperabilityTag 0xa005 2402 +55c55 +< Makernote.Nikon3.Quality 0x0004 FINE +--- +> Makernote.Nikon3.Quality 0x0004 Typical Nikon3 Quality +101c101 +< Thumbnail.RecordingOffset.JPEGInterchangeFormat 0x0201 30444 +--- +> Thumbnail.RecordingOffset.JPEGInterchangeFormat 0x0201 2538 diff --git a/src/write-test.sh b/src/write-test.sh index af92c7a5..aaf6170f 100755 --- a/src/write-test.sh +++ b/src/write-test.sh @@ -1,62 +1,43 @@ #! /bin/sh # Test driver for the write unit tests -# Case 1 -echo "------------------------------------------------------------" -testFile="../test/img_1771.jpg" -rm -f test1.jpg thumb1.jpg -rm -f iii ttt; -./exifprint $testFile > iii; -cp $testFile ./test1.jpg; -./write-test $testFile 1 > ttt; -diff iii ttt +# Function: +# runTestCase number file +# Params: +# number: Test case number +# file : Input file +# Abstract: +# Run the requested test case number with the given file +runTestCase() +{ + rtc_number=$1 + rtc_infile=$2 -# Case 2 -echo "------------------------------------------------------------" -testFile="../test/img_1771.jpg" -rm -f test2.jpg thumb2.jpg -rm -f iii ttt; -./exifprint $testFile > iii; -cp $testFile ./test2.jpg; -./write-test $testFile 2 > ttt; -diff iii ttt + rtc_outfile=test${rtc_number}.jpg + rtc_jpgthumb=thumb${rtc_number}.jpg + rtc_tifthumb=thumb${rtc_number}.tif -# Case 3 -echo "------------------------------------------------------------" -testFile="../test/kodak-dc210.jpg" -rm -f test3.jpg thumb3.jpg -rm -f iii ttt; -./exifprint $testFile > iii; -cp $testFile ./test3.jpg; -./write-test $testFile 3 > ttt; -diff iii ttt + rm -f $rtc_outfile $rtc_jpgthumb $rtc_tifthumb + rm -f iii ttt; -# Case 4 -echo "------------------------------------------------------------" -testFile="../test/img_1771.jpg" -rm -f test4.jpg thumb4.jpg -rm -f iii ttt; -./exifprint $testFile > iii; -cp $testFile ./test4.jpg; -./write-test $testFile 4 > ttt; -diff iii ttt + echo "------------------------------------------------------------" + ./exifprint $rtc_infile > iii; + cp $rtc_infile $rtc_outfile; + ./write-test $rtc_infile $rtc_number > ttt; + diff iii ttt +} -# Case 5 -echo "------------------------------------------------------------" -testFile="../test/img_1771.jpg" -rm -f test5.jpg thumb5.jpg -rm -f iii ttt; -./exifprint $testFile > iii; -cp $testFile ./test5.jpg; -./write-test $testFile 5 > ttt; -diff iii ttt +# ********************************************************************** +# main -# Case 6 -echo "------------------------------------------------------------" -testFile="../test/kodak-dc210.jpg" -rm -f test6.jpg thumb6.jpg -rm -f iii ttt; -./exifprint $testFile > iii; -cp $testFile ./test6.jpg; -./write-test $testFile 6 > ttt; -diff iii ttt +runTestCase 1 ../test/img_1771.jpg +runTestCase 2 ../test/img_1771.jpg +runTestCase 3 ../test/kodak-dc210.jpg +runTestCase 4 ../test/img_1771.jpg +runTestCase 5 ../test/img_1771.jpg +runTestCase 6 ../test/kodak-dc210.jpg +runTestCase 7 ../test/dscf0176.jpg +runTestCase 8 ../test/sigma-d10-IMG10086.jpg +runTestCase 9 ../test/nikon-coolpix-990-DSCN1180.jpg +runTestCase 10 ../test/nikon-e950.jpg +runTestCase 11 ../test/nikon-d70-dsc_0063.jpg