summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/qa/unit/ucalc_copypaste.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx
index 0fe6eb03f161..148accac85f9 100644
--- a/sc/qa/unit/ucalc_copypaste.cxx
+++ b/sc/qa/unit/ucalc_copypaste.cxx
@@ -113,6 +113,7 @@ public:
void testCopyPasteReferencesExternalDoc(); // tdf#106456
void testTdf68976();
void testTdf71058();
+ void testTdf149554();
void testCutPasteSpecial();
void testCutPasteSpecialTranspose();
@@ -217,6 +218,7 @@ public:
CPPUNIT_TEST(testTdf68976);
CPPUNIT_TEST(testTdf71058);
+ CPPUNIT_TEST(testTdf149554);
CPPUNIT_TEST(testCutPasteSpecial);
CPPUNIT_TEST(testCutPasteSpecialTranspose);
@@ -10351,6 +10353,34 @@ void TestCopyPaste::testTdf71058()
CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(3, 2, nTab));
}
+void TestCopyPaste::testTdf149554()
+{
+ const SCTAB nTab = 0;
+ m_pDoc->InsertTab(nTab, "Test");
+
+ // Cut C4:C5 to the clip document.
+ ScDocument aClipDoc(SCDOCMODE_CLIP);
+ ScRange aSrcRange(2, 3, nTab, 3, 3, nTab);
+ cutToClip(*m_xDocShell, aSrcRange, &aClipDoc, false);
+
+ // To E6:E7
+ ScRange aDestRange(4, 5, nTab, 4, 6, nTab);
+ ScMarkData aDestMark(m_pDoc->GetSheetLimits());
+
+ // Transpose
+ ScDocument* pOrigClipDoc = &aClipDoc;
+ ScDocumentUniquePtr pTransClip(new ScDocument(SCDOCMODE_CLIP));
+ aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::ALL, false, true);
+ aDestMark.SetMarkArea(aDestRange);
+ // Paste. Without the fix in place, this test would have crashed here
+ m_pDoc->CopyFromClip(aDestRange, aDestMark, InsertDeleteFlags::ALL, nullptr, pTransClip.get(),
+ true, false, true, false);
+ m_pDoc->UpdateTranspose(aDestRange.aStart, pOrigClipDoc, aDestMark, nullptr);
+ pTransClip.reset();
+
+ m_pDoc->DeleteTab(0);
+}
+
void TestCopyPaste::testMixData()
{
m_pDoc->InsertTab(0, "Test");