summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-06-27 19:17:22 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-06-27 20:20:03 +0200
commitecfe650f43292518117a2148ff02a458ce1b2028 (patch)
tree9c29d0f3520dbb3a52be436aad60c266513c3f70 /sc/qa
parentda4357fef9a4de2b51ab0e080c864d9e90e15b77 (diff)
add a test for listener update during insert tab
Change-Id: Ia726c76a448aaef97228a5c04d5fd876d5d4c67f Reviewed-on: https://gerrit.libreoffice.org/39313 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.hxx2
-rw-r--r--sc/qa/unit/ucalc_condformat.cxx24
2 files changed, 26 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index dac42e64b77b..9acfdb76856f 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -492,6 +492,7 @@ public:
void testFormulaListenerMultipleCellsToSingleCell();
void testFormulaListenerSingleCellToMultipleCells();
void testFormulaListenerMultipleCellsToMultipleCells();
+ void testFormulaListenerUpdateInsertTab();
// Check that the Listeners are correctly updated when we
// call a operation
@@ -787,6 +788,7 @@ public:
CPPUNIT_TEST(testFormulaListenerSingleCellToMultipleCells);
CPPUNIT_TEST(testFormulaListenerMultipleCellsToSingleCell);
CPPUNIT_TEST(testFormulaListenerMultipleCellsToMultipleCells);
+ CPPUNIT_TEST(testFormulaListenerUpdateInsertTab);
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 b5f2087971fd..89ccc9cc405c 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -806,6 +806,30 @@ void Test::testFormulaListenerMultipleCellsToMultipleCells()
m_pDoc->DeleteTab(0);
}
+void Test::testFormulaListenerUpdateInsertTab()
+{
+ m_pDoc->InsertTab(0, "test");
+
+ ScCompiler aCompiler(m_pDoc, ScAddress(10, 10, 0), formula::FormulaGrammar::GRAM_ENGLISH);
+ std::unique_ptr<ScTokenArray> pTokenArray(aCompiler.CompileString("A1"));
+
+ ScFormulaListener aListener(m_pDoc);
+ aListener.addTokenArray(pTokenArray.get(), ScAddress(10, 10, 0));
+ CPPUNIT_ASSERT(!aListener.NeedsRepaint());
+
+ m_pDoc->InsertTab(0, "new_tab");
+
+ // check that the listener has moved to the new sheet
+ m_pDoc->SetValue(ScAddress(0, 0, 1), 1.0);
+ CPPUNIT_ASSERT(aListener.NeedsRepaint());
+
+ // check that we are not listening to the old sheet
+ 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");