diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-01-25 21:10:17 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-01-26 09:01:46 +0100 |
commit | 2bc4fad3a82d3fa763630db497a861550567c126 (patch) | |
tree | 2f6fe1555e20041515bbcfc51efa317a2ad907a6 | |
parent | 2682feb036fdf566028a9cab83ba8369484e459b (diff) |
tdf#92963: sc_uitest: Add unittest
Change-Id: Ic47f2c715c362554a5b2fdd9f76f49043452d52c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109928
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sc/qa/unit/uicalc/data/tdf92963.ods | bin | 0 -> 11036 bytes | |||
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 36 |
2 files changed, 36 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/data/tdf92963.ods b/sc/qa/unit/uicalc/data/tdf92963.ods Binary files differnew file mode 100644 index 000000000000..a40765344890 --- /dev/null +++ b/sc/qa/unit/uicalc/data/tdf92963.ods diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 5924ff02bc8f..201ac6e10ae2 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -17,6 +17,7 @@ #include <comphelper/propertysequence.hxx> #include <com/sun/star/awt/Key.hpp> #include <com/sun/star/frame/Desktop.hpp> +#include <conditio.hxx> #include <dbfunc.hxx> #include <document.hxx> #include <docuno.hxx> @@ -101,6 +102,41 @@ ScModelObj* ScUiCalcTest::createDoc(const char* pName) return pModelObj; } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf92963) +{ + ScModelObj* pModelObj = createDoc("tdf92963.ods"); + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + // Disable replace cell warning + ScModule* pMod = SC_MOD(); + ScInputOptions aInputOption = pMod->GetInputOptions(); + bool bOldStatus = aInputOption.GetReplaceCellsWarn(); + aInputOption.SetReplaceCellsWarn(false); + pMod->SetInputOptions(aInputOption); + + ScConditionalFormatList* pList = pDoc->GetCondFormList(0); + CPPUNIT_ASSERT_EQUAL(size_t(3), pList->size()); + + lcl_SelectRangeFromString(*pDoc, "A3:C4"); + + ScDocument aClipDoc(SCDOCMODE_CLIP); + ScDocShell::GetViewData()->GetView()->CopyToClip(&aClipDoc, false, false, false, false); + Scheduler::ProcessEventsToIdle(); + + lcl_SelectRangeFromString(*pDoc, "A1:C1"); + + // Without the fix in place, this test would have crashed here + ScDocShell::GetViewData()->GetView()->PasteFromClip(InsertDeleteFlags::ALL, &aClipDoc); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(size_t(2), pList->size()); + + // Restore previous status + aInputOption.SetReplaceCellsWarn(bOldStatus); + pMod->SetInputOptions(aInputOption); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf68290) { ScModelObj* pModelObj = createDoc("tdf68290.ods"); |