]> granicus.if.org Git - taglib/commitdiff
Add a test for #743/#779.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Tue, 29 Nov 2016 01:53:33 +0000 (10:53 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Tue, 29 Nov 2016 01:53:33 +0000 (10:53 +0900)
tests/test_flac.cpp

index 6a306981b04f2763e3d74d3cb54ac371168fa350..f2065e09c0ef7f7a6fe6347f49596a20b346d2a7 100644 (file)
@@ -62,6 +62,7 @@ class TestFLAC : public CppUnit::TestFixture
   CPPUNIT_TEST(testUpdateID3v2);
   CPPUNIT_TEST(testEmptyID3v2);
   CPPUNIT_TEST(testStripTags);
+  CPPUNIT_TEST(testRemoveXiphField);
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -493,6 +494,28 @@ public:
     }
   }
 
+  void testRemoveXiphField()
+  {
+    ScopedFileCopy copy("silence-44-s", ".flac");
+
+    {
+      FLAC::File f(copy.fileName().c_str());
+      f.xiphComment(true)->setTitle("XiphComment Title");
+      f.ID3v2Tag(true)->setTitle("ID3v2 Title");
+      f.save();
+    }
+    {
+      FLAC::File f(copy.fileName().c_str());
+      CPPUNIT_ASSERT_EQUAL(String("XiphComment Title"), f.xiphComment()->title());
+      f.xiphComment()->removeFields("TITLE");
+      f.save();
+    }
+    {
+      FLAC::File f(copy.fileName().c_str());
+      CPPUNIT_ASSERT_EQUAL(String(), f.xiphComment()->title());
+    }
+  }
+
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION(TestFLAC);