From e44904ba22ce0a350c1070d53f897a712001fc3d Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 14 Jun 2024 12:52:32 +0200 Subject: [PATCH] CppunitTest_sc_copypaste: inherit from ScModelTestBase Change-Id: I0847ba4455cec24332030e87244c0d9c9ad2ad2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168859 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sc/CppunitTest_sc_copypaste.mk | 1 + sc/qa/unit/copy_paste_test.cxx | 244 +++++++++++---------------------- 2 files changed, 78 insertions(+), 167 deletions(-) diff --git a/sc/CppunitTest_sc_copypaste.mk b/sc/CppunitTest_sc_copypaste.mk index 9ce5233e5ad0..afe07d82fe8d 100644 --- a/sc/CppunitTest_sc_copypaste.mk +++ b/sc/CppunitTest_sc_copypaste.mk @@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_copypaste, \ i18nlangtag \ sal \ sc \ + scqahelper \ sfx \ subsequenttest \ svl \ diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index 2e49de627d8f..41d764e82381 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -9,7 +9,7 @@ #include -#include +#include "helper/qahelper.hxx" #include #include @@ -25,7 +25,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -class ScCopyPasteTest : public UnoApiTest +class ScCopyPasteTest : public ScModelTestBase { public: ScCopyPasteTest(); @@ -71,16 +71,9 @@ private: // tdf#83366 void ScCopyPasteTest::testCopyPasteXLS() { - loadFromFile(u"xls/chartx2.xls"); - - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - // Get the document controller - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc("xls/chartx2.xls"); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); // 2. Highlight B2:C5 ScRange aSrcRange; @@ -96,17 +89,10 @@ void ScCopyPasteTest::testCopyPasteXLS() ScDocument aClipDoc(SCDOCMODE_CLIP); pViewShell->GetViewData().GetView()->CopyToClip(&aClipDoc, false, false, false, false); - // 4. Close the document (Ctrl-W) - mxComponent->dispose(); - mxComponent.clear(); - // Open a new document - mxComponent = loadFromDesktop(u"private:factory/scalc"_ustr); + createScDoc(); - // Get the document controller - pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - pViewShell = pViewData->GetViewShell(); + pViewShell = getViewShell(); // 6. Paste pViewShell->GetViewData().GetView()->PasteFromClip(InsertDeleteFlags::ALL, &aClipDoc); @@ -122,7 +108,7 @@ ScMarkData::MarkedTabsType TabsInRange(const ScRange& r) return aResult; } -void lcl_copy( const OUString& rSrcRange, const OUString& rDstRange, ScDocument& rDoc, ScTabViewShell* pViewShell ) +void lcl_copy( const OUString& rSrcRange, const OUString& rDstRange, ScDocument& rDoc, ScTabViewShell* pViewShell) { ScDocument aClipDoc(SCDOCMODE_CLIP); @@ -147,16 +133,9 @@ void lcl_copy( const OUString& rSrcRange, const OUString& rDstRange, ScDocument& void ScCopyPasteTest::testTdf84411() { - mxComponent = loadFromDesktop(u"private:factory/scalc"_ustr); - - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - // Get the document controller - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc(); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); // 2. Setup data and formulas for (unsigned int r = 0; r <= 4991; ++r) @@ -171,6 +150,8 @@ void ScCopyPasteTest::testTdf84411() // 3. Disable OpenCL + ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); + CPPUNIT_ASSERT(pModelObj); bool bOpenCLState = ScCalcConfig::isOpenCLEnabled(); pModelObj->enableOpenCL(false); CPPUNIT_ASSERT(!ScCalcConfig::isOpenCLEnabled() || ScCalcConfig::getForceCalculationType() == ForceCalculationOpenCL); @@ -191,15 +172,9 @@ void ScCopyPasteTest::testTdf84411() void ScCopyPasteTest::testTdf124565() { - mxComponent = loadFromDesktop(u"private:factory/scalc"_ustr); - - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc(); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); // Set content and height of first row pDoc->SetString(ScAddress(0, 0, 0), u"Test"_ustr); @@ -232,16 +207,9 @@ void ScCopyPasteTest::testTdf124565() void ScCopyPasteTest::testTdf126421() { - mxComponent = loadFromDesktop(u"private:factory/scalc"_ustr); - - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - // Get the document controller - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc(); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); // 2. Setup data for (int r = 0; r < 2; ++r) @@ -262,11 +230,8 @@ void ScCopyPasteTest::testTdf126421() void ScCopyPasteTest::testTdf107394() { - mxComponent = loadFromDesktop(u"private:factory/scalc"_ustr); - - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); + createScDoc(); + ScDocument* pDoc = getScDoc(); sal_uInt16 nFirstRowHeight = pDoc->GetRowHeight(0, 0); sal_uInt16 nSecondRowHeight = pDoc->GetRowHeight(1, 0); @@ -321,24 +286,18 @@ static ScAddress lcl_getMergeSizeOfCell(const ScDocument& rDoc, SCCOL nCol, SCRO void ScCopyPasteTest::testTdf53431_fillOnAutofilter() { - loadFromFile(u"ods/tdf53431_autofilterFilldown.ods"); - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - // Get the document controller - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc("ods/tdf53431_autofilterFilldown.ods"); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); //Fill should not clone Autofilter button - pViewData->GetMarkData().SetMarkArea(ScRange(1, 1, 0, 2, 4, 0)); + pViewShell->GetViewData().GetMarkData().SetMarkArea(ScRange(1, 1, 0, 2, 4, 0)); pViewShell->FillSimple(FILL_TO_BOTTOM); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 1, 1, 0) & ScMF::Auto)); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 2, 1, 0) & ScMF::Auto)); CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 1, 4, 0) & ScMF::Auto)); - pViewData->GetMarkData().SetMarkArea(ScRange(1, 1, 0, 4, 4, 0)); + pViewShell->GetViewData().GetMarkData().SetMarkArea(ScRange(1, 1, 0, 4, 4, 0)); pViewShell->FillSimple(FILL_TO_RIGHT); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 1, 1, 0) & ScMF::Auto)); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 2, 1, 0) & ScMF::Auto)); @@ -347,20 +306,20 @@ void ScCopyPasteTest::testTdf53431_fillOnAutofilter() CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 4, 4, 0) & ScMF::Auto)); //Fill should not delete Autofilter buttons - pViewData->GetMarkData().SetMarkArea(ScRange(0, 0, 0, 2, 4, 0)); + pViewShell->GetViewData().GetMarkData().SetMarkArea(ScRange(0, 0, 0, 2, 4, 0)); pViewShell->FillSimple(FILL_TO_TOP); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 1, 1, 0) & ScMF::Auto)); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 2, 1, 0) & ScMF::Auto)); CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 1, 0, 0) & ScMF::Auto)); //Fill should not clone Autofilter button - pViewData->GetMarkData().SetMarkArea(ScRange(1, 1, 0, 2, 4, 0)); + pViewShell->GetViewData().GetMarkData().SetMarkArea(ScRange(1, 1, 0, 2, 4, 0)); pViewShell->FillSimple(FILL_TO_BOTTOM); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 1, 1, 0) & ScMF::Auto)); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 2, 1, 0) & ScMF::Auto)); CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 1, 4, 0) & ScMF::Auto)); - pViewData->GetMarkData().SetMarkArea(ScRange(1, 1, 0, 4, 4, 0)); + pViewShell->GetViewData().GetMarkData().SetMarkArea(ScRange(1, 1, 0, 4, 4, 0)); pViewShell->FillSimple(FILL_TO_RIGHT); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 1, 1, 0) & ScMF::Auto)); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 2, 1, 0) & ScMF::Auto)); @@ -369,13 +328,13 @@ void ScCopyPasteTest::testTdf53431_fillOnAutofilter() CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 4, 4, 0) & ScMF::Auto)); //Fill should not delete Autofilter buttons - pViewData->GetMarkData().SetMarkArea(ScRange(0, 0, 0, 2, 4, 0)); + pViewShell->GetViewData().GetMarkData().SetMarkArea(ScRange(0, 0, 0, 2, 4, 0)); pViewShell->FillSimple(FILL_TO_TOP); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 1, 1, 0) & ScMF::Auto)); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 2, 1, 0) & ScMF::Auto)); CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 1, 0, 0) & ScMF::Auto)); - pViewData->GetMarkData().SetMarkArea(ScRange(0, 0, 0, 4, 4, 0)); + pViewShell->GetViewData().GetMarkData().SetMarkArea(ScRange(0, 0, 0, 4, 4, 0)); pViewShell->FillSimple(FILL_TO_LEFT); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 1, 1, 0) & ScMF::Auto)); CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(*pDoc, 2, 1, 0) & ScMF::Auto)); @@ -384,15 +343,9 @@ void ScCopyPasteTest::testTdf53431_fillOnAutofilter() void ScCopyPasteTest::testTdf40993_fillMergedCells() { - loadFromFile(u"ods/tdf40993_fillMergedCells.ods"); - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - // Get the document controller - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc("ods/tdf40993_fillMergedCells.ods"); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); // check content of the merged cell H11:I11 CPPUNIT_ASSERT_EQUAL(u"1.5"_ustr, pDoc->GetString(ScAddress(7, 10, 0))); @@ -401,7 +354,7 @@ void ScCopyPasteTest::testTdf40993_fillMergedCells() // (as long as ATTR_MERGE_FLAG has only ScMF::Hor or ScMF::Ver) // // select merged cell - pViewData->GetMarkData().SetMarkArea(ScRange(7, 10, 0, 8, 10, 0)); + pViewShell->GetViewData().GetMarkData().SetMarkArea(ScRange(7, 10, 0, 8, 10, 0)); // copy its content in the next ten rows pViewShell->FillAuto(FILL_TO_BOTTOM, 7, 10, 8, 10, 10); for (int i = 7; i < 9; i++) @@ -434,9 +387,9 @@ void ScCopyPasteTest::testTdf40993_fillMergedCells() lcl_getMergeSizeOfCell(*pDoc, 8, 10, 0)); // area A6:E9 with various merged cells copied vertically and horizontally - pViewData->GetMarkData().SetMarkArea(ScRange(0, 5, 0, 4, 8, 0)); + pViewShell->GetViewData().GetMarkData().SetMarkArea(ScRange(0, 5, 0, 4, 8, 0)); pViewShell->FillAuto(FILL_TO_BOTTOM, 0, 5, 4, 8, 12); - pViewData->GetMarkData().SetMarkArea(ScRange(0, 5, 0, 4, 8, 0)); + pViewShell->GetViewData().GetMarkData().SetMarkArea(ScRange(0, 5, 0, 4, 8, 0)); pViewShell->FillAuto(FILL_TO_RIGHT, 0, 5, 4, 8, 10); for (int i = 0; i < 5; i++) { @@ -463,54 +416,47 @@ void ScCopyPasteTest::testTdf40993_fillMergedCells() CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(*pDoc, 3, 5, 0), ScAddress(2, 1, 0)); } -static void lcl_clickAndCheckCurrentArea(SCCOL nCol, SCROW nRow, SCCOL nCol2, SCROW nRow2) +static void lcl_clickAndCheckCurrentArea(SCCOL nCol, SCROW nRow, SCCOL nCol2, SCROW nRow2, ScTabViewShell* pViewShell) { ScRange aRange; - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - pViewData->SetCurX(nCol); - pViewData->SetCurY(nRow); - pViewData->GetSimpleArea(aRange); + pViewShell->GetViewData().SetCurX(nCol); + pViewShell->GetViewData().SetCurY(nRow); + pViewShell->GetViewData().GetSimpleArea(aRange); CPPUNIT_ASSERT_EQUAL(aRange, ScRange(nCol, nRow, 0, nCol2, nRow2, 0)); } void ScCopyPasteTest::testTdf43958_clickSelectOnMergedCells() { - loadFromFile(u"ods/tdf40993_fillMergedCells.ods"); + createScDoc("ods/tdf40993_fillMergedCells.ods"); + ScTabViewShell* pViewShell = getViewShell(); // select cell (e.g. by clicking on it) and check what is selected [but not marked]: // if it is the top left cell of a merged area, the selection is enlarged to the area - lcl_clickAndCheckCurrentArea(1, 5, 2, 8); // B6 -> B6:C9 - lcl_clickAndCheckCurrentArea(0, 5, 0, 6); // A6 -> A6:A7 - lcl_clickAndCheckCurrentArea(3, 5, 4, 5); // D6 -> D6:E6 - lcl_clickAndCheckCurrentArea(4, 6, 4, 7); // D7 -> D6:D7 - lcl_clickAndCheckCurrentArea(7, 10, 8, 10); // H11 -> H11:I11 - lcl_clickAndCheckCurrentArea(7, 13, 8, 13); // H14 -> H14:I14 + lcl_clickAndCheckCurrentArea(1, 5, 2, 8, pViewShell); // B6 -> B6:C9 + lcl_clickAndCheckCurrentArea(0, 5, 0, 6, pViewShell); // A6 -> A6:A7 + lcl_clickAndCheckCurrentArea(3, 5, 4, 5, pViewShell); // D6 -> D6:E6 + lcl_clickAndCheckCurrentArea(4, 6, 4, 7, pViewShell); // D7 -> D6:D7 + lcl_clickAndCheckCurrentArea(7, 10, 8, 10, pViewShell); // H11 -> H11:I11 + lcl_clickAndCheckCurrentArea(7, 13, 8, 13, pViewShell); // H14 -> H14:I14 // otherwise it remains the same - lcl_clickAndCheckCurrentArea(0, 7, 0, 7); // A8 - lcl_clickAndCheckCurrentArea(0, 8, 0, 8); // A9 - lcl_clickAndCheckCurrentArea(2, 6, 2, 6); // C7 - lcl_clickAndCheckCurrentArea(2, 7, 2, 7); // C8 - lcl_clickAndCheckCurrentArea(2, 8, 2, 8); // C9 + lcl_clickAndCheckCurrentArea(0, 7, 0, 7, pViewShell); // A8 + lcl_clickAndCheckCurrentArea(0, 8, 0, 8, pViewShell); // A9 + lcl_clickAndCheckCurrentArea(2, 6, 2, 6, pViewShell); // C7 + lcl_clickAndCheckCurrentArea(2, 7, 2, 7, pViewShell); // C8 + lcl_clickAndCheckCurrentArea(2, 8, 2, 8, pViewShell); // C9 } void ScCopyPasteTest::testTdf88782_autofillLinearNumbersInMergedCells() { - loadFromFile(u"ods/tdf88782_AutofillLinearNumbersInMergedCells.ods"); - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - // Get the document controller - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc("ods/tdf88782_AutofillLinearNumbersInMergedCells.ods"); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); // merge the yellow cells ScCellMergeOption aMergeOptions(9, 11, 10, 13); //J12:K14 aMergeOptions.maTabs.insert(0); - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScDocShell* pDocSh = pViewShell->GetViewData().GetDocShell(); pDocSh->GetDocFunc().MergeCells(aMergeOptions, false, true, true, false); // fillauto numbers, these areas contain mostly merged cells @@ -561,15 +507,9 @@ void ScCopyPasteTest::testTdf88782_autofillLinearNumbersInMergedCells() void ScCopyPasteTest::tdf137621_autofillMergedBool() { - loadFromFile(u"ods/tdf137621_autofillMergedBool.ods"); - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - // Get the document controller - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc("ods/tdf137621_autofillMergedBool.ods"); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); // fillauto booleans, these areas contain only merged cells pViewShell->FillAuto(FILL_TO_RIGHT, 0, 4, 3, 5, 8); //A5:D6 @@ -596,15 +536,9 @@ void ScCopyPasteTest::tdf137621_autofillMergedBool() void ScCopyPasteTest::tdf137205_autofillDatesInMergedCells() { - loadFromFile(u"ods/tdf137205_AutofillDatesInMergedCells.ods"); - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - // Get the document controller - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc("ods/tdf137205_AutofillDatesInMergedCells.ods"); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); // fillauto dates, this areas contain only merged cells pViewShell->FillAuto(FILL_TO_RIGHT, 1, 5, 4, 7, 8); //B6:E8 @@ -636,15 +570,9 @@ void ScCopyPasteTest::addToUserList(const OUString& rStr) void ScCopyPasteTest::tdf137653_137654_autofillUserlist() { - loadFromFile(u"ods/tdf137653_137654_autofillUserlist.ods"); - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - // Get the document controller - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc("ods/tdf137653_137654_autofillUserlist.ods"); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); // delete every userlist to make sure there won't be any string that is in 2 different userlist ScGlobal::GetUserList().clear(); @@ -698,15 +626,9 @@ void ScCopyPasteTest::tdf137653_137654_autofillUserlist() void ScCopyPasteTest::tdf113500_autofillMixed() { - loadFromFile(u"ods/tdf113500_autofillMixed.ods"); - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - // Get the document controller - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc("ods/tdf113500_autofillMixed.ods"); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); // fillauto userlist, these areas contain only merged cells pViewShell->FillAuto(FILL_TO_RIGHT, 4, 5, 6, 7, 3); //E6:G8 @@ -750,15 +672,9 @@ void ScCopyPasteTest::tdf113500_autofillMixed() void ScCopyPasteTest::tdf137625_autofillMergedUserlist() { - loadFromFile(u"ods/tdf137625_autofillMergedUserlist.ods"); - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - // Get the document controller - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc("ods/tdf137625_autofillMergedUserlist.ods"); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); // delete every userlist to make sure there won't be any string that is in 2 different userlist ScGlobal::GetUserList().clear(); @@ -812,15 +728,9 @@ void ScCopyPasteTest::tdf137625_autofillMergedUserlist() void ScCopyPasteTest::tdf137624_autofillMergedMixed() { - loadFromFile(u"ods/tdf137624_autofillMergedMixed.ods"); - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - ScDocument* pDoc = pModelObj->GetDocument(); - - // Get the document controller - ScViewData* pViewData = ScDocShell::GetViewData(); - CPPUNIT_ASSERT(pViewData); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + createScDoc("ods/tdf137624_autofillMergedMixed.ods"); + ScDocument* pDoc = getScDoc(); + ScTabViewShell* pViewShell = getViewShell(); // add 1aa,2bb,3cc,4dd,5ee,6ff to userlist, to test that autofill won't confuse it with 1aa,3aa // delete every userlist to make sure there won't be any string that is in 2 different userlist @@ -866,7 +776,7 @@ void ScCopyPasteTest::tdf137624_autofillMergedMixed() } ScCopyPasteTest::ScCopyPasteTest() - : UnoApiTest(u"/sc/qa/unit/data/"_ustr) + : ScModelTestBase(u"/sc/qa/unit/data/"_ustr) { }