sc/qa/unit/opencl-test.cxx | 7 +++---- sc/qa/unit/ucalc_formula.cxx | 36 +++++++++++++++++++++++++++++++++++- sc/source/core/data/column2.cxx | 2 +- 3 files changed, 39 insertions(+), 6 deletions(-)
New commits: commit 94a569c25026ea67f18ace8a075e13ac355ff3d2 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Thu Oct 31 12:35:30 2013 -0400 Don't hard-code the start row position of string array to 0... Change-Id: I06724e2e8754ac20217f5375a445c85f9a5b31e6 diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index cf5fa7e..862d24c 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -237,13 +237,12 @@ void ScOpenclTest::testCompilerString() // Check the results of formula cells in the shared formula range. for (SCROW i = 1; i < 5; ++i) { -#if 0 double fLibre = pDoc->GetValue(ScAddress(2, i, 0)); double fExcel = pDocRes->GetValue(ScAddress(2, i, 0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); -#endif - double fLibre = pDoc->GetValue(ScAddress(3, i, 0)); - double fExcel = pDocRes->GetValue(ScAddress(3, i, 0)); + + fLibre = pDoc->GetValue(ScAddress(3, i, 0)); + fExcel = pDocRes->GetValue(ScAddress(3, i, 0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); } xDocSh->DoClose(); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index ce9ce2e..92eebc2 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -61,7 +61,13 @@ bool equals( const formula::VectorRefArray& rArray, size_t nPos, const OUString& if (!rArray.mpStringArray) return false; - return OUString(rArray.mpStringArray[nPos]).equalsIgnoreAsciiCase(rVal); + bool bEquals = OUString(rArray.mpStringArray[nPos]).equalsIgnoreAsciiCase(rVal); + if (!bEquals) + { + cerr << "Expected: " << rVal.toAsciiUpperCase() << " (upcased)" << endl; + cerr << "Actual: " << OUString(rArray.mpStringArray[nPos]) << " (upcased)" << endl; + } + return bEquals; } } @@ -235,6 +241,34 @@ void Test::testFetchVectorRefArray() CPPUNIT_ASSERT_MESSAGE("Array should have a numeric array.", aArray.mpNumericArray); CPPUNIT_ASSERT_MESSAGE("Array should NOT have a string array.", !aArray.mpStringArray); + // Column G consists only of strings. + m_pDoc->SetString(ScAddress(6,0,0), "Title"); + m_pDoc->SetString(ScAddress(6,1,0), "foo"); + m_pDoc->SetString(ScAddress(6,2,0), "bar"); + m_pDoc->SetString(ScAddress(6,3,0), "foo"); + m_pDoc->SetString(ScAddress(6,4,0), "baz"); + m_pDoc->SetString(ScAddress(6,5,0), "quack"); + m_pDoc->SetString(ScAddress(6,6,0), "beep"); + m_pDoc->SetString(ScAddress(6,7,0), "kerker"); + + aArray = m_pDoc->FetchVectorRefArray(ScAddress(6,1,0), 4); // G2:G5 + CPPUNIT_ASSERT_MESSAGE("Failed to fetch vector ref array.", aArray.isValid()); + CPPUNIT_ASSERT_MESSAGE("Array should NOT have a numeric array.", !aArray.mpNumericArray); + CPPUNIT_ASSERT_MESSAGE("Array should have a string array.", aArray.mpStringArray); + CPPUNIT_ASSERT_MESSAGE("Unexpected string cell.", equals(aArray, 0, "foo")); + CPPUNIT_ASSERT_MESSAGE("Unexpected string cell.", equals(aArray, 1, "bar")); + CPPUNIT_ASSERT_MESSAGE("Unexpected string cell.", equals(aArray, 2, "foo")); + CPPUNIT_ASSERT_MESSAGE("Unexpected string cell.", equals(aArray, 3, "baz")); + + aArray = m_pDoc->FetchVectorRefArray(ScAddress(6,2,0), 4); // G3:G6 + CPPUNIT_ASSERT_MESSAGE("Failed to fetch vector ref array.", aArray.isValid()); + CPPUNIT_ASSERT_MESSAGE("Array should NOT have a numeric array.", !aArray.mpNumericArray); + CPPUNIT_ASSERT_MESSAGE("Array should have a string array.", aArray.mpStringArray); + CPPUNIT_ASSERT_MESSAGE("Unexpected string cell.", equals(aArray, 0, "bar")); + CPPUNIT_ASSERT_MESSAGE("Unexpected string cell.", equals(aArray, 1, "foo")); + CPPUNIT_ASSERT_MESSAGE("Unexpected string cell.", equals(aArray, 2, "baz")); + CPPUNIT_ASSERT_MESSAGE("Unexpected string cell.", equals(aArray, 3, "quack")); + m_pDoc->DeleteTab(0); } diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 5176d82..4715b48 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2722,7 +2722,7 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( SCROW nRow1, SCROW nRow2 { // Requested range falls within the first block. copyFirstStringBlock(*pDocument, rArray, nRow2+1, itBlk); - return formula::VectorRefArray(&rArray[0]); + return formula::VectorRefArray(&rArray[nRow1]); } copyFirstStringBlock(*pDocument, rArray, itBlk->size, itBlk); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits