Kaydet (Commit) 4dac6fe3 authored tarafından Thorsten Behrens's avatar Thorsten Behrens

Add test for basebmp memory clobber.

Cloned bitmap devices may share the same chunk of memory, thus
risking overwriting our own data when we copy stuff around. Now
caught from unit tests.

Change-Id: I33b1a0b5d17550cbc6eced8bae01ae5ab9ebce9d
üst 31b35ed6
...@@ -81,7 +81,7 @@ namespace basebmp ...@@ -81,7 +81,7 @@ namespace basebmp
#if OSL_DEBUG_LEVEL > 2 #if OSL_DEBUG_LEVEL > 2
SAL_DLLPUBLIC_EXPORT void debugDump( const BitmapDeviceSharedPtr& rDevice, void debugDump( const BitmapDeviceSharedPtr& rDevice,
std::ostream& rOutputStream ) std::ostream& rOutputStream )
{ {
const basegfx::B2IVector aSize( rDevice->getSize() ); const basegfx::B2IVector aSize( rDevice->getSize() );
......
...@@ -89,6 +89,22 @@ private: ...@@ -89,6 +89,22 @@ private:
DrawMode_PAINT ); DrawMode_PAINT );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 32", CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 32",
countPixel( rDevice, aCol ) == 32); countPixel( rDevice, aCol ) == 32);
BitmapDeviceSharedPtr pClone = subsetBitmapDevice(
rBmp, aSourceRect );
// two overlapping areas within the same memory block, check
// if we clobber the mem or properly detect the case
const basegfx::B2IBox aSourceOverlap(0,0,6,10);
const basegfx::B2IBox aDestOverlap(3,0,9,10);
rBmp->drawBitmap(
pClone,
aSourceOverlap,
aDestOverlap,
DrawMode_PAINT );
CPPUNIT_ASSERT_MESSAGE("clobbertest - number of set pixel is not 50",
countPixel( rBmp, aCol ) == 50);
} }
void implTestBmpClip(const BitmapDeviceSharedPtr& rDevice, void implTestBmpClip(const BitmapDeviceSharedPtr& rDevice,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment