summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-10-27 09:32:46 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-10-27 11:28:55 +0200
commit447321aab480abae3097ce2bce1693d05e7fe1a8 (patch)
tree74e1653c65012ebc7b72b5f74d8a890823d0e1ed /sc
parent551e5943d4bec10c31077f38ccf5d8149c05265c (diff)
CppunitTest_sc_copypaste: inherit from UnoApiTest
Clean CppunitTest_sc_copypaste.mk a bit as well Change-Id: I0100bcba556fa09a82349c417d34a33789e760e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141898 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/CppunitTest_sc_copypaste.mk76
-rw-r--r--sc/qa/unit/copy_paste_test.cxx493
2 files changed, 259 insertions, 310 deletions
diff --git a/sc/CppunitTest_sc_copypaste.mk b/sc/CppunitTest_sc_copypaste.mk
index c8387159fb3a..9ce5233e5ad0 100644
--- a/sc/CppunitTest_sc_copypaste.mk
+++ b/sc/CppunitTest_sc_copypaste.mk
@@ -9,8 +9,6 @@
$(eval $(call gb_CppunitTest_CppunitTest,sc_copypaste))
-$(eval $(call gb_CppunitTest_use_common_precompiled_header,sc_copypaste))
-
$(eval $(call gb_CppunitTest_add_exception_objects,sc_copypaste, \
sc/qa/unit/copy_paste_test \
))
@@ -22,41 +20,22 @@ $(eval $(call gb_CppunitTest_use_externals,sc_copypaste, \
))
$(eval $(call gb_CppunitTest_use_libraries,sc_copypaste, \
- basegfx \
comphelper \
cppu \
cppuhelper \
- drawinglayer \
- drawinglayercore \
- editeng \
- for \
- forui \
i18nlangtag \
- msfilter \
- oox \
sal \
- salhelper \
- sax \
- sb \
sc \
- scqahelper \
sfx \
- sot \
subsequenttest \
svl \
- svt \
svx \
svxcore \
- test \
- tk \
+ test \
tl \
- ucbhelper \
- unotest \
+ unotest \
utl \
- $(call gb_Helper_optional,SCRIPTING, \
- vbahelper) \
vcl \
- xo \
))
$(eval $(call gb_CppunitTest_set_include,sc_copypaste,\
@@ -65,59 +44,12 @@ $(eval $(call gb_CppunitTest_set_include,sc_copypaste,\
$$(INCLUDE) \
))
-$(eval $(call gb_CppunitTest_use_api,sc_copypaste,\
- udkapi \
- offapi \
- oovbaapi \
-))
+$(eval $(call gb_CppunitTest_use_sdk_api,sc_copypaste))
$(eval $(call gb_CppunitTest_use_ure,sc_copypaste))
$(eval $(call gb_CppunitTest_use_vcl,sc_copypaste))
-$(eval $(call gb_CppunitTest_use_components,sc_copypaste,\
- basic/util/sb \
- chart2/source/chartcore \
- chart2/source/controller/chartcontroller \
- comphelper/util/comphelp \
- configmgr/source/configmgr \
- dbaccess/util/dba \
- embeddedobj/util/embobj \
- eventattacher/source/evtatt \
- filter/source/config/cache/filterconfig1 \
- forms/util/frm \
- framework/util/fwk \
- i18npool/source/search/i18nsearch \
- i18npool/util/i18npool \
- linguistic/source/lng \
- oox/util/oox \
- package/source/xstor/xstor \
- package/util/package2 \
- sax/source/expatwrap/expwrap \
- scaddins/source/analysis/analysis \
- scaddins/source/datefunc/date \
- sc/util/sc \
- sc/util/scfilt \
- sfx2/util/sfx \
- sot/util/sot \
- svl/util/svl \
- svl/source/fsstor/fsstorage \
- svtools/util/svt \
- toolkit/util/tk \
- ucb/source/core/ucb1 \
- ucb/source/ucp/file/ucpfile1 \
- ucb/source/ucp/tdoc/ucptdoc1 \
- unotools/util/utl \
- unoxml/source/rdf/unordf \
- unoxml/source/service/unoxml \
- uui/util/uui \
- vcl/vcl.common \
- xmloff/util/xo \
- xmlsecurity/util/xmlsecurity \
-))
-
-$(eval $(call gb_CppunitTest_use_components,sc_copypaste,\
- xmlsecurity/util/xsec_xmlsec \
-))
+$(eval $(call gb_CppunitTest_use_rdb,sc_copypaste,services))
$(eval $(call gb_CppunitTest_use_configuration,sc_copypaste))
diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx
index 207efa140b2d..c020565655ef 100644
--- a/sc/qa/unit/copy_paste_test.cxx
+++ b/sc/qa/unit/copy_paste_test.cxx
@@ -11,7 +11,7 @@
#include <string_view>
-#include <test/bootstrapfixture.hxx>
+#include <test/unoapi_test.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/propertyvalue.hxx>
@@ -25,14 +25,10 @@
#include <userlist.hxx>
#include <undomanager.hxx>
-#include <com/sun/star/frame/Desktop.hpp>
-
-#include "helper/qahelper.hxx"
-
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-class ScCopyPasteTest : public ScBootstrapFixture
+class ScCopyPasteTest : public UnoApiTest
{
public:
ScCopyPasteTest();
@@ -78,20 +74,21 @@ private:
// tdf#83366
void ScCopyPasteTest::testCopyPasteXLS()
{
- ScDocShellRef xDocSh = loadDocAndSetupModelViewController(u"chartx2.", FORMAT_XLS);
+ loadFromURL(u"xls/chartx2.xls");
- ScDocument& rDoc = xDocSh->GetDocument();
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
// Get the document controller
- ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pViewShell != nullptr);
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
// 2. Highlight B2:C5
ScRange aSrcRange;
- ScRefFlags nRes = aSrcRange.Parse("B2:C5", rDoc, rDoc.GetAddressConvention());
+ ScRefFlags nRes = aSrcRange.Parse("B2:C5", *pDoc, pDoc->GetAddressConvention());
CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID));
- ScMarkData aMark(rDoc.GetSheetLimits());
+ ScMarkData aMark(pDoc->GetSheetLimits());
aMark.SetMarkArea(aSrcRange);
pViewShell->GetViewData().GetMarkData().SetMarkArea(aSrcRange);
@@ -101,19 +98,17 @@ void ScCopyPasteTest::testCopyPasteXLS()
pViewShell->GetViewData().GetView()->CopyToClip(&aClipDoc, false, false, false, false);
// 4. Close the document (Ctrl-W)
- xDocSh->DoClose();
+ mxComponent->dispose();
+ mxComponent.clear();
- xDocSh = loadEmptyDocument();
- CPPUNIT_ASSERT(xDocSh);
+ // Open a new document
+ mxComponent = loadFromDesktop("private:factory/scalc");
// Get the document controller
- pViewShell = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pViewShell != nullptr);
+ pViewShell = ScDocShell::GetViewData()->GetViewShell();
// 6. Paste
pViewShell->GetViewData().GetView()->PasteFromClip(InsertDeleteFlags::ALL, &aClipDoc);
-
- xDocSh->DoClose();
}
namespace {
@@ -151,65 +146,60 @@ void lcl_copy( const OUString& rSrcRange, const OUString& rDstRange, ScDocument&
void ScCopyPasteTest::testTdf84411()
{
- ScDocShellRef xDocSh = loadEmptyDocument();
- CPPUNIT_ASSERT(xDocSh);
+ mxComponent = loadFromDesktop("private:factory/scalc");
- ScDocument& rDoc = xDocSh->GetDocument();
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
// Get the document controller
- ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pViewShell != nullptr);
-
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
// 2. Setup data and formulas
for (unsigned int r = 0; r <= 4991; ++r)
for (unsigned int c = 0; c <= 14; ++c)
- rDoc.SetValue( ScAddress(c,r,0), (r+1)*(c+1) );
+ pDoc->SetValue( ScAddress(c,r,0), (r+1)*(c+1) );
- rDoc.SetString(ScAddress(15,10000,0), "=AVERAGE(A10001:O10001)");
- rDoc.SetString(ScAddress(16,10000,0), "=MIN(A10001:O10001)");
- rDoc.SetString(ScAddress(17,10000,0), "=MAX(A10001:O10001)");
+ pDoc->SetString(ScAddress(15,10000,0), "=AVERAGE(A10001:O10001)");
+ pDoc->SetString(ScAddress(16,10000,0), "=MIN(A10001:O10001)");
+ pDoc->SetString(ScAddress(17,10000,0), "=MAX(A10001:O10001)");
- lcl_copy("P10001:R10001", "P10002:R12500", rDoc, pViewShell);
+ lcl_copy("P10001:R10001", "P10002:R12500", *pDoc, pViewShell);
// 3. Disable OpenCL
- uno::Reference<lang::XComponent> xComponent = xDocSh->GetModel();
- ScModelObj* pModel = dynamic_cast<ScModelObj*>(xComponent.get());
- CPPUNIT_ASSERT(pModel != nullptr);
bool bOpenCLState = ScCalcConfig::isOpenCLEnabled();
- pModel->enableOpenCL(false);
+ pModelObj->enableOpenCL(false);
CPPUNIT_ASSERT(!ScCalcConfig::isOpenCLEnabled() || ScCalcConfig::getForceCalculationType() == ForceCalculationOpenCL);
- pModel->enableAutomaticCalculation(true);
+ pModelObj->enableAutomaticCalculation(true);
// 4. Copy and Paste
- lcl_copy("A1:O2500", "A10001:O12500", rDoc, pViewShell);
+ lcl_copy("A1:O2500", "A10001:O12500", *pDoc, pViewShell);
- lcl_copy("A2501:O5000", "A12501:O15000", rDoc, pViewShell);
+ lcl_copy("A2501:O5000", "A12501:O15000", *pDoc, pViewShell);
- lcl_copy("P10001:R10001", "P12501:R15000", rDoc, pViewShell);
+ lcl_copy("P10001:R10001", "P12501:R15000", *pDoc, pViewShell);
// 5. Close the document (Ctrl-W)
- pModel->enableOpenCL(bOpenCLState);
-
- xDocSh->DoClose();
+ pModelObj->enableOpenCL(bOpenCLState);
}
void ScCopyPasteTest::testTdf124565()
{
- ScDocShellRef xDocSh = loadEmptyDocument();
- CPPUNIT_ASSERT(xDocSh);
+ mxComponent = loadFromDesktop("private:factory/scalc");
- ScDocument& rDoc = xDocSh->GetDocument();
- ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pViewShell != nullptr);
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
+
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
// Set content and height of first row
- rDoc.SetString(ScAddress(0, 0, 0), "Test");
- rDoc.SetRowHeight(0, 0, 500);
- rDoc.SetManualHeight(0, 0, 0, true);
+ pDoc->SetString(ScAddress(0, 0, 0), "Test");
+ pDoc->SetRowHeight(0, 0, 500);
+ pDoc->SetManualHeight(0, 0, 0, true);
// Copy first row
ScDocument aClipDoc(SCDOCMODE_CLIP);
@@ -227,59 +217,56 @@ void ScCopyPasteTest::testTdf124565()
pViewShell->GetViewData().GetView()->PasteFromClip(InsertDeleteFlags::ALL, &aClipDoc);
// Copy-pasted?
- CPPUNIT_ASSERT_EQUAL_MESSAGE("String was not pasted!", OUString("Test"), rDoc.GetString(nCol, nRow, nTab));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("String was not pasted!", OUString("Test"), pDoc->GetString(nCol, nRow, nTab));
// And height same as in source?
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Row#2 height is invalid!", sal_uInt16(500), rDoc.GetRowHeight(nRow, nTab));
-
- CPPUNIT_ASSERT_MESSAGE("Row#2 must be manual height!", rDoc.IsManualRowHeight(nRow, nTab));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Row#2 height is invalid!", sal_uInt16(500), pDoc->GetRowHeight(nRow, nTab));
- xDocSh->DoClose();
+ CPPUNIT_ASSERT_MESSAGE("Row#2 must be manual height!", pDoc->IsManualRowHeight(nRow, nTab));
}
void ScCopyPasteTest::testTdf126421()
{
- ScDocShellRef xDocSh = loadEmptyDocument();
- CPPUNIT_ASSERT(xDocSh);
+ mxComponent = loadFromDesktop("private:factory/scalc");
- ScDocument& rDoc = xDocSh->GetDocument();
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
// Get the document controller
- ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pViewShell != nullptr);
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
// 2. Setup data
for (int r = 0; r < 2; ++r)
for (int c = 0; c < 1024; ++c)
- rDoc.SetValue(c, r, 0, (c + 1) * 100 + (r + 1));
+ pDoc->SetValue(c, r, 0, (c + 1) * 100 + (r + 1));
- const SCTAB n2ndTab = rDoc.GetMaxTableNumber() + 1;
- rDoc.MakeTable(n2ndTab);
- const auto aTabNames = rDoc.GetAllTableNames();
+ const SCTAB n2ndTab = pDoc->GetMaxTableNumber() + 1;
+ pDoc->MakeTable(n2ndTab);
+ const auto aTabNames = pDoc->GetAllTableNames();
- lcl_copy(aTabNames[0] + ".A1:AMJ2", aTabNames[n2ndTab] + ".A1:AMJ2", rDoc, pViewShell);
+ lcl_copy(aTabNames[0] + ".A1:AMJ2", aTabNames[n2ndTab] + ".A1:AMJ2", *pDoc, pViewShell);
// 3. Check all cells in destination table
for (int r = 0; r < 2; ++r)
for (int c = 0; c < 1024; ++c)
- CPPUNIT_ASSERT_EQUAL(double((c + 1) * 100 + (r + 1)), rDoc.GetValue(c, r, n2ndTab));
-
- xDocSh->DoClose();
+ CPPUNIT_ASSERT_EQUAL(double((c + 1) * 100 + (r + 1)), pDoc->GetValue(c, r, n2ndTab));
}
void ScCopyPasteTest::testTdf107394()
{
- ScDocShellRef xDocSh = loadEmptyDocument();
- CPPUNIT_ASSERT(xDocSh);
+ mxComponent = loadFromDesktop("private:factory/scalc");
- ScDocument& rDoc = xDocSh->GetDocument();
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
- sal_uInt16 nFirstRowHeight = rDoc.GetRowHeight(0, 0);
- sal_uInt16 nSecondRowHeight = rDoc.GetRowHeight(1, 0);
+ sal_uInt16 nFirstRowHeight = pDoc->GetRowHeight(0, 0);
+ sal_uInt16 nSecondRowHeight = pDoc->GetRowHeight(1, 0);
CPPUNIT_ASSERT_EQUAL(nFirstRowHeight, nSecondRowHeight);
// Import values to A1:A2.
- ScImportExport aObj(rDoc, ScAddress(0,0,0));
+ ScImportExport aObj(*pDoc, ScAddress(0,0,0));
aObj.SetImportBroadcast(true);
SvMemoryStream aStream;
@@ -287,30 +274,28 @@ void ScCopyPasteTest::testTdf107394()
aStream.Seek(0);
CPPUNIT_ASSERT(aObj.ImportStream(aStream, OUString(), SotClipboardFormatId::HTML));
- CPPUNIT_ASSERT_EQUAL(OUString("First"), rDoc.GetString(ScAddress(0,0,0)));
- CPPUNIT_ASSERT_EQUAL(OUString("Very long sentence."), rDoc.GetString(ScAddress(0,1,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("First"), pDoc->GetString(ScAddress(0,0,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("Very long sentence."), pDoc->GetString(ScAddress(0,1,0)));
- nFirstRowHeight = rDoc.GetRowHeight(0, 0);
- nSecondRowHeight = rDoc.GetRowHeight(1, 0);
+ nFirstRowHeight = pDoc->GetRowHeight(0, 0);
+ nSecondRowHeight = pDoc->GetRowHeight(1, 0);
CPPUNIT_ASSERT_GREATER(nFirstRowHeight, nSecondRowHeight);
// Undo, and check the result.
- SfxUndoManager* pUndoMgr = rDoc.GetUndoManager();
+ SfxUndoManager* pUndoMgr = pDoc->GetUndoManager();
CPPUNIT_ASSERT_MESSAGE("Failed to get the undo manager.", pUndoMgr);
pUndoMgr->Undo();
- CPPUNIT_ASSERT(rDoc.GetString(ScAddress(0,0,0)).isEmpty());
- CPPUNIT_ASSERT(rDoc.GetString(ScAddress(0,1,0)).isEmpty());
+ CPPUNIT_ASSERT(pDoc->GetString(ScAddress(0,0,0)).isEmpty());
+ CPPUNIT_ASSERT(pDoc->GetString(ScAddress(0,1,0)).isEmpty());
- nFirstRowHeight = rDoc.GetRowHeight(0, 0);
- nSecondRowHeight = rDoc.GetRowHeight(1, 0);
+ nFirstRowHeight = pDoc->GetRowHeight(0, 0);
+ nSecondRowHeight = pDoc->GetRowHeight(1, 0);
// Without the accompanying fix in place, this test would have failed:
// - Expected: 256
// - Actual : 477
// i.e. the increased height of the second row remained after undo.
CPPUNIT_ASSERT_EQUAL(nFirstRowHeight, nSecondRowHeight);
-
- xDocSh->DoClose();
}
static ScMF lcl_getMergeFlagOfCell(const ScDocument& rDoc, SCCOL nCol, SCROW nRow, SCTAB nTab)
@@ -329,53 +314,77 @@ static ScAddress lcl_getMergeSizeOfCell(const ScDocument& rDoc, SCCOL nCol, SCRO
void ScCopyPasteTest::testTdf53431_fillOnAutofilter()
{
- ScDocShellRef xDocSh = loadDocAndSetupModelViewController(u"tdf53431_autofilterFilldown.", FORMAT_ODS);
- ScDocument& rDoc = xDocSh->GetDocument();
+ loadFromURL(u"ods/tdf53431_autofilterFilldown.ods");
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
// Get the document controller
- ScTabViewShell* pView = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pView != nullptr);
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
+
+ //Fill should not clone Autofilter button
+ ScDocShell::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));
+
+ ScDocShell::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));
+ CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 4, 1, 0) & ScMF::Auto));
+ CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 1, 4, 0) & ScMF::Auto));
+ CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 4, 4, 0) & ScMF::Auto));
+
+ //Fill should not delete Autofilter buttons
+ ScDocShell::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
ScDocShell::GetViewData()->GetMarkData().SetMarkArea(ScRange(1, 1, 0, 2, 4, 0));
- pView->FillSimple(FILL_TO_BOTTOM);
- CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(rDoc, 1, 1, 0) & ScMF::Auto));
- CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(rDoc, 2, 1, 0) & ScMF::Auto));
- CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(rDoc, 1, 4, 0) & ScMF::Auto));
+ 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));
ScDocShell::GetViewData()->GetMarkData().SetMarkArea(ScRange(1, 1, 0, 4, 4, 0));
- pView->FillSimple(FILL_TO_RIGHT);
- CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(rDoc, 1, 1, 0) & ScMF::Auto));
- CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(rDoc, 2, 1, 0) & ScMF::Auto));
- CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(rDoc, 4, 1, 0) & ScMF::Auto));
- CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(rDoc, 1, 4, 0) & ScMF::Auto));
- CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(rDoc, 4, 4, 0) & ScMF::Auto));
+ 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));
+ CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 4, 1, 0) & ScMF::Auto));
+ CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 1, 4, 0) & ScMF::Auto));
+ CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 4, 4, 0) & ScMF::Auto));
//Fill should not delete Autofilter buttons
ScDocShell::GetViewData()->GetMarkData().SetMarkArea(ScRange(0, 0, 0, 2, 4, 0));
- pView->FillSimple(FILL_TO_TOP);
- CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(rDoc, 1, 1, 0) & ScMF::Auto));
- CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(rDoc, 2, 1, 0) & ScMF::Auto));
- CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(rDoc, 1, 0, 0) & ScMF::Auto));
+ 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));
ScDocShell::GetViewData()->GetMarkData().SetMarkArea(ScRange(0, 0, 0, 4, 4, 0));
- pView->FillSimple(FILL_TO_LEFT);
- CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(rDoc, 1, 1, 0) & ScMF::Auto));
- CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(rDoc, 2, 1, 0) & ScMF::Auto));
- CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(rDoc, 0, 1, 0) & ScMF::Auto));
+ 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));
+ CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(*pDoc, 0, 1, 0) & ScMF::Auto));
}
void ScCopyPasteTest::testTdf40993_fillMergedCells()
{
- ScDocShellRef xDocSh = loadDocAndSetupModelViewController(u"tdf40993_fillMergedCells.", FORMAT_ODS);
- ScDocument& rDoc = xDocSh->GetDocument();
+ loadFromURL(u"ods/tdf40993_fillMergedCells.ods");
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
// Get the document controller
- ScTabViewShell* pView = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pView != nullptr);
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
// check content of the merged cell H11:I11
- CPPUNIT_ASSERT_EQUAL(OUString("1.5"), rDoc.GetString(ScAddress(7, 10, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("1.5"), pDoc->GetString(ScAddress(7, 10, 0)));
// fill operation on the merged cell should clone ATTR_MERGE and ATTR_MERGE_FLAG
// (as long as ATTR_MERGE_FLAG has only ScMF::Hor or ScMF::Ver)
@@ -383,11 +392,11 @@ void ScCopyPasteTest::testTdf40993_fillMergedCells()
// select merged cell
ScDocShell::GetViewData()->GetMarkData().SetMarkArea(ScRange(7, 10, 0, 8, 10, 0));
// copy its content in the next ten rows
- pView->FillAuto(FILL_TO_BOTTOM, 7, 10, 8, 10, 10);
+ pViewShell->FillAuto(FILL_TO_BOTTOM, 7, 10, 8, 10, 10);
for (int i = 7; i < 9; i++)
{
- ScMF nOriginFlag = lcl_getMergeFlagOfCell(rDoc, i, 10, 0);
- ScAddress aOriginMerge = lcl_getMergeSizeOfCell(rDoc, i, 10, 0);
+ ScMF nOriginFlag = lcl_getMergeFlagOfCell(*pDoc, i, 10, 0);
+ ScAddress aOriginMerge = lcl_getMergeSizeOfCell(*pDoc, i, 10, 0);
// ATTR_MERGE_FLAG: top left cell is NONE, the other cell shows horizontal overlapping
CPPUNIT_ASSERT_EQUAL(i == 7 ? ScMF::NONE : ScMF::Hor, nOriginFlag);
@@ -399,48 +408,48 @@ void ScCopyPasteTest::testTdf40993_fillMergedCells()
for (int j = 11; j < 21; j++)
{
// check copying of ATTR_MERGE and ATTR_MERGE_FLAG
- CPPUNIT_ASSERT_EQUAL(lcl_getMergeFlagOfCell(rDoc, i, j, 0), nOriginFlag);
- CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(rDoc, i, j, 0), aOriginMerge);
+ CPPUNIT_ASSERT_EQUAL(lcl_getMergeFlagOfCell(*pDoc, i, j, 0), nOriginFlag);
+ CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(*pDoc, i, j, 0), aOriginMerge);
}
}
- CPPUNIT_ASSERT_EQUAL(lcl_getMergeFlagOfCell(rDoc, 7, 21, 0),
- lcl_getMergeFlagOfCell(rDoc, 7, 10, 0));
- CPPUNIT_ASSERT(lcl_getMergeSizeOfCell(rDoc, 7, 21, 0) !=
- lcl_getMergeSizeOfCell(rDoc, 7, 10, 0));
- CPPUNIT_ASSERT(lcl_getMergeFlagOfCell(rDoc, 8, 21, 0) !=
- lcl_getMergeFlagOfCell(rDoc, 8, 10, 0));
- CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(rDoc, 8, 21, 0),
- lcl_getMergeSizeOfCell(rDoc, 8, 10, 0));
+ CPPUNIT_ASSERT_EQUAL(lcl_getMergeFlagOfCell(*pDoc, 7, 21, 0),
+ lcl_getMergeFlagOfCell(*pDoc, 7, 10, 0));
+ CPPUNIT_ASSERT(lcl_getMergeSizeOfCell(*pDoc, 7, 21, 0) !=
+ lcl_getMergeSizeOfCell(*pDoc, 7, 10, 0));
+ CPPUNIT_ASSERT(lcl_getMergeFlagOfCell(*pDoc, 8, 21, 0) !=
+ lcl_getMergeFlagOfCell(*pDoc, 8, 10, 0));
+ CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(*pDoc, 8, 21, 0),
+ lcl_getMergeSizeOfCell(*pDoc, 8, 10, 0));
// area A6:E9 with various merged cells copied vertically and horizontally
ScDocShell::GetViewData()->GetMarkData().SetMarkArea(ScRange(0, 5, 0, 4, 8, 0));
- pView->FillAuto(FILL_TO_BOTTOM, 0, 5, 4, 8, 12);
+ pViewShell->FillAuto(FILL_TO_BOTTOM, 0, 5, 4, 8, 12);
ScDocShell::GetViewData()->GetMarkData().SetMarkArea(ScRange(0, 5, 0, 4, 8, 0));
- pView->FillAuto(FILL_TO_RIGHT, 0, 5, 4, 8, 10);
+ pViewShell->FillAuto(FILL_TO_RIGHT, 0, 5, 4, 8, 10);
for (int i = 0; i < 5; i++)
{
for (int j = 5; j < 9; j++)
{
- ScMF nOriginFlag = lcl_getMergeFlagOfCell(rDoc, i, j, 0);
- ScAddress aOriginMerge = lcl_getMergeSizeOfCell(rDoc, i, j, 0);
+ ScMF nOriginFlag = lcl_getMergeFlagOfCell(*pDoc, i, j, 0);
+ ScAddress aOriginMerge = lcl_getMergeSizeOfCell(*pDoc, i, j, 0);
// copies contain the same ATTR_MERGE and ATTR_MERGE_FLAG
for (int k = 0; k < 12; k += 4)
{
- CPPUNIT_ASSERT_EQUAL(lcl_getMergeFlagOfCell(rDoc, i, j + k, 0), nOriginFlag);
- CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(rDoc, i, j + k, 0), aOriginMerge);
+ CPPUNIT_ASSERT_EQUAL(lcl_getMergeFlagOfCell(*pDoc, i, j + k, 0), nOriginFlag);
+ CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(*pDoc, i, j + k, 0), aOriginMerge);
}
for (int k = 0; k < 10; k += 5)
{
- CPPUNIT_ASSERT_EQUAL(lcl_getMergeFlagOfCell(rDoc, i + k, j, 0), nOriginFlag);
- CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(rDoc, i + k, j, 0), aOriginMerge);
+ CPPUNIT_ASSERT_EQUAL(lcl_getMergeFlagOfCell(*pDoc, i + k, j, 0), nOriginFlag);
+ CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(*pDoc, i + k, j, 0), aOriginMerge);
}
}
}
- CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(rDoc, 1, 5, 0), ScAddress(2, 4, 0));
- CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(rDoc, 0, 5, 0), ScAddress(1, 2, 0));
- CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(rDoc, 4, 6, 0), ScAddress(1, 2, 0));
- CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(rDoc, 3, 5, 0), ScAddress(2, 1, 0));
+ CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(*pDoc, 1, 5, 0), ScAddress(2, 4, 0));
+ CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(*pDoc, 0, 5, 0), ScAddress(1, 2, 0));
+ CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(*pDoc, 4, 6, 0), ScAddress(1, 2, 0));
+ 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)
@@ -454,7 +463,7 @@ static void lcl_clickAndCheckCurrentArea(SCCOL nCol, SCROW nRow, SCCOL nCol2, SC
void ScCopyPasteTest::testTdf43958_clickSelectOnMergedCells()
{
- loadDocAndSetupModelViewController(u"tdf40993_fillMergedCells.", FORMAT_ODS);
+ loadFromURL(u"ods/tdf40993_fillMergedCells.ods");
// 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
@@ -475,24 +484,26 @@ void ScCopyPasteTest::testTdf43958_clickSelectOnMergedCells()
void ScCopyPasteTest::testTdf88782_autofillLinearNumbersInMergedCells()
{
- ScDocShellRef xDocSh = loadDocAndSetupModelViewController(u"tdf88782_AutofillLinearNumbersInMergedCells.", FORMAT_ODS);
- ScDocument& rDoc = xDocSh->GetDocument();
+ loadFromURL(u"ods/tdf88782_AutofillLinearNumbersInMergedCells.ods");
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
// Get the document controller
- ScTabViewShell* pView = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pView != nullptr);
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
// merge the yellow cells
ScCellMergeOption aMergeOptions(9, 11, 10, 13); //J12:K14
aMergeOptions.maTabs.insert(0);
- xDocSh->GetDocFunc().MergeCells(aMergeOptions, false, true, true, false);
+ ScDocShell* pDocSh = ScDocShell::GetViewData()->GetDocShell();
+ pDocSh->GetDocFunc().MergeCells(aMergeOptions, false, true, true, false);
// fillauto numbers, these areas contain mostly merged cells
- pView->FillAuto(FILL_TO_BOTTOM, 1, 8, 3, 14, 7); // B9:D15 -> B9:D22
- pView->FillAuto(FILL_TO_BOTTOM, 5, 8, 7, 17, 10); // F9:H18 -> F9:H28
- pView->FillAuto(FILL_TO_BOTTOM, 9, 8, 10, 13, 6); // J9:K14 -> J9:K20
- pView->FillAuto(FILL_TO_RIGHT, 9, 30, 16, 35, 8); //J31:Q36 -> J31:Y36
- pView->FillAuto(FILL_TO_LEFT, 9, 30, 16, 35, 8); //J31:Q36 -> B31:Q36
+ pViewShell->FillAuto(FILL_TO_BOTTOM, 1, 8, 3, 14, 7); // B9:D15 -> B9:D22
+ pViewShell->FillAuto(FILL_TO_BOTTOM, 5, 8, 7, 17, 10); // F9:H18 -> F9:H28
+ pViewShell->FillAuto(FILL_TO_BOTTOM, 9, 8, 10, 13, 6); // J9:K14 -> J9:K20
+ pViewShell->FillAuto(FILL_TO_RIGHT, 9, 30, 16, 35, 8); //J31:Q36 -> J31:Y36
+ pViewShell->FillAuto(FILL_TO_LEFT, 9, 30, 16, 35, 8); //J31:Q36 -> B31:Q36
// compare the results of fill-down with the reference stored in the test file
// this compares the whole area blindly, for specific test cases, check the test file
@@ -501,10 +512,10 @@ void ScCopyPasteTest::testTdf88782_autofillLinearNumbersInMergedCells()
{
for (int nRow = 8; nRow <= 27; nRow++)
{
- CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0));
- CellType nType2 = rDoc.GetCellType(ScAddress(nCol + 22, nRow, 0));
- double* pValue1 = rDoc.GetValueCell(ScAddress(nCol, nRow, 0));
- double* pValue2 = rDoc.GetValueCell(ScAddress(nCol + 22, nRow, 0));
+ CellType nType1 = pDoc->GetCellType(ScAddress(nCol, nRow, 0));
+ CellType nType2 = pDoc->GetCellType(ScAddress(nCol + 22, nRow, 0));
+ double* pValue1 = pDoc->GetValueCell(ScAddress(nCol, nRow, 0));
+ double* pValue2 = pDoc->GetValueCell(ScAddress(nCol + 22, nRow, 0));
CPPUNIT_ASSERT_EQUAL(nType1, nType2);
if (pValue2 != nullptr)
@@ -519,10 +530,10 @@ void ScCopyPasteTest::testTdf88782_autofillLinearNumbersInMergedCells()
{
for (int nRow = 30; nRow <= 35; nRow++)
{
- CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0));
- CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 16, 0));
- double* pValue1 = rDoc.GetValueCell(ScAddress(nCol, nRow, 0));
- double* pValue2 = rDoc.GetValueCell(ScAddress(nCol, nRow + 16, 0));
+ CellType nType1 = pDoc->GetCellType(ScAddress(nCol, nRow, 0));
+ CellType nType2 = pDoc->GetCellType(ScAddress(nCol, nRow + 16, 0));
+ double* pValue1 = pDoc->GetValueCell(ScAddress(nCol, nRow, 0));
+ double* pValue2 = pDoc->GetValueCell(ScAddress(nCol, nRow + 16, 0));
CPPUNIT_ASSERT_EQUAL(nType1, nType2);
if (pValue2 != nullptr)
@@ -535,15 +546,16 @@ void ScCopyPasteTest::testTdf88782_autofillLinearNumbersInMergedCells()
void ScCopyPasteTest::tdf137621_autofillMergedBool()
{
- ScDocShellRef xDocSh = loadDocAndSetupModelViewController(u"tdf137621_autofillMergedBool.", FORMAT_ODS);
- ScDocument& rDoc = xDocSh->GetDocument();
+ loadFromURL(u"ods/tdf137621_autofillMergedBool.ods");
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
// Get the document controller
- ScTabViewShell* pView = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pView != nullptr);
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
// fillauto booleans, these areas contain only merged cells
- pView->FillAuto(FILL_TO_RIGHT, 0, 4, 3, 5, 8); //A5:D6
+ pViewShell->FillAuto(FILL_TO_RIGHT, 0, 4, 3, 5, 8); //A5:D6
// compare the results of fill-right with the reference stored in the test file
// this compares the whole area blindly, for specific test cases, check the test file
@@ -551,10 +563,10 @@ void ScCopyPasteTest::tdf137621_autofillMergedBool()
{
for (int nRow = 4; nRow <= 5; nRow++)
{
- CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0));
- CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 3, 0));
- double* pValue1 = rDoc.GetValueCell(ScAddress(nCol, nRow, 0));
- double* pValue2 = rDoc.GetValueCell(ScAddress(nCol, nRow + 3, 0));
+ CellType nType1 = pDoc->GetCellType(ScAddress(nCol, nRow, 0));
+ CellType nType2 = pDoc->GetCellType(ScAddress(nCol, nRow + 3, 0));
+ double* pValue1 = pDoc->GetValueCell(ScAddress(nCol, nRow, 0));
+ double* pValue2 = pDoc->GetValueCell(ScAddress(nCol, nRow + 3, 0));
CPPUNIT_ASSERT_EQUAL(nType1, nType2);
if (pValue2 != nullptr)
@@ -567,15 +579,16 @@ void ScCopyPasteTest::tdf137621_autofillMergedBool()
void ScCopyPasteTest::tdf137205_autofillDatesInMergedCells()
{
- ScDocShellRef xDocSh = loadDocAndSetupModelViewController(u"tdf137205_AutofillDatesInMergedCells.", FORMAT_ODS);
- ScDocument& rDoc = xDocSh->GetDocument();
+ loadFromURL(u"ods/tdf137205_AutofillDatesInMergedCells.ods");
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
// Get the document controller
- ScTabViewShell* pView = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pView != nullptr);
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
// fillauto dates, this areas contain only merged cells
- pView->FillAuto(FILL_TO_RIGHT, 1, 5, 4, 7, 8); //B6:E8
+ pViewShell->FillAuto(FILL_TO_RIGHT, 1, 5, 4, 7, 8); //B6:E8
// compare the results of fill-right with the reference stored in the test file
// this compares the whole area blindly, for specific test cases, check the test file
@@ -583,10 +596,10 @@ void ScCopyPasteTest::tdf137205_autofillDatesInMergedCells()
{
for (int nRow = 5; nRow <= 7; nRow++)
{
- CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0));
- CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 5, 0));
- double* pValue1 = rDoc.GetValueCell(ScAddress(nCol, nRow, 0));
- double* pValue2 = rDoc.GetValueCell(ScAddress(nCol, nRow + 5, 0));
+ CellType nType1 = pDoc->GetCellType(ScAddress(nCol, nRow, 0));
+ CellType nType2 = pDoc->GetCellType(ScAddress(nCol, nRow + 5, 0));
+ double* pValue1 = pDoc->GetValueCell(ScAddress(nCol, nRow, 0));
+ double* pValue2 = pDoc->GetValueCell(ScAddress(nCol, nRow + 5, 0));
CPPUNIT_ASSERT_EQUAL(nType1, nType2);
if (pValue2 != nullptr)
@@ -605,12 +618,13 @@ void ScCopyPasteTest::addToUserList(const OUString& rStr)
void ScCopyPasteTest::tdf137653_137654_autofillUserlist()
{
- ScDocShellRef xDocSh = loadDocAndSetupModelViewController(u"tdf137653_137654_autofillUserlist.", FORMAT_ODS);
- ScDocument& rDoc = xDocSh->GetDocument();
+ loadFromURL(u"ods/tdf137653_137654_autofillUserlist.ods");
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
// Get the document controller
- ScTabViewShell* pView = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pView != nullptr);
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
// delete every userlist to make sure there won't be any string that is in 2 different userlist
ScGlobal::GetUserList()->clear();
@@ -621,10 +635,10 @@ void ScCopyPasteTest::tdf137653_137654_autofillUserlist()
bool bMatchCase = false;
// fillauto userlist, these areas contain only merged cells
- pView->FillAuto(FILL_TO_RIGHT, 4, 5, 6, 7, 3); //E6:G8
- pView->FillAuto(FILL_TO_LEFT, 4, 5, 6, 7, 3); //E6:G8
- pView->FillAuto(FILL_TO_BOTTOM, 1, 18, 3, 19, 2); //B19:D20
- pView->FillAuto(FILL_TO_TOP, 1, 18, 3, 19, 2); //B19:D20
+ pViewShell->FillAuto(FILL_TO_RIGHT, 4, 5, 6, 7, 3); //E6:G8
+ pViewShell->FillAuto(FILL_TO_LEFT, 4, 5, 6, 7, 3); //E6:G8
+ pViewShell->FillAuto(FILL_TO_BOTTOM, 1, 18, 3, 19, 2); //B19:D20
+ pViewShell->FillAuto(FILL_TO_TOP, 1, 18, 3, 19, 2); //B19:D20
// compare the results of fill-right / -left with the reference stored in the test file
// this compares the whole area blindly, for specific test cases, check the test file
@@ -632,10 +646,10 @@ void ScCopyPasteTest::tdf137653_137654_autofillUserlist()
{
for (int nRow = 5; nRow <= 7; nRow++)
{
- CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0));
- CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 4, 0));
- bHasIdx1 = pListData->GetSubIndex(rDoc.GetString(nCol, nRow, 0), nIdx1, bMatchCase);
- bHasIdx2 = pListData->GetSubIndex(rDoc.GetString(nCol, nRow + 4, 0), nIdx2, bMatchCase);
+ CellType nType1 = pDoc->GetCellType(ScAddress(nCol, nRow, 0));
+ CellType nType2 = pDoc->GetCellType(ScAddress(nCol, nRow + 4, 0));
+ bHasIdx1 = pListData->GetSubIndex(pDoc->GetString(nCol, nRow, 0), nIdx1, bMatchCase);
+ bHasIdx2 = pListData->GetSubIndex(pDoc->GetString(nCol, nRow + 4, 0), nIdx2, bMatchCase);
CPPUNIT_ASSERT_EQUAL(nType1, nType2);
CPPUNIT_ASSERT(bHasIdx1);
@@ -649,10 +663,10 @@ void ScCopyPasteTest::tdf137653_137654_autofillUserlist()
{
for (int nRow = 16; nRow <= 21; nRow++)
{
- CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0));
- CellType nType2 = rDoc.GetCellType(ScAddress(nCol + 4, nRow, 0));
- bHasIdx1 = pListData->GetSubIndex(rDoc.GetString(nCol, nRow, 0), nIdx1, bMatchCase);
- bHasIdx2 = pListData->GetSubIndex(rDoc.GetString(nCol + 4, nRow, 0), nIdx2, bMatchCase);
+ CellType nType1 = pDoc->GetCellType(ScAddress(nCol, nRow, 0));
+ CellType nType2 = pDoc->GetCellType(ScAddress(nCol + 4, nRow, 0));
+ bHasIdx1 = pListData->GetSubIndex(pDoc->GetString(nCol, nRow, 0), nIdx1, bMatchCase);
+ bHasIdx2 = pListData->GetSubIndex(pDoc->GetString(nCol + 4, nRow, 0), nIdx2, bMatchCase);
CPPUNIT_ASSERT_EQUAL(nType1, nType2);
CPPUNIT_ASSERT(bHasIdx1);
@@ -664,18 +678,19 @@ void ScCopyPasteTest::tdf137653_137654_autofillUserlist()
void ScCopyPasteTest::tdf113500_autofillMixed()
{
- ScDocShellRef xDocSh = loadDocAndSetupModelViewController(u"tdf113500_autofillMixed.", FORMAT_ODS);
- ScDocument& rDoc = xDocSh->GetDocument();
+ loadFromURL(u"ods/tdf113500_autofillMixed.ods");
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
// Get the document controller
- ScTabViewShell* pView = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pView != nullptr);
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
// fillauto userlist, these areas contain only merged cells
- pView->FillAuto(FILL_TO_RIGHT, 4, 5, 6, 7, 3); //E6:G8
- pView->FillAuto(FILL_TO_LEFT, 4, 5, 6, 7, 3); //E6:G8
- pView->FillAuto(FILL_TO_BOTTOM, 1, 18, 3, 19, 2); //B19:D20
- pView->FillAuto(FILL_TO_TOP, 1, 18, 3, 19, 2); //B19:D20
+ pViewShell->FillAuto(FILL_TO_RIGHT, 4, 5, 6, 7, 3); //E6:G8
+ pViewShell->FillAuto(FILL_TO_LEFT, 4, 5, 6, 7, 3); //E6:G8
+ pViewShell->FillAuto(FILL_TO_BOTTOM, 1, 18, 3, 19, 2); //B19:D20
+ pViewShell->FillAuto(FILL_TO_TOP, 1, 18, 3, 19, 2); //B19:D20
// compare the results of fill-right / -left with the reference stored in the test file
// this compares the whole area blindly, for specific test cases, check the test file
@@ -684,10 +699,10 @@ void ScCopyPasteTest::tdf113500_autofillMixed()
{
for (int nRow = 5; nRow <= 6; nRow++)
{
- CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0));
- CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 4, 0));
- OUString aStr1 = rDoc.GetString(nCol, nRow, 0);
- OUString aStr2 = rDoc.GetString(nCol, nRow + 4, 0);
+ CellType nType1 = pDoc->GetCellType(ScAddress(nCol, nRow, 0));
+ CellType nType2 = pDoc->GetCellType(ScAddress(nCol, nRow + 4, 0));
+ OUString aStr1 = pDoc->GetString(nCol, nRow, 0);
+ OUString aStr2 = pDoc->GetString(nCol, nRow + 4, 0);
CPPUNIT_ASSERT_EQUAL(nType1, nType2);
CPPUNIT_ASSERT_EQUAL(aStr1, aStr2);
@@ -700,10 +715,10 @@ void ScCopyPasteTest::tdf113500_autofillMixed()
{
for (int nRow = 16; nRow <= 21; nRow++)
{
- CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0));
- CellType nType2 = rDoc.GetCellType(ScAddress(nCol + 4, nRow, 0));
- OUString aStr1 = rDoc.GetString(nCol, nRow, 0);
- OUString aStr2 = rDoc.GetString(nCol + 4, nRow, 0);
+ CellType nType1 = pDoc->GetCellType(ScAddress(nCol, nRow, 0));
+ CellType nType2 = pDoc->GetCellType(ScAddress(nCol + 4, nRow, 0));
+ OUString aStr1 = pDoc->GetString(nCol, nRow, 0);
+ OUString aStr2 = pDoc->GetString(nCol + 4, nRow, 0);
CPPUNIT_ASSERT_EQUAL(nType1, nType2);
CPPUNIT_ASSERT_EQUAL(aStr1, aStr2);
@@ -713,12 +728,13 @@ void ScCopyPasteTest::tdf113500_autofillMixed()
void ScCopyPasteTest::tdf137625_autofillMergedUserlist()
{
- ScDocShellRef xDocSh = loadDocAndSetupModelViewController(u"tdf137625_autofillMergedUserlist.", FORMAT_ODS);
- ScDocument& rDoc = xDocSh->GetDocument();
+ loadFromURL(u"ods/tdf137625_autofillMergedUserlist.ods");
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
// Get the document controller
- ScTabViewShell* pView = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pView != nullptr);
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
// delete every userlist to make sure there won't be any string that is in 2 different userlist
ScGlobal::GetUserList()->clear();
@@ -729,10 +745,10 @@ void ScCopyPasteTest::tdf137625_autofillMergedUserlist()
bool bMatchCase = false;
// fillauto userlist, these areas contain only merged cells
- pView->FillAuto(FILL_TO_RIGHT, 7, 5, 12, 7, 6); //H6:M8
- pView->FillAuto(FILL_TO_LEFT, 7, 5, 12, 7, 6); //H6:M8
- pView->FillAuto(FILL_TO_BOTTOM, 1, 20, 3, 23, 4); //B21:D24
- pView->FillAuto(FILL_TO_TOP, 1, 20, 3, 23, 4); //B21:D24
+ pViewShell->FillAuto(FILL_TO_RIGHT, 7, 5, 12, 7, 6); //H6:M8
+ pViewShell->FillAuto(FILL_TO_LEFT, 7, 5, 12, 7, 6); //H6:M8
+ pViewShell->FillAuto(FILL_TO_BOTTOM, 1, 20, 3, 23, 4); //B21:D24
+ pViewShell->FillAuto(FILL_TO_TOP, 1, 20, 3, 23, 4); //B21:D24
// compare the results of fill-right / -left with the reference stored in the test file
// this compares the whole area blindly, for specific test cases, check the test file
@@ -740,10 +756,10 @@ void ScCopyPasteTest::tdf137625_autofillMergedUserlist()
{
for (int nRow = 5; nRow <= 7; nRow++)
{
- CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0));
- CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 4, 0));
- bHasIdx1 = pListData->GetSubIndex(rDoc.GetString(nCol, nRow, 0), nIdx1, bMatchCase);
- bHasIdx2 = pListData->GetSubIndex(rDoc.GetString(nCol, nRow + 4, 0), nIdx2, bMatchCase);
+ CellType nType1 = pDoc->GetCellType(ScAddress(nCol, nRow, 0));
+ CellType nType2 = pDoc->GetCellType(ScAddress(nCol, nRow + 4, 0));
+ bHasIdx1 = pListData->GetSubIndex(pDoc->GetString(nCol, nRow, 0), nIdx1, bMatchCase);
+ bHasIdx2 = pListData->GetSubIndex(pDoc->GetString(nCol, nRow + 4, 0), nIdx2, bMatchCase);
CPPUNIT_ASSERT_EQUAL(nType1, nType2);
CPPUNIT_ASSERT_EQUAL(bHasIdx1, bHasIdx2);
@@ -757,10 +773,10 @@ void ScCopyPasteTest::tdf137625_autofillMergedUserlist()
{
for (int nRow = 16; nRow <= 27; nRow++)
{
- CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0));
- CellType nType2 = rDoc.GetCellType(ScAddress(nCol + 4, nRow, 0));
- bHasIdx1 = pListData->GetSubIndex(rDoc.GetString(nCol, nRow, 0), nIdx1, bMatchCase);
- bHasIdx2 = pListData->GetSubIndex(rDoc.GetString(nCol + 4, nRow, 0), nIdx2, bMatchCase);
+ CellType nType1 = pDoc->GetCellType(ScAddress(nCol, nRow, 0));
+ CellType nType2 = pDoc->GetCellType(ScAddress(nCol + 4, nRow, 0));
+ bHasIdx1 = pListData->GetSubIndex(pDoc->GetString(nCol, nRow, 0), nIdx1, bMatchCase);
+ bHasIdx2 = pListData->GetSubIndex(pDoc->GetString(nCol + 4, nRow, 0), nIdx2, bMatchCase);
CPPUNIT_ASSERT_EQUAL(nType1, nType2);
CPPUNIT_ASSERT_EQUAL(bHasIdx1, bHasIdx2);
@@ -772,12 +788,13 @@ void ScCopyPasteTest::tdf137625_autofillMergedUserlist()
void ScCopyPasteTest::tdf137624_autofillMergedMixed()
{
- ScDocShellRef xDocSh = loadDocAndSetupModelViewController(u"tdf137624_autofillMergedMixed.", FORMAT_ODS);
- ScDocument& rDoc = xDocSh->GetDocument();
+ loadFromURL(u"ods/tdf137624_autofillMergedMixed.ods");
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
// Get the document controller
- ScTabViewShell* pView = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pView != nullptr);
+ ScTabViewShell* pViewShell = ScDocShell::GetViewData()->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
@@ -785,10 +802,10 @@ void ScCopyPasteTest::tdf137624_autofillMergedMixed()
addToUserList({ "1aa,2bb,3cc,4dd,5ee,6ff" });
// fillauto mixed (string + number), these areas contain only merged cells
- pView->FillAuto(FILL_TO_RIGHT, 7, 5, 12, 7, 6); //H6:M8
- pView->FillAuto(FILL_TO_LEFT, 7, 5, 12, 7, 6); //H6:M8
- pView->FillAuto(FILL_TO_BOTTOM, 1, 20, 3, 23, 4); //B21:D24
- pView->FillAuto(FILL_TO_TOP, 1, 20, 3, 23, 4); //B21:D24
+ pViewShell->FillAuto(FILL_TO_RIGHT, 7, 5, 12, 7, 6); //H6:M8
+ pViewShell->FillAuto(FILL_TO_LEFT, 7, 5, 12, 7, 6); //H6:M8
+ pViewShell->FillAuto(FILL_TO_BOTTOM, 1, 20, 3, 23, 4); //B21:D24
+ pViewShell->FillAuto(FILL_TO_TOP, 1, 20, 3, 23, 4); //B21:D24
// compare the results of fill-right / -left with the reference stored in the test file
// this compares the whole area blindly, for specific test cases, check the test file
@@ -796,10 +813,10 @@ void ScCopyPasteTest::tdf137624_autofillMergedMixed()
{
for (int nRow = 5; nRow <= 7; nRow++)
{
- CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0));
- CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 4, 0));
- OUString aStr1 = rDoc.GetString(nCol, nRow, 0);
- OUString aStr2 = rDoc.GetString(nCol, nRow + 4, 0);
+ CellType nType1 = pDoc->GetCellType(ScAddress(nCol, nRow, 0));
+ CellType nType2 = pDoc->GetCellType(ScAddress(nCol, nRow + 4, 0));
+ OUString aStr1 = pDoc->GetString(nCol, nRow, 0);
+ OUString aStr2 = pDoc->GetString(nCol, nRow + 4, 0);
CPPUNIT_ASSERT_EQUAL(nType1, nType2);
CPPUNIT_ASSERT_EQUAL(aStr1, aStr2);
@@ -811,10 +828,10 @@ void ScCopyPasteTest::tdf137624_autofillMergedMixed()
{
for (int nRow = 16; nRow <= 27; nRow++)
{
- CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0));
- CellType nType2 = rDoc.GetCellType(ScAddress(nCol + 4, nRow, 0));
- OUString aStr1 = rDoc.GetString(nCol, nRow, 0);
- OUString aStr2 = rDoc.GetString(nCol + 4, nRow, 0);
+ CellType nType1 = pDoc->GetCellType(ScAddress(nCol, nRow, 0));
+ CellType nType2 = pDoc->GetCellType(ScAddress(nCol + 4, nRow, 0));
+ OUString aStr1 = pDoc->GetString(nCol, nRow, 0);
+ OUString aStr2 = pDoc->GetString(nCol + 4, nRow, 0);
CPPUNIT_ASSERT_EQUAL(nType1, nType2);
CPPUNIT_ASSERT_EQUAL(aStr1, aStr2);
@@ -823,7 +840,7 @@ void ScCopyPasteTest::tdf137624_autofillMergedMixed()
}
ScCopyPasteTest::ScCopyPasteTest()
- : ScBootstrapFixture( "sc/qa/unit/data" )
+ : UnoApiTest("/sc/qa/unit/data/")
{
}