diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-16 23:05:40 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-16 23:08:48 -0400 |
commit | 30cc43a56d63ba9ffd588ebc589e3576483d7141 (patch) | |
tree | b2350c06680bfb7b1b9bdb7064dd0e8956e3a3a2 /sc | |
parent | e8b2e9163c953048e9e5f7f6cb9392b66be26e01 (diff) |
fdo#77735: Write test for this. This test will freeze with the bug present.
Change-Id: I7b7e67fe2ee59b57ce74f8303d30bebc84f6b0d0
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 25 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 |
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); |