Implement the PropertyMap interface for WMA

This commit is contained in:
Lukáš Lalinský
2012-11-23 09:32:00 +01:00
parent 353eb9f00f
commit 812f63502b
8 changed files with 241 additions and 6 deletions

View File

@ -3,6 +3,7 @@
#include <tag.h>
#include <tstringlist.h>
#include <tbytevectorlist.h>
#include <tpropertymap.h>
#include <asffile.h>
#include <cppunit/extensions/HelperMacros.h>
#include "utils.h"
@ -13,7 +14,7 @@ using namespace TagLib;
class TestASF : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(TestASF);
CPPUNIT_TEST(testProperties);
CPPUNIT_TEST(testAudioProperties);
CPPUNIT_TEST(testRead);
CPPUNIT_TEST(testSaveMultipleValues);
CPPUNIT_TEST(testSaveStream);
@ -22,11 +23,12 @@ class TestASF : public CppUnit::TestFixture
CPPUNIT_TEST(testSaveLargeValue);
CPPUNIT_TEST(testSavePicture);
CPPUNIT_TEST(testSaveMultiplePictures);
CPPUNIT_TEST(testProperties);
CPPUNIT_TEST_SUITE_END();
public:
void testProperties()
void testAudioProperties()
{
ASF::File f(TEST_FILE_PATH_C("silence-1.wma"));
CPPUNIT_ASSERT_EQUAL(4, f.audioProperties()->length());
@ -215,6 +217,39 @@ public:
delete f;
}
void testProperties()
{
ASF::File f(TEST_FILE_PATH_C("silence-1.wma"));
PropertyMap tags = f.properties();
tags["TRACKNUMBER"] = StringList("2");
tags["DISCNUMBER"] = StringList("3");
tags["BPM"] = StringList("123");
tags["ARTIST"] = StringList("Foo Bar");
f.setProperties(tags);
tags = f.properties();
CPPUNIT_ASSERT_EQUAL(String("Foo Bar"), f.tag()->artist());
CPPUNIT_ASSERT_EQUAL(StringList("Foo Bar"), tags["ARTIST"]);
CPPUNIT_ASSERT(f.tag()->attributeListMap().contains("WM/BeatsPerMinute"));
CPPUNIT_ASSERT_EQUAL(1u, f.tag()->attributeListMap()["WM/BeatsPerMinute"].size());
CPPUNIT_ASSERT_EQUAL(String("123"), f.tag()->attributeListMap()["WM/BeatsPerMinute"].front().toString());
CPPUNIT_ASSERT_EQUAL(StringList("123"), tags["BPM"]);
CPPUNIT_ASSERT(f.tag()->attributeListMap().contains("WM/TrackNumber"));
CPPUNIT_ASSERT_EQUAL(1u, f.tag()->attributeListMap()["WM/TrackNumber"].size());
CPPUNIT_ASSERT_EQUAL(String("2"), f.tag()->attributeListMap()["WM/TrackNumber"].front().toString());
CPPUNIT_ASSERT_EQUAL(StringList("2"), tags["TRACKNUMBER"]);
CPPUNIT_ASSERT(f.tag()->attributeListMap().contains("WM/PartOfSet"));
CPPUNIT_ASSERT_EQUAL(1u, f.tag()->attributeListMap()["WM/PartOfSet"].size());
CPPUNIT_ASSERT_EQUAL(String("3"), f.tag()->attributeListMap()["WM/PartOfSet"].front().toString());
CPPUNIT_ASSERT_EQUAL(StringList("3"), tags["DISCNUMBER"]);
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestASF);