Kaydet (Commit) 30cc43a5 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

fdo#77735: Write test for this. This test will freeze with the bug present.

Change-Id: I7b7e67fe2ee59b57ce74f8303d30bebc84f6b0d0
üst e8b2e916
...@@ -3706,6 +3706,31 @@ void Test::testCopyPasteSkipEmpty() ...@@ -3706,6 +3706,31 @@ void Test::testCopyPasteSkipEmpty()
m_pDoc->DeleteTab(0); 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() void Test::testCopyPasteSkipEmptyConditionalFormatting()
{ {
m_pDoc->InsertTab(0, "Test"); m_pDoc->InsertTab(0, "Test");
......
...@@ -273,6 +273,7 @@ public: ...@@ -273,6 +273,7 @@ public:
void testCopyPasteTranspose(); void testCopyPasteTranspose();
void testCopyPasteMultiRange(); void testCopyPasteMultiRange();
void testCopyPasteSkipEmpty(); void testCopyPasteSkipEmpty();
void testCopyPasteSkipEmpty2();
void testCopyPasteSkipEmptyConditionalFormatting(); void testCopyPasteSkipEmptyConditionalFormatting();
void testCutPasteRefUndo(); void testCutPasteRefUndo();
void testUndoCut(); void testUndoCut();
...@@ -469,6 +470,7 @@ public: ...@@ -469,6 +470,7 @@ public:
CPPUNIT_TEST(testCopyPasteTranspose); CPPUNIT_TEST(testCopyPasteTranspose);
CPPUNIT_TEST(testCopyPasteMultiRange); CPPUNIT_TEST(testCopyPasteMultiRange);
CPPUNIT_TEST(testCopyPasteSkipEmpty); CPPUNIT_TEST(testCopyPasteSkipEmpty);
CPPUNIT_TEST(testCopyPasteSkipEmpty2);
//CPPUNIT_TEST(testCopyPasteSkipEmptyConditionalFormatting); //CPPUNIT_TEST(testCopyPasteSkipEmptyConditionalFormatting);
CPPUNIT_TEST(testCutPasteRefUndo); CPPUNIT_TEST(testCutPasteRefUndo);
CPPUNIT_TEST(testUndoCut); CPPUNIT_TEST(testUndoCut);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment