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

Markus Mohrhard markus.mohrhard at googlemail.com
Tue Feb 20 02:46:37 UTC 2018


 sc/inc/document.hxx                                    |    2 
 sc/inc/hints.hxx                                       |    2 
 sc/qa/unit/data/xlsx/cond_format_formula_listener.xlsx |binary
 sc/qa/unit/subsequent_filters-test.cxx                 |   44 +++++++++++++++++
 4 files changed, 46 insertions(+), 2 deletions(-)

New commits:
commit dc0cdf9396af7cd0d4517fac102a604b99834e68
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 19 00:51:16 2018 +0100

    add test for tdf#115530
    
    Change-Id: Ie1eb79d34ca79d1cf085e235e1ead4d886ea7df5
    Reviewed-on: https://gerrit.libreoffice.org/49958
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a2e661a76dd0..08fa0849ff09 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1455,7 +1455,7 @@ public:
     void                         SetClipArea( const ScRange& rArea, bool bCut = false );
 
     SC_DLLPUBLIC bool            IsDocVisible() const                        { return bIsVisible; }
-    void                         SetDocVisible( bool bSet );
+    SC_DLLPUBLIC void            SetDocVisible( bool bSet );
 
     bool                         HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark = nullptr );
 
diff --git a/sc/inc/hints.hxx b/sc/inc/hints.hxx
index 7dc6dbfa3a56..cd3817120530 100644
--- a/sc/inc/hints.hxx
+++ b/sc/inc/hints.hxx
@@ -24,7 +24,7 @@
 #include "address.hxx"
 #include <svl/hint.hxx>
 
-class ScPaintHint : public SfxHint
+class SC_DLLPUBLIC ScPaintHint : public SfxHint
 {
     ScRange         aRange;
     PaintPartFlags  nParts;
diff --git a/sc/qa/unit/data/xlsx/cond_format_formula_listener.xlsx b/sc/qa/unit/data/xlsx/cond_format_formula_listener.xlsx
new file mode 100644
index 000000000000..97d7845c3511
Binary files /dev/null and b/sc/qa/unit/data/xlsx/cond_format_formula_listener.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 4f72dddadf44..6a8c051cf15e 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -64,6 +64,7 @@
 #include <formula/errorcodes.hxx>
 #include <externalrefmgr.hxx>
 #include <stlpool.hxx>
+#include <hints.hxx>
 
 #include <orcusfiltersimpl.hxx>
 #include <orcusfilters.hxx>
@@ -234,6 +235,7 @@ public:
 #ifdef UNX
     void testUnicodeFileNameGnumeric();
 #endif
+    void testCondFormatFormulaListenerXLSX();
 
     void testMergedCellsXLSXML();
     void testBackgroundColorStandardXLSXML();
@@ -365,6 +367,7 @@ public:
     CPPUNIT_TEST(testBackgroundColorStandardXLSXML);
     CPPUNIT_TEST(testNamedExpressionsXLSXML);
     CPPUNIT_TEST(testEmptyRowsXLSXML);
+    CPPUNIT_TEST(testCondFormatFormulaListenerXLSX);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -3749,6 +3752,47 @@ void ScFiltersTest::testActiveXCheckboxXLSX()
     xDocSh->DoClose();
 }
 
+namespace {
+
+struct PaintListener : public SfxListener
+{
+    bool mbCalled = false;
+    virtual void Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) override
+    {
+        const ScPaintHint* pPaintHint = dynamic_cast<const ScPaintHint*>(&rHint);
+        if (pPaintHint)
+        {
+            if (pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 0
+                    && pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() >= 9)
+            {
+                mbCalled = true;
+            }
+        }
+    }
+};
+
+}
+
+void ScFiltersTest::testCondFormatFormulaListenerXLSX()
+{
+    ScDocShellRef xDocSh = loadDoc("cond_format_formula_listener.", FORMAT_XLSX);
+    PaintListener aListener;
+    aListener.StartListening(*xDocSh);
+    ScDocument& rDoc = xDocSh->GetDocument();
+    ScConditionalFormatList* pList = rDoc.GetCondFormList(0);
+    CPPUNIT_ASSERT(pList);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), pList->size());
+    ScConditionalFormat* pFormat = pList->begin()->get();
+    CPPUNIT_ASSERT(pFormat);
+    rDoc.SetDocVisible(true);
+    rDoc.SetValue(0, 0, 0, 2.0);
+
+    CPPUNIT_ASSERT(aListener.mbCalled);
+
+    xDocSh->DoClose();
+}
+
 ScFiltersTest::ScFiltersTest()
       : ScBootstrapFixture( "sc/qa/unit/data" )
 {


More information about the Libreoffice-commits mailing list