Kaydet (Commit) ba83043d authored tarafından Miklos Vajna's avatar Miklos Vajna

CppunitTest_svx_unit: use CPPUNIT_TEST_FIXTURE()

Change-Id: Ib2eac7368ebb06702f05101641e8830ea1fff6d5
Reviewed-on: https://gerrit.libreoffice.org/69483
Tested-by: Jenkins
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
üst 5bcad163
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <cppunit/TestAssert.h> #include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h> #include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/HelperMacros.h>
#include <unotest/bootstrapfixturebase.hxx>
#include <sal/types.h> #include <sal/types.h>
#include <sfx2/app.hxx> #include <sfx2/app.hxx>
...@@ -30,20 +31,14 @@ using namespace css; ...@@ -30,20 +31,14 @@ using namespace css;
class XTableImportExportTest : public CppUnit::TestFixture class XTableImportExportTest : public CppUnit::TestFixture
{ {
public: public:
void testImportExport();
virtual void setUp() override virtual void setUp() override
{ {
CppUnit::TestFixture::setUp(); CppUnit::TestFixture::setUp();
SfxApplication::GetOrCreate(); SfxApplication::GetOrCreate();
} }
CPPUNIT_TEST_SUITE(XTableImportExportTest);
CPPUNIT_TEST(testImportExport);
CPPUNIT_TEST_SUITE_END();
}; };
void XTableImportExportTest::testImportExport() CPPUNIT_TEST_FIXTURE(XTableImportExportTest, testImportExport)
{ {
utl::TempFile aTempFile(nullptr, true); utl::TempFile aTempFile(nullptr, true);
aTempFile.EnableKillingFile(); aTempFile.EnableKillingFile();
...@@ -87,6 +82,4 @@ void XTableImportExportTest::testImportExport() ...@@ -87,6 +82,4 @@ void XTableImportExportTest::testImportExport()
} }
} }
CPPUNIT_TEST_SUITE_REGISTRATION(XTableImportExportTest);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -34,9 +34,8 @@ const OUString sDataDirectory("svx/qa/unit/data/"); ...@@ -34,9 +34,8 @@ const OUString sDataDirectory("svx/qa/unit/data/");
/// Tests for svx/source/customshapes/ code. /// Tests for svx/source/customshapes/ code.
class CustomshapesTest : public test::BootstrapFixture, public unotest::MacrosTest class CustomshapesTest : public test::BootstrapFixture, public unotest::MacrosTest
{ {
protected:
uno::Reference<lang::XComponent> mxComponent; uno::Reference<lang::XComponent> mxComponent;
private:
// get shape nShapeIndex from page 0 // get shape nShapeIndex from page 0
uno::Reference<drawing::XShape> getShape(sal_uInt8 nShapeIndex); uno::Reference<drawing::XShape> getShape(sal_uInt8 nShapeIndex);
...@@ -55,26 +54,6 @@ public: ...@@ -55,26 +54,6 @@ public:
} }
test::BootstrapFixture::tearDown(); test::BootstrapFixture::tearDown();
} }
void testViewBoxLeftTop();
void testAccuracyCommandX();
void testToggleCommandXY();
void testMultipleMoveTo();
void testWidthOrientationCommandU();
void testHalfEllipseVML();
void testLargeSwingAngleVML();
void testTdf121845_two_commands_U();
CPPUNIT_TEST_SUITE(CustomshapesTest);
CPPUNIT_TEST(testViewBoxLeftTop);
CPPUNIT_TEST(testAccuracyCommandX);
CPPUNIT_TEST(testToggleCommandXY);
CPPUNIT_TEST(testMultipleMoveTo);
CPPUNIT_TEST(testWidthOrientationCommandU);
CPPUNIT_TEST(testHalfEllipseVML);
CPPUNIT_TEST(testLargeSwingAngleVML);
CPPUNIT_TEST(testTdf121845_two_commands_U);
CPPUNIT_TEST_SUITE_END();
}; };
uno::Reference<drawing::XShape> CustomshapesTest::getShape(sal_uInt8 nShapeIndex) uno::Reference<drawing::XShape> CustomshapesTest::getShape(sal_uInt8 nShapeIndex)
...@@ -90,7 +69,7 @@ uno::Reference<drawing::XShape> CustomshapesTest::getShape(sal_uInt8 nShapeIndex ...@@ -90,7 +69,7 @@ uno::Reference<drawing::XShape> CustomshapesTest::getShape(sal_uInt8 nShapeIndex
return xShape; return xShape;
} }
void CustomshapesTest::testViewBoxLeftTop() CPPUNIT_TEST_FIXTURE(CustomshapesTest, testViewBoxLeftTop)
{ {
// tdf#121890 formula values "left" and "top" are wrongly calculated // tdf#121890 formula values "left" and "top" are wrongly calculated
// Load a document with two custom shapes of type "non-primitive" // Load a document with two custom shapes of type "non-primitive"
...@@ -123,7 +102,7 @@ void CustomshapesTest::testViewBoxLeftTop() ...@@ -123,7 +102,7 @@ void CustomshapesTest::testViewBoxLeftTop()
CPPUNIT_ASSERT_LESS(static_cast<long>(3), labs(aFrameRectTB.Y - aBoundRectTB.Y)); CPPUNIT_ASSERT_LESS(static_cast<long>(3), labs(aFrameRectTB.Y - aBoundRectTB.Y));
} }
void CustomshapesTest::testAccuracyCommandX() CPPUNIT_TEST_FIXTURE(CustomshapesTest, testAccuracyCommandX)
{ {
// 121761 Increase accuracy of quarter circles drawn by command X or Y // 121761 Increase accuracy of quarter circles drawn by command X or Y
// The loaded document has a quarter circle with radius 10000 (unit 1/100 mm) // The loaded document has a quarter circle with radius 10000 (unit 1/100 mm)
...@@ -145,7 +124,7 @@ void CustomshapesTest::testAccuracyCommandX() ...@@ -145,7 +124,7 @@ void CustomshapesTest::testAccuracyCommandX()
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("segment height out of tolerance", 2942.0, fHeight, 8.0); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("segment height out of tolerance", 2942.0, fHeight, 8.0);
} }
void CustomshapesTest::testToggleCommandXY() CPPUNIT_TEST_FIXTURE(CustomshapesTest, testToggleCommandXY)
{ {
// 121952 Toggle x- and y-direction if command X has several parameters // 121952 Toggle x- and y-direction if command X has several parameters
// The loaded document has a shape with command X and two parameter placed on a diagonal. // The loaded document has a shape with command X and two parameter placed on a diagonal.
...@@ -168,7 +147,7 @@ void CustomshapesTest::testToggleCommandXY() ...@@ -168,7 +147,7 @@ void CustomshapesTest::testToggleCommandXY()
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("segment height out of tolerance", 5871.0, fHeight, 16.0); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("segment height out of tolerance", 5871.0, fHeight, 16.0);
} }
void CustomshapesTest::testMultipleMoveTo() CPPUNIT_TEST_FIXTURE(CustomshapesTest, testMultipleMoveTo)
{ {
// tdf122964 Multiple moveTo has to be treated as lineTo in draw:enhanced-path // tdf122964 Multiple moveTo has to be treated as lineTo in draw:enhanced-path
// Load a document with path "M 0 0 5 10 10 0 N" // Load a document with path "M 0 0 5 10 10 0 N"
...@@ -187,7 +166,7 @@ void CustomshapesTest::testMultipleMoveTo() ...@@ -187,7 +166,7 @@ void CustomshapesTest::testMultipleMoveTo()
CPPUNIT_ASSERT_MESSAGE("Path is empty", !bIsZero); CPPUNIT_ASSERT_MESSAGE("Path is empty", !bIsZero);
} }
void CustomshapesTest::testWidthOrientationCommandU() CPPUNIT_TEST_FIXTURE(CustomshapesTest, testWidthOrientationCommandU)
{ {
// tdf121845 custom shape with command U (angleellipse) is wrongly drawn // tdf121845 custom shape with command U (angleellipse) is wrongly drawn
// Load a document with path "M 750 0 L 750 500 250 500 250 0 U 500 0 500 500 0 180 N" // Load a document with path "M 750 0 L 750 500 250 500 250 0 U 500 0 500 500 0 180 N"
...@@ -211,7 +190,7 @@ void CustomshapesTest::testWidthOrientationCommandU() ...@@ -211,7 +190,7 @@ void CustomshapesTest::testWidthOrientationCommandU()
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("wrong orientation", 5000.0, fHeight, 40.0); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("wrong orientation", 5000.0, fHeight, 40.0);
} }
void CustomshapesTest::testHalfEllipseVML() CPPUNIT_TEST_FIXTURE(CustomshapesTest, testHalfEllipseVML)
{ {
// tdf121845 custom shape with command U (angleellipse) is wrongly drawn // tdf121845 custom shape with command U (angleellipse) is wrongly drawn
// Load a document which was converted from VML to doc by Word. It had a VML // Load a document which was converted from VML to doc by Word. It had a VML
...@@ -231,7 +210,7 @@ void CustomshapesTest::testHalfEllipseVML() ...@@ -231,7 +210,7 @@ void CustomshapesTest::testHalfEllipseVML()
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("not a half circle", 0.0, fDiff2HmW, 40.0); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("not a half circle", 0.0, fDiff2HmW, 40.0);
} }
void CustomshapesTest::testLargeSwingAngleVML() CPPUNIT_TEST_FIXTURE(CustomshapesTest, testLargeSwingAngleVML)
{ {
// tdf121845 custom shape with command U (angleellipse) is wrongly drawn // tdf121845 custom shape with command U (angleellipse) is wrongly drawn
// Load a document which was converted from VML to doc by Word. It had a VML // Load a document which was converted from VML to doc by Word. It had a VML
...@@ -250,7 +229,7 @@ void CustomshapesTest::testLargeSwingAngleVML() ...@@ -250,7 +229,7 @@ void CustomshapesTest::testLargeSwingAngleVML()
// Need some tolerance for line width // Need some tolerance for line width
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Full circle plus segment expected", 0.0, fDiffWmH, 10.0); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Full circle plus segment expected", 0.0, fDiffWmH, 10.0);
} }
void CustomshapesTest::testTdf121845_two_commands_U() CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf121845_two_commands_U)
{ {
// tdf121845 custom shape with command U (angleellipse) is wrongly drawn // tdf121845 custom shape with command U (angleellipse) is wrongly drawn
// Load a document with path "U 950 250 200 200 90 180 250 250 200 200 180 270 N" // Load a document with path "U 950 250 200 200 90 180 250 250 200 200 180 270 N"
...@@ -271,8 +250,6 @@ void CustomshapesTest::testTdf121845_two_commands_U() ...@@ -271,8 +250,6 @@ void CustomshapesTest::testTdf121845_two_commands_U()
CPPUNIT_ASSERT_EQUAL_MESSAGE("count polygons", static_cast<sal_uInt32>(2), CPPUNIT_ASSERT_EQUAL_MESSAGE("count polygons", static_cast<sal_uInt32>(2),
aPolyPolygon.count()); aPolyPolygon.count());
} }
CPPUNIT_TEST_SUITE_REGISTRATION(CustomshapesTest);
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -29,18 +29,13 @@ char const DATA_DIRECTORY[] = "/svx/qa/unit/data/"; ...@@ -29,18 +29,13 @@ char const DATA_DIRECTORY[] = "/svx/qa/unit/data/";
/// Tests for svx/source/unodraw/ code. /// Tests for svx/source/unodraw/ code.
class UnodrawTest : public test::BootstrapFixture, public unotest::MacrosTest class UnodrawTest : public test::BootstrapFixture, public unotest::MacrosTest
{ {
protected:
uno::Reference<uno::XComponentContext> mxComponentContext; uno::Reference<uno::XComponentContext> mxComponentContext;
uno::Reference<lang::XComponent> mxComponent; uno::Reference<lang::XComponent> mxComponent;
public: public:
void testWriterGraphicExport();
void setUp() override; void setUp() override;
void tearDown() override; void tearDown() override;
CPPUNIT_TEST_SUITE(UnodrawTest);
CPPUNIT_TEST(testWriterGraphicExport);
CPPUNIT_TEST_SUITE_END();
}; };
void UnodrawTest::setUp() void UnodrawTest::setUp()
...@@ -59,7 +54,7 @@ void UnodrawTest::tearDown() ...@@ -59,7 +54,7 @@ void UnodrawTest::tearDown()
test::BootstrapFixture::tearDown(); test::BootstrapFixture::tearDown();
} }
void UnodrawTest::testWriterGraphicExport() CPPUNIT_TEST_FIXTURE(UnodrawTest, testWriterGraphicExport)
{ {
// Load a document with a Writer picture in it. // Load a document with a Writer picture in it.
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "unodraw-writer-image.odt"; OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "unodraw-writer-image.odt";
...@@ -82,8 +77,6 @@ void UnodrawTest::testWriterGraphicExport() ...@@ -82,8 +77,6 @@ void UnodrawTest::testWriterGraphicExport()
{ "MediaType", uno::Any(OUString("image/jpeg")) } })); { "MediaType", uno::Any(OUString("image/jpeg")) } }));
CPPUNIT_ASSERT(xExportFilter->filter(aProperties)); CPPUNIT_ASSERT(xExportFilter->filter(aProperties));
} }
CPPUNIT_TEST_SUITE_REGISTRATION(UnodrawTest);
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <cppunit/TestAssert.h> #include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h> #include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/HelperMacros.h>
#include <unotest/bootstrapfixturebase.hxx>
#include <sal/types.h> #include <sal/types.h>
#include <sfx2/app.hxx> #include <sfx2/app.hxx>
...@@ -25,20 +26,14 @@ ...@@ -25,20 +26,14 @@
class XOutdevTest : public CppUnit::TestFixture class XOutdevTest : public CppUnit::TestFixture
{ {
public: public:
void testPdfGraphicExport();
virtual void setUp() override virtual void setUp() override
{ {
CppUnit::TestFixture::setUp(); CppUnit::TestFixture::setUp();
SfxApplication::GetOrCreate(); SfxApplication::GetOrCreate();
} }
CPPUNIT_TEST_SUITE(XOutdevTest);
CPPUNIT_TEST(testPdfGraphicExport);
CPPUNIT_TEST_SUITE_END();
}; };
void XOutdevTest::testPdfGraphicExport() CPPUNIT_TEST_FIXTURE(XOutdevTest, testPdfGraphicExport)
{ {
#if HAVE_FEATURE_PDFIUM #if HAVE_FEATURE_PDFIUM
// Import the graphic. // Import the graphic.
...@@ -68,6 +63,4 @@ void XOutdevTest::testPdfGraphicExport() ...@@ -68,6 +63,4 @@ void XOutdevTest::testPdfGraphicExport()
#endif #endif
} }
CPPUNIT_TEST_SUITE_REGISTRATION(XOutdevTest);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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