]> granicus.if.org Git - taglib/commitdiff
Moved APE test to correct place; added MOD tag test.
authorMichael Helmling <helmling@mathematik.uni-kl.de>
Sat, 25 Feb 2012 17:46:19 +0000 (18:46 +0100)
committerMichael Helmling <helmling@mathematik.uni-kl.de>
Sat, 25 Feb 2012 17:46:19 +0000 (18:46 +0100)
tests/test_ape.cpp
tests/test_apetag.cpp
tests/test_mod.cpp

index e6c31405df2d6731b8acc704af978c28c7d2642e..c95ff0c22d6663719706bc2a29154bb39da77a54 100644 (file)
@@ -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);
index 8419d9cecbaa369118b0343a5fd3c829b60e1941..422725df4732f175d2a8a80aa71518a6a9fde8ca 100644 (file)
@@ -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);
+
index 67c46f28340ddf670cfb001c4ab867f79182364d..a3919d7eb24f3511f8bddea94c2215e5f7d0ed79 100644 (file)
@@ -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)
   {