diff options
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 28 |
2 files changed, 30 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 9028928f3136..732ab5b1ec3d 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -168,6 +168,7 @@ public: void testFormulaRefUpdateValidity(); void testTokenArrayRefUpdateMove(); void testSingleCellCopyColumnLabel(); + void testIntersectionOpExcel(); void testMultipleOperations(); void testFuncCOLUMN(); void testFuncCOUNT(); @@ -574,6 +575,7 @@ public: CPPUNIT_TEST(testFormulaRefUpdateNameDelete); CPPUNIT_TEST(testFormulaRefUpdateValidity); CPPUNIT_TEST(testTokenArrayRefUpdateMove); + CPPUNIT_TEST(testIntersectionOpExcel); CPPUNIT_TEST(testMultipleOperations); CPPUNIT_TEST(testFuncCOLUMN); CPPUNIT_TEST(testFuncCOUNT); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 8647328a8aa9..0458749df73a 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -7832,4 +7832,32 @@ void Test::testSingleCellCopyColumnLabel() m_pDoc->DeleteTab(0); } +// Significant whitespace operator intersection in Excel syntax, tdf#96426 +void Test::testIntersectionOpExcel() +{ + CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test")); + + ScRangeName* pGlobalNames = m_pDoc->GetRangeName(); + // Horizontal cell range covering C2. + pGlobalNames->insert( new ScRangeData( m_pDoc, "horz", "$B$2:$D$2")); + // Vertical cell range covering C2. + pGlobalNames->insert( new ScRangeData( m_pDoc, "vert", "$C$1:$C$3")); + // Data in C2. + m_pDoc->SetString(2,1,0,"1"); + + m_pDoc->SetGrammar(FormulaGrammar::GRAM_ENGLISH_XL_A1); + + // Choose formular positions that don't intersect with those data ranges. + ScAddress aPos(0,3,0); + m_pDoc->SetString(aPos,"=B2:D2 C1:C3"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("A4 intersecting references failed", 1.0, m_pDoc->GetValue(aPos)); + aPos.IncRow(); + m_pDoc->SetString(aPos,"=horz vert"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("A5 intersecting named expressions failed", 1.0, m_pDoc->GetValue(aPos)); + + m_pDoc->SetGrammar(FormulaGrammar::GRAM_ENGLISH); + + m_pDoc->DeleteTab(0); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |