summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-01-25 21:10:17 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-01-26 09:01:46 +0100
commit2bc4fad3a82d3fa763630db497a861550567c126 (patch)
tree2f6fe1555e20041515bbcfc51efa317a2ad907a6
parent2682feb036fdf566028a9cab83ba8369484e459b (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.odsbin0 -> 11036 bytes
-rw-r--r--sc/qa/unit/uicalc/uicalc.cxx36
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
new file mode 100644
index 000000000000..a40765344890
--- /dev/null
+++ b/sc/qa/unit/uicalc/data/tdf92963.ods
Binary files differ
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");