summaryrefslogtreecommitdiff
path: root/sc/qa/unit/ucalc.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/qa/unit/ucalc.cxx')
-rw-r--r--sc/qa/unit/ucalc.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 596bd92c7954..275e4a04eadf 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -56,6 +56,7 @@
#include <asciiopt.hxx>
#include <impex.hxx>
#include <columnspanset.hxx>
+#include <docoptio.hxx>
#include "formula/IFunctionDescription.hxx"
@@ -1189,6 +1190,42 @@ void Test::testHorizontalIterator()
m_pDoc->DeleteTab(0);
}
+void Test::testValueIterator()
+{
+ m_pDoc->InsertTab(0, "Test");
+
+ // Turn on "precision as shown" option.
+ ScDocOptions aOpt = m_pDoc->GetDocOptions();
+ aOpt.SetCalcAsShown(true);
+ m_pDoc->SetDocOptions(aOpt);
+
+ // Purely horizontal data layout with numeric data.
+ for (SCCOL i = 1; i <= 3; ++i)
+ m_pDoc->SetValue(ScAddress(i,2,0), i);
+
+ double fVal;
+ sal_uInt16 nErr;
+
+ {
+ const double aChecks[] = { 1.0, 2.0, 3.0 };
+ size_t nCheckLen = SAL_N_ELEMENTS(aChecks);
+
+ ScValueIterator aIter(m_pDoc, ScRange(1,2,0,3,2,0));
+ bool bHas = false;
+
+ size_t nCheckPos = 0;
+ for (bHas = aIter.GetFirst(fVal, nErr); bHas; bHas = aIter.GetNext(fVal, nErr), ++nCheckPos)
+ {
+ CPPUNIT_ASSERT_MESSAGE("Iteration longer than expected.", nCheckPos < nCheckLen);
+ CPPUNIT_ASSERT_EQUAL(aChecks[nCheckPos], fVal);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(0), nErr);
+ }
+ }
+
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testFormulaDepTracking()
{
CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", m_pDoc->InsertTab (0, "foo"));