diff options
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_condformat.cxx | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 9acfdb76856f..85efd25e7dc2 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -493,6 +493,7 @@ public: void testFormulaListenerSingleCellToMultipleCells(); void testFormulaListenerMultipleCellsToMultipleCells(); void testFormulaListenerUpdateInsertTab(); + void testFormulaListenerUpdateDeleteTab(); // Check that the Listeners are correctly updated when we // call a operation @@ -789,6 +790,7 @@ public: CPPUNIT_TEST(testFormulaListenerMultipleCellsToSingleCell); CPPUNIT_TEST(testFormulaListenerMultipleCellsToMultipleCells); CPPUNIT_TEST(testFormulaListenerUpdateInsertTab); + CPPUNIT_TEST(testFormulaListenerUpdateDeleteTab); CPPUNIT_TEST(testImportStream); CPPUNIT_TEST(testDeleteContents); CPPUNIT_TEST(testTransliterateText); diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index 89ccc9cc405c..03e4682de635 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -830,6 +830,27 @@ void Test::testFormulaListenerUpdateInsertTab() m_pDoc->DeleteTab(0); } +void Test::testFormulaListenerUpdateDeleteTab() +{ + m_pDoc->InsertTab(0, "test"); + m_pDoc->InsertTab(0, "to_delete"); + + ScCompiler aCompiler(m_pDoc, ScAddress(10, 10, 1), formula::FormulaGrammar::GRAM_ENGLISH); + std::unique_ptr<ScTokenArray> pTokenArray(aCompiler.CompileString("A1")); + + ScFormulaListener aListener(m_pDoc); + aListener.addTokenArray(pTokenArray.get(), ScAddress(10, 10, 1)); + CPPUNIT_ASSERT(!aListener.NeedsRepaint()); + + m_pDoc->DeleteTab(0); + + // check that the listener has moved + m_pDoc->SetValue(ScAddress(0, 0, 0), 1.0); + CPPUNIT_ASSERT(aListener.NeedsRepaint()); + + m_pDoc->DeleteTab(0); +} + void Test::testCondFormatUpdateMoveTab() { m_pDoc->InsertTab(0, "test"); |