diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-10-18 11:11:11 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-10-18 12:40:16 +0200 |
commit | 36bffa3cb5d30a6f58253c627ba23d1cde6864c8 (patch) | |
tree | 9208f0d2036b70785c73260db58f74775b359947 /sc/qa | |
parent | d4512d391bc7f96af9b66a8ee44f3f2be38dc5ec (diff) |
sc: Add new wrapper for these tests
Change-Id: Idfa3dc085a944fb8ffe5819b08ba9a264d58900b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141490
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/datatransformation_test.cxx | 34 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.cxx | 24 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.hxx | 11 | ||||
-rw-r--r-- | sc/qa/unit/parallelism.cxx | 27 | ||||
-rw-r--r-- | sc/qa/unit/range.cxx | 37 | ||||
-rw-r--r-- | sc/qa/unit/rangelst_test.cxx | 37 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 46 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_condformat.cxx | 40 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_copypaste.cxx | 37 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 41 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_pivottable.cxx | 40 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_sharedformula.cxx | 42 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_sort.cxx | 41 |
13 files changed, 58 insertions, 399 deletions
diff --git a/sc/qa/unit/datatransformation_test.cxx b/sc/qa/unit/datatransformation_test.cxx index 9e9f66e4655a..7f33aa21548a 100644 --- a/sc/qa/unit/datatransformation_test.cxx +++ b/sc/qa/unit/datatransformation_test.cxx @@ -12,18 +12,14 @@ #include "helper/qahelper.hxx" #include <document.hxx> #include <datatransformation.hxx> -#include <scdll.hxx> #include <svl/numformat.hxx> #include <tools/time.hxx> -class ScDataTransformationTest : public test::BootstrapFixture +class ScDataTransformationTest : public ScSimpleBootstrapFixture { public: - ScDataTransformationTest(); - virtual void setUp() override; - virtual void tearDown() override; void testColumnRemove(); void testColumnSplit(); @@ -112,10 +108,6 @@ public: CPPUNIT_TEST(testGetMinute); CPPUNIT_TEST(testGetSecond); CPPUNIT_TEST_SUITE_END(); - -private: - ScDocShellRef m_xDocShell; - ScDocument *m_pDoc; }; void ScDataTransformationTest::testColumnRemove() @@ -1000,34 +992,12 @@ void ScDataTransformationTest::testGetSecond() CPPUNIT_ASSERT_DOUBLES_EQUAL(49, m_pDoc->GetValue(2, 3, 0), 0); } -ScDataTransformationTest::ScDataTransformationTest() : - m_pDoc(nullptr) -{ -} - void ScDataTransformationTest::setUp() { - BootstrapFixture::setUp(); - - ScDLL::Init(); - m_xDocShell = new ScDocShell( - SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); - - m_xDocShell->SetIsInUcalc(); - m_xDocShell->DoInitUnitTest(); - m_pDoc = &m_xDocShell->GetDocument(); + ScSimpleBootstrapFixture::setUp(); m_pDoc->InsertTab(0, "Tab"); } -void ScDataTransformationTest::tearDown() -{ - m_xDocShell->DoClose(); - m_xDocShell.clear(); - BootstrapFixture::tearDown(); -} - CPPUNIT_TEST_SUITE_REGISTRATION(ScDataTransformationTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index a6249972e801..6b520bcd2774 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -40,6 +40,7 @@ #include <sfx2/frame.hxx> #include <undoblk.hxx> #include <unotools/tempfile.hxx> +#include <scdll.hxx> #include <scitems.hxx> #include <stringutil.hxx> #include <tokenarray.hxx> @@ -928,6 +929,29 @@ void ScBootstrapFixture::tearDown() test::BootstrapFixture::tearDown(); } +void ScSimpleBootstrapFixture::setUp() +{ + BootstrapFixture::setUp(); + + ScDLL::Init(); + + m_xDocShell + = new ScDocShell(SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS + | SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); + m_xDocShell->SetIsInUcalc(); + m_xDocShell->DoInitUnitTest(); + + m_pDoc = &m_xDocShell->GetDocument(); +} + +void ScSimpleBootstrapFixture::tearDown() +{ + m_xDocShell->DoClose(); + m_xDocShell.clear(); + + test::BootstrapFixture::tearDown(); +} + std::string to_std_string(const OUString& rStr) { return std::string(rStr.toUtf8().getStr()); diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 78a3fa1eddda..caa449c6a6a9 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -236,6 +236,17 @@ public: virtual void tearDown() override; }; +class SCQAHELPER_DLLPUBLIC ScSimpleBootstrapFixture : public test::BootstrapFixture +{ +public: + virtual void setUp() override; + virtual void tearDown() override; + +protected: + ScDocShellRef m_xDocShell; + ScDocument* m_pDoc; +}; + #define ASSERT_DOUBLES_EQUAL( expected, result ) \ CPPUNIT_ASSERT_DOUBLES_EQUAL( (expected), (result), 1e-14 ) diff --git a/sc/qa/unit/parallelism.cxx b/sc/qa/unit/parallelism.cxx index eb084b95e516..eea2afa4b70a 100644 --- a/sc/qa/unit/parallelism.cxx +++ b/sc/qa/unit/parallelism.cxx @@ -3,7 +3,6 @@ #include <sal/config.h> #include <test/bootstrapfixture.hxx> -#include <scdll.hxx> #include <sfx2/sfxmodelfactory.hxx> #include "helper/qahelper.hxx" @@ -22,11 +21,9 @@ using namespace css; using namespace css::uno; -class ScParallelismTest : public test::BootstrapFixture +class ScParallelismTest : public ScSimpleBootstrapFixture { public: - ScParallelismTest(); - virtual void setUp() override; virtual void tearDown() override; @@ -78,16 +75,9 @@ private: static ScUndoCut* cutToClip(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* pClipDoc, bool bCreateUndo); static void pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc); - ScDocument *m_pDoc; - - ScDocShellRef m_xDocShell; bool m_bThreadingFlagCfg; }; -ScParallelismTest::ScParallelismTest() -{ -} - bool ScParallelismTest::getThreadingFlag() const { return officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::get(); @@ -143,15 +133,7 @@ void ScParallelismTest::pasteFromClip(ScDocument* pDestDoc, const ScRange& rDest void ScParallelismTest::setUp() { - test::BootstrapFixture::setUp(); - - ScDLL::Init(); - - m_xDocShell = new ScDocShell( - SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); - m_pDoc = &m_xDocShell->GetDocument(); + ScSimpleBootstrapFixture::setUp(); sc::FormulaGroupInterpreter::disableOpenCL_UnitTestsOnly(); @@ -166,10 +148,7 @@ void ScParallelismTest::tearDown() if (!m_bThreadingFlagCfg) setThreadingFlag(false); - m_xDocShell->DoClose(); - m_xDocShell.clear(); - - test::BootstrapFixture::tearDown(); + ScSimpleBootstrapFixture::tearDown(); } void ScParallelismTest::testSUMIFS() diff --git a/sc/qa/unit/range.cxx b/sc/qa/unit/range.cxx index 18e6e0768e49..30f8a1f8cc3c 100644 --- a/sc/qa/unit/range.cxx +++ b/sc/qa/unit/range.cxx @@ -8,7 +8,7 @@ */ #include <sal/config.h> -#include <test/bootstrapfixture.hxx> +#include "helper/qahelper.hxx" #include <unotools/configmgr.hxx> #include <document.hxx> #include <docsh.hxx> @@ -19,12 +19,9 @@ #include <rangeutl.hxx> #include <refupdatecontext.hxx> -class ScRangeTest : public test::BootstrapFixture +class ScRangeTest : public ScSimpleBootstrapFixture { public: - virtual void setUp() override; - virtual void tearDown() override; - CPPUNIT_TEST_SUITE(ScRangeTest); CPPUNIT_TEST(testOverlap); CPPUNIT_TEST(testRangeParsing); @@ -36,9 +33,6 @@ public: void testRangeParsing(); void testAddressParsing(); void testTdf147451(); - -private: - ScDocShellRef m_xDocShRef; }; void ScRangeTest::testOverlap() @@ -63,46 +57,25 @@ void ScRangeTest::testOverlap() void ScRangeTest::testRangeParsing() { ScRange aRange; - ScDocument& rDoc = m_xDocShRef->GetDocument(); - ScRefFlags nRes = aRange.Parse(":1", rDoc, formula::FormulaGrammar::CONV_OOO); + ScRefFlags nRes = aRange.Parse(":1", *m_pDoc, formula::FormulaGrammar::CONV_OOO); CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); } void ScRangeTest::testAddressParsing() { ScAddress aAddr; - ScDocument& rDoc = m_xDocShRef->GetDocument(); - ScRefFlags nRes = aAddr.Parse("1", rDoc, formula::FormulaGrammar::CONV_OOO); + ScRefFlags nRes = aAddr.Parse("1", *m_pDoc, formula::FormulaGrammar::CONV_OOO); CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); } void ScRangeTest::testTdf147451() { ScAddress aAddr; - ScDocument& rDoc = m_xDocShRef->GetDocument(); // "Sheet1" is technically a valid address like "XF1", but it should overflow. - ScRefFlags nRes = aAddr.Parse("Sheet1", rDoc, formula::FormulaGrammar::CONV_OOO); + ScRefFlags nRes = aAddr.Parse("Sheet1", *m_pDoc, formula::FormulaGrammar::CONV_OOO); CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); } -void ScRangeTest::setUp() -{ - BootstrapFixture::setUp(); - - ScDLL::Init(); - m_xDocShRef = new ScDocShell( - SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); -} - -void ScRangeTest::tearDown() -{ - m_xDocShRef->DoClose(); - m_xDocShRef.clear(); - BootstrapFixture::tearDown(); -} - class ScRangeUpdaterTest : public CppUnit::TestFixture { public: diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx index 040c8835aac1..48d95dddfcbc 100644 --- a/sc/qa/unit/rangelst_test.cxx +++ b/sc/qa/unit/rangelst_test.cxx @@ -8,23 +8,14 @@ */ #include <sal/config.h> -#include <test/bootstrapfixture.hxx> +#include "helper/qahelper.hxx" #include <docsh.hxx> -#include <scdll.hxx> #include <rangelst.hxx> -class Test : public test::BootstrapFixture +class Test : public ScSimpleBootstrapFixture { public: - Test() - : m_pDoc(nullptr) - { - } - - virtual void setUp() override; - virtual void tearDown() override; - void testDeleteArea_4Ranges(); void testDeleteArea_3Ranges(); void testDeleteArea_3Ranges_Case2(); @@ -84,32 +75,8 @@ public: CPPUNIT_TEST(testInsertRow); CPPUNIT_TEST(testInsertCol); CPPUNIT_TEST_SUITE_END(); - -private: - ScDocument *m_pDoc; - ScDocShellRef m_xDocShRef; }; -void Test::setUp() -{ - BootstrapFixture::setUp(); - - ScDLL::Init(); - m_xDocShRef = new ScDocShell( - SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); - - m_pDoc = &m_xDocShRef->GetDocument(); -} - -void Test::tearDown() -{ - m_xDocShRef->DoClose(); - m_xDocShRef.clear(); - BootstrapFixture::tearDown(); -} - void Test::testDeleteArea_4Ranges() { ScRangeList aList(ScRange(0,0,0,5,5,0)); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 271ddc83ee5a..325b3ffbeca3 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -12,7 +12,6 @@ #include <svl/asiancfg.hxx> -#include <scdll.hxx> #include <simpleformulacalc.hxx> #include <stringutil.hxx> #include <scmatrix.hxx> @@ -68,20 +67,13 @@ class ScUndoPaste; class ScUndoCut; -class Test : public test::BootstrapFixture +class Test : public ScSimpleBootstrapFixture { public: - Test(); - void checkPrecisionAsShown(OUString& rCode, double fValue, double fExpectedRoundVal); /** Get a separate new ScDocShell with ScDocument that suits unit test needs. */ void getNewDocShell(ScDocShellRef& rDocShellRef); - /** Close such new ScDocShell. */ - void closeDocShell(ScDocShellRef& rDocShellRef); - - virtual void setUp() override; - virtual void tearDown() override; void testCollator(); void testSharedStringPool(); @@ -330,16 +322,8 @@ public: CPPUNIT_TEST(testProtectedSheetEditByColumn); CPPUNIT_TEST(testInsertColumnsWithFormulaCells); CPPUNIT_TEST_SUITE_END(); - -private: - ScDocShellRef m_xDocShell; - ScDocument* m_pDoc; }; -Test::Test() -{ -} - void Test::getNewDocShell( ScDocShellRef& rDocShellRef ) { rDocShellRef = new ScDocShell( @@ -351,28 +335,6 @@ void Test::getNewDocShell( ScDocShellRef& rDocShellRef ) rDocShellRef->DoInitUnitTest(); } -void Test::closeDocShell( ScDocShellRef& rDocShellRef ) -{ - rDocShellRef->DoClose(); - rDocShellRef.clear(); -} - -void Test::setUp() -{ - BootstrapFixture::setUp(); - - ScDLL::Init(); - - getNewDocShell(m_xDocShell); - m_pDoc = &m_xDocShell->GetDocument(); -} - -void Test::tearDown() -{ - closeDocShell(m_xDocShell); - BootstrapFixture::tearDown(); -} - void Test::testCollator() { sal_Int32 nRes = ScGlobal::GetCollator().compareString("A", "B"); @@ -1127,7 +1089,8 @@ void Test::testCopyToDocument() m_pDoc->GetNote(ScAddress(0, 0, 0))->GetText(), pDestDoc->GetNote(ScAddress(0, 0, 0))->GetText()); pDestDoc->DeleteTab(0); - closeDocShell(xDocSh2); + xDocSh2->DoClose(); + xDocSh2.clear(); m_pDoc->DeleteTab(0); } @@ -5261,7 +5224,8 @@ void Test::testNoteLifeCycle() aClipDoc2.ClosingClipboardSource(); pDoc2->DeleteTab(0); - closeDocShell(xDocSh2); + xDocSh2->DoClose(); + xDocSh2.clear(); pasteFromClip( m_pDoc, aPosB5, &aClipDoc2); // should not crash... tdf#104967 ScPostIt* pNoteB5 = m_pDoc->GetNote(aPosB5); diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index c5738bf42569..031114770207 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -15,7 +15,6 @@ #include <globstr.hrc> #include <scresid.hxx> #include <docfunc.hxx> -#include <scdll.hxx> #include <scitems.hxx> #include <attrib.hxx> #include <fillinfo.hxx> @@ -87,14 +86,9 @@ sal_uInt32 addSingleCellCondFormat(ScDocument* pDoc, const ScAddress& rAddr, sal } -class TestCondformat : public test::BootstrapFixture +class TestCondformat : public ScSimpleBootstrapFixture { public: - TestCondformat(); - - virtual void setUp() override; - virtual void tearDown() override; - void testCondFormatINSDEL(); void testCondFormatInsertRow(); void testCondFormatInsertCol(); @@ -176,40 +170,8 @@ public: CPPUNIT_TEST(testFormulaListenerUpdateDeleteTab); CPPUNIT_TEST_SUITE_END(); - -private: - ScDocShellRef m_xDocShell; - ScDocument* m_pDoc; }; -TestCondformat::TestCondformat() -{ -} - -void TestCondformat::setUp() -{ - BootstrapFixture::setUp(); - - ScDLL::Init(); - - m_xDocShell = new ScDocShell( - SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); - m_xDocShell->SetIsInUcalc(); - m_xDocShell->DoInitUnitTest(); - - m_pDoc = &m_xDocShell->GetDocument(); -} - -void TestCondformat::tearDown() -{ - m_xDocShell->DoClose(); - m_xDocShell.clear(); - - test::BootstrapFixture::tearDown(); -} - void TestCondformat::testCondFormatINSDEL() { // fdo#62206 diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 148accac85f9..497a309461ab 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -25,23 +25,16 @@ #include <postit.hxx> #include <queryparam.hxx> #include <refundo.hxx> -#include <scdll.hxx> #include <scitems.hxx> #include <scopetools.hxx> -#include <test/bootstrapfixture.hxx> #include <sfx2/docfile.hxx> #include <memory> -class TestCopyPaste : public test::BootstrapFixture +class TestCopyPaste : public ScSimpleBootstrapFixture { public: - TestCopyPaste(); - - virtual void setUp() override; - virtual void tearDown() override; - void testCopyPaste(); void testCopyPasteAsLink(); void testCopyPasteTranspose(); @@ -250,9 +243,6 @@ public: CPPUNIT_TEST_SUITE_END(); private: - ScDocShellRef m_xDocShell; - ScDocument* m_pDoc; - enum CalcMode { NoCalc, @@ -326,31 +316,6 @@ private: OUString getNote(SCCOL nCol, SCROW nRow, SCTAB nTab); }; -TestCopyPaste::TestCopyPaste() {} - -void TestCopyPaste::setUp() -{ - BootstrapFixture::setUp(); - - ScDLL::Init(); - - m_xDocShell - = new ScDocShell(SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS - | SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); - m_xDocShell->SetIsInUcalc(); - m_xDocShell->DoInitUnitTest(); - - m_pDoc = &m_xDocShell->GetDocument(); -} - -void TestCopyPaste::tearDown() -{ - m_xDocShell->DoClose(); - m_xDocShell.clear(); - - test::BootstrapFixture::tearDown(); -} - static ScMF lcl_getMergeFlagOfCell(const ScDocument& rDoc, SCCOL nCol, SCROW nRow, SCTAB nTab) { const SfxPoolItem& rPoolItem = rDoc.GetPattern(nCol, nRow, nTab)->GetItem(ATTR_MERGE_FLAG); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 1ade8026f3bc..337028bfbd4f 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -7,7 +7,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <test/bootstrapfixture.hxx> #include "helper/debughelper.hxx" #include "helper/qahelper.hxx" #include <clipparam.hxx> @@ -24,7 +23,6 @@ #include <docpool.hxx> #include <docoptio.hxx> #include <externalrefmgr.hxx> -#include <scdll.hxx> #include <scmod.hxx> #include <undomanager.hxx> @@ -188,14 +186,9 @@ public: } -class TestFormula : public test::BootstrapFixture +class TestFormula : public ScSimpleBootstrapFixture { public: - TestFormula(); - - virtual void setUp() override; - virtual void tearDown() override; - void testFormulaCreateStringFromTokens(); void testFormulaParseReference(); void testFetchVectorRefArray(); @@ -437,40 +430,8 @@ public: CPPUNIT_TEST(testFuncJumpMatrixArrayOFFSET); CPPUNIT_TEST_SUITE_END(); - -private: - ScDocShellRef m_xDocShell; - ScDocument* m_pDoc; }; -TestFormula::TestFormula() -{ -} - -void TestFormula::setUp() -{ - BootstrapFixture::setUp(); - - ScDLL::Init(); - - m_xDocShell = new ScDocShell( - SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); - m_xDocShell->SetIsInUcalc(); - m_xDocShell->DoInitUnitTest(); - - m_pDoc = &m_xDocShell->GetDocument(); -} - -void TestFormula::tearDown() -{ - m_xDocShell->DoClose(); - m_xDocShell.clear(); - - test::BootstrapFixture::tearDown(); -} - void TestFormula::testFormulaCreateStringFromTokens() { // Insert sheets. diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx index 3d2d159a8f96..e2b7380ef713 100644 --- a/sc/qa/unit/ucalc_pivottable.cxx +++ b/sc/qa/unit/ucalc_pivottable.cxx @@ -8,7 +8,6 @@ */ #include <rtl/math.hxx> -#include <scdll.hxx> #include "helper/qahelper.hxx" #include <dpshttab.hxx> #include <dpobject.hxx> @@ -191,14 +190,9 @@ ScRange refreshGroups(ScDPCollection* pDPs, ScDPObject* pDPObj) } -class TestPivottable : public test::BootstrapFixture +class TestPivottable : public ScSimpleBootstrapFixture { public: - TestPivottable(); - - virtual void setUp() override; - virtual void tearDown() override; - /** * Basic test for pivot tables. */ @@ -310,40 +304,8 @@ public: CPPUNIT_TEST(testPivotTableMedianFunc); CPPUNIT_TEST_SUITE_END(); - -private: - ScDocShellRef m_xDocShell; - ScDocument* m_pDoc; }; -TestPivottable::TestPivottable() -{ -} - -void TestPivottable::setUp() -{ - BootstrapFixture::setUp(); - - ScDLL::Init(); - - m_xDocShell = new ScDocShell( - SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); - m_xDocShell->SetIsInUcalc(); - m_xDocShell->DoInitUnitTest(); - - m_pDoc = &m_xDocShell->GetDocument(); -} - -void TestPivottable::tearDown() -{ - m_xDocShell->DoClose(); - m_xDocShell.clear(); - - test::BootstrapFixture::tearDown(); -} - void TestPivottable::testPivotTable() { m_pDoc->InsertTab(0, "Data"); diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 254269bf9716..e82d21dc3b03 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -19,23 +19,16 @@ #include <globalnames.hxx> #include <dbdata.hxx> #include <bcaslot.hxx> -#include <scdll.hxx> #include <undomanager.hxx> #include <sfx2/docfile.hxx> -#include <test/bootstrapfixture.hxx> #include <memory> #include <string_view> -class TestSharedFormula : public test::BootstrapFixture +class TestSharedFormula : public ScSimpleBootstrapFixture { public: - TestSharedFormula(); - - virtual void setUp() override; - virtual void tearDown() override; - void testSharedFormulas(); void testSharedFormulasRefUpdate(); void testSharedFormulasRefUpdateMove(); @@ -95,41 +88,8 @@ public: CPPUNIT_TEST(testSharedFormulaInsertShift); CPPUNIT_TEST_SUITE_END(); - -private: - ScDocShellRef m_xDocShell; - ScDocument* m_pDoc; }; - -TestSharedFormula::TestSharedFormula() -{ -} - -void TestSharedFormula::setUp() -{ - BootstrapFixture::setUp(); - - ScDLL::Init(); - - m_xDocShell = new ScDocShell( - SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); - m_xDocShell->SetIsInUcalc(); - m_xDocShell->DoInitUnitTest(); - - m_pDoc = &m_xDocShell->GetDocument(); -} - -void TestSharedFormula::tearDown() -{ - m_xDocShell->DoClose(); - m_xDocShell.clear(); - - test::BootstrapFixture::tearDown(); -} - void TestSharedFormula::testSharedFormulas() { m_pDoc->InsertTab(0, "Test"); diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx index 21b734d1d37c..f3008d85a131 100644 --- a/sc/qa/unit/ucalc_sort.cxx +++ b/sc/qa/unit/ucalc_sort.cxx @@ -11,7 +11,6 @@ #include "helper/debughelper.hxx" #include "helper/qahelper.hxx" -#include <scdll.hxx> #include <postit.hxx> #include <sortparam.hxx> #include <dbdata.hxx> @@ -32,14 +31,9 @@ #include <svx/svdpage.hxx> #include <rtl/math.hxx> -class TestSort : public test::BootstrapFixture +class TestSort : public ScSimpleBootstrapFixture { public: - TestSort(); - - virtual void setUp() override; - virtual void tearDown() override; - void testSort(); void testSortHorizontal(); void testSortHorizontalWholeColumn(); @@ -86,41 +80,8 @@ public: CPPUNIT_TEST(testQueryBinarySearch); CPPUNIT_TEST_SUITE_END(); - -private: - ScDocShellRef m_xDocShell; - ScDocument* m_pDoc; }; - -TestSort::TestSort() -{ -} - -void TestSort::setUp() -{ - BootstrapFixture::setUp(); - - ScDLL::Init(); - - m_xDocShell = new ScDocShell( - SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); - m_xDocShell->SetIsInUcalc(); - m_xDocShell->DoInitUnitTest(); - - m_pDoc = &m_xDocShell->GetDocument(); -} - -void TestSort::tearDown() -{ - m_xDocShell->DoClose(); - m_xDocShell.clear(); - - test::BootstrapFixture::tearDown(); -} - void TestSort::testSort() { m_pDoc->InsertTab(0, "test1"); |