diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-03-20 21:42:07 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-03-21 09:07:02 +0100 |
commit | ba83043d679b11740323708e0c9da8b1e4cae488 (patch) | |
tree | ff96243de5dfc110754da8d20ac8096fa294c1ee /svx | |
parent | 5bcad163b67e1d83ab44ac31ae29d3f5c4bb3eb9 (diff) |
CppunitTest_svx_unit: use CPPUNIT_TEST_FIXTURE()
Change-Id: Ib2eac7368ebb06702f05101641e8830ea1fff6d5
Reviewed-on: https://gerrit.libreoffice.org/69483
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/qa/unit/XTableImportExportTest.cxx | 11 | ||||
-rw-r--r-- | svx/qa/unit/customshapes.cxx | 41 | ||||
-rw-r--r-- | svx/qa/unit/unodraw.cxx | 11 | ||||
-rw-r--r-- | svx/qa/unit/xoutdev.cxx | 11 |
4 files changed, 15 insertions, 59 deletions
diff --git a/svx/qa/unit/XTableImportExportTest.cxx b/svx/qa/unit/XTableImportExportTest.cxx index 564920f801d3..cc86393577e3 100644 --- a/svx/qa/unit/XTableImportExportTest.cxx +++ b/svx/qa/unit/XTableImportExportTest.cxx @@ -12,6 +12,7 @@ #include <cppunit/TestAssert.h> #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> +#include <unotest/bootstrapfixturebase.hxx> #include <sal/types.h> #include <sfx2/app.hxx> @@ -30,20 +31,14 @@ using namespace css; class XTableImportExportTest : public CppUnit::TestFixture { public: - void testImportExport(); - virtual void setUp() override { CppUnit::TestFixture::setUp(); 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); aTempFile.EnableKillingFile(); @@ -87,6 +82,4 @@ void XTableImportExportTest::testImportExport() } } -CPPUNIT_TEST_SUITE_REGISTRATION(XTableImportExportTest); - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index 23d3fb676770..33384f56c83b 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -34,9 +34,8 @@ const OUString sDataDirectory("svx/qa/unit/data/"); /// Tests for svx/source/customshapes/ code. class CustomshapesTest : public test::BootstrapFixture, public unotest::MacrosTest { +protected: uno::Reference<lang::XComponent> mxComponent; - -private: // get shape nShapeIndex from page 0 uno::Reference<drawing::XShape> getShape(sal_uInt8 nShapeIndex); @@ -55,26 +54,6 @@ public: } 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) @@ -90,7 +69,7 @@ uno::Reference<drawing::XShape> CustomshapesTest::getShape(sal_uInt8 nShapeIndex return xShape; } -void CustomshapesTest::testViewBoxLeftTop() +CPPUNIT_TEST_FIXTURE(CustomshapesTest, testViewBoxLeftTop) { // tdf#121890 formula values "left" and "top" are wrongly calculated // Load a document with two custom shapes of type "non-primitive" @@ -123,7 +102,7 @@ void CustomshapesTest::testViewBoxLeftTop() 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 // The loaded document has a quarter circle with radius 10000 (unit 1/100 mm) @@ -145,7 +124,7 @@ void CustomshapesTest::testAccuracyCommandX() 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 // The loaded document has a shape with command X and two parameter placed on a diagonal. @@ -168,7 +147,7 @@ void CustomshapesTest::testToggleCommandXY() 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 // Load a document with path "M 0 0 5 10 10 0 N" @@ -187,7 +166,7 @@ void CustomshapesTest::testMultipleMoveTo() 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 // 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() 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 // Load a document which was converted from VML to doc by Word. It had a VML @@ -231,7 +210,7 @@ void CustomshapesTest::testHalfEllipseVML() 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 // Load a document which was converted from VML to doc by Word. It had a VML @@ -250,7 +229,7 @@ void CustomshapesTest::testLargeSwingAngleVML() // Need some tolerance for line width 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 // 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() CPPUNIT_ASSERT_EQUAL_MESSAGE("count polygons", static_cast<sal_uInt32>(2), aPolyPolygon.count()); } - -CPPUNIT_TEST_SUITE_REGISTRATION(CustomshapesTest); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx index 263d3f8c3825..f3d28bda4bac 100644 --- a/svx/qa/unit/unodraw.cxx +++ b/svx/qa/unit/unodraw.cxx @@ -29,18 +29,13 @@ char const DATA_DIRECTORY[] = "/svx/qa/unit/data/"; /// Tests for svx/source/unodraw/ code. class UnodrawTest : public test::BootstrapFixture, public unotest::MacrosTest { +protected: uno::Reference<uno::XComponentContext> mxComponentContext; uno::Reference<lang::XComponent> mxComponent; public: - void testWriterGraphicExport(); - void setUp() override; void tearDown() override; - - CPPUNIT_TEST_SUITE(UnodrawTest); - CPPUNIT_TEST(testWriterGraphicExport); - CPPUNIT_TEST_SUITE_END(); }; void UnodrawTest::setUp() @@ -59,7 +54,7 @@ void UnodrawTest::tearDown() test::BootstrapFixture::tearDown(); } -void UnodrawTest::testWriterGraphicExport() +CPPUNIT_TEST_FIXTURE(UnodrawTest, testWriterGraphicExport) { // Load a document with a Writer picture in it. OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "unodraw-writer-image.odt"; @@ -82,8 +77,6 @@ void UnodrawTest::testWriterGraphicExport() { "MediaType", uno::Any(OUString("image/jpeg")) } })); CPPUNIT_ASSERT(xExportFilter->filter(aProperties)); } - -CPPUNIT_TEST_SUITE_REGISTRATION(UnodrawTest); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx index 90186df8e831..513661d669b6 100644 --- a/svx/qa/unit/xoutdev.cxx +++ b/svx/qa/unit/xoutdev.cxx @@ -12,6 +12,7 @@ #include <cppunit/TestAssert.h> #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> +#include <unotest/bootstrapfixturebase.hxx> #include <sal/types.h> #include <sfx2/app.hxx> @@ -25,20 +26,14 @@ class XOutdevTest : public CppUnit::TestFixture { public: - void testPdfGraphicExport(); - virtual void setUp() override { CppUnit::TestFixture::setUp(); 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 // Import the graphic. @@ -68,6 +63,4 @@ void XOutdevTest::testPdfGraphicExport() #endif } -CPPUNIT_TEST_SUITE_REGISTRATION(XOutdevTest); - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |