diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2013-06-04 20:24:06 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2013-06-04 20:39:55 +0200 |
commit | 4dac6fe35573cfd59eb35e4323de1c16085d6a73 (patch) | |
tree | cd6167858bac1eca6ce8de7081b68b48b810303e /basebmp/test | |
parent | 31b35ed6bb7fe77f3f276b00fefce112a620b6ac (diff) |
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
Diffstat (limited to 'basebmp/test')
-rw-r--r-- | basebmp/test/bmptest.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/basebmp/test/bmptest.cxx b/basebmp/test/bmptest.cxx index 571e32e776d0..376b24f4ff2e 100644 --- a/basebmp/test/bmptest.cxx +++ b/basebmp/test/bmptest.cxx @@ -89,6 +89,22 @@ private: DrawMode_PAINT ); CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 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, |