Changed to reflect new behavior of BBitmapStream, and prevent testing of buggy behavior in Be's BBitmapStream
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5212 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -261,14 +261,30 @@ BitmapStreamTest::ReadWriteTest()
|
|||||||
CPPUNIT_ASSERT(stream.Size() ==
|
CPPUNIT_ASSERT(stream.Size() ==
|
||||||
sizeof(TranslatorBitmap) + sheader.dataSize);
|
sizeof(TranslatorBitmap) + sheader.dataSize);
|
||||||
|
|
||||||
|
// Test reading zero bytes
|
||||||
|
NextSubTest();
|
||||||
|
CPPUNIT_ASSERT(stream.ReadAt(stream.Size(), &(chbuf[0]), 0) == 0);
|
||||||
|
CPPUNIT_ASSERT(stream.ReadAt(sheader.dataSize + 1000, &(chbuf[0]), 0) == 0);
|
||||||
|
CPPUNIT_ASSERT(stream.ReadAt(-1, &(chbuf[0]), 0) == 0);
|
||||||
|
|
||||||
// Read bitmap data
|
// Read bitmap data
|
||||||
NextSubTest();
|
NextSubTest();
|
||||||
bytesLeft = sheader.dataSize;
|
#if !TEST_R5
|
||||||
nPos = sizeof(TranslatorBitmap);
|
// This test fails with Be's version because of a bug.
|
||||||
while (bytesLeft--) {
|
// Be's BBitmapStream::ReadAt() has strange behavior in cases
|
||||||
CPPUNIT_ASSERT(stream.ReadAt(nPos++, &(chbuf[0]), 1) == 1);
|
// where the pos parameter of ReadAt() is != BBitmapStream::Position().
|
||||||
CPPUNIT_ASSERT(chbuf[0] == byt);
|
// If BBitmapStream::Read() is used instead, it calls
|
||||||
}
|
// BBitmapStream::ReadAt() with pos = BBitmapStream::Position(),
|
||||||
|
// so, this issue is rarely a problem because Read() is most often used.
|
||||||
|
bytesLeft = sheader.dataSize;
|
||||||
|
nPos = sizeof(TranslatorBitmap);
|
||||||
|
while (bytesLeft--) {
|
||||||
|
chbuf[0] = 0x99;
|
||||||
|
ssize_t rd = stream.ReadAt(nPos++, &(chbuf[0]), 1);
|
||||||
|
CPPUNIT_ASSERT(rd == 1);
|
||||||
|
CPPUNIT_ASSERT(chbuf[0] == byt);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Send erroneous and weird data to WriteAt()
|
// Send erroneous and weird data to WriteAt()
|
||||||
NextSubTest();
|
NextSubTest();
|
||||||
|
|||||||
Reference in New Issue
Block a user