summaryrefslogtreecommitdiff
path: root/sc/qa/unit
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-07-14 01:55:45 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-07-14 10:28:10 +0200
commitbe7203eca9745bd39d167777d7ec824954b3e4c0 (patch)
tree783746b6049abc55063e5b37564df0fb9a26426e /sc/qa/unit
parent1ce2d70bc29b348f2f819d616a897e1dcb6a1a9f (diff)
add test for tdf#91385
Change-Id: Ic755d330f242a78214e8b1610aa496ecce3d61b4 Reviewed-on: https://gerrit.libreoffice.org/57410 Tested-by: Jenkins Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/qa/unit')
-rw-r--r--sc/qa/unit/ucalc.hxx2
-rw-r--r--sc/qa/unit/ucalc_condformat.cxx38
2 files changed, 40 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 60cee22b07c2..e2c778a01dda 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -523,6 +523,7 @@ public:
void testMultipleSingleCellCondFormatCopyPaste();
void testDeduplicateMultipleCondFormats();
void testCondFormatListenToOwnRange();
+ void testCondFormatVolatileFunctionRecalc();
void testImportStream();
void testDeleteContents();
@@ -812,6 +813,7 @@ public:
CPPUNIT_TEST(testCondFormatUndoList);
CPPUNIT_TEST(testMultipleSingleCellCondFormatCopyPaste);
CPPUNIT_TEST(testDeduplicateMultipleCondFormats);
+ CPPUNIT_TEST(testCondFormatVolatileFunctionRecalc);
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 62b0ba9dace0..d2bf5d23c6df 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -1226,4 +1226,42 @@ void Test::testCondFormatListenToOwnRange()
m_pDoc->DeleteTab(0);
}
+void Test::testCondFormatVolatileFunctionRecalc()
+{
+ m_pDoc->InsertTab(0, "Test");
+
+ m_pDoc->SetValue(0, 0, 0, 0.5);
+
+ ScConditionalFormatList* pList = m_pDoc->GetCondFormList(0);
+
+ ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc);
+ ScRangeList aRangeList(ScRange(0,0,0,10,0,0));
+ pFormat->SetRange(aRangeList);
+
+ ScCondFormatEntry* pEntry = new ScCondFormatEntry(ScConditionMode::Greater,"RAND()","",m_pDoc,ScAddress(0,0,0),ScResId(STR_STYLENAME_RESULT));
+ pEntry->SetParent(pFormat);
+
+ m_pDoc->AddCondFormatData(pFormat->GetRange(), 0, 1);
+ pFormat->AddEntry(pEntry);
+ pList->InsertNew(pFormat);
+
+ ScRefCellValue aCell(*m_pDoc, ScAddress(0, 0, 0));
+ bool bValid = pEntry->IsCellValid(aCell, ScAddress(0, 0, 0));
+
+ bool bNewValid = bValid;
+ // chance of a random failure is 0.5^100, anyone hitting that will get a beer from me
+ for (size_t i = 0; i < 100; ++i)
+ {
+ pFormat->CalcAll();
+ bNewValid = pEntry->IsCellValid(aCell, ScAddress(0, 0, 0));
+
+ if (bValid != bNewValid)
+ break;
+ }
+
+ CPPUNIT_ASSERT(bValid != bNewValid);
+
+ m_pDoc->DeleteTab(0);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */