]> granicus.if.org Git - taglib/commitdiff
Add a test case for reading APIC frames with descriptions in UTF-16 including BOM
authorLukáš Lalinský <lalinsky@gmail.com>
Mon, 21 Jan 2008 15:46:12 +0000 (15:46 +0000)
committerLukáš Lalinský <lalinsky@gmail.com>
Mon, 21 Jan 2008 15:46:12 +0000 (15:46 +0000)
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@764373 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

tests/test_id3v2.cpp

index d4566555b17d83ee426b735861bc6b7c9ee4a96c..4ccdc9afeae0d6e10f539b4b9e824df28eb0cd15 100644 (file)
@@ -34,6 +34,7 @@ class TestID3v2 : public CppUnit::TestFixture
   CPPUNIT_TEST(testUTF16Delimiter);
   CPPUNIT_TEST(testReadStringField);
   CPPUNIT_TEST(testParseAPIC);
+  CPPUNIT_TEST(testParseAPIC_UTF16_BOM);
   CPPUNIT_TEST(testParseGEOB);
   CPPUNIT_TEST(testParseRelativeVolumeFrame);
   CPPUNIT_TEST(testParseUniqueFileIdentifierFrame);
@@ -106,6 +107,19 @@ public:
     CPPUNIT_ASSERT_EQUAL(String("d"), f.description());
   }
 
+  void testParseAPIC_UTF16_BOM()
+  {
+    ID3v2::AttachedPictureFrame f(ByteVector(
+      "\x41\x50\x49\x43\x00\x02\x0c\x59\x00\x00\x01\x69\x6d\x61\x67\x65"
+      "\x2f\x6a\x70\x65\x67\x00\x00\xfe\xff\x00\x63\x00\x6f\x00\x76\x00"
+      "\x65\x00\x72\x00\x2e\x00\x6a\x00\x70\x00\x67\x00\x00\xff\xd8\xff",
+      16 * 3));
+    CPPUNIT_ASSERT_EQUAL(String("image/jpeg"), f.mimeType());
+    CPPUNIT_ASSERT_EQUAL(ID3v2::AttachedPictureFrame::Other, f.type());
+    CPPUNIT_ASSERT_EQUAL(String("cover.jpg"), f.description());
+    CPPUNIT_ASSERT_EQUAL(ByteVector("\xff\xd8\xff", 3), f.picture());
+  }
+
   // http://bugs.kde.org/show_bug.cgi?id=151078
   void testParseGEOB()
   {