diff --git a/tests/test_ape.cpp b/tests/test_ape.cpp index e6c31405..c95ff0c2 100644 --- a/tests/test_ape.cpp +++ b/tests/test_ape.cpp @@ -5,9 +5,6 @@ #include #include #include -#include -#include -#include #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); diff --git a/tests/test_apetag.cpp b/tests/test_apetag.cpp index 8419d9ce..422725df 100644 --- a/tests/test_apetag.cpp +++ b/tests/test_apetag.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #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); + diff --git a/tests/test_mod.cpp b/tests/test_mod.cpp index 67c46f28..a3919d7e 100644 --- a/tests/test_mod.cpp +++ b/tests/test_mod.cpp @@ -21,6 +21,7 @@ #include #include +#include #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) {