diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-02-19 00:51:16 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-02-20 03:46:14 +0100 |
commit | dc0cdf9396af7cd0d4517fac102a604b99834e68 (patch) | |
tree | 6ce70c4b2103afc415bfadb624215999ff3a5b77 /sc/qa/unit/subsequent_filters-test.cxx | |
parent | 60ae5f530c3123341a8c2d49793693c2cd4521c2 (diff) |
add test for tdf#115530
Change-Id: Ie1eb79d34ca79d1cf085e235e1ead4d886ea7df5
Reviewed-on: https://gerrit.libreoffice.org/49958
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/qa/unit/subsequent_filters-test.cxx')
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 44 |
1 files changed, 44 insertions, 0 deletions
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" ) { |