Kaydet (Commit) 6437313b authored tarafından Kohei Yoshida's avatar Kohei Yoshida

fdo#74507: Write test for this to induce the crash during unit test run.

Change-Id: Ib25136c203f7da17a9b7f086916d870225bc729b
üst 850d1b78
......@@ -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"));
......
......@@ -137,6 +137,7 @@ public:
void testVolatileFunc();
void testHorizontalIterator();
void testValueIterator();
/**
* Basic test for formula dependency tracking.
......@@ -361,6 +362,7 @@ public:
CPPUNIT_TEST(testSheetsFunc);
CPPUNIT_TEST(testVolatileFunc);
CPPUNIT_TEST(testHorizontalIterator);
CPPUNIT_TEST(testValueIterator);
CPPUNIT_TEST(testFormulaDepTracking);
CPPUNIT_TEST(testFormulaDepTracking2);
CPPUNIT_TEST(testCellBroadcaster);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment