From: Tsuda Kageyu Date: Tue, 17 Nov 2015 06:05:43 +0000 (+0900) Subject: Add a test for the CRC checksum of Ogg pages. X-Git-Tag: v1.11beta~143 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76de4234a1928e9dd9af23320880d069817b5000;p=taglib Add a test for the CRC checksum of Ogg pages. --- diff --git a/tests/test_ogg.cpp b/tests/test_ogg.cpp index 210fca2f..90ae162d 100644 --- a/tests/test_ogg.cpp +++ b/tests/test_ogg.cpp @@ -21,6 +21,7 @@ class TestOGG : public CppUnit::TestFixture CPPUNIT_TEST(testDictInterface1); CPPUNIT_TEST(testDictInterface2); CPPUNIT_TEST(testAudioProperties); + CPPUNIT_TEST(testPageChecksum); CPPUNIT_TEST_SUITE_END(); public: @@ -134,6 +135,30 @@ public: CPPUNIT_ASSERT_EQUAL(112000, f.audioProperties()->bitrateNominal()); CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->bitrateMinimum()); } + + void testPageChecksum() + { + ScopedFileCopy copy("empty", ".ogg"); + + { + Vorbis::File f(copy.fileName().c_str()); + f.tag()->setArtist("The Artist"); + f.save(); + + f.seek(0x50); + CPPUNIT_ASSERT_EQUAL((TagLib::uint)0x3d3bd92d, f.readBlock(4).toUInt(0, true)); + } + { + Vorbis::File f(copy.fileName().c_str()); + f.tag()->setArtist("The Artist 2"); + f.save(); + + f.seek(0x50); + CPPUNIT_ASSERT_EQUAL((TagLib::uint)0xd985291c, f.readBlock(4).toUInt(0, true)); + } + + } + }; CPPUNIT_TEST_SUITE_REGISTRATION(TestOGG);