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

Markus Mohrhard markus.mohrhard at googlemail.com
Tue Jun 27 21:28:40 UTC 2017


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

New commits:
commit 0c9ad1c74d613ef1c53025b0415b78e1db9d3615
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jun 27 19:28:12 2017 +0200

    add test for formula listener during delete sheet
    
    Change-Id: I49c53048db575e60f5110b2161658c190ba2e7f8
    Reviewed-on: https://gerrit.libreoffice.org/39318
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

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


More information about the Libreoffice-commits mailing list