diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2018-07-17 11:38:40 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2018-07-31 16:00:45 +0200 |
commit | 3c15daa2a11d675a37b2d75a3f9952cfd60b3e98 (patch) | |
tree | aaee45f1b03ae9235d39ac35877f46795f8f0002 /sc/qa | |
parent | 0522251d5bf21185b907acb068619dbfc3ac4684 (diff) |
even more implicit intersection computation
This extends 60c5ca1b87 to do implicit intersection while generating
RPN code for even more opcodes. This will serve as a basis for making
it possible to know when ScGroupTokenConverter can convert svDoubleRef
to a matrix without the problems mentioned in its convert() method.
Change-Id: I8dfeefc026418bd5644bd266ad94c31f670e811c
Reviewed-on: https://gerrit.libreoffice.org/57958
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 36 |
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"); |