sc/qa/unit/uicalc/data/tdf92963.ods |binary
 sc/qa/unit/uicalc/uicalc.cxx        |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

New commits:
commit 2bc4fad3a82d3fa763630db497a861550567c126
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Jan 25 21:10:17 2021 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jan 26 09:01:46 2021 +0100

    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 <xiscofa...@libreoffice.org>

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
Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf92963.ods 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");
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to