[Libreoffice-commits] core.git: Branch 'aoo/trunk' - basebmp/test
Damjan Jovanovic
damjan at apache.org
Sat Aug 29 01:08:13 PDT 2015
basebmp/test/basictest.cxx | 396 ++++++++++++++++++-------------------------
basebmp/test/bmpmasktest.cxx | 58 +-----
basebmp/test/bmptest.cxx | 71 ++-----
basebmp/test/cliptest.cxx | 133 +++++---------
basebmp/test/export.map | 30 ---
basebmp/test/filltest.cxx | 128 ++++---------
basebmp/test/linetest.cxx | 152 +++++-----------
basebmp/test/main.cxx | 28 +++
basebmp/test/makefile.mk | 33 +--
basebmp/test/masktest.cxx | 58 +-----
basebmp/test/polytest.cxx | 133 +++++---------
11 files changed, 470 insertions(+), 750 deletions(-)
New commits:
commit 05c9f765b76b0da85d4425ce40dc629a45f4f8d9
Author: Damjan Jovanovic <damjan at apache.org>
Date: Sat Aug 29 07:37:28 2015 +0000
#i125003# migrate main/basebmp from cppunit to Google Test.
diff --git a/basebmp/test/basictest.cxx b/basebmp/test/basictest.cxx
index 7e242ad..85d4aaa 100644
--- a/basebmp/test/basictest.cxx
+++ b/basebmp/test/basictest.cxx
@@ -24,10 +24,7 @@
// autogenerated file with codegen.pl
#include "preextstl.h"
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-#include "cppunit/plugin/TestPlugIn.h"
+#include "gtest/gtest.h"
#include "postextstl.h"
#include <basegfx/vector/b2isize.hxx>
@@ -51,248 +48,195 @@ namespace
debugDump( mpDevice32bpp, output );
*/
-class BasicTest : public CppUnit::TestFixture
+class BasicTest : public ::testing::Test
{
public:
- void colorTest()
+};
+
+TEST_F(BasicTest, colorTest)
+{
+ Color aTestColor;
+
+ aTestColor = Color(0xDEADBEEF);
+ ASSERT_TRUE( aTestColor.toInt32() == 0xDEADBEEF ) << "unary constructor";
+
+ aTestColor = Color( 0x10, 0x20, 0xFF );
+ ASSERT_TRUE( aTestColor.toInt32() == 0x001020FF ) << "ternary constructor";
+
+ aTestColor.setRed( 0x0F );
+ ASSERT_TRUE( aTestColor.toInt32() == 0x00F20FF ) << "setRed()";
+
+ aTestColor.setGreen( 0x0F );
+ ASSERT_TRUE( aTestColor.toInt32() == 0x00F0FFF ) << "setGreen()";
+
+ aTestColor.setBlue( 0x10 );
+ ASSERT_TRUE( aTestColor.toInt32() == 0x00F0F10 ) << "setBlue()";
+
+ aTestColor.setGrey( 0x13 );
+ ASSERT_TRUE( aTestColor.toInt32() == 0x00131313 ) << "setGrey()";
+
+ aTestColor = Color( 0x10, 0x20, 0xFF );
+ ASSERT_TRUE( aTestColor.getRed() == 0x10 ) << "getRed()";
+ ASSERT_TRUE( aTestColor.getGreen() == 0x20 ) << "getGreen()";
+ ASSERT_TRUE( aTestColor.getBlue() == 0xFF ) << "getBlue()";
+}
+
+TEST_F(BasicTest, testConstruction)
+{
+ const basegfx::B2ISize aSize(101,101);
+ basegfx::B2ISize aSize2(aSize);
+ BitmapDeviceSharedPtr pDevice( createBitmapDevice( aSize,
+ true,
+ Format::ONE_BIT_MSB_PAL ));
+ ASSERT_TRUE( pDevice->getSize() == aSize2 ) << "right size";
+ ASSERT_TRUE( pDevice->isTopDown() == true ) << "Top down format";
+ ASSERT_TRUE( pDevice->getScanlineFormat() == Format::ONE_BIT_MSB_PAL ) << "Scanline format";
+ ASSERT_TRUE( pDevice->getScanlineStride() == (aSize2.getY() + 7)/8 ) << "Scanline len";
+ ASSERT_TRUE( pDevice->getPalette() ) << "Palette existence";
+ ASSERT_TRUE( (*pDevice->getPalette())[0] == Color(0) ) << "Palette entry 0 is black";
+ ASSERT_TRUE( (*pDevice->getPalette())[1] == Color(0xFFFFFFFF) ) << "Palette entry 1 is white";
+}
+
+TEST_F(BasicTest, testPixelFuncs)
+{
+ // 1bpp
+ const basegfx::B2ISize aSize(64,64);
+ BitmapDeviceSharedPtr pDevice( createBitmapDevice( aSize,
+ true,
+ Format::ONE_BIT_MSB_PAL ));
+
+ const basegfx::B2IPoint aPt(3,3);
+ const Color aCol(0xFFFFFFFF);
+ pDevice->setPixel( aPt, aCol, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt) == aCol) << "get/setPixel roundtrip #1";
+
+ const basegfx::B2IPoint aPt2(0,0);
+ const Color aCol2(0xFFFFFFFF);
+ pDevice->setPixel( aPt2, aCol2, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt2) == aCol2) << "get/setPixel roundtrip #2";
+
+ const basegfx::B2IPoint aPt3(aSize.getX()-1,aSize.getY()-1);
+ const Color aCol3(0x00000000);
+ pDevice->setPixel( aPt3, aCol3, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt3) == aCol3) << "get/setPixel roundtrip #3";
+
+ pDevice->setPixel( aPt3, aCol2, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt3) == aCol2) << "get/setPixel roundtrip #3.5";
+
+ const basegfx::B2IPoint aPt4(-100000,-100000);
+ pDevice->setPixel( aPt4, aCol3, DrawMode_PAINT );
+ const basegfx::B2IPoint aPt5(100000,100000);
+ pDevice->setPixel( aPt5, aCol3, DrawMode_PAINT );
+
+ sal_Int32 nPixel(countPixel(pDevice, aCol2));
+ const basegfx::B2IPoint aPt6(aSize.getX(),aSize.getY());
+ pDevice->setPixel( aPt6, aCol2, DrawMode_PAINT );
+ ASSERT_TRUE(countPixel(pDevice, aCol2) == nPixel) << "setPixel clipping";
+
+ ASSERT_TRUE(pDevice->getBuffer()[0] == 0x80) << "raw pixel value #1";
+
+ // 1bit LSB
{
- Color aTestColor;
+ pDevice = createBitmapDevice( aSize,
+ true,
+ Format::ONE_BIT_LSB_PAL );
- aTestColor = Color(0xDEADBEEF);
- CPPUNIT_ASSERT_MESSAGE("unary constructor",
- aTestColor.toInt32() == 0xDEADBEEF );
+ pDevice->setPixel( aPt2, aCol, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt2) == aCol) << "get/setPixel roundtrip #4";
- aTestColor = Color( 0x10, 0x20, 0xFF );
- CPPUNIT_ASSERT_MESSAGE("ternary constructor",
- aTestColor.toInt32() == 0x001020FF );
+ const basegfx::B2IPoint aPt222(1,1);
+ pDevice->setPixel( aPt222, aCol, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt222) == aCol) << "get/setPixel roundtrip #5";
- aTestColor.setRed( 0x0F );
- CPPUNIT_ASSERT_MESSAGE("setRed()",
- aTestColor.toInt32() == 0x00F20FF );
+ pDevice->setPixel( aPt3, aCol, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt3) == aCol) << "get/setPixel roundtrip #6";
- aTestColor.setGreen( 0x0F );
- CPPUNIT_ASSERT_MESSAGE("setGreen()",
- aTestColor.toInt32() == 0x00F0FFF );
+ ASSERT_TRUE(pDevice->getBuffer()[0] == 0x01) << "raw pixel value #2";
+ ASSERT_TRUE(pDevice->getBuffer()[8] == 0x02) << "raw pixel value #3";
+ }
- aTestColor.setBlue( 0x10 );
- CPPUNIT_ASSERT_MESSAGE("setBlue()",
- aTestColor.toInt32() == 0x00F0F10 );
+ // 8bit alpha
+ {
+ pDevice = createBitmapDevice( aSize,
+ true,
+ Format::EIGHT_BIT_GREY );
- aTestColor.setGrey( 0x13 );
- CPPUNIT_ASSERT_MESSAGE("setGrey()",
- aTestColor.toInt32() == 0x00131313 );
+ const Color aCol4(0x010101);
+ pDevice->setPixel( aPt, aCol4, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt) == aCol4) << "get/setPixel roundtrip #4";
- aTestColor = Color( 0x10, 0x20, 0xFF );
- CPPUNIT_ASSERT_MESSAGE("getRed()",
- aTestColor.getRed() == 0x10 );
- CPPUNIT_ASSERT_MESSAGE("getGreen()",
- aTestColor.getGreen() == 0x20 );
- CPPUNIT_ASSERT_MESSAGE("getBlue()",
- aTestColor.getBlue() == 0xFF );
+ const Color aCol5(0x0F0F0F);
+ pDevice->setPixel( aPt2, aCol5, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt2) == aCol5) << "get/setPixel roundtrip #5";
+ const Color aCol6(0xFFFFFF);
+ pDevice->setPixel( aPt3, aCol6, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt3) == aCol6) << "get/setPixel roundtrip #6";
}
- void testConstruction()
+ // 16bpp
{
- const basegfx::B2ISize aSize(101,101);
- basegfx::B2ISize aSize2(aSize);
- BitmapDeviceSharedPtr pDevice( createBitmapDevice( aSize,
- true,
- Format::ONE_BIT_MSB_PAL ));
- CPPUNIT_ASSERT_MESSAGE("right size",
- pDevice->getSize() == aSize2 );
- CPPUNIT_ASSERT_MESSAGE("Top down format",
- pDevice->isTopDown() == true );
- CPPUNIT_ASSERT_MESSAGE("Scanline format",
- pDevice->getScanlineFormat() == Format::ONE_BIT_MSB_PAL );
- CPPUNIT_ASSERT_MESSAGE("Scanline len",
- pDevice->getScanlineStride() == (aSize2.getY() + 7)/8 );
- CPPUNIT_ASSERT_MESSAGE("Palette existence",
- pDevice->getPalette() );
- CPPUNIT_ASSERT_MESSAGE("Palette entry 0 is black",
- (*pDevice->getPalette())[0] == Color(0) );
- CPPUNIT_ASSERT_MESSAGE("Palette entry 1 is white",
- (*pDevice->getPalette())[1] == Color(0xFFFFFFFF) );
+ pDevice = createBitmapDevice( aSize,
+ true,
+ Format::SIXTEEN_BIT_LSB_TC_MASK );
+ const Color aCol7(0);
+ pDevice->clear( aCol7 );
+
+ const Color aCol4(0x00101010);
+ pDevice->setPixel( aPt, aCol4, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt) == aCol4) << "get/setPixel roundtrip #7";
+
+ const Color aCol5(0x00F0F0F0);
+ pDevice->setPixel( aPt2, aCol5, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt2) != aCol7) << "get/setPixel roundtrip #8";
+
+ const Color aCol6(0x00FFFFFF);
+ pDevice->setPixel( aPt3, aCol6, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt3) == aCol6) << "get/setPixel roundtrip #9";
}
- void testPixelFuncs()
+ // 24bpp
{
- // 1bpp
- const basegfx::B2ISize aSize(64,64);
- BitmapDeviceSharedPtr pDevice( createBitmapDevice( aSize,
- true,
- Format::ONE_BIT_MSB_PAL ));
-
- const basegfx::B2IPoint aPt(3,3);
- const Color aCol(0xFFFFFFFF);
- pDevice->setPixel( aPt, aCol, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #1",
- pDevice->getPixel(aPt) == aCol);
-
- const basegfx::B2IPoint aPt2(0,0);
- const Color aCol2(0xFFFFFFFF);
- pDevice->setPixel( aPt2, aCol2, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #2",
- pDevice->getPixel(aPt2) == aCol2);
-
- const basegfx::B2IPoint aPt3(aSize.getX()-1,aSize.getY()-1);
- const Color aCol3(0x00000000);
- pDevice->setPixel( aPt3, aCol3, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #3",
- pDevice->getPixel(aPt3) == aCol3);
-
- pDevice->setPixel( aPt3, aCol2, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #3.5",
- pDevice->getPixel(aPt3) == aCol2);
-
- const basegfx::B2IPoint aPt4(-100000,-100000);
- pDevice->setPixel( aPt4, aCol3, DrawMode_PAINT );
- const basegfx::B2IPoint aPt5(100000,100000);
- pDevice->setPixel( aPt5, aCol3, DrawMode_PAINT );
-
- sal_Int32 nPixel(countPixel(pDevice, aCol2));
- const basegfx::B2IPoint aPt6(aSize.getX(),aSize.getY());
- pDevice->setPixel( aPt6, aCol2, DrawMode_PAINT );
- 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,
- true,
- Format::EIGHT_BIT_GREY );
-
- const Color aCol4(0x010101);
- pDevice->setPixel( aPt, aCol4, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #4",
- pDevice->getPixel(aPt) == aCol4);
-
- const Color aCol5(0x0F0F0F);
- pDevice->setPixel( aPt2, aCol5, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #5",
- pDevice->getPixel(aPt2) == aCol5);
-
- const Color aCol6(0xFFFFFF);
- pDevice->setPixel( aPt3, aCol6, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #6",
- pDevice->getPixel(aPt3) == aCol6);
- }
-
- // 16bpp
- {
- pDevice = createBitmapDevice( aSize,
- true,
- Format::SIXTEEN_BIT_LSB_TC_MASK );
- const Color aCol7(0);
- pDevice->clear( aCol7 );
-
- const Color aCol4(0x00101010);
- pDevice->setPixel( aPt, aCol4, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #7",
- pDevice->getPixel(aPt) == aCol4);
-
- const Color aCol5(0x00F0F0F0);
- pDevice->setPixel( aPt2, aCol5, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #8",
- pDevice->getPixel(aPt2) != aCol7);
-
- const Color aCol6(0x00FFFFFF);
- pDevice->setPixel( aPt3, aCol6, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #9",
- pDevice->getPixel(aPt3) == aCol6);
- }
-
- // 24bpp
- {
- pDevice = createBitmapDevice( aSize,
- true,
- Format::TWENTYFOUR_BIT_TC_MASK );
-
- const Color aCol4(0x01010101);
- pDevice->setPixel( aPt, aCol4, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #10",
- pDevice->getPixel(aPt) == aCol4);
-
- const Color aCol5(0x0F3F2F1F);
- pDevice->setPixel( aPt2, aCol5, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #11",
- pDevice->getPixel(aPt2) == aCol5);
-
- const Color aCol6(0xFFFFFFFF);
- pDevice->setPixel( aPt3, aCol6, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #12",
- pDevice->getPixel(aPt3) == aCol6);
-
- CPPUNIT_ASSERT_MESSAGE("raw pixel value #4",
- pDevice->getBuffer()[2] == 0x3F
- && pDevice->getBuffer()[1] == 0x2F
- && pDevice->getBuffer()[0] == 0x1F);
- }
-
- // 32bpp
- {
- pDevice = createBitmapDevice( aSize,
- true,
- Format::THIRTYTWO_BIT_TC_MASK );
-
- const Color aCol4(0x01010101);
- pDevice->setPixel( aPt, aCol4, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #13",
- pDevice->getPixel(aPt) == aCol4);
-
- const Color aCol5(0x0F0F0F0F);
- pDevice->setPixel( aPt2, aCol5, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #14",
- pDevice->getPixel(aPt2) == aCol5);
-
- const Color aCol6(0xFFFFFFFF);
- pDevice->setPixel( aPt3, aCol6, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #15",
- pDevice->getPixel(aPt3) == aCol6);
- }
+ pDevice = createBitmapDevice( aSize,
+ true,
+ Format::TWENTYFOUR_BIT_TC_MASK );
+
+ const Color aCol4(0x01010101);
+ pDevice->setPixel( aPt, aCol4, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt) == aCol4) << "get/setPixel roundtrip #10";
+
+ const Color aCol5(0x0F3F2F1F);
+ pDevice->setPixel( aPt2, aCol5, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt2) == aCol5) << "get/setPixel roundtrip #11";
+
+ const Color aCol6(0xFFFFFFFF);
+ pDevice->setPixel( aPt3, aCol6, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt3) == aCol6) << "get/setPixel roundtrip #12";
+
+ ASSERT_TRUE(pDevice->getBuffer()[2] == 0x3F
+ && pDevice->getBuffer()[1] == 0x2F
+ && pDevice->getBuffer()[0] == 0x1F) << "raw pixel value #4";
}
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
+ // 32bpp
+ {
+ pDevice = createBitmapDevice( aSize,
+ true,
+ Format::THIRTYTWO_BIT_TC_MASK );
+
+ const Color aCol4(0x01010101);
+ pDevice->setPixel( aPt, aCol4, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt) == aCol4) << "get/setPixel roundtrip #13";
- CPPUNIT_TEST_SUITE(BasicTest);
- CPPUNIT_TEST(colorTest);
- CPPUNIT_TEST(testConstruction);
- CPPUNIT_TEST(testPixelFuncs);
- CPPUNIT_TEST_SUITE_END();
-};
+ const Color aCol5(0x0F0F0F0F);
+ pDevice->setPixel( aPt2, aCol5, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt2) == aCol5) << "get/setPixel roundtrip #14";
+
+ const Color aCol6(0xFFFFFFFF);
+ pDevice->setPixel( aPt3, aCol6, DrawMode_PAINT );
+ ASSERT_TRUE(pDevice->getPixel(aPt3) == aCol6) << "get/setPixel roundtrip #15";
+ }
+}
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(BasicTest);
}
-CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/basebmp/test/bmpmasktest.cxx b/basebmp/test/bmpmasktest.cxx
index 7ca0a01..f5cd169 100644
--- a/basebmp/test/bmpmasktest.cxx
+++ b/basebmp/test/bmpmasktest.cxx
@@ -24,9 +24,7 @@
// autogenerated file with codegen.pl
#include "preextstl.h"
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
+#include "gtest/gtest.h"
#include "postextstl.h"
#include <basegfx/vector/b2isize.hxx>
@@ -57,9 +55,9 @@ namespace
debugDump( rBmp, output2 );
*/
-class BmpMaskTest : public CppUnit::TestFixture
+class BmpMaskTest : public ::testing::Test
{
-private:
+protected:
BitmapDeviceSharedPtr mpDevice1bpp;
BitmapDeviceSharedPtr mpMaskBmp1bpp;
BitmapDeviceSharedPtr mpBmp1bpp;
@@ -81,8 +79,7 @@ private:
aSourceRect,
aDestAll,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 30",
- countPixel( rDevice, aCol ) == 30);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 30) << "number of rendered pixel is not 30";
}
void implTestBmpScaledClip(const BitmapDeviceSharedPtr& rDevice,
@@ -100,12 +97,11 @@ private:
aSourceRect,
aDestLeftTop,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 12",
- countPixel( rDevice, aCol ) == 12);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 12) << "number of rendered pixel is not 12";
}
public:
- void setUp()
+ virtual void SetUp()
{
const basegfx::B2ISize aSize(10,10);
mpDevice1bpp = createBitmapDevice( aSize,
@@ -130,7 +126,7 @@ public:
"m 0 0h5v10h5v-5h-10z" );
basegfx::B2DPolyPolygon aPoly;
- basegfx::tools::importFromSvgD( aPoly, aSvg );
+ basegfx::tools::importFromSvgD( aPoly, aSvg, false, NULL );
const Color aColWhite(0xFFFFFFFF);
const Color aColBlack(0);
mpBmp1bpp->fillPolyPolygon(
@@ -146,44 +142,26 @@ public:
"m 0 0 h6 v10 h-6z" );
aPoly.clear();
- basegfx::tools::importFromSvgD( aPoly, aSvg );
+ basegfx::tools::importFromSvgD( aPoly, aSvg, false, NULL );
mpMaskBmp1bpp->clear(aColWhite);
mpMaskBmp1bpp->fillPolyPolygon(
aPoly,
aColBlack,
DrawMode_PAINT );
}
-
- void testBmpBasics()
- {
- implTestBmpBasics( mpDevice1bpp, mpBmp1bpp );
- implTestBmpBasics( mpDevice32bpp, mpBmp32bpp );
- }
-
- void testBmpClip()
- {
- implTestBmpScaledClip( mpDevice1bpp, mpBmp1bpp );
- implTestBmpScaledClip( mpDevice32bpp, mpBmp32bpp );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(BmpMaskTest);
- CPPUNIT_TEST(testBmpBasics);
- CPPUNIT_TEST(testBmpClip);
- CPPUNIT_TEST_SUITE_END();
};
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(BmpMaskTest);
+TEST_F(BmpMaskTest, testBmpBasics)
+{
+ implTestBmpBasics( mpDevice1bpp, mpBmp1bpp );
+ implTestBmpBasics( mpDevice32bpp, mpBmp32bpp );
}
+TEST_F(BmpMaskTest, testBmpClip)
+{
+ implTestBmpScaledClip( mpDevice1bpp, mpBmp1bpp );
+ implTestBmpScaledClip( mpDevice32bpp, mpBmp32bpp );
+}
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-//NOADDITIONAL;
+}
diff --git a/basebmp/test/bmptest.cxx b/basebmp/test/bmptest.cxx
index 7af6578..07e37bb 100644
--- a/basebmp/test/bmptest.cxx
+++ b/basebmp/test/bmptest.cxx
@@ -24,9 +24,7 @@
// autogenerated file with codegen.pl
#include "preextstl.h"
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
+#include "gtest/gtest.h"
#include "postextstl.h"
#include <basegfx/vector/b2isize.hxx>
@@ -57,9 +55,9 @@ namespace
debugDump( rBmp, output2 );
*/
-class BmpTest : public CppUnit::TestFixture
+class BmpTest : public ::testing::Test
{
-private:
+protected:
BitmapDeviceSharedPtr mpDevice1bpp;
BitmapDeviceSharedPtr mpBmp1bpp;
BitmapDeviceSharedPtr mpDevice32bpp;
@@ -82,32 +80,28 @@ private:
aSourceRect,
aDestLeftTop,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 8",
- countPixel( rDevice, aCol ) == 8);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 8) << "number of rendered pixel is not 8";
rDevice->drawBitmap(
rBmp,
aSourceRect,
aDestRightTop,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 16",
- countPixel( rDevice, aCol ) == 16);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 16) << "number of rendered pixel is not 16";
rDevice->drawBitmap(
rBmp,
aSourceRect,
aDestLeftBottom,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 24",
- countPixel( rDevice, aCol ) == 24);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 24) << "number of rendered pixel is not 24";
rDevice->drawBitmap(
rBmp,
aSourceRect,
aDestRightBottom,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 32",
- countPixel( rDevice, aCol ) == 32);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 32) << "number of rendered pixel is not 32";
}
void implTestBmpClip(const BitmapDeviceSharedPtr& rDevice,
@@ -127,28 +121,25 @@ private:
aSourceRect,
aDestLeftTop,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 4",
- countPixel( rDevice, aCol ) == 4);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 4) << "number of rendered pixel is not 4";
rDevice->drawBitmap(
rBmp,
aSourceRect,
aDestLeftBottom,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 4(c)",
- countPixel( rDevice, aCol ) == 4);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 4) << "number of rendered pixel is not 4(c)";
rDevice->drawBitmap(
rBmp,
aSourceRect,
aDestRightBottom,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 8",
- countPixel( rDevice, aCol ) == 8);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 8) << "number of rendered pixel is not 8";
}
public:
- void setUp()
+ virtual void SetUp()
{
const basegfx::B2ISize aSize(10,10);
mpDevice1bpp = createBitmapDevice( aSize,
@@ -169,7 +160,7 @@ public:
"m 0 0h5v10h5v-5h-10z" );
basegfx::B2DPolyPolygon aPoly;
- basegfx::tools::importFromSvgD( aPoly, aSvg );
+ basegfx::tools::importFromSvgD( aPoly, aSvg, false, NULL );
const Color aCol(0xFFFFFFFF);
mpBmp1bpp->fillPolyPolygon(
aPoly,
@@ -180,37 +171,19 @@ public:
aCol,
DrawMode_PAINT );
}
-
- void testBmpBasics()
- {
- implTestBmpBasics( mpDevice1bpp, mpBmp1bpp );
- implTestBmpBasics( mpDevice32bpp, mpBmp32bpp );
- }
-
- void testBmpClip()
- {
- implTestBmpClip( mpDevice1bpp, mpBmp1bpp );
- implTestBmpClip( mpDevice32bpp, mpBmp32bpp );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(BmpTest);
- CPPUNIT_TEST(testBmpBasics);
- CPPUNIT_TEST(testBmpClip);
- CPPUNIT_TEST_SUITE_END();
};
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(BmpTest);
+TEST_F(BmpTest, testBmpBasics)
+{
+ implTestBmpBasics( mpDevice1bpp, mpBmp1bpp );
+ implTestBmpBasics( mpDevice32bpp, mpBmp32bpp );
}
+TEST_F(BmpTest, testBmpClip)
+{
+ implTestBmpClip( mpDevice1bpp, mpBmp1bpp );
+ implTestBmpClip( mpDevice32bpp, mpBmp32bpp );
+}
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-//NOADDITIONAL;
+}
diff --git a/basebmp/test/cliptest.cxx b/basebmp/test/cliptest.cxx
index 2ee228c..df04b0f 100644
--- a/basebmp/test/cliptest.cxx
+++ b/basebmp/test/cliptest.cxx
@@ -24,9 +24,7 @@
// autogenerated file with codegen.pl
#include "preextstl.h"
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
+#include "gtest/gtest.h"
#include "postextstl.h"
#include <basegfx/vector/b2isize.hxx>
@@ -56,9 +54,9 @@ namespace
debugDump( mpDevice32bpp, output );
*/
-class ClipTest : public CppUnit::TestFixture
+class ClipTest : public ::testing::Test
{
-private:
+protected:
BitmapDeviceSharedPtr mpClipMask;
BitmapDeviceSharedPtr mpDevice1bpp;
BitmapDeviceSharedPtr mpDevice32bpp;
@@ -71,23 +69,19 @@ private:
const basegfx::B2IPoint aPt(0,0);
const Color aCol(0xFFFFFFFF);
rDevice->setPixel( aPt, aCol, DrawMode_PAINT, mpClipMask );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel clip #1",
- rDevice->getPixel(aPt) == aBgCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt) == aBgCol) << "get/setPixel clip #1";
const basegfx::B2IPoint aPt2(10,10);
rDevice->setPixel( aPt2, aCol, DrawMode_PAINT, mpClipMask );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel clip #2",
- rDevice->getPixel(aPt2) == aBgCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt2) == aBgCol) << "get/setPixel clip #2";
const basegfx::B2IPoint aPt1(10,0);
rDevice->setPixel( aPt1, aCol, DrawMode_PAINT, mpClipMask );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel clip #3",
- rDevice->getPixel(aPt1) != aBgCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt1) != aBgCol) << "get/setPixel clip #3";
const basegfx::B2IPoint aPt3(0,10);
rDevice->setPixel( aPt3, aCol, DrawMode_PAINT, mpClipMask );
- CPPUNIT_ASSERT_MESSAGE("get/setPixel clip #4",
- rDevice->getPixel(aPt3) != aBgCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt3) != aBgCol) << "get/setPixel clip #4";
}
void implTestLineClip(const BitmapDeviceSharedPtr& rDevice)
@@ -101,16 +95,13 @@ private:
rDevice->drawLine( aPt1, aPt2, aCol, DrawMode_PAINT, mpClipMask );
const basegfx::B2IPoint aPt3(1,5);
- CPPUNIT_ASSERT_MESSAGE("get line pixel",
- rDevice->getPixel(aPt3) != aBgCol);
- CPPUNIT_ASSERT_MESSAGE("number of rendered line pixel is not 4",
- countPixel( rDevice,
- rDevice->getPixel(aPt3) ) == 4);
+ ASSERT_TRUE(rDevice->getPixel(aPt3) != aBgCol) << "get line pixel";
+ ASSERT_TRUE(countPixel( rDevice, rDevice->getPixel(aPt3) ) == 4)
+ << "number of rendered line pixel is not 4";
rDevice->drawLine( aPt1, aPt2, aCol, DrawMode_XOR, mpClipMask );
- CPPUNIT_ASSERT_MESSAGE("number of xor-rendered line pixel is not 0",
- countPixel( rDevice,
- rDevice->getPixel(aPt3) ) == 121);
+ ASSERT_TRUE(countPixel( rDevice, rDevice->getPixel(aPt3) ) == 121)
+ << "number of xor-rendered line pixel is not 0";
}
void implTestFillClip(const BitmapDeviceSharedPtr& rDevice)
@@ -125,23 +116,23 @@ private:
DrawMode_PAINT,
mpClipMask );
const basegfx::B2IPoint aPt(0,10);
- CPPUNIT_ASSERT_MESSAGE("number of clipped pixel is not 30",
- countPixel( rDevice, rDevice->getPixel(aPt) ) == 121-30);
+ ASSERT_TRUE(countPixel( rDevice, rDevice->getPixel(aPt) ) == 121-30)
+ << "number of clipped pixel is not 30";
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aAllOver)),
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of filled pixel is not 121",
- countPixel( rDevice, rDevice->getPixel(aPt) ) == 121);
+ ASSERT_TRUE(countPixel( rDevice, rDevice->getPixel(aPt) ) == 121)
+ << "number of filled pixel is not 121";
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aAllOver)),
aCol,
DrawMode_XOR,
mpClipMask );
- CPPUNIT_ASSERT_MESSAGE("number of xor-cleared pixel is not 91",
- countPixel( rDevice, rDevice->getPixel(aPt) ) == 121-30);
+ ASSERT_TRUE(countPixel( rDevice, rDevice->getPixel(aPt) ) == 121-30)
+ << "number of xor-cleared pixel is not 91";
}
void implTestBmpClip(const BitmapDeviceSharedPtr& rDevice)
@@ -164,9 +155,8 @@ private:
mpClipMask);
const basegfx::B2IPoint aPt(1,1);
- CPPUNIT_ASSERT_MESSAGE("number of clipped pixel is not 5",
- countPixel( rDevice,
- rDevice->getPixel(aPt) ) == 5);
+ ASSERT_TRUE(countPixel( rDevice, rDevice->getPixel(aPt) ) == 5)
+ << "number of clipped pixel is not 5";
}
void implTestMaskColorClip(const BitmapDeviceSharedPtr& rDevice)
@@ -179,7 +169,7 @@ private:
"m 0 0h5v10h5v-5h-10z" );
basegfx::B2DPolyPolygon aPoly;
- basegfx::tools::importFromSvgD( aPoly, aSvg );
+ basegfx::tools::importFromSvgD( aPoly, aSvg, false, NULL );
const basebmp::Color aCol(0xFF);
pBmp->clear( basebmp::Color(0) );
pBmp->fillPolyPolygon(
@@ -197,13 +187,13 @@ private:
aDestLeftTop,
mpClipMask );
const basegfx::B2IPoint aPt(1,1);
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 41",
- countPixel( rDevice, rDevice->getPixel(aPt) ) == 41);
+ ASSERT_TRUE(countPixel( rDevice, rDevice->getPixel(aPt) ) == 41)
+ << "number of rendered pixel is not 41";
}
public:
- void setUp()
+ virtual void SetUp()
{
const basegfx::B2ISize aSize(11,11);
mpClipMask = createBitmapDevice( aSize,
@@ -219,65 +209,44 @@ public:
::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 );
+ basegfx::tools::importFromSvgD( aPoly, aSvg, false, NULL );
mpClipMask->clear(Color(0));
mpClipMask->drawPolygon(
aPoly.getB2DPolygon(0),
Color(0xFFFFFFFF),
DrawMode_PAINT );
}
+};
- void testPixelClip()
- {
- implTestPixelClip( mpDevice1bpp );
- implTestPixelClip( mpDevice32bpp );
- }
-
- void testLineClip()
- {
- implTestLineClip( mpDevice1bpp );
- implTestLineClip( mpDevice32bpp );
- }
-
- void testFillClip()
- {
- implTestFillClip( mpDevice1bpp );
- implTestFillClip( mpDevice32bpp );
- }
-
- void testBmpClip()
- {
- implTestBmpClip( mpDevice1bpp );
- implTestBmpClip( mpDevice32bpp );
- }
-
- void testMaskColorClip()
- {
- implTestMaskColorClip( mpDevice1bpp );
- implTestMaskColorClip( mpDevice32bpp );
- }
+TEST_F(ClipTest, testPixelClip)
+{
+ implTestPixelClip( mpDevice1bpp );
+ implTestPixelClip( mpDevice32bpp );
+}
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(ClipTest);
- CPPUNIT_TEST(testPixelClip);
- CPPUNIT_TEST(testLineClip);
- CPPUNIT_TEST(testFillClip);
- CPPUNIT_TEST(testBmpClip);
- CPPUNIT_TEST(testMaskColorClip);
- CPPUNIT_TEST_SUITE_END();
-};
+TEST_F(ClipTest, testLineClip)
+{
+ implTestLineClip( mpDevice1bpp );
+ implTestLineClip( mpDevice32bpp );
+}
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(ClipTest);
+TEST_F(ClipTest, testFillClip)
+{
+ implTestFillClip( mpDevice1bpp );
+ implTestFillClip( mpDevice32bpp );
}
+TEST_F(ClipTest, testBmpClip)
+{
+ implTestBmpClip( mpDevice1bpp );
+ implTestBmpClip( mpDevice32bpp );
+}
-// -----------------------------------------------------------------------------
+TEST_F(ClipTest, testMaskColorClip)
+{
+ implTestMaskColorClip( mpDevice1bpp );
+ implTestMaskColorClip( mpDevice32bpp );
+}
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-//NOADDITIONAL;
+}
diff --git a/basebmp/test/export.map b/basebmp/test/export.map
deleted file mode 100644
index ec49c45..0000000
--- a/basebmp/test/export.map
+++ /dev/null
@@ -1,30 +0,0 @@
-#**************************************************************
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#**************************************************************
-
-
-
-UDK_3_0_0 {
- global:
- cppunitTestPlugIn;
-
- local:
- *;
-};
diff --git a/basebmp/test/filltest.cxx b/basebmp/test/filltest.cxx
index 6ead4fa..c590b3c 100644
--- a/basebmp/test/filltest.cxx
+++ b/basebmp/test/filltest.cxx
@@ -24,9 +24,7 @@
// autogenerated file with codegen.pl
#include "preextstl.h"
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
+#include "gtest/gtest.h"
#include "postextstl.h"
#include <basegfx/vector/b2isize.hxx>
@@ -55,9 +53,9 @@ namespace
debugDump( mpDevice32bpp, output );
*/
-class FillTest : public CppUnit::TestFixture
+class FillTest : public ::testing::Test
{
-private:
+protected:
BitmapDeviceSharedPtr mpDevice1bpp;
BitmapDeviceSharedPtr mpDevice32bpp;
@@ -75,20 +73,15 @@ private:
DrawMode_PAINT );
const basegfx::B2IPoint aPt1(1,1);
- CPPUNIT_ASSERT_MESSAGE("first pixel set",
- rDevice->getPixel(aPt1) == aCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt1) == aCol) << "first pixel set";
const basegfx::B2IPoint aPt2(9,9);
- CPPUNIT_ASSERT_MESSAGE("last pixel set",
- rDevice->getPixel(aPt2) == aCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt2) == aCol) << "last pixel set";
const basegfx::B2IPoint aPt3(0,0);
- CPPUNIT_ASSERT_MESSAGE("topmost pixel not set",
- rDevice->getPixel(aPt3) != aCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt3) != aCol) << "topmost pixel not set";
const basegfx::B2IPoint aPt4(10,10);
- CPPUNIT_ASSERT_MESSAGE("bottommost pixel not set",
- rDevice->getPixel(aPt4) != aCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt4) != aCol) << "bottommost pixel not set";
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 81",
- countPixel( rDevice, aCol ) == 81);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 81) << "number of rendered pixel is not 81";
}
void implTestCornerCases(const BitmapDeviceSharedPtr& rDevice)
@@ -108,72 +101,61 @@ private:
basegfx::tools::createPolygonFromRect( aEmpty1 )),
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 0",
- countPixel( rDevice, aCol ) == 0);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 0) << "number of rendered pixel is not 0";
rDevice->fillPolyPolygon(
basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect( aEmpty2 )),
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 0",
- countPixel( rDevice, aCol ) == 0);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 0) << "number of rendered pixel is not 0";
rDevice->fillPolyPolygon(
basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect( aVertLineLeft )),
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 11",
- countPixel( rDevice, aCol ) == 11);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 11) << "number of rendered pixel is not 11";
const basegfx::B2IPoint aPt1(0,0);
- CPPUNIT_ASSERT_MESSAGE("first pixel set",
- rDevice->getPixel(aPt1) == aCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt1) == aCol) << "first pixel set";
rDevice->fillPolyPolygon(
basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect( aVertLineRight )),
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 22",
- countPixel( rDevice, aCol ) == 22);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 22) << "number of rendered pixel is not 22";
const basegfx::B2IPoint aPt2(10,10);
- CPPUNIT_ASSERT_MESSAGE("last pixel set",
- rDevice->getPixel(aPt2) == aCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt2) == aCol) << "last pixel set";
rDevice->fillPolyPolygon(
basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect( aHorzLineTop )),
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 31",
- countPixel( rDevice, aCol ) == 31);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 31) << "number of rendered pixel is not 31";
const basegfx::B2IPoint aPt3(5,0);
- CPPUNIT_ASSERT_MESSAGE("top-middle pixel set",
- rDevice->getPixel(aPt3) == aCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt3) == aCol) << "top-middle pixel set";
rDevice->fillPolyPolygon(
basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect( aHorzLineBottom )),
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 40",
- countPixel( rDevice, aCol ) == 40);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 40) << "number of rendered pixel is not 40";
const basegfx::B2IPoint aPt4(5,10);
- CPPUNIT_ASSERT_MESSAGE("bottom-middle pixel set",
- rDevice->getPixel(aPt4) == aCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt4) == aCol) << "bottom-middle pixel set";
::rtl::OUString aSvg = ::rtl::OUString::createFromAscii(
"m 0 0l7 7h-1z" );
basegfx::B2DPolyPolygon aPoly;
- basegfx::tools::importFromSvgD( aPoly, aSvg );
+ basegfx::tools::importFromSvgD( aPoly, aSvg, false, NULL );
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 43",
- countPixel( rDevice, aCol ) == 43);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 43) << "number of rendered pixel is not 43";
}
void implTestClipping(const BitmapDeviceSharedPtr& rDevice)
@@ -191,87 +173,63 @@ private:
basegfx::tools::createPolygonFromRect(aLeftTop)),
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 1",
- countPixel( rDevice, aCol ) == 1);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 1) << "number of rendered pixel is not 1";
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aRightTop)),
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 2",
- countPixel( rDevice, aCol ) == 2);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 2) << "number of rendered pixel is not 2";
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aLeftBottom)),
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 3",
- countPixel( rDevice, aCol ) == 3);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 3) << "number of rendered pixel is not 3";
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aRightBottom)),
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 4",
- countPixel( rDevice, aCol ) == 4);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 4) << "number of rendered pixel is not 4";
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aAllOver)),
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 121",
- countPixel( rDevice, aCol ) == 121);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 121) << "number of rendered pixel is not 121";
}
public:
- void setUp()
+ virtual void SetUp()
{
const basegfx::B2ISize aSize(11,11);
mpDevice1bpp = createBitmapDevice( aSize,
true,
Format::ONE_BIT_MSB_PAL );
mpDevice32bpp = createBitmapDevice( aSize,
- true,
- Format::THIRTYTWO_BIT_TC_MASK );
- }
-
- void testRectFill()
- {
- implTestRectFill( mpDevice1bpp );
- implTestRectFill( mpDevice32bpp );
- }
-
- void testClipping()
- {
- implTestClipping( mpDevice1bpp );
- implTestClipping( mpDevice32bpp );
- }
-
- void testCornerCases()
- {
- implTestCornerCases( mpDevice1bpp );
- implTestCornerCases( mpDevice32bpp );
+ true,
+ Format::THIRTYTWO_BIT_TC_MASK );
}
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(FillTest);
- CPPUNIT_TEST(testRectFill);
- CPPUNIT_TEST(testClipping);
- CPPUNIT_TEST(testCornerCases);
- CPPUNIT_TEST_SUITE_END();
};
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(FillTest);
+TEST_F(FillTest, testRectFill)
+{
+ implTestRectFill( mpDevice1bpp );
+ implTestRectFill( mpDevice32bpp );
}
+TEST_F(FillTest, testClipping)
+{
+ implTestClipping( mpDevice1bpp );
+ implTestClipping( mpDevice32bpp );
+}
-// -----------------------------------------------------------------------------
+TEST_F(FillTest, testCornerCases)
+{
+ implTestCornerCases( mpDevice1bpp );
+ implTestCornerCases( mpDevice32bpp );
+}
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-//NOADDITIONAL;
+}
diff --git a/basebmp/test/linetest.cxx b/basebmp/test/linetest.cxx
index 2774328..74b0071 100644
--- a/basebmp/test/linetest.cxx
+++ b/basebmp/test/linetest.cxx
@@ -24,9 +24,7 @@
// autogenerated file with codegen.pl
#include "preextstl.h"
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
+#include "gtest/gtest.h"
#include "postextstl.h"
#include <basegfx/vector/b2isize.hxx>
@@ -50,9 +48,9 @@ namespace
debugDump( mpDevice32bpp, output );
*/
-class LineTest : public CppUnit::TestFixture
+class LineTest : public ::testing::Test
{
-private:
+protected:
BitmapDeviceSharedPtr mpDevice1bpp;
BitmapDeviceSharedPtr mpDevice32bpp;
@@ -64,25 +62,19 @@ private:
const basegfx::B2IPoint aPt2(9,9);
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);
+ ASSERT_TRUE(rDevice->getPixel(aPt1) == aCol) << "first pixel set";
+ ASSERT_TRUE(rDevice->getPixel(aPt2) == aCol) << "last pixel set";
const basegfx::B2IPoint aPt3(0,0);
- CPPUNIT_ASSERT_MESSAGE("topmost pixel not set",
- rDevice->getPixel(aPt3) != aCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt3) != aCol) << "topmost pixel not set";
const basegfx::B2IPoint aPt4(10,10);
- CPPUNIT_ASSERT_MESSAGE("bottommost pixel not set",
- rDevice->getPixel(aPt4) != aCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt4) != aCol) << "bottommost pixel not set";
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 9",
- countPixel( rDevice, aCol ) == 9);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 9) << "number of rendered pixel is not 9";
rDevice->drawLine( aPt2, aPt1, aCol, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel after "
- "reversed paint is not 9",
- countPixel( rDevice, aCol ) == 9);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 9)
+ << "number of rendered pixel after reversed paint is not 9";
}
void implTestBasicHorizontalLines(const BitmapDeviceSharedPtr& rDevice)
@@ -93,21 +85,15 @@ private:
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);
+ ASSERT_TRUE(rDevice->getPixel(aPt1) == aCol) << "first pixel set";
+ ASSERT_TRUE(rDevice->getPixel(aPt2) == aCol) << "last pixel set";
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 11) << "number of rendered pixel is not 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);
+ ASSERT_TRUE(rDevice->getPixel(aPt1) == aCol) << "first pixel set";
+ ASSERT_TRUE(rDevice->getPixel(aPt2) == aCol) << "last pixel set";
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 11) << "number of rendered pixel is not 11";
}
void implTestBasicVerticalLines(const BitmapDeviceSharedPtr& rDevice)
@@ -118,19 +104,14 @@ private:
const basegfx::B2IPoint aPt2(1,9);
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);
+ ASSERT_TRUE(rDevice->getPixel(aPt1) == aCol) << "first pixel set";
+ ASSERT_TRUE(rDevice->getPixel(aPt2) == aCol) << "last pixel set";
const basegfx::B2IPoint aPt3(0,0);
- CPPUNIT_ASSERT_MESSAGE("topmost pixel not set",
- rDevice->getPixel(aPt3) != aCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt3) != aCol) << "topmost pixel not set";
const basegfx::B2IPoint aPt4(0,10);
- CPPUNIT_ASSERT_MESSAGE("bottommost pixel not set",
- rDevice->getPixel(aPt4) != aCol);
+ ASSERT_TRUE(rDevice->getPixel(aPt4) != aCol) << "bottommost pixel not set";
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 9",
- countPixel( rDevice, aCol ) == 9);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 9) << "number of rendered pixel is not 9";
}
// test pixel rounding (should always tend towards start point of
@@ -143,27 +124,22 @@ private:
const basegfx::B2IPoint aPt2(3,2);
const Color aCol(0xFFFFFFFF);
rDevice->drawLine( aPt1, aPt2, aCol, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("first pixel set",
- rDevice->getPixel(aPt1) == aCol);
- CPPUNIT_ASSERT_MESSAGE("second pixel set",
- rDevice->getPixel(basegfx::B2IPoint(2,1)) == aCol);
- CPPUNIT_ASSERT_MESSAGE("last pixel set",
- rDevice->getPixel(aPt2) == aCol);
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel after "
- "reversed paint is not 3",
- countPixel( rDevice, aCol ) == 3);
+ ASSERT_TRUE(rDevice->getPixel(aPt1) == aCol) << "first pixel set";
+ ASSERT_TRUE(rDevice->getPixel(basegfx::B2IPoint(2,1)) == aCol) << "second pixel set";
+ ASSERT_TRUE(rDevice->getPixel(aPt2) == aCol) << "last pixel set";
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 3)
+ << "number of rendered pixel after reversed paint is not 3";
rDevice->drawLine( aPt2, aPt1, aCol, DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("alternate second pixel set",
- rDevice->getPixel(basegfx::B2IPoint(2,2)) == aCol);
+ ASSERT_TRUE(rDevice->getPixel(basegfx::B2IPoint(2,2)) == aCol)
+ << "alternate second pixel set";
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel after "
- "reversed paint is not 4",
- countPixel( rDevice, aCol ) == 4);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 4)
+ << "number of rendered pixel after reversed paint is not 4";
}
public:
- void setUp()
+ virtual void SetUp()
{
const basegfx::B2ISize aSize(11,11);
mpDevice1bpp = createBitmapDevice( aSize,
@@ -173,53 +149,33 @@ public:
true,
Format::THIRTYTWO_BIT_TC_MASK );
}
-
- void testBasicDiagonalLines()
- {
- implTestBasicDiagonalLines( mpDevice1bpp );
- implTestBasicDiagonalLines( mpDevice32bpp );
- }
-
- void testBasicHorizontalLines()
- {
- implTestBasicHorizontalLines( mpDevice1bpp );
- implTestBasicHorizontalLines( mpDevice32bpp );
- }
-
- void testBasicVerticalLines()
- {
- implTestBasicVerticalLines( mpDevice1bpp );
- implTestBasicVerticalLines( mpDevice32bpp );
- }
-
- // test pixel rounding (should always tend towards start point of
- // the line)
- void testTieBreaking()
- {
- implTestTieBreaking( mpDevice1bpp );
- implTestTieBreaking( mpDevice32bpp );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(LineTest);
- CPPUNIT_TEST(testBasicDiagonalLines);
- CPPUNIT_TEST(testBasicHorizontalLines);
- CPPUNIT_TEST(testBasicVerticalLines);
- CPPUNIT_TEST(testTieBreaking);
- CPPUNIT_TEST_SUITE_END();
};
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(LineTest);
+TEST_F(LineTest, testBasicDiagonalLines)
+{
+ implTestBasicDiagonalLines( mpDevice1bpp );
+ implTestBasicDiagonalLines( mpDevice32bpp );
+}
+
+TEST_F(LineTest, testBasicHorizontalLines)
+{
+ implTestBasicHorizontalLines( mpDevice1bpp );
+ implTestBasicHorizontalLines( mpDevice32bpp );
}
+TEST_F(LineTest, testBasicVerticalLines)
+{
+ implTestBasicVerticalLines( mpDevice1bpp );
+ implTestBasicVerticalLines( mpDevice32bpp );
+}
-// -----------------------------------------------------------------------------
+// test pixel rounding (should always tend towards start point of
+// the line)
+TEST_F(LineTest, testTieBreaking)
+{
+ implTestTieBreaking( mpDevice1bpp );
+ implTestTieBreaking( mpDevice32bpp );
+}
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-//NOADDITIONAL;
+}
diff --git a/basebmp/test/main.cxx b/basebmp/test/main.cxx
new file mode 100644
index 0000000..df14e5b
--- /dev/null
+++ b/basebmp/test/main.cxx
@@ -0,0 +1,28 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "gtest/gtest.h"
+
+int main(int argc, char **argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk
index 08bcb54..c951586 100644
--- a/basebmp/test/makefile.mk
+++ b/basebmp/test/makefile.mk
@@ -25,14 +25,13 @@ PRJ=..
PRJNAME=basebmp
TARGET=tests
-TARGETTYPE=GUI
ENABLE_EXCEPTIONS=TRUE
-.IF "$(WITH_CPPUNIT)" != "YES"
+.IF "$(ENABLE_UNIT_TESTS)" != "YES"
@all:
- @echo "cppunit disabled. nothing do do."
+ @echo "unit tests are disabled. Nothing do do."
.ELSE
@@ -63,34 +62,29 @@ CDEFS+=-xalias_level=compatible
.ENDIF
.ENDIF
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
# --- Common ----------------------------------------------------------
.IF "$(L10N_framework)"==""
# BEGIN ----------------------------------------------------------------
# auto generated Target:tests by codegen.pl
-SHL1OBJS= \
+APP1OBJS= \
$(SLO)$/basictest.obj \
$(SLO)$/bmpmasktest.obj \
$(SLO)$/bmptest.obj \
$(SLO)$/cliptest.obj \
$(SLO)$/filltest.obj \
$(SLO)$/linetest.obj \
+ $(SLO)$/main.obj \
$(SLO)$/masktest.obj \
$(SLO)$/polytest.obj \
$(SLO)$/tools.obj
-SHL1TARGET= tests
-SHL1STDLIBS= $(BASEBMPLIB) \
- $(SALLIB) \
- $(CPPUNITLIB) \
+APP1TARGET= tests
+APP1STDLIBS= $(BASEBMPLIB) \
+ $(SALLIB) \
+ $(GTESTLIB) \
$(BASEGFXLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-
-DEF1NAME =$(SHL1TARGET)
-SHL1VERSIONMAP = export.map
-SHL1RPATH = NONE
+APP1RPATH = NONE
+APP1TEST = enabled
.ENDIF
# END ------------------------------------------------------------------
@@ -116,15 +110,12 @@ SHL1RPATH = NONE
#------------------------------- All object files -------------------------------
# do this here, so we get right dependencies
-SLOFILES=$(SHL1OBJS)
+SLOFILES=$(APP1OBJS)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
# --- Enable test execution in normal build ------------------------
-.IF "$(L10N_framework)"==""
-.INCLUDE : _cppunit.mk
-.ENDIF
-.ENDIF # "$(WITH_CPPUNIT)" != "YES"
+.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"
diff --git a/basebmp/test/masktest.cxx b/basebmp/test/masktest.cxx
index 9002885..94a85b1 100644
--- a/basebmp/test/masktest.cxx
+++ b/basebmp/test/masktest.cxx
@@ -24,9 +24,7 @@
// autogenerated file with codegen.pl
#include "preextstl.h"
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
+#include "gtest/gtest.h"
#include "postextstl.h"
#include <basegfx/vector/b2isize.hxx>
@@ -57,9 +55,9 @@ namespace
debugDump( rBmp, output2 );
*/
-class MaskTest : public CppUnit::TestFixture
+class MaskTest : public ::testing::Test
{
-private:
+protected:
BitmapDeviceSharedPtr mpDevice1bpp;
BitmapDeviceSharedPtr mpDevice32bpp;
BitmapDeviceSharedPtr mpMask;
@@ -86,8 +84,7 @@ private:
rBmp,
aSourceRect,
aDestLeftTop );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 50",
- countPixel( rDevice, aCol ) == 100-50);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 100-50) << "number of rendered pixel is not 50";
rDevice->clear(aCol);
rDevice->drawMaskedColor(
@@ -95,8 +92,7 @@ private:
rBmp,
aSourceRect,
aDestRightTop );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 25",
- countPixel( rDevice, aCol ) == 100-25);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 100-25) << "number of rendered pixel is not 25";
rDevice->clear(aCol);
rDevice->drawMaskedColor(
@@ -104,8 +100,7 @@ private:
rBmp,
aSourceRect,
aDestLeftBottom );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 25(b)",
- countPixel( rDevice, aCol ) == 100-25);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 100-25) << "number of rendered pixel is not 25(b)";
rDevice->clear(aCol);
rDevice->drawMaskedColor(
@@ -113,12 +108,11 @@ private:
rBmp,
aSourceRect,
aDestRightBottom );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 25(c)",
- countPixel( rDevice, aCol ) == 100-25);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 100-25) << "number of rendered pixel is not 25(c)";
}
public:
- void setUp()
+ virtual void SetUp()
{
const basegfx::B2ISize aSize(10,10);
mpDevice1bpp = createBitmapDevice( aSize,
@@ -136,42 +130,24 @@ public:
"m 0 0h5v10h5v-5h-10z" );
basegfx::B2DPolyPolygon aPoly;
- basegfx::tools::importFromSvgD( aPoly, aSvg );
+ basegfx::tools::importFromSvgD( aPoly, aSvg, false, NULL );
const Color aCol(0xFF);
mpMask->fillPolyPolygon(
aPoly,
aCol,
DrawMode_PAINT );
}
-
- void testMaskBasics()
- {
- implTestMaskBasics( mpDevice32bpp, mpMask );
- implTestMaskBasics( mpDevice1bpp, mpMask );
- }
-
- void testMaskClip()
- {
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(MaskTest);
- CPPUNIT_TEST(testMaskBasics);
- CPPUNIT_TEST(testMaskClip);
- CPPUNIT_TEST_SUITE_END();
};
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(MaskTest);
+TEST_F(MaskTest, testMaskBasics)
+{
+ implTestMaskBasics( mpDevice32bpp, mpMask );
+ implTestMaskBasics( mpDevice1bpp, mpMask );
}
+TEST_F(MaskTest, testMaskClip)
+{
+}
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-//NOADDITIONAL;
+}
diff --git a/basebmp/test/polytest.cxx b/basebmp/test/polytest.cxx
index eef61ee..2080bad 100644
--- a/basebmp/test/polytest.cxx
+++ b/basebmp/test/polytest.cxx
@@ -24,9 +24,7 @@
// autogenerated file with codegen.pl
#include "preextstl.h"
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
+#include "gtest/gtest.h"
#include "postextstl.h"
#include <basegfx/vector/b2isize.hxx>
@@ -56,9 +54,9 @@ namespace
debugDump( rDevice, output );
*/
-class PolyTest : public CppUnit::TestFixture
+class PolyTest : public ::testing::Test
{
-private:
+protected:
BitmapDeviceSharedPtr mpDevice1bpp;
BitmapDeviceSharedPtr mpDevice32bpp;
@@ -73,13 +71,13 @@ private:
basegfx::tools::importFromSvgD(
aPoly,
rtl::OUString::createFromAscii(
- "M2 2 l7 7 z" ) );
+ "M2 2 l7 7 z" ),
+ false, NULL);
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 0",
- countPixel( rDevice, aCol ) == 0);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 0) << "number of rendered pixel is not 0";
// --------------------------------------------------
@@ -88,13 +86,13 @@ private:
basegfx::tools::importFromSvgD(
aPoly,
rtl::OUString::createFromAscii(
- "M7 2 l-6 6 z" ) );
+ "M7 2 l-6 6 z" ),
+ false, NULL);
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 0(b)",
- countPixel( rDevice, aCol ) == 0);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 0) << "number of rendered pixel is not 0(b)";
}
void implTestHairline(const BitmapDeviceSharedPtr& rDevice)
@@ -108,13 +106,13 @@ private:
basegfx::tools::importFromSvgD(
aPoly,
rtl::OUString::createFromAscii(
- "M2 2 h1 l7 7 h-1 z" ) );
+ "M2 2 h1 l7 7 h-1 z" ),
+ false, NULL);
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 7",
- countPixel( rDevice, aCol ) == 7);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 7) << "number of rendered pixel is not 7";
// --------------------------------------------------
@@ -123,13 +121,13 @@ private:
basegfx::tools::importFromSvgD(
aPoly,
rtl::OUString::createFromAscii(
- "M7 2 h-1 l-6 6 h1 z" ) );
+ "M7 2 h-1 l-6 6 h1 z" ),
+ false, NULL);
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 6",
- countPixel( rDevice, aCol ) == 6);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 6) << "number of rendered pixel is not 6";
// --------------------------------------------------
@@ -138,13 +136,13 @@ private:
basegfx::tools::importFromSvgD(
aPoly,
rtl::OUString::createFromAscii(
- "M0 0 l7 7 h-1 l-5-7 z" ) );
+ "M0 0 l7 7 h-1 l-5-7 z" ),
+ false, NULL);
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 3",
- countPixel( rDevice, aCol ) == 3);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 3) << "number of rendered pixel is not 3";
}
void implTestPolyPoly(const BitmapDeviceSharedPtr& rDevice)
@@ -157,14 +155,14 @@ private:
basegfx::tools::importFromSvgD( aPoly,
::rtl::OUString::createFromAscii(
- "M0 0 h7 v7 h-7 z M2 2 v3 h3 v-3 z" ) );
+ "M0 0 h7 v7 h-7 z M2 2 v3 h3 v-3 z" ),
+ false, NULL );
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 40",
- countPixel( rDevice, aCol ) == 40);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 40) << "number of rendered pixel is not 40";
}
void implTestPolyPolyClip(const BitmapDeviceSharedPtr& rDevice)
@@ -177,7 +175,8 @@ private:
basegfx::tools::importFromSvgD( aPoly,
::rtl::OUString::createFromAscii(
- "M0 0 h7 v7 h-7 z M2 2 v3 h3 v-3 z" ) );
+ "M0 0 h7 v7 h-7 z M2 2 v3 h3 v-3 z" ),
+ false, NULL );
basegfx::B2DHomMatrix aMat;
aMat.translate(-3,-3);
aMat.rotate( 1.7 );
@@ -189,8 +188,7 @@ private:
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 39",
- countPixel( rDevice, aCol ) == 39);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 39) << "number of rendered pixel is not 39";
BitmapDeviceSharedPtr pClippedDevice(
subsetBitmapDevice( rDevice,
@@ -201,8 +199,7 @@ private:
aPoly,
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 7",
- countPixel( rDevice, aCol ) == 7);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 7) << "number of rendered pixel is not 7";
}
void implTestPolyPolyCrissCross(const BitmapDeviceSharedPtr& rDevice)
@@ -219,18 +216,18 @@ private:
"M10 6 v-2 l-10 2 v2 z"
"M1 0 h1 v10 h-1 z"
"M4 0 h1 v10 h-1 z"
- "M8 0 h1 v10 h-1 z" ) );
+ "M8 0 h1 v10 h-1 z" ),
+ false, NULL );
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode_PAINT );
- CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 46",
- countPixel( rDevice, aCol ) == 46);
+ ASSERT_TRUE(countPixel( rDevice, aCol ) == 46) << "number of rendered pixel is not 46";
}
public:
- void setUp()
+ virtual void SetUp()
{
const basegfx::B2ISize aSize(10,10);
mpDevice1bpp = createBitmapDevice( aSize,
@@ -240,58 +237,38 @@ public:
true,
Format::THIRTYTWO_BIT_TC_MASK );
}
+};
- void testEmpty()
- {
- implTestEmpty( mpDevice1bpp );
- implTestEmpty( mpDevice32bpp );
- }
-
- void testHairline()
- {
- implTestHairline( mpDevice1bpp );
- implTestHairline( mpDevice32bpp );
- }
-
- void testPolyPoly()
- {
- implTestPolyPoly( mpDevice1bpp );
- implTestPolyPoly( mpDevice32bpp );
- }
-
- void testPolyPolyClip()
- {
- implTestPolyPolyClip(mpDevice1bpp);
- implTestPolyPolyClip(mpDevice32bpp);
- }
- void testPolyPolyCrissCross()
- {
- implTestPolyPolyCrissCross(mpDevice1bpp);
- implTestPolyPolyCrissCross(mpDevice32bpp);
- }
+TEST_F(PolyTest, testEmpty)
+{
+ implTestEmpty( mpDevice1bpp );
+ implTestEmpty( mpDevice32bpp );
+}
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(PolyTest);
- CPPUNIT_TEST(testEmpty);
- CPPUNIT_TEST(testHairline);
- CPPUNIT_TEST(testPolyPoly);
- CPPUNIT_TEST(testPolyPolyClip);
- CPPUNIT_TEST(testPolyPolyCrissCross);
- CPPUNIT_TEST_SUITE_END();
-};
+TEST_F(PolyTest, testHairline)
+{
+ implTestHairline( mpDevice1bpp );
+ implTestHairline( mpDevice32bpp );
+}
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(PolyTest);
+TEST_F(PolyTest, testPolyPoly)
+{
+ implTestPolyPoly( mpDevice1bpp );
+ implTestPolyPoly( mpDevice32bpp );
}
+TEST_F(PolyTest, testPolyPolyClip)
+{
+ implTestPolyPolyClip(mpDevice1bpp);
+ implTestPolyPolyClip(mpDevice32bpp);
+}
-// -----------------------------------------------------------------------------
+TEST_F(PolyTest, testPolyPolyCrissCross)
+{
+ implTestPolyPolyCrissCross(mpDevice1bpp);
+ implTestPolyPolyCrissCross(mpDevice32bpp);
+}
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-//NOADDITIONAL;
+}
More information about the Libreoffice-commits
mailing list