tdf#143979: sc_uicalc: Add unittest
Change-Id: I0c51e69521a290bb13e39f592a45b9d94634ad3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120911
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/uicalc/data/tdf143979.ods b/sc/qa/unit/uicalc/data/tdf143979.ods
new file mode 100644
index 0000000..0ebc22d
--- /dev/null
+++ b/sc/qa/unit/uicalc/data/tdf143979.ods
Binary files differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 034df5a..b7f2728 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -1739,6 +1739,30 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126540_GridToggleModifiesTheDocument)
CPPUNIT_ASSERT(pDocSh->IsModified());
}
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf143979)
{
ScModelObj* pModelObj = createDoc("tdf143979.ods");
ScDocument* pDoc = pModelObj->GetDocument();
CPPUNIT_ASSERT(pDoc);
goToCell("A5:B79");
dispatchCommand(mxComponent, ".uno:Copy", {});
Scheduler::ProcessEventsToIdle();
goToCell("D5");
//Without the fix in place, this test would have crashed
dispatchCommand(mxComponent, ".uno:PasteTransposed", {});
Scheduler::ProcessEventsToIdle();
for (size_t i = 3; i < 76; ++i)
{
OUString sExpected = "A" + OUString::number(i + 2);
CPPUNIT_ASSERT_EQUAL(sExpected, pDoc->GetString(ScAddress(i, 4, 0)));
}
}
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126926)
{
mxComponent = loadFromDesktop("private:factory/scalc");