#1058. Calming the test suite. LangAltValue comparator causes harmless changes in order of lang reporting.
This commit is contained in:
parent
8b059e49e1
commit
ce1d4cfc75
@ -847,27 +847,33 @@ namespace Exiv2 {
|
||||
return static_cast<long>(value_.size());
|
||||
}
|
||||
|
||||
static const std::string x_default = "x-default";
|
||||
|
||||
std::ostream& LangAltValue::write(std::ostream& os) const
|
||||
{
|
||||
bool first = true;
|
||||
bool first = true;
|
||||
|
||||
// Write the default entry first
|
||||
ValueType::const_iterator i = value_.find("x-default");
|
||||
ValueType::const_iterator i = value_.find(x_default);
|
||||
if (i != value_.end()) {
|
||||
os << "lang=\"" << i->first << "\" " << i->second;
|
||||
first = false;
|
||||
}
|
||||
|
||||
// Write the others
|
||||
for (i = value_.begin(); i != value_.end(); ++i) {
|
||||
if (i->first == "x-default") continue;
|
||||
if (!first) os << ", ";
|
||||
os << "lang=\"" << i->first << "\" " << i->second;
|
||||
first = false;
|
||||
if (i->first != x_default ) {
|
||||
if (!first) os << ", ";
|
||||
os << "lang=\"" << i->first << "\" " << i->second;
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
std::string LangAltValue::toString(long /*n*/) const
|
||||
{
|
||||
return toString("x-default");
|
||||
return toString(x_default);
|
||||
}
|
||||
|
||||
std::string LangAltValue::toString(const std::string& qualifier) const
|
||||
@ -1009,8 +1015,8 @@ namespace Exiv2 {
|
||||
os << date_.year << '-' << std::right
|
||||
<< std::setw(2) << std::setfill('0') << date_.month << '-'
|
||||
<< std::setw(2) << std::setfill('0') << date_.day;
|
||||
os.flags(f);
|
||||
return os;
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
long DateValue::toLong(long /*n*/) const
|
||||
|
||||
29
src/xmp.cpp
29
src/xmp.cpp
@ -403,9 +403,9 @@ namespace Exiv2 {
|
||||
xmpLockFct_ = xmpLockFct;
|
||||
pLockData_ = pLockData;
|
||||
initialized_ = SXMPMeta::Initialize();
|
||||
SXMPMeta::RegisterNamespace("http://ns.adobe.com/lightroom/1.0/", "lr");
|
||||
SXMPMeta::RegisterNamespace("http://rs.tdwg.org/dwc/index.htm", "dwc");
|
||||
SXMPMeta::RegisterNamespace("http://purl.org/dc/terms/", "dcterms");
|
||||
SXMPMeta::RegisterNamespace("http://ns.adobe.com/lightroom/1.0/", "lr");
|
||||
SXMPMeta::RegisterNamespace("http://rs.tdwg.org/dwc/index.htm", "dwc");
|
||||
SXMPMeta::RegisterNamespace("http://purl.org/dc/terms/", "dcterms");
|
||||
SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/1.0/", "digiKam");
|
||||
SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/kipi/1.0/", "kipi");
|
||||
SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.0/", "MicrosoftPhoto");
|
||||
@ -417,9 +417,9 @@ namespace Exiv2 {
|
||||
SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/t/RegionInfo#", "MPRI");
|
||||
SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/t/Region#", "MPReg");
|
||||
SXMPMeta::RegisterNamespace("http://www.metadataworkinggroup.com/schemas/regions/", "mwg-rs");
|
||||
SXMPMeta::RegisterNamespace("http://www.metadataworkinggroup.com/schemas/keywords/", "mwg-kw");
|
||||
SXMPMeta::RegisterNamespace("http://www.metadataworkinggroup.com/schemas/keywords/", "mwg-kw");
|
||||
SXMPMeta::RegisterNamespace("http://ns.adobe.com/xmp/sType/Area#", "stArea");
|
||||
|
||||
|
||||
#else
|
||||
initialized_ = true;
|
||||
#endif
|
||||
@ -659,22 +659,16 @@ namespace Exiv2 {
|
||||
XMP_OptionBits options = 0;
|
||||
|
||||
if (i->typeId() == langAlt) {
|
||||
|
||||
// Encode Lang Alt property
|
||||
const LangAltValue* la = dynamic_cast<const LangAltValue*>(&i->value());
|
||||
if (la == 0) throw Error(43, i->key());
|
||||
|
||||
int idx = 1;
|
||||
// write the default first
|
||||
LangAltValue::ValueType::const_iterator k = la->value_.find("x-default");
|
||||
if (k != la->value_.end()) {
|
||||
#ifdef DEBUG
|
||||
printNode(ns, i->tagName(), k->second, 0);
|
||||
#endif
|
||||
meta.AppendArrayItem(ns.c_str(), i->tagName().c_str(), kXMP_PropArrayIsAlternate, k->second.c_str());
|
||||
const std::string item = i->tagName() + "[" + toString(idx++) + "]";
|
||||
meta.SetQualifier(ns.c_str(), item.c_str(), kXMP_NS_XML, "lang", k->first.c_str());
|
||||
}
|
||||
for (k = la->value_.begin(); k != la->value_.end(); ++k) {
|
||||
if (k->first == "x-default") continue;
|
||||
for ( LangAltValue::ValueType::const_iterator k = la->value_.begin()
|
||||
; k != la->value_.end()
|
||||
; ++k
|
||||
) {
|
||||
#ifdef DEBUG
|
||||
printNode(ns, i->tagName(), k->second, 0);
|
||||
#endif
|
||||
@ -684,6 +678,7 @@ namespace Exiv2 {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Todo: Xmpdatum should have an XmpValue, not a Value
|
||||
const XmpValue* val = dynamic_cast<const XmpValue*>(&i->value());
|
||||
if (val == 0) throw Error(52, i->key(), i->typeName());
|
||||
|
||||
@ -23,7 +23,7 @@ Testcase 4
|
||||
==========
|
||||
Warning: Failed to convert Xmp.dc.description to Iptc.Application2.Caption
|
||||
Warning: Failed to convert Xmp.dc.description to Exif.Image.ImageDescription
|
||||
Xmp.dc.description LangAlt 2 lang="de-DE" The Exif image description, lang="it-IT" Ciao bella
|
||||
Xmp.dc.description LangAlt 2 lang="it-IT" Ciao bella, lang="de-DE" The Exif image description
|
||||
File 1/1: k.jpg
|
||||
k.jpg: (No Exif data found in the file)
|
||||
File 1/1: k.jpg
|
||||
|
||||
@ -32,10 +32,10 @@ Xmp.exif.NativeDigest XmpText 414 36864,40960,40961,37
|
||||
< <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="3.1.2-113">
|
||||
---
|
||||
> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
|
||||
35d34
|
||||
< <rdf:li xml:lang="en-US">Blue Square Test File - .jpg</rdf:li>
|
||||
37a37
|
||||
> <rdf:li xml:lang="en-US">Blue Square Test File - .jpg</rdf:li>
|
||||
34a35
|
||||
> <rdf:li xml:lang="de-CH">Blaues Quadrat Test Datei - .jpg</rdf:li>
|
||||
37d37
|
||||
< <rdf:li xml:lang="de-CH">Blaues Quadrat Test Datei - .jpg</rdf:li>
|
||||
-----> Decoding XMP data read from StaffPhotographer-Example.xmp <-----
|
||||
Xmp.iptc.IntellectualGenre XmpText 7 Profile
|
||||
Xmp.iptc.Location XmpText 17 Moore family farm
|
||||
@ -372,8 +372,8 @@ Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiUrlWork XmpText 20 http://www.exi
|
||||
</dc:publisher>
|
||||
<tiff:ImageDescription>
|
||||
<rdf:Alt>
|
||||
<rdf:li xml:lang="x-default">TIFF image description</rdf:li>
|
||||
<rdf:li xml:lang="de-DE">TIFF Bildbeschreibung</rdf:li>
|
||||
<rdf:li xml:lang="x-default">TIFF image description</rdf:li>
|
||||
</rdf:Alt>
|
||||
</tiff:ImageDescription>
|
||||
<xmpDM:videoFrameSize
|
||||
|
||||
Loading…
Reference in New Issue
Block a user