diff options
Diffstat (limited to 'sc/qa/unit')
-rw-r--r-- | sc/qa/unit/data/xlsx/cond_format_formula_listener.xlsx | bin | 0 -> 8545 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 44 |
2 files changed, 44 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/cond_format_formula_listener.xlsx b/sc/qa/unit/data/xlsx/cond_format_formula_listener.xlsx Binary files differnew file mode 100644 index 000000000000..97d7845c3511 --- /dev/null +++ b/sc/qa/unit/data/xlsx/cond_format_formula_listener.xlsx 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" ) { |