From: Tsuda Kageyu Date: Thu, 3 Dec 2015 04:05:18 +0000 (+0900) Subject: Move a test to the proper place. X-Git-Tag: v1.11beta~52 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=24f220224d9ee3f4d49b338975031ed3dc759aed;p=taglib Move a test to the proper place. The test is actually for XiphComment, not Vorbis::File. --- diff --git a/tests/test_ogg.cpp b/tests/test_ogg.cpp index 2469aa15..6e527f0d 100644 --- a/tests/test_ogg.cpp +++ b/tests/test_ogg.cpp @@ -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 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); diff --git a/tests/test_xiphcomment.cpp b/tests/test_xiphcomment.cpp index 621179fe..475e906e 100644 --- a/tests/test_xiphcomment.cpp +++ b/tests/test_xiphcomment.cpp @@ -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 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);