summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-02-18 03:32:02 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-02-18 03:33:44 +0100
commit5915d38e84c7a7861c169bea18c63824bcfdc470 (patch)
tree5a8d8a5655f1fefbadf6734ab45ddcddb9309183 /sc/qa
parentb57bad8422c0efee8a42660806765f36746bb2fe (diff)
add disabled test for conditional formatting with skip empty cells
Change-Id: I01920c1e27a1c9b0445524bc51292a48a6827877
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.cxx67
-rw-r--r--sc/qa/unit/ucalc.hxx2
2 files changed, 69 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 14dffd9f260b..7b4321faef80 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3883,6 +3883,73 @@ void Test::testCopyPasteSkipEmpty()
m_pDoc->DeleteTab(0);
}
+void Test::testCopyPasteSkipEmptyConditionalFormatting()
+{
+ m_pDoc->InsertTab(0, "Test");
+
+ ScRange aDestRange(0,0,0,1,2,0);
+ ScRange aSrcRange(3,3,0,5,4,0);
+
+ ScMarkData aMark;
+ aMark.SetMarkArea(aDestRange);
+
+ m_pDoc->SetValue(0,0,0,1);
+ m_pDoc->SetValue(1,0,0,1);
+ m_pDoc->SetValue(0,1,0,1);
+ m_pDoc->SetValue(0,2,0,1);
+ m_pDoc->SetValue(1,2,0,1);
+
+ //create conditional formatting for A1:B3
+ ScConditionalFormatList* pCondFormatList = new ScConditionalFormatList();
+ m_pDoc->SetCondFormList(pCondFormatList, 0);
+
+ ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc);
+ pFormat->AddRange(aDestRange);
+ sal_uLong nCondFormatKey = m_pDoc->AddCondFormat(pFormat, 0);
+
+ // Prepare a clipboard content interleaved with empty cells.
+ ScDocument aClipDoc(SCDOCMODE_CLIP);
+ aClipDoc.ResetClip(m_pDoc, &aMark);
+ ScClipParam aParam(aSrcRange, false);
+ aClipDoc.SetClipParam(aParam);
+ aClipDoc.SetValue(3,3,0,2);
+ aClipDoc.SetValue(4,3,0,2);
+ aClipDoc.SetValue(4,4,0,2);
+ aClipDoc.SetValue(3,5,0,2);
+ aClipDoc.SetValue(4,5,0,2);
+
+ ScConditionalFormat* pClipFormat = new ScConditionalFormat(2, &aClipDoc);
+ pClipFormat->AddRange(aSrcRange);
+ aClipDoc.AddCondFormat(pClipFormat, 0);
+
+ // Create undo document.
+ ScDocument* pUndoDoc = new ScDocument(SCDOCMODE_UNDO);
+ pUndoDoc->InitUndo(m_pDoc, 0, 0);
+ m_pDoc->CopyToDocument(aDestRange, IDF_CONTENTS, false, pUndoDoc, &aMark);
+
+ // Paste clipboard content onto A1:A5 but skip empty cells.
+ bool bSkipEmpty = true;
+ m_pDoc->CopyFromClip(aDestRange, aMark, IDF_CONTENTS, pUndoDoc, &aClipDoc, true, false, false, bSkipEmpty);
+
+ ScConditionalFormatList* pList = m_pDoc->GetCondFormList(0);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), pList->size());
+ CPPUNIT_ASSERT(m_pDoc->GetCondFormat(1,1,0));
+ // empty cell in copy area does not overwrite conditional formatting
+ CPPUNIT_ASSERT_EQUAL(sal_uInt32(nCondFormatKey), m_pDoc->GetCondFormat(1,1,0)->GetKey());
+ for(SCCOL nCol = 0; nCol <= 1; ++nCol)
+ {
+ for(SCROW nRow = 0; nRow <= 2; ++nRow)
+ {
+ if(nRow == 1 && nCol == 1)
+ continue;
+
+ CPPUNIT_ASSERT(m_pDoc->GetCondFormat(nCol, nRow, 0));
+ CPPUNIT_ASSERT(nCondFormatKey != m_pDoc->GetCondFormat(nCol, nRow, 0)->GetKey());
+ }
+ }
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testUndoCut()
{
m_pDoc->InsertTab(0, "Test");
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 2e57b31901bf..01cb9083e3e8 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -244,6 +244,7 @@ public:
void testCopyPasteAsLink();
void testCopyPasteTranspose();
void testCopyPasteSkipEmpty();
+ void testCopyPasteSkipEmptyConditionalFormatting();
void testUndoCut();
void testMoveBlock();
void testCopyPasteRelativeFormula();
@@ -411,6 +412,7 @@ public:
CPPUNIT_TEST(testCopyPasteAsLink);
CPPUNIT_TEST(testCopyPasteTranspose);
CPPUNIT_TEST(testCopyPasteSkipEmpty);
+ //CPPUNIT_TEST(testCopyPasteSkipEmptyConditionalFormatting);
CPPUNIT_TEST(testUndoCut);
CPPUNIT_TEST(testMoveBlock);
CPPUNIT_TEST(testCopyPasteRelativeFormula);