]> granicus.if.org Git - taglib/commitdiff
add id3v2 frame delete test
authorMichael Helmling <helmling@mathematik.uni-kl.de>
Mon, 23 Jul 2012 18:53:25 +0000 (20:53 +0200)
committerMichael Helmling <helmling@mathematik.uni-kl.de>
Mon, 23 Jul 2012 18:53:25 +0000 (20:53 +0200)
tests/test_id3v2.cpp

index 275336555b0ce0f572e41f021e136c054f4a927d..0dd033d590bd8c278df9f88b41063e6f4ec84283 100644 (file)
@@ -71,6 +71,7 @@ class TestID3v2 : public CppUnit::TestFixture
   CPPUNIT_TEST(testCompressedFrameWithBrokenLength);
   CPPUNIT_TEST(testPropertyInterface);
   CPPUNIT_TEST(testPropertyInterface2);
+  CPPUNIT_TEST(testDeleteFrame);
   CPPUNIT_TEST(testSaveAndStripID3v1ShouldNotAddFrameFromID3v1ToId3v2);
   CPPUNIT_TEST_SUITE_END();
 
@@ -629,6 +630,21 @@ public:
     CPPUNIT_ASSERT(tag.frameList("TIPL").isEmpty());
   }
 
+  void testDeleteFrame()
+  {
+    ScopedFileCopy copy("rare_frames", ".mp3");
+    string newname = copy.fileName();
+    MPEG::File f(newname.c_str());
+    ID3v2::Tag *t = f.ID3v2Tag();
+    ID3v2::Frame *frame = t->frameList("TCON")[0];
+    CPPUNIT_ASSERT_EQUAL(1u, t->frameList("TCON").size());
+    t->removeFrame(frame, true);
+    f.save(MPEG::File::ID3v2);
+
+    MPEG::File f2(newname.c_str());
+    t = f2.ID3v2Tag();
+    CPPUNIT_ASSERT(t->frameList("TCON").isEmpty());
+  }
   void testSaveAndStripID3v1ShouldNotAddFrameFromID3v1ToId3v2()
   {
     ScopedFileCopy copy("xing", ".mp3");