From: Tsuda Kageyu Date: Fri, 19 Jun 2015 00:25:36 +0000 (+0900) Subject: Add a test to check if the FLAC audio stream remains intact after adding an ID3v1... X-Git-Tag: v1.10beta~26^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8fa86162c7c0bd0d9d89d6393225ad7e27d32428;p=taglib Add a test to check if the FLAC audio stream remains intact after adding an ID3v1 tag. --- diff --git a/tests/test_flac.cpp b/tests/test_flac.cpp index dd09b3ea..54104cc5 100644 --- a/tests/test_flac.cpp +++ b/tests/test_flac.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "utils.h" @@ -27,6 +28,7 @@ class TestFLAC : public CppUnit::TestFixture CPPUNIT_TEST(testInvalid); CPPUNIT_TEST(testAudioProperties); CPPUNIT_TEST(testZeroSizedPadding); + CPPUNIT_TEST(testSaveID3v1); CPPUNIT_TEST_SUITE_END(); public: @@ -283,6 +285,29 @@ public: CPPUNIT_ASSERT(f.isValid()); } + void testSaveID3v1() + { + ScopedFileCopy copy("no-tags", ".flac"); + + ByteVector audioStream; + { + FLAC::File f(copy.fileName().c_str()); + CPPUNIT_ASSERT(!f.hasID3v1Tag()); + CPPUNIT_ASSERT_EQUAL((long)4692, f.length()); + + f.seek(0x0100); + audioStream = f.readBlock(4436); + + f.ID3v1Tag(true)->setTitle("01234 56789 ABCDE FGHIJ"); + f.save(); + CPPUNIT_ASSERT(f.hasID3v1Tag()); + CPPUNIT_ASSERT_EQUAL((long)4820, f.length()); + + f.seek(0x0100); + CPPUNIT_ASSERT_EQUAL(audioStream, f.readBlock(4436)); + } + } + }; CPPUNIT_TEST_SUITE_REGISTRATION(TestFLAC);