diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-06-14 10:37:26 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-06-14 21:22:00 +0200 |
commit | 629d2db54bd9f97d2c494b85637a83229275a1a6 (patch) | |
tree | 5c2b2866202700c217153e29a483403af2f861d2 /sc | |
parent | b33d89d8e97ba4bfb17743632dee471727d11ac5 (diff) |
tdf#149554: sc_ucalc_copypaste: Add unittest
Change-Id: Iba3cf497cdfaca64b75303d40bb062869bf3a50e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135816
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc_copypaste.cxx | 30 |
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"); |