summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/qa/unit/ucalc.cxx25
-rw-r--r--sc/qa/unit/ucalc.hxx2
2 files changed, 27 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 14a323ba32e4..b08671180196 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3706,6 +3706,31 @@ void Test::testCopyPasteSkipEmpty()
m_pDoc->DeleteTab(0);
}
+void Test::testCopyPasteSkipEmpty2()
+{
+ m_pDoc->InsertTab(0, "Test");
+
+ m_pDoc->SetString(ScAddress(0,0,0), "A");
+ m_pDoc->SetString(ScAddress(2,0,0), "C");
+
+ // Copy A1:C1 to clipboard.
+ ScDocument aClipDoc(SCDOCMODE_CLIP);
+ aClipDoc.ResetClip(m_pDoc, static_cast<SCTAB>(0));
+ copyToClip(m_pDoc, ScRange(0,0,0,2,0,0), &aClipDoc);
+
+ // Paste to A3 with the skip empty option set. This used to freeze. (fdo#77735)
+ ScRange aDestRange(0,2,0,2,2,0);
+ ScMarkData aMark;
+ aMark.SetMarkArea(aDestRange);
+ m_pDoc->CopyFromClip(aDestRange, aMark, IDF_ALL, NULL, &aClipDoc, false, false, true, true);
+
+ CPPUNIT_ASSERT_EQUAL(OUString("A"), m_pDoc->GetString(ScAddress(0,2,0)));
+ CPPUNIT_ASSERT_MESSAGE("B3 should be empty.", m_pDoc->GetCellType(ScAddress(1,2,0)) == CELLTYPE_NONE);
+ CPPUNIT_ASSERT_EQUAL(OUString("C"), m_pDoc->GetString(ScAddress(2,2,0)));
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testCopyPasteSkipEmptyConditionalFormatting()
{
m_pDoc->InsertTab(0, "Test");
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 35d57ceec8a9..66fbfd52db23 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -273,6 +273,7 @@ public:
void testCopyPasteTranspose();
void testCopyPasteMultiRange();
void testCopyPasteSkipEmpty();
+ void testCopyPasteSkipEmpty2();
void testCopyPasteSkipEmptyConditionalFormatting();
void testCutPasteRefUndo();
void testUndoCut();
@@ -469,6 +470,7 @@ public:
CPPUNIT_TEST(testCopyPasteTranspose);
CPPUNIT_TEST(testCopyPasteMultiRange);
CPPUNIT_TEST(testCopyPasteSkipEmpty);
+ CPPUNIT_TEST(testCopyPasteSkipEmpty2);
//CPPUNIT_TEST(testCopyPasteSkipEmptyConditionalFormatting);
CPPUNIT_TEST(testCutPasteRefUndo);
CPPUNIT_TEST(testUndoCut);