mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 21:14:23 -04:00
Fix defect in ByteVectorStream::seek when Position==End.
This commit is contained in:
@ -38,6 +38,7 @@ class TestByteVectorStream : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testReadBlock);
|
||||
CPPUNIT_TEST(testRemoveBlock);
|
||||
CPPUNIT_TEST(testInsert);
|
||||
CPPUNIT_TEST(testSeekEnd);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -112,6 +113,19 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("yyx123foa"), *stream.data());
|
||||
}
|
||||
|
||||
void testSeekEnd()
|
||||
{
|
||||
ByteVector v("abcdefghijklmnopqrstuvwxyz");
|
||||
ByteVectorStream stream(v);
|
||||
CPPUNIT_ASSERT_EQUAL(26L, stream.length());
|
||||
|
||||
stream.seek(-4, IOStream::End);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("w"), stream.readBlock(1));
|
||||
|
||||
stream.seek(-25, IOStream::End);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("b"), stream.readBlock(1));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestByteVectorStream);
|
||||
|
Reference in New Issue
Block a user