[Libreoffice-commits] core.git: sc/qa

Markus Mohrhard markus.mohrhard at googlemail.com
Tue Jun 27 18:20:25 UTC 2017


 sc/qa/unit/ucalc.hxx            |    2 ++
 sc/qa/unit/ucalc_condformat.cxx |   24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

New commits:
commit ecfe650f43292518117a2148ff02a458ce1b2028
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jun 27 19:17:22 2017 +0200

    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 at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

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");


More information about the Libreoffice-commits mailing list