From d369aa67d517f16a78ffc0d5636168d5f05c27e3 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Fri, 19 Aug 2016 18:59:28 +0000 Subject: [PATCH] #1199 Test suite changes and associate fixes to the code. --- Makefile | 12 +- config/Makefile.in | 12 +- src/actions.cpp | 59 +++++--- src/actions.hpp | 2 +- src/webpimage.cpp | 12 +- test/Makefile | 5 +- test/bugfixes-test.sh | 48 ------ test/data/bugfixes-test.out | Bin 1930752 -> 1911615 bytes test/data/webp-test.out | 291 ++++++++++++++++++++++++++++++++++++ test/webp-test.sh | 87 +++++++++++ 10 files changed, 441 insertions(+), 87 deletions(-) create mode 100644 test/data/webp-test.out create mode 100755 test/webp-test.sh diff --git a/Makefile b/Makefile index 8642dee9..b19a1f6c 100644 --- a/Makefile +++ b/Makefile @@ -87,16 +87,20 @@ teste testx testv: cd test && $(MAKE) $@ # convenience for running individual tests -bugfixes-test.sh crw-test.sh curliotest.sh eps-preview-test.sh eps-test.sh exifdata-test.sh \ -exiv2-test.sh httpiotest.sh imagetest.sh iotest.sh iptctest.sh modify-test.sh \ -path-test.sh preview-test.sh sshiotest.sh stringto-test.sh tiff-test.sh video-test.sh \ -write-test.sh write-video-test.sh write2-test.sh xmpparser-test.sh : +bugfixes-test.sh crw-test.sh curliotest.sh eps-preview-test.sh eps-test.sh exifdata-test.sh \ +exiv2-test.sh httpiotest.sh imagetest.sh iotest.sh iptctest.sh modify-test.sh \ +path-test.sh preview-test.sh sshiotest.sh stringto-test.sh tiff-test.sh video-test.sh \ +write-test.sh write-video-test.sh write2-test.sh xmpparser-test.sh webp-test.sh: cd test && ./$@ # convenience target for running bugfixes-test.sh bugtest bugstest testbugs bugfixes: cd test && ./bugfixes-test.sh +# convenience target for running webp-test.sh +webp-test webptest: + cd test && ./webp-test.sh + # convenience target for building individual sample programs addmoddel exifcomment exifvalue httptest iptctest mmap-test stringto-test \ exifdata iotest key-test path-test taglist write2-test write-test \ diff --git a/config/Makefile.in b/config/Makefile.in index dfa1f31e..44a3ca15 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -87,16 +87,20 @@ teste testx testv: cd test && $(MAKE) $@ # convenience for running individual tests -bugfixes-test.sh crw-test.sh curliotest.sh eps-preview-test.sh eps-test.sh exifdata-test.sh \ -exiv2-test.sh httpiotest.sh imagetest.sh iotest.sh iptctest.sh modify-test.sh \ -path-test.sh preview-test.sh sshiotest.sh stringto-test.sh tiff-test.sh video-test.sh \ -write-test.sh write-video-test.sh write2-test.sh xmpparser-test.sh : +bugfixes-test.sh crw-test.sh curliotest.sh eps-preview-test.sh eps-test.sh exifdata-test.sh \ +exiv2-test.sh httpiotest.sh imagetest.sh iotest.sh iptctest.sh modify-test.sh \ +path-test.sh preview-test.sh sshiotest.sh stringto-test.sh tiff-test.sh video-test.sh \ +write-test.sh write-video-test.sh write2-test.sh xmpparser-test.sh webp-test.sh: cd test && ./$@ # convenience target for running bugfixes-test.sh bugtest bugstest testbugs bugfixes: cd test && ./bugfixes-test.sh +# convenience target for running webp-test.sh +webp-test webptest: + cd test && ./webp-test.sh + # convenience target for building individual sample programs addmoddel exifcomment exifvalue httptest iptctest mmap-test stringto-test \ exifdata iotest key-test path-test taglist write2-test write-test \ diff --git a/src/actions.cpp b/src/actions.cpp index 7a193168..60cfd0b9 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -1258,12 +1258,18 @@ namespace Action { || Params::instance().target_ & Params::ctXmpRaw)) { std::string suffix = Params::instance().suffix_; if (suffix.empty()) suffix = ".exv"; - if (Params::instance().target_ & Params::ctXmpSidecar) suffix = ".xmp"; + if ((Params::instance().target_ & Params::ctXmpSidecar) + || (Params::instance().target_ & Params::ctXmpRaw )) suffix = ".xmp"; + std::string exvPath = newFilePath(path, suffix); - rc = metacopy(exvPath, path, Exiv2::ImageType::none, true); + std::string xmpPath = newFilePath(path, suffix); + rc = suffix == ".exv" ? metacopy(exvPath, path, Exiv2::ImageType::xmp, true) + : insertXmpPacket(xmpPath,path) + ; } if (0 == rc && Params::instance().target_ & Params::ctXmpSidecar) { - rc = insertXmpPacket(path); + std::string xmpPath = newFilePath(path,".xmp"); + rc = insertXmpPacket(xmpPath,path); } if (0 == rc && Params::instance().target_ & Params::ctIccProfile) { rc = insertIccProfile(path); @@ -1280,9 +1286,8 @@ namespace Action { return 1; } // Insert::run - int Insert::insertXmpPacket(const std::string& path) const + int Insert::insertXmpPacket(const std::string& xmpPath,const std::string& path) const { - std::string xmpPath = newFilePath(path, ".xmp"); if (!Exiv2::fileExists(xmpPath, true)) { std::cerr << xmpPath << ": " << _("Failed to open the file\n"); @@ -1295,7 +1300,9 @@ namespace Action { } Exiv2::DataBuf buf = Exiv2::readFile(xmpPath); std::string xmpPacket; - xmpPacket.assign(reinterpret_cast(buf.pData_), buf.size_); + for ( long i = 0 ; i < buf.size_ ; i++ ) { + xmpPacket += (char) buf.pData_[i]; + } Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); assert(image.get() != 0); image->readMetadata(); @@ -1307,25 +1314,37 @@ namespace Action { int Insert::insertIccProfile(const std::string& path) const { + int rc = 0; + // for path "foo.XXX", do a binary copy of "foo.icc" std::string iccProfilePath = newFilePath(path, ".icc"); if (!Exiv2::fileExists(iccProfilePath, true)) { - std::cerr << iccProfilePath - << ": " << _("Failed to open the file\n"); - return -1; - } - if (!Exiv2::fileExists(path, true)) { - std::cerr << path - << ": " << _("Failed to open the file\n"); - return -1; + std::cerr << iccProfilePath + << ": " << _("Failed to open the file\n"); + rc = -1; } Exiv2::DataBuf iccProfileBlob = Exiv2::readFile(iccProfilePath); - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); - assert(image.get() != 0); - image->readMetadata(); - image->setIccProfile(iccProfileBlob); - image->writeMetadata(); - return 0; + // test path exists + if (rc==0 && !Exiv2::fileExists(path, true)) { + std::cerr << path + << ": " << _("Failed to open the file\n"); + rc=-1; + } + + // read in the metadata + if ( rc == 0 ) { + Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); + assert(image.get() != 0); + image->readMetadata(); + // clear existing profile, assign the blob and rewrite image + image->clearIccProfile(); + if ( iccProfileBlob.size_ ) { + image->setIccProfile(iccProfileBlob); + } + image->writeMetadata(); + } + + return rc; } // Insert::insertIccProfile int Insert::insertThumbnail(const std::string& path) const diff --git a/src/actions.hpp b/src/actions.hpp index a59bb5ee..c6a78c64 100644 --- a/src/actions.hpp +++ b/src/actions.hpp @@ -350,7 +350,7 @@ namespace Action { The filename of the XMP packet is expected to be the image filename (\em path) minus its suffix plus ".xmp". */ - int insertXmpPacket(const std::string& path) const; + int insertXmpPacket(const std::string& xmpPath,const std::string& path) const; /*! @brief Insert an ICC profile from a file into file \em path. The filename of the ICC profile is expected to be the image diff --git a/src/webpimage.cpp b/src/webpimage.cpp index 3fefb240..5472a43d 100644 --- a/src/webpimage.cpp +++ b/src/webpimage.cpp @@ -137,7 +137,6 @@ namespace Exiv2 { int height = 0; byte size_buff[4]; - std::string xmpData; Blob blob; if (exifData_.count() > 0) { @@ -147,15 +146,12 @@ namespace Exiv2 { } } - if (xmpData_.count() > 0) { + if (xmpData_.count() > 0 && !writeXmpFromPacket()) { XmpParser::encode(xmpPacket_, xmpData_, XmpParser::useCompactFormat | XmpParser::omitAllFormatting); - if (xmpPacket_.size() > 0) { - has_xmp = true; - xmpData = xmpPacket_.data(); - } } + has_xmp = xmpPacket_.size() > 0; /* Verify for a VP8X Chunk First before writing in case we have any exif or xmp data, also check @@ -389,9 +385,9 @@ namespace Exiv2 { if (has_xmp) { std::string header = "XMP "; if (outIo.write((const byte*)header.data(), TAG_SIZE) != TAG_SIZE) throw Error(21); - ul2Data(data, (uint32_t) xmpData.size(), littleEndian); + ul2Data(data, (uint32_t) xmpPacket().size(), littleEndian); if (outIo.write(data, 4) != 4) throw Error(21); - if (outIo.write((const byte*)xmpData.data(), static_cast(xmpData.size())) != (long)xmpData.size()) { + if (outIo.write((const byte*)xmpPacket().data(), static_cast(xmpPacket().size())) != (long)xmpPacket().size()) { throw Error(21); } } diff --git a/test/Makefile b/test/Makefile index 7bf77242..8957db97 100644 --- a/test/Makefile +++ b/test/Makefile @@ -74,13 +74,14 @@ TESTS = addmoddel.sh \ preview-test.sh \ stringto-test.sh \ tiff-test.sh \ + webp-test.sh \ write-test.sh \ write2-test.sh \ xmpparser-test.sh \ conversions.sh # video tests -TESTV = video-test.sh +TESTV = video-test.sh TESTVW = write-video-test.sh # EPS tests @@ -149,7 +150,7 @@ testx: done mostlyclean clean: - rm -rf $(top_srcdir)/test/tmp/* + rm -rf $(top_srcdir)/test/tmp/* distclean: clean $(RM) *~ *.bak *# diff --git a/test/bugfixes-test.sh b/test/bugfixes-test.sh index c66f4748..b471035b 100755 --- a/test/bugfixes-test.sh +++ b/test/bugfixes-test.sh @@ -548,54 +548,6 @@ source ./functions.source runTest exiv2 -pa --grep fuji/i $filename done - num=1199 # WebPImage - printf "$num " >&3 - filename=exiv2-bug$num.webp # http://dev.exiv2.org/attachments/download/1033/Stonehenge-with-icc.webp - icc_name=exiv2-bug$num.icc - exv_name=exiv2-bug$num.exv - copyTestFile $filename - runTest exiv2 -pS $filename - runTest exiv2 -pR $filename - runTest exiv2 -pX $filename | xmllint --pretty 2 - - # test deleting metadata - for option in -dC -de -dx -dCe -dCx -dCxe; do - copyTestFile $filename - runTest exiv2 -pS $filename - runTest exiv2 $option $filename - runTest exiv2 -pS $filename - done - # test print/insert metadata - if [ 1 == 1 ]; then - # ICC Profile - copyTestFile $filename - copyTestFile Reagan.tiff - exiv2 -pS $filename - exiv2 -pC Reagan.tiff > $icc_name - exiv2 -iC $filename - exiv2 -pS $filename - fi - - if [ 1 == 0 ]; then # TODO: Fix this - # XMP - copyTestFile $filename - copyTestFile Reagan.tiff - exiv2 -pS $filename - exiv2 --force -ex Reagan.tiff - mv Reagan.exv $exv_name - exiv2 -ix $filename - exiv2 -pS $filename - fi - - if [ 1 == 0 ]; then # TODO: Fix this - # EXIF - copyTestFile exiv2-bug937.jpg $filename - exiv2 --force -ea $filename - copyTestFile $filename - exiv2 -pS $filename - exiv2 -ie $filename - exiv2 -pS $filename - fi - num=1202 printf "$num " >&3 filename=exiv2-bug$num.jpg # test/tmp/20030925_201850.jpg diff --git a/test/data/bugfixes-test.out b/test/data/bugfixes-test.out index 3bbe853adf7e893354177f1b9cb8e0fe0a023274..d1e34baa5c9c3edb64ba78418dfe9bc66cbb2a3c 100644 GIT binary patch delta 82 zcmZp8Q@a0JNka=`3sVbo3rh=Y3tJ0&3r7oQ3s(zw3r`Dg3ttO=i$IHDi%^Sji%5%T mi&%?zi$sfLi&Tqri_8|;cbd~bmB`vmmN639{=Y<)kr4o;2^;MI delta 9078 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 diff --git a/test/data/webp-test.out b/test/data/webp-test.out new file mode 100644 index 00000000..057a455b --- /dev/null +++ b/test/data/webp-test.out @@ -0,0 +1,291 @@ +STRUCTURE OF WEBP FILE: exiv2-bug1199.webp + Chunk | Length | Offset | Payload + RIFF | 187526 | 0 | WEBP + VP8X | 10 | 12 | ,........ + ICCP | 560 | 30 | ...0ADBE....mntrRGB XYZ ........ + VP8 | 172008 | 598 | .G...*.. .>1..B.!..o.. ......].. + EXIF | 12040 | 172614 | II*........................... . + XMP | 2864 | 184662 | 1..B.!..o.. ......].. + EXIF | 12040 | 172614 | II*........................... . + STRUCTURE OF TIFF FILE (II): MemIo + address | tag | type | count | offset | value + 10 | 0x0100 ImageWidth | LONG | 1 | 1200 | 1200 + 22 | 0x0101 ImageLength | LONG | 1 | 800 | 800 + 34 | 0x0102 BitsPerSample | SHORT | 3 | 194 | 8 8 8 + 46 | 0x010e ImageDescription | ASCII | 37 | 200 | ... + 58 | 0x010f Make | ASCII | 18 | 238 | NIKON CORPORATION + 70 | 0x0110 Model | ASCII | 12 | 256 | NIKON D5300 + 82 | 0x0112 Orientation | SHORT | 1 | 1 | 1 + 94 | 0x011a XResolution | RATIONAL | 1 | 268 | 268/0 + 106 | 0x011b YResolution | RATIONAL | 1 | 276 | 276/0 + 118 | 0x0128 ResolutionUnit | SHORT | 1 | 2 | 2 + 130 | 0x0131 Software | ASCII | 11 | 284 | GIMP 2.9.5 + 142 | 0x0132 DateTime | ASCII | 20 | 296 | 2016:08:13 10:54:16 + 154 | 0x0213 YCbCrPositioning | SHORT | 1 | 1 | 1 + 166 | 0x8769 ExifTag | LONG | 1 | 316 | 316 + STRUCTURE OF TIFF FILE (II): MemIo + address | tag | type | count | offset | value + 318 | 0x829a ExposureTime | RATIONAL | 1 | 814 | 814/0 + 330 | 0x829d FNumber | RATIONAL | 1 | 822 | 822/0 + 342 | 0x8822 ExposureProgram | SHORT | 1 | 0 | 0 + 354 | 0x8827 ISOSpeedRatings | SHORT | 1 | 200 | 200 + 366 | 0x8830 SensitivityType | SHORT | 1 | 2 | 2 + 378 | 0x9000 ExifVersion | UNDEFINED | 4 | 808661552 | 0230 + 390 | 0x9003 DateTimeOriginal | ASCII | 20 | 830 | 2015:07:16 15:38:54 + 402 | 0x9004 DateTimeDigitized | ASCII | 20 | 850 | 2015:07:16 15:38:54 + 414 | 0x9101 ComponentsConfiguration | UNDEFINED | 4 | 197121 | ... + 426 | 0x9102 CompressedBitsPerPixel | RATIONAL | 1 | 870 | 870/0 + 438 | 0x9204 ExposureBiasValue | SRATIONAL | 1 | 878 | 878/0 + 450 | 0x9205 MaxApertureValue | RATIONAL | 1 | 886 | 886/0 + 462 | 0x9207 MeteringMode | SHORT | 1 | 5 | 5 + 474 | 0x9208 LightSource | SHORT | 1 | 0 | 0 + 486 | 0x9209 Flash | SHORT | 1 | 16 | 16 + 498 | 0x920a FocalLength | RATIONAL | 1 | 894 | 894/0 + 510 | 0x927c MakerNote | UNDEFINED | 3826 | 902 | Nikon.....II*.....9.+...$...... ... + STRUCTURE OF TIFF FILE (II): MemIo + address | tag | type | count | offset | value + 10 | 0x002b | ASCII | 36 | 698 | 48 49 48 48 0 0 2 0 0 0 0 0 0 0 ... + 22 | 0x002c | ASCII | 1157 | 734 | 48 49 48 49 35 0 128 2 170 1 0 0 ... + 34 | 0x002d | ASCII | 8 | 1892 | 512 0 0 + 46 | 0x0032 | ASCII | 20 | 1900 | 48 49 48 48 1 0 0 0 + 58 | 0x0035 | ASCII | 16 | 1920 | 48 50 48 48 0 0 + 70 | 0x003b | ASCII | 32 | 1936 | 256/256 256/256 256/256 256/256 + 82 | 0x003c | ASCII | 2 | 49 | 1 + 94 | 0x009d | ASCII | 2 | 48 | 0 + 106 | 0x00a3 | BYTE | 1 | 0 | + 118 | 0x00b6 | ASCII | 16 | 1968 | 0 0 0 0 0 0 0 0 + 130 | 0x00bb | ASCII | 26 | 1984 | 48 50 48 48 255 255 255 0 + 142 | 0x00bf | ASCII | 2 | 48 | 0 + 154 | 0x00c0 | ASCII | 21 | 2010 | 60 1 12 0 144 1 12 0 + 166 | 0x0022 | SHORT | 1 | 65535 | 65535 + 178 | 0x008a | SHORT | 1 | 1 | 1 + 190 | 0x001e GPSDifferential | SHORT | 1 | 1 | 1 + 202 | 0x001b GPSProcessingMethod | SHORT | 7 | 2032 | 0 6016 4016 6016 4016 ... + 214 | 0x0019 GPSDestDistanceRef | SRATIONAL | 1 | 2046 | 2046/0 + 226 | 0x000e GPSTrackRef | UNDEFINED | 4 | 786688 | ... + 238 | 0x001c GPSAreaInformation | SHORT | 3 | 2054 | 0 1 6 + 250 | 0x0018 GPSDestBearing | UNDEFINED | 4 | 393472 | ... + 262 | 0x0012 GPSMapDatum | UNDEFINED | 4 | 393472 | ... + 274 | 0x0009 GPSStatus | ASCII | 20 | 2060 | + 286 | 0x0017 GPSDestBearingRef | UNDEFINED | 4 | 393472 | ... + 298 | 0x00a8 | UNDEFINED | 49 | 2080 | 0106........................... ... + 310 | 0x0087 | BYTE | 1 | 0 | + 322 | 0x0008 FlashSetting | ASCII | 13 | 2130 | + 334 | 0x0007 Focus | ASCII | 7 | 2144 | AF-A + 346 | 0x00b1 | SHORT | 1 | 4 | 4 + 358 | 0x0013 GPSDestLatitudeRef | SHORT | 2 | 13107200 | 0 200 + 370 | 0x0002 ISOSpeed | SHORT | 2 | 13107200 | 0 200 + 382 | 0x0016 GPSDestLongitude | SHORT | 4 | 2152 | 0 0 6000 4000 + 394 | 0x00a2 | LONG | 1 | 6173648 | 6173648 + 406 | 0x0084 | RATIONAL | 4 | 2160 | 180/0 10/0 2500/0 10/0 + 418 | 0x008b | UNDEFINED | 4 | 786743 | 7.. + 430 | 0x0083 | BYTE | 1 | 14 | . + 442 | 0x0095 | ASCII | 5 | 2192 | OFF + 454 | 0x000d GPSSpeed | UNDEFINED | 4 | 393472 | ... + 466 | 0x0004 Quality | ASCII | 8 | 2198 | NORMAL + 478 | 0x009e | SHORT | 10 | 2206 | 0 0 0 0 0 ... + 490 | 0x001d GPSDateStamp | ASCII | 8 | 2226 | 2567806 + 502 | 0x0089 | SHORT | 1 | 0 | 0 + 514 | 0x00a7 | LONG | 1 | 9608 | 9608 + 526 | 0x00ab | ASCII | 16 | 2234 | AUTO(FLASH OFF) + 538 | 0x0001 Version | UNDEFINED | 4 | 825307696 | 0211 + 550 | 0x000c GPSSpeedRef | RATIONAL | 4 | 2250 | 538/0 256/0 354/0 256/0 + 562 | 0x0005 WhiteBalance | ASCII | 13 | 2282 | AUTO + 574 | 0x000b ProcessingSoftware | SSHORT | 2 | 0 | 0 0 + 586 | 0x00b7 | UNDEFINED | 30 | 2296 | 0100....i.................... + 598 | 0x0097 | UNDEFINED | 1188 | 2326 | 0219.dU....W..2......:.......F.# ... + 610 | 0x00b8 | UNDEFINED | 172 | 3514 | 0100..e........................ ... + 622 | 0x0025 | UNDEFINED | 14 | 3686 | H.....H...... + 634 | 0x0098 | UNDEFINED | 33 | 3700 | 0204.W....z.o..#[.....!o.x..E... ... + 646 | 0x00b0 | UNDEFINED | 16 | 3734 | 0100........... + 658 | 0x0023 | UNDEFINED | 58 | 3750 | 0100STANDARD............STANDARD ... + 670 | 0x001f | UNDEFINED | 8 | 3808 | 0100... + 682 | 0x0024 | UNDEFINED | 4 | 65536 | ... + END MemIo + 522 | 0x9286 UserComment | UNDEFINED | 44 | 4728 | ........ ... + 534 | 0x9290 SubSecTime | ASCII | 3 | 12336 | 00 + 546 | 0x9291 SubSecTimeOriginal | ASCII | 3 | 12336 | 00 + 558 | 0x9292 SubSecTimeDigitized | ASCII | 3 | 12336 | 00 + 570 | 0xa000 FlashpixVersion | UNDEFINED | 4 | 808464688 | 0100 + 582 | 0xa001 ColorSpace | SHORT | 1 | 1 | 1 + 594 | 0xa002 PixelXDimension | LONG | 1 | 6000 | 6000 + 606 | 0xa003 PixelYDimension | LONG | 1 | 4000 | 4000 + 618 | 0xa217 SensingMethod | SHORT | 1 | 2 | 2 + 630 | 0xa300 FileSource | UNDEFINED | 1 | 3 | . + 642 | 0xa301 SceneType | UNDEFINED | 1 | 1 | . + 654 | 0xa302 CFAPattern | UNDEFINED | 8 | 4772 | ........ + 666 | 0xa401 CustomRendered | SHORT | 1 | 0 | 0 + 678 | 0xa402 ExposureMode | SHORT | 1 | 0 | 0 + 690 | 0xa403 WhiteBalance | SHORT | 1 | 0 | 0 + 702 | 0xa404 DigitalZoomRatio | RATIONAL | 1 | 4780 | 4780/0 + 714 | 0xa405 FocalLengthIn35mmFilm | SHORT | 1 | 66 | 66 + 726 | 0xa406 SceneCaptureType | SHORT | 1 | 0 | 0 + 738 | 0xa407 GainControl | SHORT | 1 | 0 | 0 + 750 | 0xa408 Contrast | SHORT | 1 | 0 | 0 + 762 | 0xa409 Saturation | SHORT | 1 | 0 | 0 + 774 | 0xa40a Sharpness | SHORT | 1 | 0 | 0 + 786 | 0xa40c SubjectDistanceRange | SHORT | 1 | 0 | 0 + 798 | 0xa420 ImageUniqueID | ASCII | 33 | 4788 | 090caaf2c085f3e102513b24750041aa ... + END MemIo + 178 | 0x8825 GPSTag | LONG | 1 | 4822 | 4822 + 5072 | 0x0100 ImageWidth | LONG | 1 | 256 | 256 + 5084 | 0x0101 ImageLength | LONG | 1 | 170 | 170 + 5096 | 0x0102 BitsPerSample | SHORT | 3 | 5172 | 8 8 8 + 5108 | 0x0103 Compression | SHORT | 1 | 6 | 6 + 5120 | 0x0106 PhotometricInterpretation | SHORT | 1 | 6 | 6 + 5132 | 0x0115 SamplesPerPixel | SHORT | 1 | 3 | 3 + 5144 | 0x0201 JPEGInterchangeFormat | LONG | 1 | 5178 | 5178 + 5156 | 0x0202 JPEGInterchangeFormatLeng | LONG | 1 | 6861 | 6861 + END MemIo + XMP | 2864 | 184662 | + + Classic View Stonehenge Robin Mills + +STRUCTURE OF WEBP FILE: exiv2-bug1199.webp + Chunk | Length | Offset | Payload + RIFF | 187526 | 0 | WEBP + VP8X | 10 | 12 | ,........ + ICCP | 560 | 30 | ...0ADBE....mntrRGB XYZ ........ + VP8 | 172008 | 598 | .G...*.. .>1..B.!..o.. ......].. + EXIF | 12040 | 172614 | II*........................... . + XMP | 2864 | 184662 | 1..B.!..o.. ......].. + EXIF | 12040 | 172046 | II*........................... . + XMP | 2864 | 184094 | 1..B.!..o.. ......].. + EXIF | 12040 | 172614 | II*........................... . + XMP | 2864 | 184662 | 1..B.!..o.. ......].. + XMP | 2864 | 172614 | 1..B.!..o.. ......].. + EXIF | 12040 | 172614 | II*........................... . + XMP | 2864 | 184662 | 1..B.!..o.. ......].. + EXIF | 12040 | 172614 | II*........................... . +STRUCTURE OF WEBP FILE: exiv2-bug1199.webp + Chunk | Length | Offset | Payload + RIFF | 187526 | 0 | WEBP + VP8X | 10 | 12 | ,........ + ICCP | 560 | 30 | ...0ADBE....mntrRGB XYZ ........ + VP8 | 172008 | 598 | .G...*.. .>1..B.!..o.. ......].. + EXIF | 12040 | 172614 | II*........................... . + XMP | 2864 | 184662 | 1..B.!..o.. ......].. + XMP | 2864 | 172046 | 1..B.!..o.. ......].. + EXIF | 12040 | 172614 | II*........................... . + XMP | 2864 | 184662 | 1..B.!..o.. ......].. + EXIF | 12040 | 172046 | II*........................... . +STRUCTURE OF WEBP FILE: exiv2-bug1199.webp + Chunk | Length | Offset | Payload + RIFF | 187526 | 0 | WEBP + VP8X | 10 | 12 | ,........ + ICCP | 560 | 30 | ...0ADBE....mntrRGB XYZ ........ + VP8 | 172008 | 598 | .G...*.. .>1..B.!..o.. ......].. + EXIF | 12040 | 172614 | II*........................... . + XMP | 2864 | 184662 | 1..B.!..o.. ......].. +STRUCTURE OF WEBP FILE: exiv2-bug1199.webp + Chunk | Length | Offset | Payload + RIFF | 187526 | 0 | WEBP + VP8X | 10 | 12 | ,........ + ICCP | 560 | 30 | ...0ADBE....mntrRGB XYZ ........ + VP8 | 172008 | 598 | .G...*.. .>1..B.!..o.. ......].. + EXIF | 12040 | 172614 | II*........................... . + XMP | 2864 | 184662 | 1..B.!..o.. ......].. + EXIF | 12040 | 175200 | II*........................... . + XMP | 2864 | 187248 | &3 + filename=exiv2-bug$num.webp # http://dev.exiv2.org/attachments/download/1033/Stonehenge-with-icc.webp + icc_name=exiv2-bug$num.icc + exv_name=exiv2-bug$num.exv + xmp_name=exiv2-bug$num.xmp + + copyTestFile $filename + runTest exiv2 -pS $filename + runTest exiv2 -pR $filename + runTest exiv2 -pX $filename | xmllint --pretty 2 - + printf "delete " >&3 + # test deleting metadata + for option in -dC -de -dx -dCe -dCx -dCxe; do + copyTestFile $filename + runTest exiv2 -pS $filename + runTest exiv2 $option $filename + runTest exiv2 -pS $filename + done + + printf "insert " >&3 + printf "ICC " >&3 + copyTestFile $filename + exiv2 -pS $filename + copyTestFile Reagan.tiff + exiv2 -pC Reagan.tiff > $icc_name + exiv2 -iC $filename + exiv2 -pS $filename + +if [ 1 == 0 ]; then + printf "XMP -iX " >&3 + # copy the XMP from Reagan.tiff to test file + copyTestFile Reagan.tiff + exiv2 -pX Reagan.tiff > $xmp_name; + copyTestFile $filename + exiv2 -pS $filename + exiv2 -iX $filename + exiv2 -pS $filename + + # copy the XMP from exiv2-bug937.jpg to test file + copyTestFile exiv2-bug937.jpg + exiv2 -pX exiv2-bug937.jpg > $xmp_name 2>/dev/null + exiv2 -ix $filename + exiv2 -pS $filename +fi + +if [ 1 == 0 ]; then + printf "XMP -ix " >&3 + # copy the metadata from Reagan.tiff to test exv file + copyTestFile Reagan.tiff + exiv2 -ea Reagan.tiff + mv Reagan.exf $exv_file + + copyTestFile $filename + exiv2 -pS $filename + exiv2 -ix $filename + exiv2 -pS $filename +fi + +if [ 1 == 0 ]; then + printf "EXIF " >&3 + copyTestFile exiv2-bug937.jpg $filename + exiv2 --force -ea $filename + copyTestFile $filename + exiv2 -pS $filename + exiv2 -ie $filename + exiv2 -pS $filename +fi + +) 3>&1 > $results 2>&1 + +printf "\n" + +# ---------------------------------------------------------------------- +# Evaluate results +cat $results | sed 's/\x0d$//' > $results-stripped +reportTest $results-stripped $good + +# That's all Folks! +##