summaryrefslogtreecommitdiff
path: root/sc/qa/unit/ucalc.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-03-21 20:44:28 +0100
committerEike Rathke <erack@redhat.com>2016-03-21 20:47:45 +0100
commitc4af2adea07fe87a0d785f413fd8cc4b1adc5e33 (patch)
treedb25549df7d4f7543b97ac3f8c60b6e9a70cc7e6 /sc/qa/unit/ucalc.cxx
parent0149e87df9f09f325f8a04f495d561b8deb1e625 (diff)
unit test for copying cells within named range, tdf#93127
Change-Id: I7bf6cd1c328e1d6eda5b67f05ec4870efe001b68
Diffstat (limited to 'sc/qa/unit/ucalc.cxx')
-rw-r--r--sc/qa/unit/ucalc.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 98e5bad035d1..f9ba17419c6a 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3298,8 +3298,11 @@ void Test::testCopyPaste()
ScRangeData* pLocal4 = new ScRangeData( m_pDoc, "local4", "Sheet1.$A$1");
ScRangeData* pLocal5 = new ScRangeData( m_pDoc, "local5", "$A$1"); // implicit relative sheet reference
ScRangeData* pGlobal = new ScRangeData( m_pDoc, "global", aAdr);
+ const OUString aGlobal2Symbol("$Sheet1.$A$1:$A$23");
+ ScRangeData* pGlobal2 = new ScRangeData( m_pDoc, "global2", aGlobal2Symbol);
ScRangeName* pGlobalRangeName = new ScRangeName();
pGlobalRangeName->insert(pGlobal);
+ pGlobalRangeName->insert(pGlobal2);
ScRangeName* pLocalRangeName1 = new ScRangeName();
pLocalRangeName1->insert(pLocal1);
pLocalRangeName1->insert(pLocal2);
@@ -3427,6 +3430,24 @@ void Test::testCopyPaste()
CPPUNIT_ASSERT_EQUAL_MESSAGE("After Redo, note again on Sheet2.C2, string cell content",
m_pDoc->GetNote(ScAddress(2, 0, 0))->GetText(), m_pDoc->GetNote(ScAddress(2, 1, 1))->GetText());
+
+ // Copy Sheet1.A11:A13 to Sheet1.A7:A9, both within global2 range.
+ aRange = ScRange(0,10,0,0,12,0);
+ ScDocument aClipDoc2(SCDOCMODE_CLIP);
+ copyToClip(m_pDoc, aRange, &aClipDoc2);
+
+ aRange = ScRange(0,6,0,0,8,0);
+ aMark.SetMarkArea(aRange);
+ m_pDoc->CopyFromClip(aRange, aMark, InsertDeleteFlags::ALL, nullptr, &aClipDoc2);
+
+ // The global2 range must not have changed.
+ pGlobal2 = m_pDoc->GetRangeName()->findByUpperName("GLOBAL2");
+ CPPUNIT_ASSERT_MESSAGE("GLOBAL2 name not found", pGlobal2);
+ OUString aSymbol;
+ pGlobal2->GetSymbol(aSymbol);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("GLOBAL2 named range changed", aGlobal2Symbol, aSymbol);
+
+
m_pDoc->DeleteTab(1);
m_pDoc->DeleteTab(0);
}