summaryrefslogtreecommitdiff
path: root/sc/qa/unit/ucalc.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/qa/unit/ucalc.cxx')
-rw-r--r--sc/qa/unit/ucalc.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 55b8b9c94405..4b7e4fd5c1eb 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -121,7 +121,16 @@ public:
*/
void testSheetsFunc();
void testVolatileFunc();
+
+ /**
+ * Basic test for formula dependency tracking.
+ */
void testFormulaDepTracking();
+
+ /**
+ * Another test for formula dependency tracking, inspired by fdo#56278.
+ */
+ void testFormulaDepTracking2();
void testFuncParam();
void testNamedRange();
void testCSV();
@@ -248,6 +257,7 @@ public:
CPPUNIT_TEST(testSheetsFunc);
CPPUNIT_TEST(testVolatileFunc);
CPPUNIT_TEST(testFormulaDepTracking);
+ CPPUNIT_TEST(testFormulaDepTracking2);
CPPUNIT_TEST(testFuncParam);
CPPUNIT_TEST(testNamedRange);
CPPUNIT_TEST(testCSV);
@@ -1223,6 +1233,30 @@ void Test::testFormulaDepTracking()
m_pDoc->DeleteTab(0);
}
+void Test::testFormulaDepTracking2()
+{
+ CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", m_pDoc->InsertTab (0, "foo"));
+
+ AutoCalcSwitch aACSwitch(m_pDoc, true); // turn on auto calculation.
+
+ double val = 2.0;
+ m_pDoc->SetValue(0, 0, 0, val);
+ val = 4.0;
+ m_pDoc->SetValue(1, 0, 0, val);
+ val = 5.0;
+ m_pDoc->SetValue(0, 1, 0, val);
+ m_pDoc->SetString(2, 0, 0, "=A1/B1");
+ m_pDoc->SetString(1, 1, 0, "=B1*C1");
+
+ CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(1, 1, 0)); // B2 should equal 2.
+
+ clearRange(m_pDoc, ScAddress(2, 0, 0)); // Delete C1.
+
+ CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(1, 1, 0)); // B2 should now equal 0.
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testFuncParam()
{
rtl::OUString aTabName("foo");