]> granicus.if.org Git - taglib/commitdiff
added APE tag PropertyMap test
authorMichael Helmling <helmling@mathematik.uni-kl.de>
Sat, 25 Feb 2012 17:32:00 +0000 (18:32 +0100)
committerMichael Helmling <helmling@mathematik.uni-kl.de>
Sat, 25 Feb 2012 17:32:00 +0000 (18:32 +0100)
tests/test_ape.cpp

index c95ff0c22d6663719706bc2a29154bb39da77a54..e6c31405df2d6731b8acc704af978c28c7d2642e 100644 (file)
@@ -5,6 +5,9 @@
 #include <tstringlist.h>
 #include <tbytevectorlist.h>
 #include <apefile.h>
+#include <apetag.h>
+#include <apeitem.h>
+#include <tpropertymap.h>
 #include "utils.h"
 
 using namespace std;
@@ -16,6 +19,7 @@ class TestAPE : public CppUnit::TestFixture
   CPPUNIT_TEST(testProperties399);
   CPPUNIT_TEST(testProperties396);
   CPPUNIT_TEST(testProperties390);
+  CPPUNIT_TEST(testPropertyinterface);
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -47,6 +51,27 @@ 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);