sc/qa/unit/uicalc/data/tdf108292.ods |binary sc/qa/unit/uicalc/uicalc.cxx | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+)
New commits: commit 7bc16436e28153dfdd01e8d49cd193f62098476c Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue Mar 22 13:27:35 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Mar 22 14:20:47 2022 +0100 tdf#108292: sc_uicalc: Add unittest Change-Id: I0543b0ce1914ff5d69370802b65da311c37111f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131935 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/unit/uicalc/data/tdf108292.ods b/sc/qa/unit/uicalc/data/tdf108292.ods new file mode 100644 index 000000000000..6f698fb71264 Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf108292.ods differ diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 69282fcd0661..aff4574845da 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1150,6 +1150,34 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117706) CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 2, 0))); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf108292) +{ + ScModelObj* pModelObj = createDoc("tdf108292.ods"); + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + Scheduler::ProcessEventsToIdle(); + + dispatchCommand(mxComponent, ".uno:Copy", {}); + Scheduler::ProcessEventsToIdle(); + + mxComponent->dispose(); + + // Open a new document + mxComponent = loadFromDesktop("private:factory/scalc"); + pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); + CPPUNIT_ASSERT(pModelObj); + pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + // Without the fix in place, this test would have crashed + dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(OUString("2D"), pDoc->GetString(ScAddress(26, 0, 0))); +} + // Inspired from testTdf117706, test columns instead of rows CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testMultiRangeCol) {