]> granicus.if.org Git - taglib/commitdiff
Add a test for duplicate ID3v2 tags.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Mon, 20 Oct 2014 15:16:43 +0000 (00:16 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Mon, 20 Oct 2014 15:16:43 +0000 (00:16 +0900)
tests/data/duplicate_id3v2.mp3 [new file with mode: 0644]
tests/test_mpeg.cpp

diff --git a/tests/data/duplicate_id3v2.mp3 b/tests/data/duplicate_id3v2.mp3
new file mode 100644 (file)
index 0000000..34f4f15
Binary files /dev/null and b/tests/data/duplicate_id3v2.mp3 differ
index 44925cac12bf380e5f82f2358bd673315b1476ba..024da6a05a5f7849c8f4d0f6566451d1e1320afd 100644 (file)
@@ -16,6 +16,7 @@ class TestMPEG : public CppUnit::TestFixture
   CPPUNIT_TEST(testSaveID3v24);
   CPPUNIT_TEST(testSaveID3v24WrongParam);
   CPPUNIT_TEST(testSaveID3v23);
+  CPPUNIT_TEST(testDuplicateID3v2);
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -92,6 +93,19 @@ public:
     }
   }
 
+  void testDuplicateID3v2()
+  {
+    ScopedFileCopy copy("duplicate_id3v2", ".mp3");
+    string newname = copy.fileName();
+
+    MPEG::File f(newname.c_str());
+
+    // duplicate_id3v2.mp3 has duplicate ID3v2 tags.
+    // Sample rate will be 32000 if can't skip the second tag.
+
+    CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
+  }
+
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION(TestMPEG);