summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-13 09:53:23 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-03-13 10:24:39 -0400
commite5802954853a9ec64fb5fec917f8c3b2daba6526 (patch)
treee0f7f22d1b1789a7e72f64eb757fb8331992c5f1 /sc/qa
parent72922d8fe70a66ad0ccf2577e354dc4a1cf4fafc (diff)
fdo#75642: Add test case for this.
Change-Id: I220cc3aeac79325e7664461d3bd5219e9e1f04f7
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.cxx6
-rw-r--r--sc/qa/unit/ucalc.hxx1
-rw-r--r--sc/qa/unit/ucalc_formula.cxx18
3 files changed, 24 insertions, 1 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 3c809a8b11af..ed5e894bf483 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5575,6 +5575,12 @@ void Test::clearRange(ScDocument* pDoc, const ScRange& rRange)
rRange.aEnd.Col(), rRange.aEnd.Row(), aMarkData, IDF_CONTENTS);
}
+void Test::clearSheet(ScDocument* pDoc, SCTAB nTab)
+{
+ ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab);
+ clearRange(pDoc, aRange);
+}
+
void Test::copyToClip(ScDocument* pSrcDoc, const ScRange& rRange, ScDocument* pClipDoc)
{
ScClipParam aClipParam(rRange, false);
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index d17c8f54fca9..68f5bc4c0d68 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -42,6 +42,7 @@ public:
static bool insertRangeNames(ScDocument* pDoc, const RangeNameDef* p, const RangeNameDef* pEnd);
static void printRange(ScDocument* pDoc, const ScRange& rRange, const char* pCaption);
static void clearRange(ScDocument* pDoc, const ScRange& rRange);
+ static void clearSheet(ScDocument* pDoc, SCTAB nTab);
static void copyToClip(ScDocument* pSrcDoc, const ScRange& rRange, ScDocument* pClipDoc);
static void pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc);
static ScUndoPaste* createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* pUndoDoc);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 3fcc89686fc8..8bf8435db929 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -2458,7 +2458,7 @@ void Test::testFuncVLOOKUP()
}
// Clear the sheet and start over.
- clearRange(m_pDoc, ScRange(0,0,0,MAXCOL,MAXROW,0));
+ clearSheet(m_pDoc, 0);
// Lookup on sorted data intersparsed with empty cells.
@@ -2492,6 +2492,22 @@ void Test::testFuncVLOOKUP()
CPPUNIT_ASSERT_EQUAL(OUString("Four"), m_pDoc->GetString(ScAddress(4,3,0)));
CPPUNIT_ASSERT_EQUAL(OUString("Four"), m_pDoc->GetString(ScAddress(4,4,0)));
+ // Start over again.
+ clearSheet(m_pDoc, 0);
+
+ // Set A,B,....,G to A1:A7.
+ m_pDoc->SetString(ScAddress(0,0,0), "A");
+ m_pDoc->SetString(ScAddress(0,1,0), "B");
+ m_pDoc->SetString(ScAddress(0,2,0), "C");
+ m_pDoc->SetString(ScAddress(0,3,0), "D");
+ m_pDoc->SetString(ScAddress(0,4,0), "E");
+ m_pDoc->SetString(ScAddress(0,5,0), "F");
+ m_pDoc->SetString(ScAddress(0,6,0), "G");
+
+ // Set the formula in C1.
+ m_pDoc->SetString(ScAddress(2,0,0), "=VLOOKUP(\"C\";A1:A16;1)");
+ CPPUNIT_ASSERT_EQUAL(OUString("C"), m_pDoc->GetString(ScAddress(2,0,0)));
+
m_pDoc->DeleteTab(0);
}