mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Moved APE test to correct place; added MOD tag test.
This commit is contained in:
parent
05b5e06928
commit
b8d5246f88
@ -5,9 +5,6 @@
|
||||
#include <tstringlist.h>
|
||||
#include <tbytevectorlist.h>
|
||||
#include <apefile.h>
|
||||
#include <apetag.h>
|
||||
#include <apeitem.h>
|
||||
#include <tpropertymap.h>
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
@ -19,7 +16,6 @@ class TestAPE : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testProperties399);
|
||||
CPPUNIT_TEST(testProperties396);
|
||||
CPPUNIT_TEST(testProperties390);
|
||||
CPPUNIT_TEST(testPropertyinterface);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -51,27 +47,6 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
|
||||
}
|
||||
|
||||
void testPropertyinterface()
|
||||
{
|
||||
APE::Tag tag;
|
||||
APE::Item item1 = APE::Item("TRACK", "17");
|
||||
tag.setItem("TRACK", item1);
|
||||
|
||||
APE::Item item2 = APE::Item();
|
||||
item2.setType(APE::Item::Binary);
|
||||
tag.setItem("TESTBINARY", item2);
|
||||
|
||||
PropertyMap properties = tag.properties();
|
||||
CPPUNIT_ASSERT_EQUAL(1u, properties.unsupportedData().size());
|
||||
CPPUNIT_ASSERT(properties.contains("TRACKNUMBER"));
|
||||
CPPUNIT_ASSERT(!properties.contains("TRACK"));
|
||||
CPPUNIT_ASSERT(tag.itemListMap().contains("TESTBINARY"));
|
||||
|
||||
tag.removeUnsupportedProperties(properties.unsupportedData());
|
||||
CPPUNIT_ASSERT(!tag.itemListMap().contains("TESTBINARY"));
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestAPE);
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <tbytevectorlist.h>
|
||||
#include <tpropertymap.h>
|
||||
#include <apetag.h>
|
||||
#include <tdebug.h>
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
@ -16,7 +17,8 @@ class TestAPETag : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST_SUITE(TestAPETag);
|
||||
CPPUNIT_TEST(testIsEmpty);
|
||||
CPPUNIT_TEST(testIsEmpty2);
|
||||
CPPUNIT_TEST(testDict);
|
||||
CPPUNIT_TEST(testPropertyInterface1);
|
||||
CPPUNIT_TEST(testPropertyInterface2);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -37,7 +39,7 @@ public:
|
||||
CPPUNIT_ASSERT(!tag.isEmpty());
|
||||
}
|
||||
|
||||
void testDict()
|
||||
void testPropertyInterface1()
|
||||
{
|
||||
APE::Tag tag;
|
||||
PropertyMap dict = tag.properties();
|
||||
@ -52,6 +54,35 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(17u, tag.track());
|
||||
}
|
||||
|
||||
void testPropertyInterface2()
|
||||
{
|
||||
APE::Tag tag;
|
||||
APE::Item item1 = APE::Item("TRACK", "17");
|
||||
tag.setItem("TRACK", item1);
|
||||
|
||||
APE::Item item2 = APE::Item();
|
||||
item2.setType(APE::Item::Binary);
|
||||
tag.setItem("TESTBINARY", item2);
|
||||
|
||||
PropertyMap properties = tag.properties();
|
||||
CPPUNIT_ASSERT_EQUAL(1u, properties.unsupportedData().size());
|
||||
CPPUNIT_ASSERT(properties.contains("TRACKNUMBER"));
|
||||
CPPUNIT_ASSERT(!properties.contains("TRACK"));
|
||||
CPPUNIT_ASSERT(tag.itemListMap().contains("TESTBINARY"));
|
||||
|
||||
tag.removeUnsupportedProperties(properties.unsupportedData());
|
||||
CPPUNIT_ASSERT(!tag.itemListMap().contains("TESTBINARY"));
|
||||
|
||||
APE::Item item3 = APE::Item("TRACKNUMBER", "29");
|
||||
tag.setItem("TRACKNUMBER", item3);
|
||||
properties = tag.properties();
|
||||
CPPUNIT_ASSERT_EQUAL(2u, properties["TRACKNUMBER"].size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("17"), properties["TRACKNUMBER"][0]);
|
||||
CPPUNIT_ASSERT_EQUAL(String("29"), properties["TRACKNUMBER"][1]);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestAPETag);
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include <modfile.h>
|
||||
#include <tpropertymap.h>
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
@ -51,6 +52,7 @@ class TestMod : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST_SUITE(TestMod);
|
||||
CPPUNIT_TEST(testReadTags);
|
||||
CPPUNIT_TEST(testWriteTags);
|
||||
CPPUNIT_TEST(testPropertyInterface);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -75,6 +77,22 @@ public:
|
||||
TEST_FILE_PATH_C("changed.mod")));
|
||||
}
|
||||
|
||||
void testPropertyInterface()
|
||||
{
|
||||
Mod::Tag t;
|
||||
PropertyMap properties;
|
||||
properties["BLA"] = String("bla");
|
||||
properties["ARTIST"] = String("artist1");
|
||||
properties["ARTIST"].append("artist2");
|
||||
properties["TITLE"] = String("title");
|
||||
|
||||
PropertyMap unsupported = t.setProperties(properties);
|
||||
CPPUNIT_ASSERT(unsupported.contains("BLA"));
|
||||
CPPUNIT_ASSERT(unsupported.contains("ARTIST"));
|
||||
CPPUNIT_ASSERT_EQUAL(properties["ARTIST"], unsupported["ARTIST"]);
|
||||
CPPUNIT_ASSERT(!unsupported.contains("TITLE"));
|
||||
}
|
||||
|
||||
private:
|
||||
void testRead(FileName fileName, const String &title, const String &comment)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user