]> granicus.if.org Git - taglib/commitdiff
Move a test to the proper place.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Thu, 3 Dec 2015 04:05:18 +0000 (13:05 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Thu, 3 Dec 2015 04:05:18 +0000 (13:05 +0900)
The test is actually for XiphComment, not Vorbis::File.

tests/test_ogg.cpp
tests/test_xiphcomment.cpp

index 2469aa15f0a26360292b7ec1bd965cccd8f93159..6e527f0dab0feea05beb1fdb539b21d48ce60f1f 100644 (file)
@@ -22,7 +22,6 @@ class TestOGG : public CppUnit::TestFixture
   CPPUNIT_TEST(testDictInterface2);
   CPPUNIT_TEST(testAudioProperties);
   CPPUNIT_TEST(testPageChecksum);
-  CPPUNIT_TEST(testPicture);
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -173,39 +172,6 @@ public:
 
   }
 
-  void testPicture()
-  {
-    ScopedFileCopy copy("empty", ".ogg");
-    string newname = copy.fileName();
-
-    Vorbis::File *f = new Vorbis::File(newname.c_str());
-    FLAC::Picture *newpic = new FLAC::Picture();
-    newpic->setType(FLAC::Picture::BackCover);
-    newpic->setWidth(5);
-    newpic->setHeight(6);
-    newpic->setColorDepth(16);
-    newpic->setNumColors(7);
-    newpic->setMimeType("image/jpeg");
-    newpic->setDescription("new image");
-    newpic->setData("JPEG data");
-    f->tag()->addPicture(newpic);
-    f->save();
-    delete f;
-
-    f = new Vorbis::File(newname.c_str());
-    List<FLAC::Picture *> lst = f->tag()->pictureList();
-    CPPUNIT_ASSERT_EQUAL((unsigned int)1, lst.size());
-    CPPUNIT_ASSERT_EQUAL(int(5), lst[0]->width());
-    CPPUNIT_ASSERT_EQUAL(int(6), lst[0]->height());
-    CPPUNIT_ASSERT_EQUAL(int(16), lst[0]->colorDepth());
-    CPPUNIT_ASSERT_EQUAL(int(7), lst[0]->numColors());
-    CPPUNIT_ASSERT_EQUAL(String("image/jpeg"), lst[0]->mimeType());
-    CPPUNIT_ASSERT_EQUAL(String("new image"), lst[0]->description());
-    CPPUNIT_ASSERT_EQUAL(ByteVector("JPEG data"), lst[0]->data());
-
-    delete f;
-  }
-
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION(TestOGG);
index 621179fe17def169e400f3299d2f3bfee61d2e95..475e906e8b3cd702837d38bcfd9c999835051aea 100644 (file)
@@ -20,6 +20,7 @@ class TestXiphComment : public CppUnit::TestFixture
   CPPUNIT_TEST(testInvalidKeys);
   CPPUNIT_TEST(testClearComment);
   CPPUNIT_TEST(testRemoveFields);
+  CPPUNIT_TEST(testPicture);
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -119,6 +120,39 @@ public:
     CPPUNIT_ASSERT_EQUAL(String("Xiph.Org libVorbis I 20050304"), f.tag()->vendorID());
   }
 
+  void testPicture()
+  {
+    ScopedFileCopy copy("empty", ".ogg");
+    string newname = copy.fileName();
+
+    {
+      Vorbis::File f(newname.c_str());
+      FLAC::Picture *newpic = new FLAC::Picture();
+      newpic->setType(FLAC::Picture::BackCover);
+      newpic->setWidth(5);
+      newpic->setHeight(6);
+      newpic->setColorDepth(16);
+      newpic->setNumColors(7);
+      newpic->setMimeType("image/jpeg");
+      newpic->setDescription("new image");
+      newpic->setData("JPEG data");
+      f.tag()->addPicture(newpic);
+      f.save();
+    }
+    {
+      Vorbis::File f(newname.c_str());
+      List<FLAC::Picture *> lst = f.tag()->pictureList();
+      CPPUNIT_ASSERT_EQUAL((unsigned int)1, lst.size());
+      CPPUNIT_ASSERT_EQUAL((int)5, lst[0]->width());
+      CPPUNIT_ASSERT_EQUAL((int)6, lst[0]->height());
+      CPPUNIT_ASSERT_EQUAL((int)16, lst[0]->colorDepth());
+      CPPUNIT_ASSERT_EQUAL((int)7, lst[0]->numColors());
+      CPPUNIT_ASSERT_EQUAL(String("image/jpeg"), lst[0]->mimeType());
+      CPPUNIT_ASSERT_EQUAL(String("new image"), lst[0]->description());
+      CPPUNIT_ASSERT_EQUAL(ByteVector("JPEG data"), lst[0]->data());
+    }
+  }
+
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION(TestXiphComment);