Kaydet (Commit) 70ec826e authored tarafından Kohei Yoshida's avatar Kohei Yoshida

New unit test to ensure correct matrix creation.

See fdo#56829 for what inspired this test case.

Change-Id: Iee15d85a35ae96769d21ce7061b352860a5b587b
üst 78bf3c9a
......@@ -125,6 +125,7 @@ public:
void testNamedRange();
void testCSV();
void testMatrix();
void testEnterMixedMatrix();
/**
* Basic test for pivot tables.
......@@ -250,6 +251,7 @@ public:
CPPUNIT_TEST(testNamedRange);
CPPUNIT_TEST(testCSV);
CPPUNIT_TEST(testMatrix);
CPPUNIT_TEST(testEnterMixedMatrix);
CPPUNIT_TEST(testPivotTable);
CPPUNIT_TEST(testPivotTableLabels);
CPPUNIT_TEST(testPivotTableDateLabels);
......@@ -1513,6 +1515,31 @@ void Test::testMatrix()
checkMatrixElements<PartiallyFilledEmptyMatrix>(*pMat);
}
void Test::testEnterMixedMatrix()
{
m_pDoc->InsertTab(0, "foo");
// Insert the source values in A1:B2.
m_pDoc->SetString(0, 0, 0, "A");
m_pDoc->SetString(1, 0, 0, "B");
double val = 1.0;
m_pDoc->SetValue(0, 1, 0, val);
val = 2.0;
m_pDoc->SetValue(1, 1, 0, val);
// Create a matrix range in A4:B5 referencing A1:B2.
ScMarkData aMark;
aMark.SelectOneTable(0);
m_pDoc->InsertMatrixFormula(0, 3, 1, 4, aMark, "=A1:B2", NULL);
CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(0,0,0), m_pDoc->GetString(0,3,0));
CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(1,0,0), m_pDoc->GetString(1,3,0));
CPPUNIT_ASSERT_EQUAL(m_pDoc->GetValue(0,1,0), m_pDoc->GetValue(0,4,0));
CPPUNIT_ASSERT_EQUAL(m_pDoc->GetValue(1,1,0), m_pDoc->GetValue(1,4,0));
m_pDoc->DeleteTab(0);
}
namespace {
struct DPFieldDef
......
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