diff options
author | Thorsten Behrens <thb@openoffice.org> | 2006-07-11 10:39:41 +0000 |
---|---|---|
committer | Thorsten Behrens <thb@openoffice.org> | 2006-07-11 10:39:41 +0000 |
commit | 01878a9bddbb00b89876d89537ec6ba8ded33a65 (patch) | |
tree | 7ac690e7f97cfa03d974246ff4243fdbe84a71bf /basebmp/test | |
parent | 6822a05136317f4fdd155055fc10feefe7c44832 (diff) |
#i65904# Consistently named constants; added rectangular device subsetting to BitmapDevice; moved spreaded pixel format configuration points into a single traits template (per format); slightly improved cross-format support
Diffstat (limited to 'basebmp/test')
-rw-r--r-- | basebmp/test/basictest.cxx | 14 | ||||
-rw-r--r-- | basebmp/test/bmpdemo.cxx | 29 | ||||
-rw-r--r-- | basebmp/test/cliptest.cxx | 14 | ||||
-rw-r--r-- | basebmp/test/masktest.cxx | 6 |
4 files changed, 44 insertions, 19 deletions
diff --git a/basebmp/test/basictest.cxx b/basebmp/test/basictest.cxx index 33209a81a534..baffe6718ad2 100644 --- a/basebmp/test/basictest.cxx +++ b/basebmp/test/basictest.cxx @@ -4,9 +4,9 @@ * * $RCSfile: basictest.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: thb $ $Date: 2006-07-06 10:00:41 $ + * last change: $Author: thb $ $Date: 2006-07-11 11:38:56 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -85,8 +85,8 @@ public: CPPUNIT_ASSERT_MESSAGE("setBlue()", aTestColor.toInt32() == 0x00F0F10 ); - aTestColor.setGray( 0x13 ); - CPPUNIT_ASSERT_MESSAGE("setGray()", + aTestColor.setGrey( 0x13 ); + CPPUNIT_ASSERT_MESSAGE("setGrey()", aTestColor.toInt32() == 0x00131313 ); aTestColor = Color( 0x10, 0x20, 0xFF ); @@ -161,7 +161,7 @@ public: { pDevice = createBitmapDevice( aSize, true, - Format::EIGHT_BIT_GRAY ); + Format::EIGHT_BIT_GREY ); const Color aCol4(0x010101); pDevice->setPixel( aPt, aCol4, DrawMode_PAINT ); @@ -197,12 +197,12 @@ public: pDevice->setPixel( aPt2, aCol5, DrawMode_PAINT ); debugDump( pDevice, output ); CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #8", - pDevice->getPixel(aPt2) == aCol5); + pDevice->getPixel(aPt2) != aCol7); const Color aCol6(0x00FFFFFF); pDevice->setPixel( aPt3, aCol6, DrawMode_PAINT ); CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #9", - pDevice->getPixel(aPt3) != aCol7); + pDevice->getPixel(aPt3) == aCol6); } // 24bpp diff --git a/basebmp/test/bmpdemo.cxx b/basebmp/test/bmpdemo.cxx index 8f699dc05a18..fc5c7752fe06 100644 --- a/basebmp/test/bmpdemo.cxx +++ b/basebmp/test/bmpdemo.cxx @@ -4,9 +4,9 @@ * * $RCSfile: bmpdemo.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: thb $ $Date: 2006-06-30 11:05:21 $ + * last change: $Author: thb $ $Date: 2006-07-11 11:38:56 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -1082,6 +1082,31 @@ void TestWindow::Paint( const Rectangle& rRect ) basebmp::Format::THIRTYTWO_BIT_TC_MASK )); { + basebmp::BitmapDeviceSharedPtr pMask( basebmp::createBitmapDevice( aTestSize, + false, + basebmp::Format::ONE_BIT_MSB_GREY )); + + ::rtl::OUString aSvg = ::rtl::OUString::createFromAscii( + "m 0 0 h5 l5 5 v5 h-5 l-5-5 z" ); + basegfx::B2DPolyPolygon aPoly; + basegfx::tools::importFromSvgD( aPoly, aSvg ); + pMask->clear(basebmp::Color(0xFFFFFFFF)); + pMask->drawPolygon( + aPoly.getB2DPolygon(0), + basebmp::Color(0), + basebmp::DrawMode_PAINT ); + + basebmp::BitmapDeviceSharedPtr pSubsetDevice = + basebmp::subsetBitmapDevice( pDevice, + basegfx::B2IRange(3,3,7,7) ); + + const basegfx::B2IPoint aPt1(0,0); + const basegfx::B2IPoint aPt2(1,9); + const basebmp::Color aCol(0xFFFFFFFF); + pDevice->drawLine( aPt1, aPt2, aCol, basebmp::DrawMode_PAINT, pMask ); + } + + { const basebmp::Color aCol(0xFFFFFFFF); #if 0 basegfx::B2DPolygon aRect = basegfx::tools::createPolygonFromRect( diff --git a/basebmp/test/cliptest.cxx b/basebmp/test/cliptest.cxx index bf6dbc3d7376..cdf3fdf2b32f 100644 --- a/basebmp/test/cliptest.cxx +++ b/basebmp/test/cliptest.cxx @@ -4,9 +4,9 @@ * * $RCSfile: cliptest.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: thb $ $Date: 2006-06-28 16:50:20 $ + * last change: $Author: thb $ $Date: 2006-07-11 11:38:56 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -108,9 +108,6 @@ private: const Color aCol(0xFFFFFFFF); rDevice->drawLine( aPt1, aPt2, aCol, DrawMode_PAINT, mpClipMask ); - std::ofstream output("32bpp_test.dump"); - debugDump( mpDevice32bpp, output ); - const basegfx::B2IPoint aPt3(1,5); CPPUNIT_ASSERT_MESSAGE("get line pixel", rDevice->getPixel(aPt3) != aBgCol); @@ -164,7 +161,7 @@ private: { BitmapDeviceSharedPtr pBmp( createBitmapDevice( rDevice->getSize(), true, - Format::EIGHT_BIT_GRAY )); + Format::EIGHT_BIT_GREY )); ::rtl::OUString aSvg = ::rtl::OUString::createFromAscii( "m 0 0h5v10h5v-5h-10z" ); @@ -199,7 +196,7 @@ public: const basegfx::B2ISize aSize(11,11); mpClipMask = createBitmapDevice( aSize, true, - Format::ONE_BIT_MSB_GRAY ); + Format::ONE_BIT_MSB_GREY ); mpDevice1bpp = createBitmapDevice( aSize, true, Format::ONE_BIT_MSB_PAL ); @@ -216,6 +213,9 @@ public: aPoly.getB2DPolygon(0), Color(0), DrawMode_PAINT ); + + std::ofstream output("clipmask.dump"); + debugDump( mpClipMask, output ); } void testPixelClip() diff --git a/basebmp/test/masktest.cxx b/basebmp/test/masktest.cxx index 1cd85c038cb4..5976e1325582 100644 --- a/basebmp/test/masktest.cxx +++ b/basebmp/test/masktest.cxx @@ -4,9 +4,9 @@ * * $RCSfile: masktest.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: thb $ $Date: 2006-06-09 04:21:01 $ + * last change: $Author: thb $ $Date: 2006-07-11 11:38:56 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -138,7 +138,7 @@ public: mpMask = createBitmapDevice( aSize, true, - Format::EIGHT_BIT_GRAY ); + Format::EIGHT_BIT_GREY ); ::rtl::OUString aSvg = ::rtl::OUString::createFromAscii( "m 0 0h5v10h5v-5h-10z" ); |