[Libreoffice-commits] core.git: sc/qa

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Mar 17 02:32:32 UTC 2017


 sc/qa/unit/ucalc.hxx            |    2 ++
 sc/qa/unit/ucalc_condformat.cxx |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

New commits:
commit 1bffa5e110772a7d6183ac64e56c23f2c3019f93
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Mar 16 22:00:15 2017 +0100

    add more conditional format one cell to range tests, related tdf#106242
    
    Change-Id: I6daa394618f7d2b06251091497128fa96391d386
    Reviewed-on: https://gerrit.libreoffice.org/35296
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index fb2390c1f5da..b172776c0ac5 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -469,6 +469,7 @@ public:
     void testCondCopyPasteSingleCell(); //e.g. fdo#82503
     void testCondCopyPasteSingleCellToRange(); //e.g. fdo#82503
     void testCondCopyPasteSingleRowToRange(); //e.g. tdf#106242
+    void testCondCopyPasteSingleRowToRange2();
     void testCondCopyPasteSheetBetweenDoc();
     void testCondCopyPasteSheet();
     void testIconSet();
@@ -747,6 +748,7 @@ public:
     CPPUNIT_TEST(testCondCopyPasteSingleCell);
     CPPUNIT_TEST(testCondCopyPasteSingleCellToRange);
     CPPUNIT_TEST(testCondCopyPasteSingleRowToRange);
+    CPPUNIT_TEST(testCondCopyPasteSingleRowToRange2);
     CPPUNIT_TEST(testCondCopyPasteSheetBetweenDoc);
     CPPUNIT_TEST(testCondCopyPasteSheet);
     CPPUNIT_TEST(testCondFormatEndsWithStr);
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 0b0a8a2af97b..391766f9f146 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -411,6 +411,38 @@ void Test::testCondCopyPasteSingleRowToRange()
     m_pDoc->DeleteTab(0);
 }
 
+void Test::testCondCopyPasteSingleRowToRange2()
+{
+    m_pDoc->InsertTab(0, "Test");
+
+    ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc);
+    ScRange aCondFormatRange(0,0,0,0,0,0);
+    ScRangeList aRangeList(aCondFormatRange);
+    pFormat->SetRange(aRangeList);
+
+    ScCondFormatEntry* pEntry = new ScCondFormatEntry(SC_COND_DIRECT,"=B2","",m_pDoc,ScAddress(0,0,0),ScGlobal::GetRscString(STR_STYLENAME_RESULT));
+    pFormat->AddEntry(pEntry);
+    m_pDoc->AddCondFormat(pFormat, 0);
+
+    ScDocument aClipDoc(SCDOCMODE_CLIP);
+    copyToClip(m_pDoc, ScRange(0,0,0,3,0,0), &aClipDoc);
+    ScRange aTargetRange(0,4,0,MAXCOL,4,0);
+    pasteOneCellFromClip(m_pDoc, aTargetRange, &aClipDoc);
+
+    std::set<sal_uLong> aCondFormatIndices;
+
+    for (SCCOL nCol = 0; nCol <= MAXCOL; ++nCol)
+    {
+        ScConditionalFormat* pNewFormat = m_pDoc->GetCondFormat(nCol, 4, 0);
+        if (nCol % 4 == 0)
+            CPPUNIT_ASSERT(pNewFormat);
+        else
+            CPPUNIT_ASSERT(!pNewFormat);
+    }
+
+    m_pDoc->DeleteTab(0);
+}
+
 void Test::testCondCopyPasteSheetBetweenDoc()
 {
     m_pDoc->InsertTab(0, "Test");


More information about the Libreoffice-commits mailing list