mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
fixed bugs preventing tests from running
This commit is contained in:
parent
6c054af3ed
commit
23d303a896
@ -114,9 +114,9 @@ PropertyMap CommentsFrame::asProperties() const
|
||||
{
|
||||
String key = PropertyMap::prepareKey(description());
|
||||
PropertyMap map;
|
||||
if(key.isEmpty())
|
||||
key = "COMMENT";
|
||||
if(key.isNull())
|
||||
if(key.isEmpty() || key == "COMMENT")
|
||||
map.insert("COMMENT", text());
|
||||
else if(key.isNull())
|
||||
map.unsupportedData().append(L"COMM/" + description());
|
||||
else
|
||||
map.insert("COMMENT:" + key, text());
|
||||
|
@ -156,12 +156,10 @@ void UserUrlLinkFrame::setDescription(const String &s)
|
||||
PropertyMap UserUrlLinkFrame::asProperties() const
|
||||
{
|
||||
PropertyMap map;
|
||||
String key;
|
||||
if(description().isEmpty())
|
||||
key = "URL";
|
||||
else
|
||||
key = PropertyMap::prepareKey(description());
|
||||
if(key.isNull())
|
||||
String key = PropertyMap::prepareKey(description());
|
||||
if(key.isEmpty() || key.upper() == "URL")
|
||||
map.insert("URL", url());
|
||||
else if(key.isNull())
|
||||
map.unsupportedData().append(L"WXXX/" + description());
|
||||
else
|
||||
map.insert("URL:" + key, url());
|
||||
|
@ -337,10 +337,8 @@ void ID3v2::Tag::removeFrames(const ByteVector &id)
|
||||
PropertyMap ID3v2::Tag::properties() const
|
||||
{
|
||||
PropertyMap properties;
|
||||
|
||||
for(FrameList::ConstIterator it = frameList().begin(); it != frameList().end(); ++it) {
|
||||
PropertyMap props = (*it)->asProperties();
|
||||
debug(props);
|
||||
properties.merge(props);
|
||||
}
|
||||
return properties;
|
||||
|
@ -161,6 +161,14 @@ bool PropertyMap::operator!=(const PropertyMap &other) const
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
String PropertyMap::toString() const
|
||||
{
|
||||
String ret = "";
|
||||
for(ConstIterator it = begin(); it != end(); ++it)
|
||||
ret += it->first+"="+it->second.toString(", ") + "\n";
|
||||
return ret;
|
||||
}
|
||||
|
||||
void PropertyMap::removeEmpty()
|
||||
{
|
||||
StringList emptyKeys;
|
||||
|
@ -166,6 +166,8 @@ namespace TagLib {
|
||||
*/
|
||||
void removeEmpty();
|
||||
|
||||
String toString() const;
|
||||
|
||||
/*!
|
||||
* Converts \a proposed into another String suitable to be used as
|
||||
* a key, or returns String::null if this is not possible.
|
||||
|
@ -561,12 +561,15 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(String("userTextData1"), dict["USERTEXTDESCRIPTION2"][0]);
|
||||
CPPUNIT_ASSERT_EQUAL(String("userTextData2"), dict["USERTEXTDESCRIPTION2"][1]);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(String("Pop"), dict["GENRE"][0]);
|
||||
CPPUNIT_ASSERT_EQUAL(String("Pop"), dict["GENRE"].front());
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(String("http://a.user.url"), dict["URL:USERURL"][0]);
|
||||
CPPUNIT_ASSERT_EQUAL(String("http://a.user.url/with/empty/description"), dict["URL"][0]);
|
||||
CPPUNIT_ASSERT_EQUAL(String("http://a.user.url"), dict["URL:USERURL"].front());
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(String("http://a.user.url/with/empty/description"), dict["URL"].front());
|
||||
debug(dict.toString());
|
||||
CPPUNIT_ASSERT_EQUAL(String("A COMMENT"), dict["COMMENT"].front());
|
||||
debug("565");
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(String("A COMMENT"), dict["COMMENT"][0]);
|
||||
CPPUNIT_ASSERT_EQUAL(1u, dict.unsupportedData().size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("UFID"), dict.unsupportedData().front());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user