summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.hxx2
-rw-r--r--sc/qa/unit/ucalc_formula.cxx36
2 files changed, 38 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index e2c778a01dda..1d46b3d50800 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -148,6 +148,7 @@ public:
void testFormulaCompilerImplicitIntersection1ParamNoChange();
void testFormulaCompilerImplicitIntersection1ParamWithChange();
void testFormulaCompilerImplicitIntersection1NoGroup();
+ void testFormulaCompilerImplicitIntersectionOperators();
void testFormulaRefUpdate();
void testFormulaRefUpdateRange();
void testFormulaRefUpdateSheets();
@@ -579,6 +580,7 @@ public:
CPPUNIT_TEST(testFormulaCompilerImplicitIntersection1ParamNoChange);
CPPUNIT_TEST(testFormulaCompilerImplicitIntersection1ParamWithChange);
CPPUNIT_TEST(testFormulaCompilerImplicitIntersection1NoGroup);
+ CPPUNIT_TEST(testFormulaCompilerImplicitIntersectionOperators);
CPPUNIT_TEST(testFormulaRefUpdate);
CPPUNIT_TEST(testFormulaRefUpdateRange);
CPPUNIT_TEST(testFormulaRefUpdateSheets);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index a3b0125c9beb..3b69bce3049f 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -1426,6 +1426,42 @@ void Test::testFormulaCompilerImplicitIntersection1NoGroup()
m_pDoc->DeleteTab(0);
}
+void Test::testFormulaCompilerImplicitIntersectionOperators()
+{
+ struct TestCase
+ {
+ OUString formula[3];
+ double result[3];
+ };
+
+ m_pDoc->InsertTab(0, "Test");
+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
+
+ m_pDoc->SetValue(2, 0, 0, 5); // C1
+ m_pDoc->SetValue(2, 1, 0, 4); // C2
+ m_pDoc->SetValue(2, 2, 0, 3); // C3
+ m_pDoc->SetValue(3, 0, 0, 1); // D1
+ m_pDoc->SetValue(3, 1, 0, 2); // D2
+ m_pDoc->SetValue(3, 2, 0, 3); // D3
+
+ TestCase tests[] =
+ {
+ { OUString("=C:C/D:D"), OUString("=C:C/D:D"), OUString("=C:C/D:D"), 5, 2, 1 },
+ { OUString("=C1:C2/D1:D2"), OUString("=C2:C3/D2:D3"), OUString("=C3:C4/D3:D4"), 5, 2, 1 }
+ };
+
+ for (const TestCase& test : tests)
+ {
+ for(int i = 0; i < 2; ++i )
+ m_pDoc->SetString(ScAddress(4,i,0), test.formula[i]); // E1-3
+ for(int i = 0; i < 2; ++i )
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OUString( test.formula[i] + " result incorrect in row " + OUString::number(i+1)).toUtf8().getStr(),
+ test.result[i], m_pDoc->GetValue(ScAddress(4,i,0)));
+ }
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testFormulaRefUpdate()
{
m_pDoc->InsertTab(0, "Formula");