[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:36:29 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=0a4c074
The following commit has been merged in the master branch:
commit 0a4c074c60f34d7bbf59e240fbd9f0b32c1ec3f1
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Sun Jun 27 06:50:25 2004 +0000
Added write2-test.cpp
---
src/Makefile | 4 +-
src/write2-test.cpp | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 119 insertions(+), 2 deletions(-)
diff --git a/src/Makefile b/src/Makefile
index 1758082..1b2cd54 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -20,7 +20,7 @@
# 02111-1307, USA.
#
# File: Makefile
-# Version: $Name: $ $Revision: 1.26 $
+# Version: $Name: $ $Revision: 1.27 $
# Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
# History: 10-Dec-03, ahu: created
#
@@ -56,7 +56,7 @@ CCSRC = canonmn.cpp exif.cpp fujimn.cpp ifd.cpp image.cpp makernote.cpp \
# Add source files of simple applications to this list
BINSRC = addmoddel.cpp exifcomment.cpp exifprint.cpp ifd-test.cpp \
- makernote-test.cpp taglist.cpp write-test.cpp
+ makernote-test.cpp taglist.cpp write-test.cpp write2-test.cpp
# State the main source file of the Exiv2 application here
EXIV2MAIN = exiv2.cpp
diff --git a/src/write2-test.cpp b/src/write2-test.cpp
new file mode 100644
index 0000000..2d51639
--- /dev/null
+++ b/src/write2-test.cpp
@@ -0,0 +1,117 @@
+// ***************************************************************** -*- C++ -*-
+/*
+ Abstract : ExifData write unit tests for Exif data created from scratch
+
+ File : write2-test.cpp
+ Version : $Name: $ $Revision: 1.1 $
+ Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
+ History : 26-Jun-04, ahu: created
+
+ */
+// *****************************************************************************
+// included header files
+#include "exif.hpp"
+#include <iostream>
+#include <iomanip>
+#include <string>
+
+void write(const std::string& file, Exiv2::ExifData& ed);
+void print(const std::string& file);
+
+// *****************************************************************************
+// Main
+int main(int argc, char* const argv[])
+{
+try {
+ if (argc != 2) {
+ std::cout << "Usage: " << argv[0] << " file
";
+ return 1;
+ }
+ std::string file(argv[1]);
+
+ std::cout <<"----- One IFD0 tag
";
+ Exiv2::ExifData ed1;
+ Exiv2::Metadatum md1("Image.OtherTags.Model");
+ md1.setValue("Test 1");
+ ed1.add(md1);
+ write(file, ed1);
+ print(file);
+
+ std::cout <<"
----- One Exif tag
";
+ Exiv2::ExifData ed2;
+ Exiv2::Metadatum md2("Image.DateTime.DateTimeOriginal");
+ md2.setValue("Test 2");
+ ed2.add(md2);
+ write(file, ed2);
+ print(file);
+
+ // Todo: One Makernote tag for each Makernote
+
+ std::cout <<"
----- One IOP tag
";
+ Exiv2::ExifData ed3;
+ Exiv2::Metadatum md3("Image.Interoperability.InteroperabilityVersion");
+ md3.setValue("Test 3");
+ ed3.add(md3);
+ write(file, ed3);
+ print(file);
+
+ std::cout <<"
----- One GPS tag
";
+ Exiv2::ExifData ed4;
+ Exiv2::Metadatum md4("Image.GPS.GPSVersionID");
+ md4.setValue("Test 4");
+ ed4.add(md4);
+ write(file, ed4);
+ print(file);
+
+ // Todo: Fix this
+ std::cout <<"
----- One IFD1 tag
";
+ Exiv2::ExifData ed5;
+ Exiv2::Metadatum md5("Thumbnail.OtherTags.Artist");
+ md5.setValue("Test 5");
+ ed5.add(md5);
+
+ Exiv2::Metadatum md6("Image.OtherTags.Model");
+ md6.setValue("Test 1");
+ ed5.add(md6);
+
+ write(file, ed5);
+ print(file);
+
+ return 0;
+}
+catch (Exiv2::Error& e) {
+ std::cout << "Caught Exiv2 exception '" << e << "'
";
+ return -1;
+}
+}
+
+void write(const std::string& file, Exiv2::ExifData& ed)
+{
+ int rc = ed.write(file);
+ if (rc) {
+ std::string error = Exiv2::ExifData::strError(rc, file);
+ throw Exiv2::Error(error);
+ }
+}
+
+void print(const std::string& file)
+{
+ Exiv2::ExifData ed;
+ int rc = ed.read(file);
+ if (rc) {
+ std::string error = Exiv2::ExifData::strError(rc, file);
+ throw Exiv2::Error(error);
+ }
+
+ Exiv2::ExifData::const_iterator end = ed.end();
+ for (Exiv2::ExifData::const_iterator i = ed.begin(); i != end; ++i) {
+ std::cout << std::setw(53) << std::setfill(' ') << std::left
+ << i->key() << " "
+ << std::setw(12) << std::setfill(' ') << std::left
+ << i->ifdName() << " "
+ << "0x" << std::setw(4) << std::setfill('0') << std::right
+ << std::hex << i->tag() << " "
+ << std::dec << i->value()
+ << "
";
+ }
+}
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list