diff --git a/taglib/ogg/flac/oggflacfile.cpp b/taglib/ogg/flac/oggflacfile.cpp index 3070f3ab..85a59354 100644 --- a/taglib/ogg/flac/oggflacfile.cpp +++ b/taglib/ogg/flac/oggflacfile.cpp @@ -93,7 +93,7 @@ Properties *Ogg::FLAC::File::audioProperties() const bool Ogg::FLAC::File::save() { - d->xiphCommentData = d->comment->render(); + d->xiphCommentData = d->comment->render(false); // Create FLAC metadata-block: diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2db60512..403e6060 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,6 +14,8 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/trueaudio ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg/vorbis + ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg/flac + ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/flac ) SET(test_runner_SRCS @@ -33,6 +35,7 @@ SET(test_runner_SRCS test_aiff.cpp test_riff.cpp test_ogg.cpp + test_oggflac.cpp ) IF(WITH_MP4) SET(test_runner_SRCS ${test_runner_SRCS} test_mp4.cpp) diff --git a/tests/Makefile.am b/tests/Makefile.am index f51e0765..e51ac0de 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,6 +7,8 @@ INCLUDES = \ -I$(top_srcdir)/taglib/mpeg/id3v2 \ -I$(top_srcdir)/taglib/ogg \ -I$(top_srcdir)/taglib/ogg/vorbis \ + -I$(top_srcdir)/taglib/ogg/flac \ + -I$(top_srcdir)/taglib/flac \ -I$(top_srcdir)/taglib/riff \ -I$(top_srcdir)/taglib/riff/aiff \ -I$(top_srcdir)/taglib/mpeg/id3v2/frames @@ -26,7 +28,8 @@ test_runner_SOURCES = \ test_xiphcomment.cpp \ test_riff.cpp \ test_aiff.cpp \ - test_ogg.cpp + test_ogg.cpp \ + test_oggflac.cpp if build_tests TESTS = test_runner diff --git a/tests/data/empty_flac.oga b/tests/data/empty_flac.oga new file mode 100644 index 00000000..444587fd Binary files /dev/null and b/tests/data/empty_flac.oga differ diff --git a/tests/data/empty_vorbis.ogg b/tests/data/empty_vorbis.ogg new file mode 100644 index 00000000..aa533104 Binary files /dev/null and b/tests/data/empty_vorbis.ogg differ diff --git a/tests/test_oggflac.cpp b/tests/test_oggflac.cpp new file mode 100644 index 00000000..a29a27a6 --- /dev/null +++ b/tests/test_oggflac.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "utils.h" + +using namespace std; +using namespace TagLib; + +class TestOggFLAC : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE(TestOggFLAC); + CPPUNIT_TEST(testFramingBit); + CPPUNIT_TEST_SUITE_END(); + +public: + + void testFramingBit() + { + string newname = copyFile("empty_flac", ".oga"); + + Ogg::FLAC::File *f = new Ogg::FLAC::File(newname.c_str()); + f->tag()->setArtist("The Artist"); + f->save(); + delete f; + + f = new Ogg::FLAC::File(newname.c_str()); + CPPUNIT_ASSERT_EQUAL(String("The Artist"), f->tag()->artist()); + + f->seek(0, File::End); + int size = f->tell(); + CPPUNIT_ASSERT_EQUAL(9134, size); + + delete f; + //deleteFile(newname); + } + +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(TestOggFLAC);