summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-04-30 22:33:16 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-05-01 09:44:37 +0000
commit8465e99a27168a2c0a62e84b819e9e133f47ddf8 (patch)
tree58b7aaeb0ed9e66f555a6c25be89c68ebf50a359
parent039b75d6cdc26dcce03e37c67115405e6f2a8ebe (diff)
add test for tdf#98990
Change-Id: I0789d250aa52994948c392c1e8f06c5546defc8f Reviewed-on: https://gerrit.libreoffice.org/24546 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/qa/unit/ucalc.hxx4
-rw-r--r--sc/qa/unit/ucalc_formula.cxx32
2 files changed, 36 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 9427367ca6a6..6896c8e6e0e9 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -198,6 +198,8 @@ public:
void testFuncMDETERM();
void testMatConcat();
void testMatConcatReplication();
+ void testRefR1C1WholeCol();
+ void testRefR1C1WholeRow();
void testExternalRef();
void testExternalRefFunctions();
@@ -550,6 +552,8 @@ public:
CPPUNIT_TEST(testFuncIFERROR);
CPPUNIT_TEST(testFuncGETPIVOTDATA);
CPPUNIT_TEST(testFuncGETPIVOTDATALeafAccess);
+ CPPUNIT_TEST(testRefR1C1WholeCol);
+ CPPUNIT_TEST(testRefR1C1WholeRow);
CPPUNIT_TEST(testMatrixOp);
CPPUNIT_TEST(testFuncRangeOp);
CPPUNIT_TEST(testFuncFORMULA);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index d47ea6aa54e2..54f1318948ea 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -7176,4 +7176,36 @@ void Test::testMatConcatReplication()
m_pDoc->DeleteTab(0);
}
+void Test::testRefR1C1WholeCol()
+{
+ CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test"));
+
+ ScAddress aPos(1, 1, 1);
+ ScCompiler aComp(m_pDoc, aPos);
+ aComp.SetGrammar(FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
+ std::unique_ptr<ScTokenArray> pTokens(aComp.CompileString("=C[10]"));
+ sc::TokenStringContext aCxt(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH);
+ OUString aFormula = pTokens->CreateString(aCxt, aPos);
+
+ CPPUNIT_ASSERT_EQUAL(OUString("L:L"), aFormula);
+
+ m_pDoc->DeleteTab(0);
+}
+
+void Test::testRefR1C1WholeRow()
+{
+ CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test"));
+
+ ScAddress aPos(1, 1, 1);
+ ScCompiler aComp(m_pDoc, aPos);
+ aComp.SetGrammar(FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
+ std::unique_ptr<ScTokenArray> pTokens(aComp.CompileString("=R[3]"));
+ sc::TokenStringContext aCxt(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH);
+ OUString aFormula = pTokens->CreateString(aCxt, aPos);
+
+ CPPUNIT_ASSERT_EQUAL(OUString("5:5"), aFormula);
+
+ m_pDoc->DeleteTab(0);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */