summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-01-18 14:36:33 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-01-18 14:41:42 -0500
commitc55d52262ea1d5f869a9528fd051ee19e687f1cc (patch)
treea6e1006b20330584d62dd611ddd9580fb4a28e37 /sc/qa
parentc881b1b50e3be023efd4dfdebddd002545ed71b3 (diff)
fdo#58988, fdo#58562: Populate draw clip document with data for charts.
Without populating the clip document, copying a chart (or charts) into clipboard makes the charts lose all their referenced data, which causes the pasted chart to appear empty. Change-Id: I3675f76baed19b48cec403964c19df00725a044b
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.cxx31
1 files changed, 30 insertions, 1 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 9e116c3aeb60..6a2ac0fbfcfe 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -117,7 +117,7 @@ public:
void testRangeList();
void testInput();
void testCellFunctions();
-
+ void testCopyToDocument();
/**
* Make sure the SHEETS function gets properly updated during sheet
* insertion and removal.
@@ -268,6 +268,7 @@ public:
CPPUNIT_TEST(testRangeList);
CPPUNIT_TEST(testInput);
CPPUNIT_TEST(testCellFunctions);
+ CPPUNIT_TEST(testCopyToDocument);
CPPUNIT_TEST(testSheetsFunc);
CPPUNIT_TEST(testVolatileFunc);
CPPUNIT_TEST(testFormulaDepTracking);
@@ -1153,6 +1154,34 @@ void Test::testCellFunctions()
m_pDoc->DeleteTab(0);
}
+void Test::testCopyToDocument()
+{
+ CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", m_pDoc->InsertTab (0, "src"));
+
+ m_pDoc->SetString(0, 0, 0, "Header");
+ m_pDoc->SetString(0, 1, 0, "1");
+ m_pDoc->SetString(0, 2, 0, "2");
+ m_pDoc->SetString(0, 3, 0, "3");
+ m_pDoc->SetString(0, 4, 0, "=4/2");
+ m_pDoc->CalcAll();
+
+ // Copy statically to another document.
+
+ ScDocument aDestDoc(SCDOCMODE_DOCUMENT);
+ aDestDoc.InsertTab(0, "src");
+ m_pDoc->CopyStaticToDocument(ScRange(0,1,0,0,3,0), 0, &aDestDoc); // Copy A2:A4
+ m_pDoc->CopyStaticToDocument(ScAddress(0,0,0), 0, &aDestDoc); // Copy A1
+ m_pDoc->CopyStaticToDocument(ScRange(0,4,0,0,7,0), 0, &aDestDoc); // Copy A5:A8
+
+ CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(0,0,0), aDestDoc.GetString(0,0,0));
+ CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(0,1,0), aDestDoc.GetString(0,1,0));
+ CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(0,2,0), aDestDoc.GetString(0,2,0));
+ CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(0,3,0), aDestDoc.GetString(0,3,0));
+ CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(0,4,0), aDestDoc.GetString(0,4,0));
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testSheetsFunc()
{
rtl::OUString aTabName1("test1");