summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-05-17 18:15:56 +0200
committerEike Rathke <erack@redhat.com>2017-05-17 18:16:43 +0200
commit67a4bb2204c841bf468504fcf5282787abc0e973 (patch)
tree1533ed32569a7f3e11b0542d1b8960ba96da9a6f /sc
parenttdf#104649: Add uitest (diff)
downloadcore-67a4bb2204c841bf468504fcf5282787abc0e973.tar.gz
core-67a4bb2204c841bf468504fcf5282787abc0e973.zip
add unit test for Excel whitespace operator intersection, tdf#96426
Change-Id: I8cc5d9fbb6a92545379288dc1648a6c68ad4ccb1
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/ucalc.hxx2
-rw-r--r--sc/qa/unit/ucalc_formula.cxx28
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: */