tdf#138710: sc_uicalc: Add unittest
Change-Id: I5496637baf51035e16fe41d9036de2895d97fed2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108087
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/uicalc/data/tdf138710.ods b/sc/qa/unit/uicalc/data/tdf138710.ods
new file mode 100644
index 0000000..2a815a7
--- /dev/null
+++ b/sc/qa/unit/uicalc/data/tdf138710.ods
Binary files differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index d87ca61..2376779 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -93,6 +93,32 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf122232)
checkCurrentCell(2, 6);
}
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf138710)
{
ScModelObj* pModelObj = createDoc("tdf138710.ods");
ScDocument* pDoc = pModelObj->GetDocument();
CPPUNIT_ASSERT(pDoc);
dispatchCommand(mxComponent, ".uno:SelectAll", {});
// Without the fix in place, this test would have crashed here
dispatchCommand(mxComponent, ".uno:DeleteRows", {});
CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 0, 1)));
dispatchCommand(mxComponent, ".uno:Undo", {});
CPPUNIT_ASSERT_EQUAL(OUString("Total"), pDoc->GetString(ScAddress(0, 0, 1)));
dispatchCommand(mxComponent, ".uno:DeleteRows", {});
CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 0, 1)));
dispatchCommand(mxComponent, ".uno:Undo", {});
CPPUNIT_ASSERT_EQUAL(OUString("Total"), pDoc->GetString(ScAddress(0, 0, 1)));
}
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf133326)
{
ScModelObj* pModelObj = createDoc("tdf133326.ods");