summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-06-27 19:28:12 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-06-27 23:28:17 +0200
commit0c9ad1c74d613ef1c53025b0415b78e1db9d3615 (patch)
treefd6958073e8ab2f170c9aac753cb0419ed07d32f
parent4a3cb4a7e9ff2e84ea29e3fe66dd8c92d4e5a50f (diff)
add test for formula listener during delete sheet
Change-Id: I49c53048db575e60f5110b2161658c190ba2e7f8 Reviewed-on: https://gerrit.libreoffice.org/39318 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/qa/unit/ucalc.hxx2
-rw-r--r--sc/qa/unit/ucalc_condformat.cxx21
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");