From f9efcfb8d6445fbc40480c0f482e554e7c4f787e Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Thu, 16 May 2013 20:26:20 +0900 Subject: [PATCH] Fixed the test for ID3V2's compressed frame --- tests/test_id3v2.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/test_id3v2.cpp b/tests/test_id3v2.cpp index 48faf306..42d0f138 100644 --- a/tests/test_id3v2.cpp +++ b/tests/test_id3v2.cpp @@ -1,5 +1,6 @@ #include #include +#include // so evil :( #define protected public #include @@ -15,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -580,13 +582,27 @@ public: { MPEG::File f(TEST_FILE_PATH_C("compressed_id3_frame.mp3"), false); CPPUNIT_ASSERT(f.ID3v2Tag()->frameListMap().contains("APIC")); - ID3v2::AttachedPictureFrame *frame = - static_cast(f.ID3v2Tag()->frameListMap()["APIC"].front()); + +#ifdef HAVE_ZLIB + + ID3v2::AttachedPictureFrame *frame + = dynamic_cast(f.ID3v2Tag()->frameListMap()["APIC"].front()); CPPUNIT_ASSERT(frame); CPPUNIT_ASSERT_EQUAL(String("image/bmp"), frame->mimeType()); CPPUNIT_ASSERT_EQUAL(ID3v2::AttachedPictureFrame::Other, frame->type()); CPPUNIT_ASSERT_EQUAL(String(""), frame->description()); CPPUNIT_ASSERT_EQUAL(TagLib::uint(86414), frame->picture().size()); + +#else + + // Skip the test if ZLIB is not installed. + // The message "Compressed frames are currently not supported." will be displayed. + + ID3v2::UnknownFrame *frame + = dynamic_cast(f.ID3v2Tag()->frameListMap()["APIC"].front()); + CPPUNIT_ASSERT(frame); + +#endif } void testW000()