summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-03-16 20:07:04 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-03-16 21:01:56 +0000
commitad9336f29650dc38be06d771f5c3dbc7f0078ff1 (patch)
tree0831aaa83d0ae8349cf055d409c896c7cf6da3ce
parent3f0f35c89f3f64fcb110483fd562a59f729dc344 (diff)
add tests for tdf#104026
Change-Id: I928828f5f3ee22429e174e6e761d6683a36fdb24 Reviewed-on: https://gerrit.libreoffice.org/35290 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/qa/unit/ucalc.hxx4
-rw-r--r--sc/qa/unit/ucalc_condformat.cxx40
2 files changed, 44 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 076e5b0e404a..92f0d6dd04d5 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -485,6 +485,8 @@ public:
void testCondFormatUpdateDeleteTab();
void testCondFormatUpdateInsertTab();
void testCondFormatUpdateReference();
+ void testCondFormatUpdateReferenceDelRow();
+ void testCondFormatUpdateReferenceInsRow();
void testCondFormatEndsWithStr();
void testCondFormatEndsWithVal();
@@ -745,6 +747,8 @@ public:
CPPUNIT_TEST(testCondCopyPasteSheet);
CPPUNIT_TEST(testCondFormatEndsWithStr);
CPPUNIT_TEST(testCondFormatEndsWithVal);
+ CPPUNIT_TEST(testCondFormatUpdateReferenceDelRow);
+ CPPUNIT_TEST(testCondFormatUpdateReferenceInsRow);
CPPUNIT_TEST(testIconSet);
CPPUNIT_TEST(testDataBarLengthAutomaticAxis);
CPPUNIT_TEST(testDataBarLengthMiddleAxis);
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 47230e100aac..ee0d8abee066 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -875,4 +875,44 @@ void Test::testCondFormatUpdateReference()
m_pDoc->DeleteTab(0);
}
+void Test::testCondFormatUpdateReferenceDelRow()
+{
+ m_pDoc->InsertTab(0, "test");
+
+ ScConditionEntry* pEntry = new ScConditionEntry(SC_COND_EQUAL, "B6", "", m_pDoc, ScAddress(0, 5, 0), "", "", formula::FormulaGrammar::GRAM_DEFAULT, formula::FormulaGrammar::GRAM_DEFAULT);
+
+ ScConditionalFormat* pFormat = new ScConditionalFormat(0, m_pDoc);
+ pFormat->SetRange(ScRange(0, 5, 0, 0, 5, 0));
+ m_pDoc->AddCondFormat(pFormat, 0);
+
+ pFormat->AddEntry(pEntry);
+
+ m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 4, 1);
+
+ OUString aStr = pEntry->GetExpression(ScAddress(0, 4, 0), 0);
+ CPPUNIT_ASSERT_EQUAL(OUString("B5"), aStr);
+
+ m_pDoc->DeleteTab(0);
+}
+
+void Test::testCondFormatUpdateReferenceInsRow()
+{
+ m_pDoc->InsertTab(0, "test");
+
+ ScConditionEntry* pEntry = new ScConditionEntry(SC_COND_EQUAL, "B6", "", m_pDoc, ScAddress(0, 5, 0), "", "", formula::FormulaGrammar::GRAM_DEFAULT, formula::FormulaGrammar::GRAM_DEFAULT);
+
+ ScConditionalFormat* pFormat = new ScConditionalFormat(0, m_pDoc);
+ pFormat->SetRange(ScRange(0, 5, 0, 0, 5, 0));
+ m_pDoc->AddCondFormat(pFormat, 0);
+
+ pFormat->AddEntry(pEntry);
+
+ m_pDoc->InsertRow(0, 0, MAXCOL, 0, 4, 1);
+
+ OUString aStr = pEntry->GetExpression(ScAddress(0, 6, 0), 0);
+ CPPUNIT_ASSERT_EQUAL(OUString("B7"), aStr);
+
+ m_pDoc->DeleteTab(0);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */