diff options
author | Thorsten Behrens <thb@openoffice.org> | 2006-07-12 21:47:21 +0000 |
---|---|---|
committer | Thorsten Behrens <thb@openoffice.org> | 2006-07-12 21:47:21 +0000 |
commit | 053fdb6c0d6862bb0110917edc5d31ff764fdea8 (patch) | |
tree | db2254c2b97af75974ce067cad981cdf4bdf1772 /basebmp/test | |
parent | 41aac5e01a735244839680528ae6245f1520ceee (diff) |
#i65904# Fixed operator+=/-= on PackedPixelRowIterator (wrong overflow handling & forgot to handle negated cases); fixed typo for paletteformats (ignoring bit gravity); made drawMaskedBitmap() work for more cases; improved tests
Diffstat (limited to 'basebmp/test')
-rw-r--r-- | basebmp/test/basictest.cxx | 34 | ||||
-rw-r--r-- | basebmp/test/bmpdemo.cxx | 13 | ||||
-rw-r--r-- | basebmp/test/cliptest.cxx | 11 | ||||
-rw-r--r-- | basebmp/test/linetest.cxx | 36 |
4 files changed, 76 insertions, 18 deletions
diff --git a/basebmp/test/basictest.cxx b/basebmp/test/basictest.cxx index 46776ce061ee..20a3e09df063 100644 --- a/basebmp/test/basictest.cxx +++ b/basebmp/test/basictest.cxx @@ -4,9 +4,9 @@ * * $RCSfile: basictest.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: thb $ $Date: 2006-07-12 15:09:45 $ + * last change: $Author: thb $ $Date: 2006-07-12 22:47:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -163,6 +163,34 @@ public: CPPUNIT_ASSERT_MESSAGE("setPixel clipping", countPixel(pDevice, aCol2) == nPixel); + CPPUNIT_ASSERT_MESSAGE("raw pixel value #1", + pDevice->getBuffer()[0] == 0x80); + + // 1bit LSB + { + pDevice = createBitmapDevice( aSize, + true, + Format::ONE_BIT_LSB_PAL ); + + pDevice->setPixel( aPt2, aCol, DrawMode_PAINT ); + CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #4", + pDevice->getPixel(aPt2) == aCol); + + const basegfx::B2IPoint aPt222(1,1); + pDevice->setPixel( aPt222, aCol, DrawMode_PAINT ); + CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #5", + pDevice->getPixel(aPt222) == aCol); + + pDevice->setPixel( aPt3, aCol, DrawMode_PAINT ); + CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #6", + pDevice->getPixel(aPt3) == aCol); + + CPPUNIT_ASSERT_MESSAGE("raw pixel value #2", + pDevice->getBuffer()[0] == 0x01); + CPPUNIT_ASSERT_MESSAGE("raw pixel value #3", + pDevice->getBuffer()[8] == 0x02); + } + // 8bit alpha { pDevice = createBitmapDevice( aSize, @@ -195,13 +223,11 @@ public: const Color aCol4(0x00101010); pDevice->setPixel( aPt, aCol4, DrawMode_PAINT ); - std::ofstream output("16bpp_test.dump"); CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #7", pDevice->getPixel(aPt) == aCol4); const Color aCol5(0x00F0F0F0); pDevice->setPixel( aPt2, aCol5, DrawMode_PAINT ); - debugDump( pDevice, output ); CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #8", pDevice->getPixel(aPt2) != aCol7); diff --git a/basebmp/test/bmpdemo.cxx b/basebmp/test/bmpdemo.cxx index fc5c7752fe06..b8cb431a2321 100644 --- a/basebmp/test/bmpdemo.cxx +++ b/basebmp/test/bmpdemo.cxx @@ -4,9 +4,9 @@ * * $RCSfile: bmpdemo.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: thb $ $Date: 2006-07-11 11:38:56 $ + * last change: $Author: thb $ $Date: 2006-07-12 22:47:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -1086,6 +1086,12 @@ void TestWindow::Paint( const Rectangle& rRect ) false, basebmp::Format::ONE_BIT_MSB_GREY )); + const basegfx::B2IPoint aPt111(10,10); + const basegfx::B2IPoint aPt222(0,10); + const basebmp::Color aCol333(0xFFFFFFFF); + pMask->drawLine( aPt111, aPt222, aCol333, basebmp::DrawMode_PAINT ); + + ::rtl::OUString aSvg = ::rtl::OUString::createFromAscii( "m 0 0 h5 l5 5 v5 h-5 l-5-5 z" ); basegfx::B2DPolyPolygon aPoly; @@ -1173,9 +1179,6 @@ void TestWindow::Paint( const Rectangle& rRect ) aPoint.setY( (int)((((double)aP2.getY())*cosd + ((double)aP2.getX())*sind)*factor) ); aP2 = aPoint; } - - std::ofstream output4("svptest.dump"); - debugDump( pDevice, output4 ); } Bitmap aBitmap( Size(aTestSize.getX(), diff --git a/basebmp/test/cliptest.cxx b/basebmp/test/cliptest.cxx index cdf3fdf2b32f..38e6797c13c1 100644 --- a/basebmp/test/cliptest.cxx +++ b/basebmp/test/cliptest.cxx @@ -4,9 +4,9 @@ * * $RCSfile: cliptest.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: thb $ $Date: 2006-07-11 11:38:56 $ + * last change: $Author: thb $ $Date: 2006-07-12 22:47:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -128,8 +128,8 @@ private: DrawMode_PAINT, mpClipMask ); const basegfx::B2IPoint aPt(0,10); - CPPUNIT_ASSERT_MESSAGE("number of clipped pixel is not 28", - countPixel( rDevice, rDevice->getPixel(aPt) ) == 121-28); + CPPUNIT_ASSERT_MESSAGE("number of clipped pixel is not 30", + countPixel( rDevice, rDevice->getPixel(aPt) ) == 121-30); } void implTestBmpClip(const BitmapDeviceSharedPtr& rDevice) @@ -213,9 +213,6 @@ public: aPoly.getB2DPolygon(0), Color(0), DrawMode_PAINT ); - - std::ofstream output("clipmask.dump"); - debugDump( mpClipMask, output ); } void testPixelClip() diff --git a/basebmp/test/linetest.cxx b/basebmp/test/linetest.cxx index decb524bc3ba..aaf4206cf9f7 100644 --- a/basebmp/test/linetest.cxx +++ b/basebmp/test/linetest.cxx @@ -4,9 +4,9 @@ * * $RCSfile: linetest.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: thb $ $Date: 2006-06-08 00:01:48 $ + * last change: $Author: thb $ $Date: 2006-07-12 22:47:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -93,6 +93,31 @@ private: countPixel( rDevice, aCol ) == 9); } + void implTestBasicHorizontalLines(const BitmapDeviceSharedPtr& rDevice) + { + rDevice->clear(Color(0)); + + const basegfx::B2IPoint aPt1(10,10); + const basegfx::B2IPoint aPt2(0,10); + const Color aCol(0xFFFFFFFF); + rDevice->drawLine( aPt1, aPt2, aCol, DrawMode_PAINT ); + CPPUNIT_ASSERT_MESSAGE("first pixel set", + rDevice->getPixel(aPt1) == aCol); + CPPUNIT_ASSERT_MESSAGE("last pixel set", + rDevice->getPixel(aPt2) == aCol); + CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 11", + countPixel( rDevice, aCol ) == 11); + + rDevice->clear(Color(0)); + rDevice->drawLine( aPt2, aPt1, aCol, DrawMode_PAINT ); + CPPUNIT_ASSERT_MESSAGE("first pixel set", + rDevice->getPixel(aPt1) == aCol); + CPPUNIT_ASSERT_MESSAGE("last pixel set", + rDevice->getPixel(aPt2) == aCol); + CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 11", + countPixel( rDevice, aCol ) == 11); + } + void implTestBasicVerticalLines(const BitmapDeviceSharedPtr& rDevice) { rDevice->clear(Color(0)); @@ -163,6 +188,12 @@ public: implTestBasicDiagonalLines( mpDevice32bpp ); } + void testBasicHorizontalLines() + { + implTestBasicHorizontalLines( mpDevice1bpp ); + implTestBasicHorizontalLines( mpDevice32bpp ); + } + void testBasicVerticalLines() { implTestBasicVerticalLines( mpDevice1bpp ); @@ -183,6 +214,7 @@ public: CPPUNIT_TEST_SUITE(LineTest); CPPUNIT_TEST(testBasicDiagonalLines); + CPPUNIT_TEST(testBasicHorizontalLines); CPPUNIT_TEST(testBasicVerticalLines); CPPUNIT_TEST(testTieBreaking); CPPUNIT_TEST_SUITE_END(); |