summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-06-18 12:14:29 +0200
committerNoel Grandin <noel@peralex.com>2014-06-24 11:34:21 +0200
commite2080e70fe8b085f18e868e46340454720fa94ca (patch)
tree4038d1d57b41b68a47d5ebbbe6ad390648ec6303 /sc/qa
parentf910280b8704ed9c289150a4ca3c8d60e15d0d97 (diff)
new compilerplugin returnbyref
Find places where we are returning a pointer to something, where we can be returning a reference. e.g. class A { struct X x; public X* getX() { return &x; } } which can be: public X& getX() { return x; } Change-Id: I796fd23fd36a18aedf6e36bc28f8fab4f518c6c7
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/extras/macros-test.cxx4
-rw-r--r--sc/qa/unit/filters-test.cxx172
-rw-r--r--sc/qa/unit/helper/qahelper.cxx14
-rw-r--r--sc/qa/unit/helper/qahelper.hxx2
-rw-r--r--sc/qa/unit/helper/shared_test_impl.hxx26
-rw-r--r--sc/qa/unit/opencl-test.cxx2986
-rw-r--r--sc/qa/unit/rangelst_test.cxx2
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx634
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx715
-rw-r--r--sc/qa/unit/ucalc.cxx74
-rw-r--r--sc/qa/unit/ucalc_formula.cxx114
-rw-r--r--sc/qa/unit/ucalc_sharedformula.cxx10
12 files changed, 2135 insertions, 2618 deletions
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index cd65d0987af2..3f210db0d68e 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -116,14 +116,14 @@ void ScMacrosTest::testStarBasic()
CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
ScDocShell* xDocSh = static_cast<ScDocShell*>(pFoundShell);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
SfxObjectShell::CallXScript(
xComponent,
"vnd.sun.Star.script:Standard.Module1.Macro1?language=Basic&location=document",
aParams, aRet, aOutParamIndex, aOutParam);
double aValue;
- pDoc->GetValue(0,0,0,aValue);
+ rDoc.GetValue(0,0,0,aValue);
std::cout << "returned value = " << aValue << std::endl;
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("script did not change the value of Sheet1.A1",2.0, aValue, 0.00001);
xDocSh->DoClose();
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 796a01d20836..33c96921a6e9 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -132,27 +132,27 @@ void ScFiltersTest::testCVEs()
namespace {
-void testRangeNameImpl(ScDocument* pDoc)
+void testRangeNameImpl(ScDocument& rDoc)
{
//check one range data per sheet and one global more detailed
//add some more checks here
- ScRangeData* pRangeData = pDoc->GetRangeName()->findByUpperName(OUString("GLOBAL1"));
+ ScRangeData* pRangeData = rDoc.GetRangeName()->findByUpperName(OUString("GLOBAL1"));
CPPUNIT_ASSERT_MESSAGE("range name Global1 not found", pRangeData);
double aValue;
- pDoc->GetValue(1,0,0,aValue);
+ rDoc.GetValue(1,0,0,aValue);
CPPUNIT_ASSERT_MESSAGE("range name Global1 should reference Sheet1.A1", aValue == 1);
- pRangeData = pDoc->GetRangeName(0)->findByUpperName(OUString("LOCAL1"));
+ pRangeData = rDoc.GetRangeName(0)->findByUpperName(OUString("LOCAL1"));
CPPUNIT_ASSERT_MESSAGE("range name Sheet1.Local1 not found", pRangeData);
- pDoc->GetValue(1,2,0,aValue);
+ rDoc.GetValue(1,2,0,aValue);
CPPUNIT_ASSERT_MESSAGE("range name Sheet1.Local1 should reference Sheet1.A3", aValue == 3);
- pRangeData = pDoc->GetRangeName(1)->findByUpperName(OUString("LOCAL2"));
+ pRangeData = rDoc.GetRangeName(1)->findByUpperName(OUString("LOCAL2"));
CPPUNIT_ASSERT_MESSAGE("range name Sheet2.Local2 not found", pRangeData);
//check for correct results for the remaining formulas
- pDoc->GetValue(1,1,0, aValue);
+ rDoc.GetValue(1,1,0, aValue);
CPPUNIT_ASSERT_MESSAGE("=global2 should be 2", aValue == 2);
- pDoc->GetValue(1,3,0, aValue);
+ rDoc.GetValue(1,3,0, aValue);
CPPUNIT_ASSERT_MESSAGE("=local2 should be 4", aValue == 4);
- pDoc->GetValue(2,0,0, aValue);
+ rDoc.GetValue(2,0,0, aValue);
CPPUNIT_ASSERT_MESSAGE("=SUM(global3) should be 10", aValue == 10);
}
@@ -166,42 +166,42 @@ void ScFiltersTest::testRangeNameODS()
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
- testRangeNameImpl(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ testRangeNameImpl(rDoc);
OUString aSheet2CSV("rangeExp_Sheet2.");
OUString aCSVPath;
createCSVPath( aSheet2CSV, aCSVPath );
- testFile( aCSVPath, pDoc, 1);
+ testFile( aCSVPath, rDoc, 1);
xDocSh->DoClose();
}
namespace {
-void testContentImpl(ScDocument* pDoc, sal_Int32 nFormat ) //same code for ods, xls, xlsx
+void testContentImpl(ScDocument& rDoc, sal_Int32 nFormat ) //same code for ods, xls, xlsx
{
double fValue;
//check value import
- pDoc->GetValue(0,0,0,fValue);
+ rDoc.GetValue(0,0,0,fValue);
CPPUNIT_ASSERT_MESSAGE("value not imported correctly", fValue == 1);
- pDoc->GetValue(0,1,0,fValue);
+ rDoc.GetValue(0,1,0,fValue);
CPPUNIT_ASSERT_MESSAGE("value not imported correctly", fValue == 2);
- OUString aString = pDoc->GetString(1, 0, 0);
+ OUString aString = rDoc.GetString(1, 0, 0);
//check string import
CPPUNIT_ASSERT_MESSAGE("string imported not correctly", aString == "String1");
- aString = pDoc->GetString(1, 1, 0);
+ aString = rDoc.GetString(1, 1, 0);
CPPUNIT_ASSERT_MESSAGE("string not imported correctly", aString == "String2");
//check basic formula import
// in case of DIF it just contains values
- pDoc->GetValue(2,0,0,fValue);
+ rDoc.GetValue(2,0,0,fValue);
CPPUNIT_ASSERT_MESSAGE("=2*3", fValue == 6);
- pDoc->GetValue(2,1,0,fValue);
+ rDoc.GetValue(2,1,0,fValue);
CPPUNIT_ASSERT_MESSAGE("=2+3", fValue == 5);
- pDoc->GetValue(2,2,0,fValue);
+ rDoc.GetValue(2,2,0,fValue);
CPPUNIT_ASSERT_MESSAGE("=2-3", fValue == -1);
- pDoc->GetValue(2,3,0,fValue);
+ rDoc.GetValue(2,3,0,fValue);
CPPUNIT_ASSERT_MESSAGE("=C1+C2", fValue == 11);
//check merged cells import
@@ -209,12 +209,12 @@ void testContentImpl(ScDocument* pDoc, sal_Int32 nFormat ) //same code for ods,
{
SCCOL nCol = 4;
SCROW nRow = 1;
- pDoc->ExtendMerge(4, 1, nCol, nRow, 0, false);
+ rDoc.ExtendMerge(4, 1, nCol, nRow, 0, false);
CPPUNIT_ASSERT_MESSAGE("merged cells are not imported", nCol == 5 && nRow == 2);
//check notes import
ScAddress aAddress(7, 2, 0);
- ScPostIt* pNote = pDoc->GetNote(aAddress);
+ ScPostIt* pNote = rDoc.GetNote(aAddress);
CPPUNIT_ASSERT_MESSAGE("note not imported", pNote);
CPPUNIT_ASSERT_EQUAL_MESSAGE("note text not imported correctly", pNote->GetText(), OUString("Test"));
}
@@ -229,8 +229,8 @@ void ScFiltersTest::testContentODS()
ScDocShellRef xDocSh = loadDoc("universal-content.", ODS);
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
- testContentImpl(pDoc, ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ testContentImpl(rDoc, ODS);
xDocSh->DoClose();
}
@@ -239,8 +239,8 @@ void ScFiltersTest::testContentXLS()
ScDocShellRef xDocSh = loadDoc("universal-content.", XLS);
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
- testContentImpl(pDoc, XLS);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ testContentImpl(rDoc, XLS);
xDocSh->DoClose();
}
@@ -249,8 +249,8 @@ void ScFiltersTest::testContentXLSX()
ScDocShellRef xDocSh = loadDoc("universal-content.", XLSX);
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
- testContentImpl(pDoc, XLSX);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ testContentImpl(rDoc, XLSX);
xDocSh->DoClose();
}
@@ -259,8 +259,8 @@ void ScFiltersTest::testContentXLSXStrict()
ScDocShellRef xDocSh = loadDoc("universal-content-strict.", XLSX);
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
- testContentImpl(pDoc, XLSX);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ testContentImpl(rDoc, XLSX);
xDocSh->DoClose();
}
@@ -269,9 +269,9 @@ void ScFiltersTest::testContentLotus123()
ScDocShellRef xDocSh = loadDoc("universal-content.", LOTUS123);
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
- testContentImpl(pDoc, LOTUS123);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(&rDoc);
+ testContentImpl(rDoc, LOTUS123);
xDocSh->DoClose();
}
@@ -279,8 +279,8 @@ void ScFiltersTest::testContentDIF()
{
ScDocShellRef xDocSh = loadDoc("universal-content.", DIF);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(&rDoc);
xDocSh->DoClose();
}
@@ -289,8 +289,8 @@ void ScFiltersTest::testContentDIF()
// ScDocShellRef xDocSh = loadDoc("universal-content.", XLS_XML);
// CPPUNIT_ASSERT(xDocSh);
//
-// ScDocument* pDoc = xDocSh->GetDocument();
-// CPPUNIT_ASSERT(pDoc);
+// ScDocument& rDoc = xDocSh->GetDocument();
+// CPPUNIT_ASSERT(&rDoc);
// testContentImpl(pDoc, XLS_XML);
// xDocSh->DoClose();
// }
@@ -299,17 +299,17 @@ void ScFiltersTest::testSharedFormulaXLS()
{
ScDocShellRef xDocSh = loadDoc("shared-formula/basic.", XLS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
xDocSh->DoHardRecalc(true);
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 18; ++i)
{
- double fVal = pDoc->GetValue(ScAddress(1,i,0));
+ double fVal = rDoc.GetValue(ScAddress(1,i,0));
double fCheck = i*10.0;
CPPUNIT_ASSERT_EQUAL(fCheck, fVal);
}
- ScFormulaCell* pCell = pDoc->GetFormulaCell(ScAddress(1,18,0));
+ ScFormulaCell* pCell = rDoc.GetFormulaCell(ScAddress(1,18,0));
CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pCell);
ScFormulaCellGroupRef xGroup = pCell->GetCellGroup();
CPPUNIT_ASSERT_MESSAGE("This cell should be a part of a cell group.", xGroup);
@@ -323,40 +323,40 @@ void ScFiltersTest::testSharedFormulaXLS()
xDocSh = loadDoc("shared-formula/gap.", XLS);
CPPUNIT_ASSERT(xDocSh.Is());
- pDoc = xDocSh->GetDocument();
- pDoc->CalcAll();
+ ScDocument& rDoc2 = xDocSh->GetDocument();
+ rDoc2.CalcAll();
- if (!checkFormula(*pDoc, ScAddress(1,0,0), "A1*20"))
+ if (!checkFormula(rDoc2, ScAddress(1,0,0), "A1*20"))
CPPUNIT_FAIL("Wrong formula.");
- if (!checkFormula(*pDoc, ScAddress(1,1,0), "A2*20"))
+ if (!checkFormula(rDoc2, ScAddress(1,1,0), "A2*20"))
CPPUNIT_FAIL("Wrong formula.");
- if (!checkFormula(*pDoc, ScAddress(1,2,0), "A3*20"))
+ if (!checkFormula(rDoc2, ScAddress(1,2,0), "A3*20"))
CPPUNIT_FAIL("Wrong formula.");
// There is an intentional gap at row 4.
- if (!checkFormula(*pDoc, ScAddress(1,4,0), "A5*20"))
+ if (!checkFormula(rDoc2, ScAddress(1,4,0), "A5*20"))
CPPUNIT_FAIL("Wrong formula.");
- if (!checkFormula(*pDoc, ScAddress(1,5,0), "A6*20"))
+ if (!checkFormula(rDoc2, ScAddress(1,5,0), "A6*20"))
CPPUNIT_FAIL("Wrong formula.");
- if (!checkFormula(*pDoc, ScAddress(1,6,0), "A7*20"))
+ if (!checkFormula(rDoc2, ScAddress(1,6,0), "A7*20"))
CPPUNIT_FAIL("Wrong formula.");
- if (!checkFormula(*pDoc, ScAddress(1,7,0), "A8*20"))
+ if (!checkFormula(rDoc2, ScAddress(1,7,0), "A8*20"))
CPPUNIT_FAIL("Wrong formula.");
// We re-group formula cells on load. Let's check that as well.
- ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(1,0,0));
+ ScFormulaCell* pFC = rDoc2.GetFormulaCell(ScAddress(1,0,0));
CPPUNIT_ASSERT_MESSAGE("Failed to fetch formula cell.", pFC);
CPPUNIT_ASSERT_MESSAGE("This should be the top cell in formula group.", pFC->IsSharedTop());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(3), pFC->GetSharedLength());
- pFC = pDoc->GetFormulaCell(ScAddress(1,4,0));
+ pFC = rDoc2.GetFormulaCell(ScAddress(1,4,0));
CPPUNIT_ASSERT_MESSAGE("Failed to fetch formula cell.", pFC);
CPPUNIT_ASSERT_MESSAGE("This should be the top cell in formula group.", pFC->IsSharedTop());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(4), pFC->GetSharedLength());
@@ -367,18 +367,18 @@ void ScFiltersTest::testSharedFormulaXLS()
void ScFiltersTest::testSharedFormulaXLSX()
{
ScDocShellRef xDocSh = loadDoc("shared-formula/basic.", XLSX);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(&rDoc);
xDocSh->DoHardRecalc(true);
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 18; ++i)
{
- double fVal = pDoc->GetValue(ScAddress(1,i,0));
+ double fVal = rDoc.GetValue(ScAddress(1,i,0));
double fCheck = i*10.0;
CPPUNIT_ASSERT_EQUAL(fCheck, fVal);
}
- ScFormulaCell* pCell = pDoc->GetFormulaCell(ScAddress(1,18,0));
+ ScFormulaCell* pCell = rDoc.GetFormulaCell(ScAddress(1,18,0));
CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pCell);
ScFormulaCellGroupRef xGroup = pCell->GetCellGroup();
CPPUNIT_ASSERT_MESSAGE("This cell should be a part of a cell group.", xGroup);
@@ -387,9 +387,9 @@ void ScFiltersTest::testSharedFormulaXLSX()
xDocSh->DoClose();
}
-void impl_testLegacyCellAnchoredRotatedShape( ScDocument* pDoc, Rectangle& aRect, ScDrawObjData& aAnchor, long TOLERANCE = 30 /* 30 hmm */ )
+void impl_testLegacyCellAnchoredRotatedShape( ScDocument& rDoc, Rectangle& aRect, ScDrawObjData& aAnchor, long TOLERANCE = 30 /* 30 hmm */ )
{
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
CPPUNIT_ASSERT_MESSAGE("No drawing layer.", pDrawLayer);
SdrPage* pPage = pDrawLayer->GetPage(0);
CPPUNIT_ASSERT_MESSAGE("No page instance for the 1st sheet.", pPage);
@@ -427,8 +427,8 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
// is a good edge case test to see if we import it still correctly )
ScDocShellRef xDocSh = loadDoc("legacycellanchoredrotatedclippedshape.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(&rDoc);
// ensure the imported legacy rotated shape is in the expected position
Rectangle aRect( 6000, -2000, 8000, 4000 );
// ensure the imported ( and converted ) anchor ( note we internally now store the anchor in
@@ -438,14 +438,14 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
aAnchor.maStart.SetCol( 5 );
aAnchor.maEnd.SetRow( 3 );
aAnchor.maEnd.SetCol( 7 );
- impl_testLegacyCellAnchoredRotatedShape( pDoc, aRect, aAnchor );
+ impl_testLegacyCellAnchoredRotatedShape( rDoc, aRect, aAnchor );
// test save and reload
// for some reason having this test in subsequent_export-test.cxx causes
// a core dump in editeng ( so moved to here )
xDocSh = saveAndReload( &(*xDocSh), ODS);
- pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
- impl_testLegacyCellAnchoredRotatedShape( pDoc, aRect, aAnchor );
+ ScDocument& rDoc2 = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(&rDoc2);
+ impl_testLegacyCellAnchoredRotatedShape( rDoc2, aRect, aAnchor );
xDocSh->DoClose();
}
@@ -455,8 +455,8 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
// the shape is completely hidden because the rows the shape occupies
// are hidden
ScDocShellRef xDocSh = loadDoc("legacycellanchoredrotatedhiddenshape.", ODS, true);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(&rDoc);
// ensure the imported legacy rotated shape is in the expected position
// when a shape is fully hidden reloading seems to result is in some errors, usually
// ( same but different error happens pre-patch ) - we should do better here, I regard it
@@ -470,12 +470,12 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
aAnchor.maStart.SetCol( 5 );
aAnchor.maEnd.SetRow( 3 );
aAnchor.maEnd.SetCol( 7 );
- pDoc->ShowRows(0, 9, 0, true); // show relavent rows
- pDoc->SetDrawPageSize(0); // trigger recalcpos
+ rDoc.ShowRows(0, 9, 0, true); // show relavent rows
+ rDoc.SetDrawPageSize(0); // trigger recalcpos
// apply hefty ( 1 mm ) tolerence here, as some opensuse tinderbox
// failing
- impl_testLegacyCellAnchoredRotatedShape( pDoc, aRect, aAnchor, 100 );
+ impl_testLegacyCellAnchoredRotatedShape( rDoc, aRect, aAnchor, 100 );
xDocSh->DoClose();
}
@@ -483,8 +483,8 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
// This example doc contains cell anchored shape that is rotated
ScDocShellRef xDocSh = loadDoc("legacycellanchoredrotatedshape.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(&rDoc);
// ensure the imported legacy rotated shape is in the expected position
Rectangle aRect( 6000, 3000, 8000, 9000 );
// ensure the imported ( and converted ) anchor ( note we internally now store the anchor in
@@ -496,20 +496,20 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
aAnchor.maEnd.SetRow( 9 );
aAnchor.maEnd.SetCol( 7 );
// test import
- impl_testLegacyCellAnchoredRotatedShape( pDoc, aRect, aAnchor );
+ impl_testLegacyCellAnchoredRotatedShape( rDoc, aRect, aAnchor );
// test save and reload
xDocSh = saveAndReload( &(*xDocSh), ODS);
- pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
- impl_testLegacyCellAnchoredRotatedShape( pDoc, aRect, aAnchor );
+ ScDocument& rDoc2 = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(&rDoc2);
+ impl_testLegacyCellAnchoredRotatedShape( rDoc2, aRect, aAnchor );
xDocSh->DoClose();
}
}
-void testEnhancedProtectionImpl( ScDocument* pDoc )
+void testEnhancedProtectionImpl( ScDocument& rDoc )
{
- const ScTableProtection* pProt = pDoc->GetTabProtection(0);
+ const ScTableProtection* pProt = rDoc.GetTabProtection(0);
CPPUNIT_ASSERT( pProt);
@@ -528,9 +528,9 @@ void ScFiltersTest::testEnhancedProtectionXLS()
{
ScDocShellRef xDocSh = loadDoc("enhanced-protection.", XLS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- testEnhancedProtectionImpl( pDoc);
+ testEnhancedProtectionImpl( rDoc);
xDocSh->DoClose();
}
@@ -539,9 +539,9 @@ void ScFiltersTest::testEnhancedProtectionXLSX()
{
ScDocShellRef xDocSh = loadDoc("enhanced-protection.", XLSX);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- testEnhancedProtectionImpl( pDoc);
+ testEnhancedProtectionImpl( rDoc);
xDocSh->DoClose();
}
@@ -550,16 +550,16 @@ void ScFiltersTest::testSortWithSharedFormulasODS()
{
ScDocShellRef xDocSh = loadDoc("shared-formula/sort-crash.", ODS, true);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// E2:E10 should be shared.
- const ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(4,1,0));
+ const ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(4,1,0));
CPPUNIT_ASSERT(pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(9), pFC->GetSharedLength());
// E12:E17 should be shared.
- pFC = pDoc->GetFormulaCell(ScAddress(4,11,0));
+ pFC = rDoc.GetFormulaCell(ScAddress(4,11,0));
CPPUNIT_ASSERT(pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(11), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(6), pFC->GetSharedLength());
@@ -567,7 +567,7 @@ void ScFiltersTest::testSortWithSharedFormulasODS()
// Set A1:E17 as an anonymous database range to sheet, or else Calc would
// refuse to sort the range.
ScDBData* pDBData = new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 4, 16, true, true);
- pDoc->SetAnonymousDBData(0, pDBData);
+ rDoc.SetAnonymousDBData(0, pDBData);
// Sort ascending by Column E.
@@ -587,7 +587,7 @@ void ScFiltersTest::testSortWithSharedFormulasODS()
CPPUNIT_ASSERT(bSorted);
// After the sort, E2:E16 should be shared.
- pFC = pDoc->GetFormulaCell(ScAddress(4,1,0));
+ pFC = rDoc.GetFormulaCell(ScAddress(4,1,0));
CPPUNIT_ASSERT(pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(15), pFC->GetSharedLength());
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index 91b4a12d1724..a22e3bc17d44 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -109,9 +109,9 @@ void loadFile(const OUString& aFileName, std::string& aContent)
#if ENABLE_ORCUS
-void testFile(OUString& aFileName, ScDocument* pDoc, SCTAB nTab, StringType aStringFormat)
+void testFile(OUString& aFileName, ScDocument& rDoc, SCTAB nTab, StringType aStringFormat)
{
- csv_handler aHandler(pDoc, nTab, aStringFormat);
+ csv_handler aHandler(&rDoc, nTab, aStringFormat);
orcus::csv::parser_config aConfig;
aConfig.delimiters.push_back(',');
aConfig.delimiters.push_back(';');
@@ -170,7 +170,7 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat)
//test Sheet1 with csv file
OUString aCSVFileName;
pTest->createCSVPath(OUString("numberFormat."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 0, PureString);
+ testFile(aCSVFileName, *pDoc, 0, PureString);
//need to test the color of B3
//it's not a font color!
//formatting for B5: # ??/100 gets lost during import
@@ -535,7 +535,7 @@ ScDocShellRef ScBootstrapFixture::load( bool bReadWrite,
pFilter->SetVersion(nFilterVersion);
ScDocShellRef xDocShRef = new ScDocShell;
- xDocShRef->GetDocument()->EnableUserInteraction(false);
+ xDocShRef->GetDocument().EnableUserInteraction(false);
SfxMedium* pSrcMed = new SfxMedium(rURL, bReadWrite ? STREAM_STD_READWRITE : STREAM_STD_READ );
pSrcMed->SetFilter(pFilter);
pSrcMed->UseInteractionHandler(false);
@@ -663,7 +663,7 @@ void ScBootstrapFixture::miscRowHeightsTest( TestParam* aTestValues, unsigned in
CPPUNIT_ASSERT(xShell.Is());
- ScDocument* pDoc = xShell->GetDocument();
+ ScDocument& rDoc = xShell->GetDocument();
for (int i=0; i<aTestValues[ index ].nRowData; ++i)
{
@@ -677,10 +677,10 @@ void ScBootstrapFixture::miscRowHeightsTest( TestParam* aTestValues, unsigned in
for ( ; nRow <= nEndRow; ++nRow )
{
SAL_INFO( "sc.qa", " checking row " << nRow << " for height " << nExpectedHeight );
- int nHeight = sc::TwipsToHMM( pDoc->GetRowHeight(nRow, nTab, false) );
+ int nHeight = sc::TwipsToHMM( rDoc.GetRowHeight(nRow, nTab, false) );
if ( bCheckOpt )
{
- bool bOpt = !(pDoc->GetRowFlags( nRow, nTab ) & CR_MANUALSIZE);
+ bool bOpt = !(rDoc.GetRowFlags( nRow, nTab ) & CR_MANUALSIZE);
CPPUNIT_ASSERT_EQUAL(aTestValues[ index ].pData[ i ].bOptimal, bOpt);
}
CPPUNIT_ASSERT_EQUAL(nExpectedHeight, nHeight);
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index 805c6d2a596a..193fc489c7f2 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -108,7 +108,7 @@ std::ostream& operator<<(std::ostream& rStrm, const Color& rColor);
SCQAHELPER_DLLPUBLIC void loadFile(const OUString& aFileName, std::string& aContent);
-SCQAHELPER_DLLPUBLIC void testFile(OUString& aFileName, ScDocument* pDoc, SCTAB nTab, StringType aStringFormat = StringValue);
+SCQAHELPER_DLLPUBLIC void testFile(OUString& aFileName, ScDocument& rDoc, SCTAB nTab, StringType aStringFormat = StringValue);
//need own handler because conditional formatting strings must be generated
SCQAHELPER_DLLPUBLIC void testCondFile(OUString& aFileName, ScDocument* pDoc, SCTAB nTab);
diff --git a/sc/qa/unit/helper/shared_test_impl.hxx b/sc/qa/unit/helper/shared_test_impl.hxx
index 8be0a71dd548..c339efa20c46 100644
--- a/sc/qa/unit/helper/shared_test_impl.hxx
+++ b/sc/qa/unit/helper/shared_test_impl.hxx
@@ -48,9 +48,9 @@ DataBarData aData[] = {
{ ScRange(1,9,0,1,12,0), COLORSCALE_AUTO, COLORSCALE_AUTO, databar::MIDDLE }
};
-void testDataBar_Impl(ScDocument* pDoc)
+void testDataBar_Impl(ScDocument& rDoc)
{
- ScConditionalFormatList* pList = pDoc->GetCondFormList(0);
+ ScConditionalFormatList* pList = rDoc.GetCondFormList(0);
CPPUNIT_ASSERT(pList);
for(size_t i = 0; i < SAL_N_ELEMENTS(aData); ++i)
@@ -85,9 +85,9 @@ ColorScale2EntryData aData2Entry[] = {
{ ScRange(5,2,0,5,5,0), COLORSCALE_VALUE, COLORSCALE_FORMULA }
};
-void testColorScale2Entry_Impl(ScDocument* pDoc)
+void testColorScale2Entry_Impl(ScDocument& rDoc)
{
- const ScConditionalFormatList* pList = pDoc->GetCondFormList(0);
+ const ScConditionalFormatList* pList = rDoc.GetCondFormList(0);
CPPUNIT_ASSERT(pList);
for(size_t i = 0; i < SAL_N_ELEMENTS(aData2Entry); ++i)
@@ -124,9 +124,9 @@ ColorScale3EntryData aData3Entry[] = {
{ ScRange(5,1,1,5,6,1), COLORSCALE_VALUE, COLORSCALE_VALUE, COLORSCALE_FORMULA }
};
-void testColorScale3Entry_Impl(ScDocument* pDoc)
+void testColorScale3Entry_Impl(ScDocument& rDoc)
{
- ScConditionalFormatList* pList = pDoc->GetCondFormList(1);
+ ScConditionalFormatList* pList = rDoc.GetCondFormList(1);
CPPUNIT_ASSERT(pList);
for(size_t i = 0; i < SAL_N_ELEMENTS(aData3Entry); ++i)
@@ -152,7 +152,7 @@ void testColorScale3Entry_Impl(ScDocument* pDoc)
}
}
-void testFunctionsExcel2010_Impl( ScDocument* pDoc )
+void testFunctionsExcel2010_Impl( ScDocument& rDoc )
{
// Original test case document is functions-excel-2010.xlsx
// Which test rows to evaluate, 1-based as in UI to ease maintenance.
@@ -252,20 +252,20 @@ void testFunctionsExcel2010_Impl( ScDocument* pDoc )
OString aStr = OString::number( aTests[i].nRow) +
", function name=[ " +
- OUStringToOString( pDoc->GetString( ScAddress( 0, nRow, 0)), RTL_TEXTENCODING_UTF8 ) +
+ OUStringToOString( rDoc.GetString( ScAddress( 0, nRow, 0)), RTL_TEXTENCODING_UTF8 ) +
" ], result=" +
- OString::number( pDoc->GetValue( ScAddress( 1, nRow, 0)) ) +
+ OString::number( rDoc.GetValue( ScAddress( 1, nRow, 0)) ) +
", expected=" +
- OString::number( pDoc->GetValue( ScAddress( 2, nRow, 0)) );
+ OString::number( rDoc.GetValue( ScAddress( 2, nRow, 0)) );
- ScFormulaCell* pFC = pDoc->GetFormulaCell( ScAddress( 1, nRow, 0) );
+ ScFormulaCell* pFC = rDoc.GetFormulaCell( ScAddress( 1, nRow, 0) );
if ( pFC && pFC->GetErrCode() != 0 )
aStr += ", error code =" + OString::number( pFC->GetErrCode() );
CPPUNIT_ASSERT_MESSAGE( OString( "Expected a formula cell without error at row " +
- aStr ).getStr(), isFormulaWithoutError( *pDoc, ScAddress( 1, nRow, 0)));
+ aStr ).getStr(), isFormulaWithoutError( rDoc, ScAddress( 1, nRow, 0)));
CPPUNIT_ASSERT_MESSAGE( OString( "Expected a TRUE value at row " +
- aStr ).getStr(), 0 != pDoc->GetValue( ScAddress( 3, nRow, 0)));
+ aStr ).getStr(), 0 != rDoc.GetValue( ScAddress( 3, nRow, 0)));
}
}
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index ee6b2e3e7051..21e074958d9c 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -556,25 +556,23 @@ void ScOpenclTest::testCompilerHorizontal()
return;
ScDocShellRef xDocSh = loadDoc("opencl/compiler/horizontal.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/compiler/horizontal.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i < 5; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(12, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(12, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(12, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(12, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
- fLibre = pDoc->GetValue(ScAddress(13, i, 0));
- fExcel = pDocRes->GetValue(ScAddress(13, i, 0));
+ fLibre = rDoc.GetValue(ScAddress(13, i, 0));
+ fExcel = rDocRes.GetValue(ScAddress(13, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
- fLibre = pDoc->GetValue(ScAddress(14, i, 0));
- fExcel = pDocRes->GetValue(ScAddress(14, i, 0));
+ fLibre = rDoc.GetValue(ScAddress(14, i, 0));
+ fExcel = rDocRes.GetValue(ScAddress(14, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -586,19 +584,17 @@ void ScOpenclTest::testCompilerNested()
return;
ScDocShellRef xDocSh = loadDoc("opencl/compiler/nested.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/compiler/nested.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i < 5; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -612,24 +608,22 @@ void ScOpenclTest::testCompilerString()
ScDocShellRef xDocSh = loadDoc("opencl/compiler/string.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/compiler/string.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i < 5; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
- fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -643,20 +637,18 @@ void ScOpenclTest::testCompilerInEq()
ScDocShellRef xDocSh = loadDoc("opencl/compiler/ineq.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/compiler/ineq.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i < 7; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -670,25 +662,23 @@ void ScOpenclTest::testSharedFormulaXLSStockHistory()
return;
ScDocShellRef xDocSh = loadDoc("stock-history.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
xDocSh->DoHardRecalc(true);
ScDocShellRef xDocShRes = loadDoc("stock-history.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 33; i < 44; ++i)
{ // Cell H34:H44 in S&P 500 (tab 1)
- double fLibre = pDoc->GetValue(ScAddress(7, i, 1));
- double fExcel = pDocRes->GetValue(ScAddress(7, i, 1));
+ double fLibre = rDoc.GetValue(ScAddress(7, i, 1));
+ double fExcel = rDocRes.GetValue(ScAddress(7, i, 1));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
}
for (SCROW i = 33; i < 44; ++i)
{ // Cell J34:J44 in S&P 500 (tab 1)
- double fLibre = pDoc->GetValue(ScAddress(9, i, 1));
- double fExcel = pDocRes->GetValue(ScAddress(9, i, 1));
+ double fLibre = rDoc.GetValue(ScAddress(9, i, 1));
+ double fExcel = rDocRes.GetValue(ScAddress(9, i, 1));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
}
@@ -702,18 +692,16 @@ void ScOpenclTest::testSharedFormulaXLSGroundWater()
return;
ScDocShellRef xDocSh = loadDoc("ground-water-daily.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
xDocSh->DoHardRecalc(true);
ScDocShellRef xDocShRes = loadDoc("ground-water-daily.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 5; i <= 77; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(11,i,1));
- double fExcel = pDocRes->GetValue(ScAddress(11,i,1));
+ double fLibre = rDoc.GetValue(ScAddress(11,i,1));
+ double fExcel = rDocRes.GetValue(ScAddress(11,i,1));
ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
}
xDocSh->DoClose();
@@ -727,50 +715,48 @@ void ScOpenclTest::testSharedFormulaXLS()
return;
ScDocShellRef xDocSh = loadDoc("sum_ex.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("sum_ex.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
// AMLOEXT-5
for (SCROW i = 0; i < 5; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
}
// AMLOEXT-6
for (SCROW i = 6; i < 14; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
}
// AMLOEXT-8
for (SCROW i = 15; i < 18; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
}
// AMLOEXT-10
for (SCROW i = 19; i < 22; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
}
// AMLOEXT-9
for (SCROW i = 23; i < 25; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- //double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ //double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
// There seems to be a bug in LibreOffice beta
ASSERT_DOUBLES_EQUAL(/*fExcel*/ 60.0, fLibre);
}
@@ -778,34 +764,34 @@ void ScOpenclTest::testSharedFormulaXLS()
// AMLOEXT-9
for (SCROW i = 25; i < 27; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
}
// AMLOEXT-11
for (SCROW i = 28; i < 35; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
}
// AMLOEXT-11; workaround for a Calc beta bug
- ASSERT_DOUBLES_EQUAL(25.0, pDoc->GetValue(ScAddress(2, 35, 0)));
- ASSERT_DOUBLES_EQUAL(24.0, pDoc->GetValue(ScAddress(2, 36, 0)));
+ ASSERT_DOUBLES_EQUAL(25.0, rDoc.GetValue(ScAddress(2, 35, 0)));
+ ASSERT_DOUBLES_EQUAL(24.0, rDoc.GetValue(ScAddress(2, 36, 0)));
// AMLOEXT-12
for (SCROW i = 38; i < 43; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
}
// AMLOEXT-14
for (SCROW i = 5; i < 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 1));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 1));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 1));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 1));
ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
}
@@ -814,8 +800,8 @@ void ScOpenclTest::testSharedFormulaXLS()
{
for (SCCOL j = 6; j < 11; ++j)
{
- double fLibre = pDoc->GetValue(ScAddress(j, i, 1));
- double fExcel = pDocRes->GetValue(ScAddress(j, i, 1));
+ double fLibre = rDoc.GetValue(ScAddress(j, i, 1));
+ double fExcel = rDocRes.GetValue(ScAddress(j, i, 1));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
fabs(fExcel*0.0001));
}
@@ -830,17 +816,15 @@ void ScOpenclTest::testMathFormulaCos()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/cos.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/cos.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -853,15 +837,15 @@ void ScOpenclTest::testMathFormulaSinh()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/sinh.", XLS);
- enableOpenCL(); ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true);
+ enableOpenCL();
+ ScDocument& rDoc = xDocSh->GetDocument();
+ xDocSh->DoHardRecalc(true);
ScDocShellRef xDocShRes = loadDoc("opencl/math/sinh.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -874,17 +858,15 @@ void ScOpenclTest::testMathFormulaPi()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/pi.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/pi.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(0,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(0,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(0,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(0,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -897,17 +879,15 @@ void ScOpenclTest::testMathFormulaRandom()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/random.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/random.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(0,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(0,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(0,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(0,i,0));
//because the random numbers will always change,so give the test "true"
(void) fLibre;
(void) fExcel;
@@ -923,152 +903,150 @@ void ScOpenclTest::testFinacialFormula()
ScDocShellRef xDocSh = loadDoc("opencl/financial/general.", XLS);
CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/general.", XLS);
CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
// AMLOEXT-22
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6,i,1));
- double fExcel = pDocRes->GetValue(ScAddress(6,i,1));
+ double fLibre = rDoc.GetValue(ScAddress(6,i,1));
+ double fExcel = rDocRes.GetValue(ScAddress(6,i,1));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-23]
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,2));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,2));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,2));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,2));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-24]
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6,i,3));
- double fExcel = pDocRes->GetValue(ScAddress(6,i,3));
+ double fLibre = rDoc.GetValue(ScAddress(6,i,3));
+ double fExcel = rDocRes.GetValue(ScAddress(6,i,3));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-25]
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,4));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,4));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,4));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,4));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-26]
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,5));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,5));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,5));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,5));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-27]
for (SCROW i = 0; i < 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5,i,6));
- double fExcel = pDocRes->GetValue(ScAddress(5,i,6));
+ double fLibre = rDoc.GetValue(ScAddress(5,i,6));
+ double fExcel = rDocRes.GetValue(ScAddress(5,i,6));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-28]
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,7));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,7));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,7));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,7));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-29]
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,8));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,8));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,8));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,8));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-30]
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,9));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,9));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,9));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,9));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-31]
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,10));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,10));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,10));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,10));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-32]
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(7,i,11));
- double fExcel = pDocRes->GetValue(ScAddress(7,i,11));
+ double fLibre = rDoc.GetValue(ScAddress(7,i,11));
+ double fExcel = rDocRes.GetValue(ScAddress(7,i,11));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-33]
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5,i,12));
- double fExcel = pDocRes->GetValue(ScAddress(5,i,12));
+ double fLibre = rDoc.GetValue(ScAddress(5,i,12));
+ double fExcel = rDocRes.GetValue(ScAddress(5,i,12));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-34]
for (SCROW i = 0; i <= 12; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6,i,13));
- double fExcel = pDocRes->GetValue(ScAddress(6,i,13));
+ double fLibre = rDoc.GetValue(ScAddress(6,i,13));
+ double fExcel = rDocRes.GetValue(ScAddress(6,i,13));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-35]
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,14));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,14));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,14));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,14));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-36]
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6,i,15));
- double fExcel = pDocRes->GetValue(ScAddress(6,i,15));
+ double fLibre = rDoc.GetValue(ScAddress(6,i,15));
+ double fExcel = rDocRes.GetValue(ScAddress(6,i,15));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-37]
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6,i,16));
- double fExcel = pDocRes->GetValue(ScAddress(6,i,16));
+ double fLibre = rDoc.GetValue(ScAddress(6,i,16));
+ double fExcel = rDocRes.GetValue(ScAddress(6,i,16));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-38]
for (SCROW i = 1; i <= 5; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6,i,17));
- double fExcel = pDocRes->GetValue(ScAddress(6,i,17));
+ double fLibre = rDoc.GetValue(ScAddress(6,i,17));
+ double fExcel = rDocRes.GetValue(ScAddress(6,i,17));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-39]
for (SCROW i = 0; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,18));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,18));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,18));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,18));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
//[AMLOEXT-42]
for (SCROW i = 0; i <= 18; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,19));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,19));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,19));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,19));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1082,20 +1060,18 @@ void ScOpenclTest::testStatisticalFormulaCorrel()
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Correl.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Correl.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1108,19 +1084,17 @@ void ScOpenclTest::testStatisticalFormulaFisher()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Fisher.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Fisher.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1133,19 +1107,17 @@ void ScOpenclTest::testStatisticalFormulaFisherInv()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/FisherInv.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/FisherInv.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1158,19 +1130,17 @@ void ScOpenclTest::testStatisticalFormulaGamma()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Gamma.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Gamma.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1182,17 +1152,15 @@ void ScOpenclTest::testFinacialFvscheduleFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Fvschedule.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Fvschedule.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1203,22 +1171,18 @@ void ScOpenclTest::testMathFormulaAbs()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/Abs.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/Abs.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/Abs.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/Abs.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify ABS Function
for (SCROW i = 1; i <= 1000; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1230,17 +1194,15 @@ void ScOpenclTest::testFinacialSYDFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/SYD.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/SYD.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1253,17 +1215,15 @@ void ScOpenclTest::testFinacialIRRFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/IRR.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/IRR.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1275,19 +1235,17 @@ void ScOpenclTest::testStatisticalFormulaGammaLn()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/GammaLn.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GammaLn.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1299,18 +1257,16 @@ void ScOpenclTest::testStatisticalFormulaGauss()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Gauss.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Gauss.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1322,19 +1278,17 @@ void ScOpenclTest::testStatisticalFormulaGeoMean()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/GeoMean.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GeoMean.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1346,19 +1300,17 @@ void ScOpenclTest::testStatisticalFormulaHarMean()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/HarMean.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/HarMean.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1370,17 +1322,15 @@ void ScOpenclTest::testFinacialSLNFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/SLN.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/SLN.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1392,17 +1342,15 @@ void ScOpenclTest::testFinacialMIRRFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/MIRR.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/MIRR.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1415,17 +1363,15 @@ void ScOpenclTest::testFinancialCoupdaybsFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupdaybs.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupdaybs.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 1; i <=10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1437,17 +1383,15 @@ void ScOpenclTest::testFinacialDollardeFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Dollarde.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Dollarde.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1459,17 +1403,15 @@ void ScOpenclTest::testFinancialCoupdaysFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupdays.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupdays.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 1; i <=10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1481,17 +1423,15 @@ void ScOpenclTest::testFinancialCoupdaysncFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupdaysnc.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupdaysnc.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 1; i <=10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1502,17 +1442,15 @@ void ScOpenclTest::testFinacialRateFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/RATE.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/RATE.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 1; i <= 5; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1524,17 +1462,15 @@ void ScOpenclTest::testFinancialAccrintmFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Accrintm.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Accrintm.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1546,17 +1482,15 @@ void ScOpenclTest::testFinancialCoupnumFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupnum.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupnum.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1569,18 +1503,16 @@ void ScOpenclTest::testStatisticalFormulaNegbinomdist()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Negbinomdist." ,XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Negbinomdist." ,XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1592,17 +1524,15 @@ void ScOpenclTest::testMathFormulaSin()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/sin.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/sin.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1614,17 +1544,15 @@ void ScOpenclTest::testMathFormulaSumSQ()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/sumsq.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/sumsq.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i < 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(5,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1636,17 +1564,15 @@ void ScOpenclTest::testMathFormulaTan()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/tan.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/tan.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1658,17 +1584,15 @@ void ScOpenclTest::testMathFormulaTanH()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/tanh.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/tanh.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1680,17 +1604,15 @@ void ScOpenclTest::testMathFormulaSqrt()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/sqrt.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/sqrt.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1702,17 +1624,15 @@ void ScOpenclTest::testFinacialPriceFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Price.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Price.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1724,17 +1644,15 @@ void ScOpenclTest::testFinacialDollarfrFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Dollarfr.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Dollarfr.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1746,17 +1664,15 @@ void ScOpenclTest::testFinacialPriceDiscFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/PriceDisc.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/PriceDisc.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1768,17 +1684,15 @@ void ScOpenclTest::testFinacialODDLPRICEFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Oddlprice.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Oddlprice.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(8, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(8, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(8, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(8, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1790,17 +1704,15 @@ void ScOpenclTest:: testFinacialOddlyieldFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Oddlyield.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Oddlyield.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(8, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(8, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(8, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(8, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1812,17 +1724,15 @@ void ScOpenclTest::testFinacialDISCFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/DISC.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/DISC.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1834,17 +1744,15 @@ void ScOpenclTest:: testFinacialPVFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/PV.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/PV.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1856,17 +1764,15 @@ void ScOpenclTest::testFinacialINTRATEFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/INTRATE.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/INTRATE.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1879,19 +1785,17 @@ void ScOpenclTest::testStatisticalFormulaStandard()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Standard.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Standard.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1904,19 +1808,17 @@ void ScOpenclTest::testStatisticalFormulaWeibull()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Weibull.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Weibull.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(4,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
fExcel == 0?1e-4:fabs(1e-4*fExcel));
}
@@ -1930,19 +1832,17 @@ void ScOpenclTest::testStatisticalFormulaVar()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Var.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Var.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1955,19 +1855,17 @@ void ScOpenclTest::testStatisticalFormulaSkew()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Skew.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Skew.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -1980,19 +1878,17 @@ void ScOpenclTest::testStatisticalFormulaSkewp()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Skewp.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Skewp.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2004,18 +1900,16 @@ void ScOpenclTest::testStatisticalFormulaPearson()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Pearson.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Pearson.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2027,18 +1921,16 @@ void ScOpenclTest::testStatisticalFormulaRsq()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Rsq.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Rsq.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2050,17 +1942,15 @@ void ScOpenclTest::testMathFormulaTrunc()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/trunc.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/trunc.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2073,17 +1963,15 @@ void ScOpenclTest::testMathFormulaCosh()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/cosh.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/cosh.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2095,19 +1983,17 @@ void ScOpenclTest::testStatisticalFormulaCovar()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Covar.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Covar.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 16; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2120,18 +2006,16 @@ void ScOpenclTest::testStatisticalFormulaKurt()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Kurt.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Kurt.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2144,17 +2028,15 @@ void ScOpenclTest::testMathFormulaCot()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/cot.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/cot.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2167,19 +2049,17 @@ void ScOpenclTest::testStatisticalFormulaDevSq()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/DevSq.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/DevSq.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 11; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2191,17 +2071,15 @@ void ScOpenclTest::testMathFormulaCsc()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/csc.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/csc.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2214,17 +2092,15 @@ void ScOpenclTest::testMathFormulaCoth()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/coth.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/coth.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2236,24 +2112,22 @@ void ScOpenclTest::testFinacialXNPVFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/XNPV.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/XNPV.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 16; i <= 26; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2266,17 +2140,15 @@ void ScOpenclTest::testStatisticalFormulaIntercept()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Intercept.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Intercept.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2288,17 +2160,15 @@ void ScOpenclTest::testFinancialAmordegrcFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Amordegrc.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Amordegrc.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2310,17 +2180,15 @@ void ScOpenclTest:: testFinancialISPMTFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/ISPMT.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/ISPMT.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2332,18 +2200,16 @@ void ScOpenclTest::testStatisticalFormulaMedian()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Median.",XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Median.",XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2355,18 +2221,16 @@ void ScOpenclTest::testStatisticalFormulaNormdist()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Normdist.",XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Normdist.",XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(4,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2378,18 +2242,16 @@ void ScOpenclTest::testStatisticalFormulaNormsdist()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Normsdist.",XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Normsdist.",XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2401,18 +2263,16 @@ void ScOpenclTest::testStatisticalFormulaPermut()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Permut.",XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Permut.",XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2424,18 +2284,16 @@ void ScOpenclTest::testStatisticalFormulaPermutation()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Permutation.",XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Permutation.",XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2447,18 +2305,16 @@ void ScOpenclTest::testStatisticalFormulaPhi()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Phi.",XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Phi.",XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2470,17 +2326,15 @@ void ScOpenclTest::testMathFormulaCscH()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/csch.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/csch.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2493,18 +2347,16 @@ void ScOpenclTest::testStatisticalFormulaLogInv()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/LogInv.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/LogInv.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2516,17 +2368,15 @@ void ScOpenclTest::testFinacialNPERFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/NPER.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/NPER.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2539,18 +2389,16 @@ void ScOpenclTest::testStatisticalFormulaForecast()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Forecast.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Forecast.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2562,17 +2410,15 @@ void ScOpenclTest::testFinancialAmorlincFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Amorlinc.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Amorlinc.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2584,17 +2430,15 @@ void ScOpenclTest::testFinancialDDBFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/ddb.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/ddb.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2605,17 +2449,15 @@ void ScOpenclTest::testFinacialPriceMatFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/PriceMat.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/PriceMat.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2626,18 +2468,16 @@ void ScOpenclTest::testFinacialFormulaReceived()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Received.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Received.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i < 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(5,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2648,18 +2488,16 @@ void ScOpenclTest::testFinancialFormulaCumipmt()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Cumipmt.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Cumipmt.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(6,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(6,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2670,18 +2508,16 @@ void ScOpenclTest::testFinancialFormulaCumprinc()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Cumprinc.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Cumprinc.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(6,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(6,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2692,17 +2528,15 @@ void ScOpenclTest::testFinacialRRIFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/RRI.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/RRI.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2713,17 +2547,15 @@ void ScOpenclTest::testFinacialEFFECT_ADDFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/EFFECT_ADD.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/EFFECT_ADD.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2734,18 +2566,16 @@ void ScOpenclTest::testFinacialNominalFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Nominal.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Nominal.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2756,17 +2586,15 @@ void ScOpenclTest::testFinacialTBILLEQFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/TBILLEQ.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/TBILLEQ.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2777,17 +2605,15 @@ void ScOpenclTest::testFinacialTBILLPRICEFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/TBILLPRICE.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/TBILLPRICE.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2798,17 +2624,15 @@ void ScOpenclTest::testFinacialTBILLYIELDFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/TBILLYIELD.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/TBILLYIELD.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2819,17 +2643,15 @@ void ScOpenclTest::testFinacialYIELDFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/YIELD.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/YIELD.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2841,17 +2663,15 @@ void ScOpenclTest::testFinacialYIELDDISCFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/YIELDDISC.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/YIELDDISC.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2863,17 +2683,15 @@ void ScOpenclTest::testFinacialYIELDMATFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/YIELDMAT.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/YIELDMAT.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2884,17 +2702,15 @@ void ScOpenclTest:: testFinacialPMTFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/PMT.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/PMT.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2906,17 +2722,15 @@ void ScOpenclTest:: testFinancialDurationFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Duration.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Duration.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2929,19 +2743,17 @@ void ScOpenclTest::testStatisticalFormulaLogNormDist()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/LogNormDist.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/LogNormDist.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(4,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2952,21 +2764,17 @@ void ScOpenclTest::testMathFormulaArcCos()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/ArcCos.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/ArcCos.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/ArcCos.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcCos.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify ACos Function
for (SCROW i = 1; i <= 1000; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -2978,17 +2786,15 @@ void ScOpenclTest::testMathFormulaPower()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/power.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/power.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3000,17 +2806,15 @@ void ScOpenclTest:: testFinacialPPMTFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/PPMT.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/PPMT.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3022,17 +2826,15 @@ void ScOpenclTest:: testFinacialNPVFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/NPV.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/NPV.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3044,17 +2846,15 @@ void ScOpenclTest:: testFinancialDuration_ADDFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Duration_ADD.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Duration_ADD.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3066,18 +2866,16 @@ void ScOpenclTest::testStatisticalFormulaNorminv()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Norminv.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Norminv.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3089,18 +2887,16 @@ void ScOpenclTest::testStatisticalFormulaNormsinv()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Normsinv.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Normsinv.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3111,21 +2907,17 @@ void ScOpenclTest::testMathFormulaArcCosHyp()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/ArcCosHyp.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/ArcCosHyp.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/ArcCosHyp.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcCosHyp.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify ACosH Function
for (SCROW i = 1; i <= 1000; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3137,17 +2929,15 @@ void ScOpenclTest:: testFinancialMDurationFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/MDuration.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/MDuration.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3158,21 +2948,17 @@ void ScOpenclTest::testMathFormulaArcCot()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/ArcCot.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/ArcCot.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/ArcCot.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcCot.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify ACot Function
for (SCROW i = 1; i <= 1000; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3184,17 +2970,15 @@ void ScOpenclTest:: testFinancialFVFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/FV.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/FV.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3206,17 +2990,15 @@ void ScOpenclTest::testFinancialDBFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/db.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/db.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3228,17 +3010,15 @@ void ScOpenclTest::testFinancialCouppcdFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Couppcd.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Couppcd.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3250,35 +3030,33 @@ void ScOpenclTest::testMathSumIfsFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/sumifs.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
sc::FormulaGroupInterpreter::enableOpenCL(true);
xDocSh->DoHardRecalc(true);
ScDocShellRef xDocShRes = loadDoc("opencl/math/sumifs.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 2; i <= 11; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(5,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 2; i <= 11; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(6,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(6,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 2; i <= 11; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(7,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(7,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(7,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(7,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 2; i <= 11; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(8,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(8,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(8,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(8,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3289,21 +3067,17 @@ void ScOpenclTest::testMathFormulaArcCotHyp()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/ArcCotHyp.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/ArcCotHyp.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/ArcCotHyp.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcCotHyp.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify ACotH Function
for (SCROW i = 1; i <= 1000; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3314,21 +3088,17 @@ void ScOpenclTest::testMathFormulaArcSin()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/ArcSin.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/ArcSin.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/ArcSin.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcSin.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify ACotH Function
for (SCROW i = 1; i <= 1000; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3340,29 +3110,27 @@ void ScOpenclTest:: testFinancialVDBFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/VDB.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/VDB.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 15; i <= 26; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 30; i <= 41; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3374,17 +3142,15 @@ void ScOpenclTest:: testFinancialIPMTFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/IPMT.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/IPMT.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3398,20 +3164,20 @@ void ScOpenclTest:: testFinancialXirrFormula()
ScDocShellRef xDocSh = loadDoc("opencl/financial/XIRR.", ODS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument *pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
for (SCROW i = 1; i <= 10; ++i)
{
- double fFormula = pDoc->GetValue(ScAddress(2, i, 0));
- double fExpected = pDoc->GetValue(ScAddress(3, i, 0));
+ double fFormula = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExpected = rDoc.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT(rtl::math::approxEqual(fExpected, fFormula));
}
for (SCROW i = 18; i <= 27; ++i)
{
- double fFormula = pDoc->GetValue(ScAddress(2, i, 0));
- double fExpected = pDoc->GetValue(ScAddress(3, i, 0));
+ double fFormula = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExpected = rDoc.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT(rtl::math::approxEqual(fExpected, fFormula));
}
@@ -3423,24 +3189,22 @@ void ScOpenclTest::testStatisticalFormulaChiSqDist()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/CHISQDIST.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/CHISQDIST.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3453,19 +3217,17 @@ void ScOpenclTest::testStatisticalFormulaConfidence()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Confidence.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Confidence.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3477,18 +3239,16 @@ void ScOpenclTest::testStatisticalFormulaFDist()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Fdist.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Fdist.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3500,17 +3260,15 @@ void ScOpenclTest::testFinancialCoupncdFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupncd.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupncd.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3522,17 +3280,15 @@ void ScOpenclTest::testFinancialAccrintFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/Accrint.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/Accrint.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3545,19 +3301,17 @@ void ScOpenclTest::testStatisticalFormulaCritBinom()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/CritBinom.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/CritBinom.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3568,21 +3322,17 @@ void ScOpenclTest::testMathFormulaArcSinHyp()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/ArcSinHyp.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/ArcSinHyp.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/ArcSinHyp.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcSinHyp.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify ASinH Function
for (SCROW i = 1; i <= 1000; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3593,21 +3343,17 @@ void ScOpenclTest::testMathFormulaArcTan()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/ArcTan.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/ArcTan.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/ArcTan.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcTan.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify ATan Function
for (SCROW i = 1; i <= 1000; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3618,21 +3364,17 @@ void ScOpenclTest::testMathFormulaArcTanHyp()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/ArcTanHyp.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/ArcTanHyp.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/ArcTanHyp.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcTanHyp.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify ATanH Function
for (SCROW i = 1; i <= 1000; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3644,17 +3386,15 @@ void ScOpenclTest:: testFinacialNPER1Formula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/NPER1.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/NPER1.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 6; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3665,21 +3405,17 @@ void ScOpenclTest::testMathFormulaArcTan2()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/ArcTan2.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/ArcTan2.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/ArcTan2.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcTan2.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify ATan2 Function
for (SCROW i = 1; i <= 17; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.000001);
}
xDocSh->DoClose();
@@ -3693,18 +3429,16 @@ void ScOpenclTest::testStatisticalFormulaChiSqInv()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/CHISQINV.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/CHISQINV.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3715,21 +3449,17 @@ void ScOpenclTest::testMathFormulaBitAnd()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/BitAnd.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/BitAnd.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/BitAnd.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/BitAnd.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify BitAnd Function
for (SCROW i = 1; i <= 1000; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3741,18 +3471,16 @@ void ScOpenclTest::testStatisticalFormulaPoisson()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Poisson.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Poisson.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3764,18 +3492,16 @@ void ScOpenclTest::testStatisticalFormulaExpondist()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Expondist.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Expondist.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3786,21 +3512,17 @@ void ScOpenclTest::testMathFormulaBitOr()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/BitOr.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/BitOr.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/BitOr.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/BitOr.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify BitOr Function
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3813,17 +3535,15 @@ void ScOpenclTest::testMathFormulaOdd()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/odd.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/odd.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3835,18 +3555,16 @@ void ScOpenclTest::testMathFormulaLN()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/LN.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/LN.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3859,17 +3577,15 @@ void ScOpenclTest::testMathFormulaMod()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/mod.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/mod.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
if(fExcel == 0.0f)
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 1e-10);
else
@@ -3884,24 +3600,22 @@ void ScOpenclTest::testMathFormulaRound()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/ROUND.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/ROUND.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 15; i <= 25; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3914,18 +3628,16 @@ void ScOpenclTest::testStatisticalFormulaGammaDist()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/GammaDist.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GammaDist.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(4,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3938,21 +3650,19 @@ void ScOpenclTest::testStatisticalFormulaGammaInv()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/GammaInv.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GammaInv.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
- fLibre = pDoc->GetValue(ScAddress(4,i,0));
- fExcel = pDocRes->GetValue(ScAddress(4,i,0));
+ fLibre = rDoc.GetValue(ScAddress(4,i,0));
+ fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3965,21 +3675,19 @@ void ScOpenclTest::testStatisticalFormulaFInv()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/FInv.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/FInv.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
- fLibre = pDoc->GetValue(ScAddress(4,i,0));
- fExcel = pDocRes->GetValue(ScAddress(4,i,0));
+ fLibre = rDoc.GetValue(ScAddress(4,i,0));
+ fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -3992,18 +3700,16 @@ void ScOpenclTest::testStatisticalFormulaFTest()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/FTest.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/FTest.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4015,21 +3721,19 @@ void ScOpenclTest::testStatisticalFormulaB()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/B.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/B.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(4,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
- fLibre = pDoc->GetValue(ScAddress(5,i,0));
- fExcel = pDocRes->GetValue(ScAddress(5,i,0));
+ fLibre = rDoc.GetValue(ScAddress(5,i,0));
+ fExcel = rDocRes.GetValue(ScAddress(5,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4041,21 +3745,19 @@ void ScOpenclTest::testStatisticalFormulaBetaDist()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/BetaDist.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/BetaDist.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(6,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(6,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
- fLibre = pDoc->GetValue(ScAddress(7,i,0));
- fExcel = pDocRes->GetValue(ScAddress(7,i,0));
+ fLibre = rDoc.GetValue(ScAddress(7,i,0));
+ fExcel = rDocRes.GetValue(ScAddress(7,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4068,17 +3770,15 @@ void ScOpenclTest::testMathFormulaEven()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/even.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/even.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4091,17 +3791,15 @@ void ScOpenclTest::testMathFormulaExp()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/exp.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/exp.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4113,18 +3811,16 @@ void ScOpenclTest::testStatisticalFormulaChiDist()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/ChiDist.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/ChiDist.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4136,18 +3832,16 @@ void ScOpenclTest::testMathFormulaBitLshift()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/BitLshift.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/BitLshift.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify BitLshift Function
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4159,18 +3853,16 @@ void ScOpenclTest::testMathFormulaBitRshift()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/BitRshift.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/BitRshift.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify BitRshift Function
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4182,17 +3874,15 @@ void ScOpenclTest::testMathFormulaFloor()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/floor.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/floor.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4205,17 +3895,15 @@ void ScOpenclTest::testMathFormulaLog()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/log.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/log.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 47; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4227,24 +3915,22 @@ void ScOpenclTest::testSpreadSheetFormulaVLookup()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/spreadsheet/VLookup.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/spreadsheet/VLookup.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 32; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(5,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 40; i <= 50; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(5,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4256,18 +3942,16 @@ void ScOpenclTest::testStatisticalFormulaChiInv()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/ChiInv.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/ChiInv.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4279,17 +3963,15 @@ void ScOpenclTest::testMathFormulaConvert()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/convert.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/convert.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 3; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4301,17 +3983,15 @@ void ScOpenclTest::testMathCountIfsFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/countifs.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
sc::FormulaGroupInterpreter::enableOpenCL(true);
xDocSh->DoHardRecalc(true);
ScDocShellRef xDocShRes = loadDoc("opencl/math/countifs.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 1; i < 10; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4323,18 +4003,16 @@ void ScOpenclTest::testMathFormulaBitXor()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/BitXor.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/BitXor.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify BitXor Function
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4346,17 +4024,15 @@ void ScOpenclTest::testMathAverageIfsFormula()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/averageifs.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
sc::FormulaGroupInterpreter::enableOpenCL(true);
xDocSh->DoHardRecalc(true);
ScDocShellRef xDocShRes = loadDoc("opencl/math/averageifs.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 1; i <= 11; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(4,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4369,17 +4045,15 @@ void ScOpenclTest::testMathFormulaLog10()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/log10.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/log10.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4392,17 +4066,15 @@ void ScOpenclTest::testMathFormulaCombina()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/combina.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/combina.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 47; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4413,21 +4085,17 @@ void ScOpenclTest::testMathFormulaCeil()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/Ceil.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/Ceil.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/Ceil.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/Ceil.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify Ceiling Function
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4439,17 +4107,15 @@ void ScOpenclTest::testMathFormulaSqrtPi()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/sqrtpi.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/sqrtpi.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i < 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4462,19 +4128,17 @@ void ScOpenclTest::testStatisticalFormulaVarP()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/VarP.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/VarP.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4487,19 +4151,17 @@ void ScOpenclTest::testStatisticalFormulaStDev()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/StDev.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/StDev.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4512,19 +4174,17 @@ void ScOpenclTest::testStatisticalFormulaStDevP()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/StDevP.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/StDevP.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4537,19 +4197,17 @@ void ScOpenclTest::testStatisticalFormulaSlope()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Slope.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Slope.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4562,19 +4220,17 @@ void ScOpenclTest::testStatisticalFormulaSTEYX()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/STEYX.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/STEYX.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4587,19 +4243,17 @@ void ScOpenclTest::testStatisticalFormulaZTest()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/ZTest.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/ZTest.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4612,19 +4266,17 @@ void ScOpenclTest::testStatisticalFormulaTTest()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/TTest.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/TTest.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(4,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4637,19 +4289,17 @@ void ScOpenclTest::testStatisticalFormulaTDist()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/TDist.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/TDist.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4662,19 +4312,17 @@ void ScOpenclTest::testStatisticalFormulaTInv()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/TInv.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/TInv.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4686,18 +4334,16 @@ void ScOpenclTest::testStatisticalFormulaBinomDist()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/BinomDist.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/BinomDist.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(4,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4709,17 +4355,15 @@ void ScOpenclTest::testMathFormulaProduct()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/product.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/product.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 3; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4732,18 +4376,16 @@ void ScOpenclTest::testMathFormulaKombin()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/Kombin.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/Kombin.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify Combin Function
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4756,23 +4398,21 @@ void ScOpenclTest:: testArrayFormulaSumX2MY2()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/array/SUMX2MY2.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/array/SUMX2MY2.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 20; i <= 26; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4784,18 +4424,16 @@ void ScOpenclTest::testStatisticalFormulaHypGeomDist()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/HypGeomDist.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/HypGeomDist.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(4,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4807,23 +4445,21 @@ void ScOpenclTest:: testArrayFormulaSumX2PY2()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/array/SUMX2PY2.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/array/SUMX2PY2.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 20; i <= 26; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4835,18 +4471,16 @@ void ScOpenclTest::testStatisticalFormulaBetainv()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Betainv.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Betainv.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(5,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(5,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4858,17 +4492,15 @@ void ScOpenclTest::testStatisticalFormulaMina()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Mina.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Mina.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4880,23 +4512,21 @@ void ScOpenclTest:: testArrayFormulaSumXMY2()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/array/SUMXMY2.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/array/SUMXMY2.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 20; i <= 26; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4908,17 +4538,15 @@ void ScOpenclTest::testStatisticalFormulaCountA()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/counta.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/counta.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4931,17 +4559,15 @@ void ScOpenclTest::testStatisticalFormulaMaxa()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Maxa.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Maxa.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -4954,18 +4580,16 @@ void ScOpenclTest::testMathFormulaSumProduct()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/sumproduct_mixSliding.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/sumproduct_mixSliding.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
if ( i == 1 )
CPPUNIT_ASSERT_DOUBLES_EQUAL(82, fLibre, fabs(0.0001*fExcel));
else if ( i == 2 )
@@ -4990,17 +4614,15 @@ void ScOpenclTest::testMathFormulaAverageIf()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/averageif.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/averageif.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 2; i <= 21; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(6,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(6,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5012,17 +4634,15 @@ void ScOpenclTest::testStatisticalFormulaAverageA()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/AverageA.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/AverageA.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5034,23 +4654,21 @@ void ScOpenclTest:: testLogicalFormulaAnd()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/logical/and.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/logical/and.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5063,19 +4681,17 @@ void ScOpenclTest::testStatisticalFormulaVarA()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/VarA.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/VarA.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5088,19 +4704,17 @@ void ScOpenclTest::testStatisticalFormulaVarPA()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/VarPA.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/VarPA.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5113,19 +4727,17 @@ void ScOpenclTest::testStatisticalFormulaStDevA()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/StDevA.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/StDevA.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5138,19 +4750,17 @@ void ScOpenclTest::testStatisticalFormulaStDevPA()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/StDevPA.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/StDevPA.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5162,17 +4772,15 @@ void ScOpenclTest:: testFinancialMDurationFormula1()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/financial/MDuration1.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/financial/MDuration1.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel,fLibre,fabs(0.00000000001*fExcel));
}
xDocSh->DoClose();
@@ -5184,18 +4792,16 @@ void ScOpenclTest::testMathFormulaSumProduct2()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/sumproductTest.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/sumproductTest.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 2; i <= 12; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4,i,1));
- double fExcel = pDocRes->GetValue(ScAddress(4,i,1));
+ double fLibre = rDoc.GetValue(ScAddress(4,i,1));
+ double fExcel = rDocRes.GetValue(ScAddress(4,i,1));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5209,18 +4815,16 @@ void ScOpenclTest:: testStatisticalParallelCountBug()
return;
ScDocShellRef xDocSh =
loadDoc("opencl/statistical/parallel_count_bug_243.", ODS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes =
loadDoc("opencl/statistical/parallel_count_bug_243.", ODS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i < 13; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5232,17 +4836,15 @@ void ScOpenclTest:: testLogicalFormulaOr()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/logical/or.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/logical/or.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i < 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5254,17 +4856,15 @@ void ScOpenclTest:: testLogicalFormulaNot()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/logical/not.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/logical/not.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i < 3000; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(1, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(1, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(1, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5276,17 +4876,15 @@ void ScOpenclTest:: testLogicalFormulaXor()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/logical/xor.", XLS);
- ScDocument *pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/logical/xor.", XLS);
- ScDocument *pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i < 3000; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1, i, 0));
- double fExcel = pDocRes->GetValue(ScAddress(1, i, 0));
+ double fLibre = rDoc.GetValue(ScAddress(1, i, 0));
+ double fExcel = rDocRes.GetValue(ScAddress(1, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5298,18 +4896,16 @@ void ScOpenclTest::testDatabaseFormulaDcount()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/database/dcount.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/database/dcount.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 32; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(9,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(9,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
}
xDocSh->DoClose();
@@ -5321,18 +4917,16 @@ void ScOpenclTest::testDatabaseFormulaDcountA()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/database/dcountA.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/database/dcountA.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 32; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(9,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(9,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
}
xDocSh->DoClose();
@@ -5344,18 +4938,16 @@ void ScOpenclTest::testDatabaseFormulaDmax()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/database/dmax.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/database/dmax.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 32; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(9,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(9,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
}
xDocSh->DoClose();
@@ -5368,18 +4960,16 @@ void ScOpenclTest::testDatabaseFormulaDmin()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/database/dmin.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/database/dmin.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 32; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(9,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(9,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
}
xDocSh->DoClose();
@@ -5392,18 +4982,16 @@ void ScOpenclTest::testDatabaseFormulaDproduct()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/database/dproduct.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/database/dproduct.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 32; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(9,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(9,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
}
xDocSh->DoClose();
@@ -5416,18 +5004,16 @@ void ScOpenclTest::testDatabaseFormulaDaverage()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/database/daverage.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/database/daverage.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 32; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(9,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(9,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
//CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
}
@@ -5441,18 +5027,16 @@ void ScOpenclTest::testDatabaseFormulaDstdev()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/database/dstdev.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/database/dstdev.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 32; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(9,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(9,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
//CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
}
@@ -5466,18 +5050,16 @@ void ScOpenclTest::testDatabaseFormulaDstdevp()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/database/dstdevp.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/database/dstdevp.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 32; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(9,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(9,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
//CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
}
@@ -5491,18 +5073,16 @@ void ScOpenclTest::testDatabaseFormulaDsum()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/database/dsum.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/database/dsum.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 32; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(9,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(9,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
//CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
}
@@ -5516,18 +5096,16 @@ void ScOpenclTest::testDatabaseFormulaDvar()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/database/dvar.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/database/dvar.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 32; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(9,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(9,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
//CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
}
@@ -5541,18 +5119,16 @@ void ScOpenclTest::testDatabaseFormulaDvarp()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/database/dvarp.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/database/dvarp.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 32; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(9,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(9,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
}
xDocSh->DoClose();
@@ -5564,18 +5140,16 @@ void ScOpenclTest::testMathFormulaRoundUp()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/roundup.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/roundup.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5587,18 +5161,16 @@ void ScOpenclTest::testMathFormulaRoundDown()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/rounddown.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/rounddown.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5610,18 +5182,16 @@ void ScOpenclTest::testMathFormulaInt()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/int.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/int.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5633,18 +5203,16 @@ void ScOpenclTest::testMathFormulaRadians()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/radians.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/radians.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5656,17 +5224,15 @@ void ScOpenclTest::testMathFormulaDegrees()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/degrees.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/degrees.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 200; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5678,18 +5244,16 @@ void ScOpenclTest::testMathFormulaIsEven()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/iseven.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/iseven.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5701,17 +5265,15 @@ void ScOpenclTest::testMathFormulaCountIf()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/countif.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/countif.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 26; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5723,18 +5285,16 @@ void ScOpenclTest::testMathFormulaIsOdd()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/isodd.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/isodd.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5746,17 +5306,15 @@ void ScOpenclTest::testMathFormulaFact()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/fact.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/fact.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 18; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5769,17 +5327,15 @@ void ScOpenclTest::testMathFormulaSEC()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/sec.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/sec.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5792,17 +5348,15 @@ void ScOpenclTest::testMathFormulaSECH()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/sech.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/sech.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5815,17 +5369,15 @@ void ScOpenclTest::testMathFormulaMROUND()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/MROUND.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/MROUND.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 13; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5836,21 +5388,17 @@ void ScOpenclTest::testMathFormulaQuotient()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh =
- loadDoc("opencl/math/Quotient.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocShellRef xDocSh = loadDoc("opencl/math/Quotient.", ODS);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
- ScDocShellRef xDocShRes =
- loadDoc("opencl/math/Quotient.", ODS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ rDoc.CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/Quotient.", ODS);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Verify BitAnd Function
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5862,17 +5410,15 @@ void ScOpenclTest::testMathFormulaSeriesSum()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/seriessum.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/seriessum.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 15; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5884,17 +5430,15 @@ void ScOpenclTest::testMathFormulaSumIf()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/sumif.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/sumif.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 26; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5907,19 +5451,17 @@ void ScOpenclTest::testAddInFormulaBesseLJ()
return;
ScDocShellRef xDocSh = loadDoc("opencl/addin/besselj.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/addin/besselj.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5932,18 +5474,16 @@ void ScOpenclTest::testStatisticalFormulaAvedev()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Avedev.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Avedev.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(3,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(3,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5957,19 +5497,17 @@ void ScOpenclTest::testNegSub()
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/NegSub.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/NegSub.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -5981,17 +5519,15 @@ void ScOpenclTest::testMathFormulaAverageIf_Mix()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/math/averageif_mix.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/math/averageif_mix.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -6003,18 +5539,16 @@ void ScOpenclTest::testStatisticalFormulaKurt1()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/Kurt1.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Kurt1.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(2,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(2,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -6026,18 +5560,16 @@ void ScOpenclTest::testStatisticalFormulaHarMean1()
if (!detectOpenCLDevice())
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/HarMean1.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/HarMean1.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -6050,19 +5582,17 @@ void ScOpenclTest::testStatisticalFormulaVarA1()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/VarA1.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/VarA1.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -6075,19 +5605,17 @@ void ScOpenclTest::testStatisticalFormulaVarPA1()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/VarPA1.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/VarPA1.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -6100,19 +5628,17 @@ void ScOpenclTest::testStatisticalFormulaStDevA1()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/StDevA1.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/StDevA1.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
@@ -6125,19 +5651,17 @@ void ScOpenclTest::testStatisticalFormulaStDevPA1()
return;
ScDocShellRef xDocSh = loadDoc("opencl/statistical/StDevPA1.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
enableOpenCL();
- pDoc->CalcAll();
+ rDoc.CalcAll();
ScDocShellRef xDocShRes = loadDoc("opencl/statistical/StDevPA1.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
- CPPUNIT_ASSERT(pDocRes);
+ ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(1,i,0));
- double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ double fLibre = rDoc.GetValue(ScAddress(1,i,0));
+ double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
xDocSh->DoClose();
diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx
index deba389e90e5..0068d03641d3 100644
--- a/sc/qa/unit/rangelst_test.cxx
+++ b/sc/qa/unit/rangelst_test.cxx
@@ -94,7 +94,7 @@ void Test::setUp()
SFXMODEL_DISABLE_EMBEDDED_SCRIPTS |
SFXMODEL_DISABLE_DOCUMENT_RECOVERY);
- m_pDoc = m_xDocShRef->GetDocument();
+ m_pDoc = &m_xDocShRef->GetDocument();
}
void Test::tearDown()
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 2e36357b56e3..d457538fd268 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -202,16 +202,15 @@ void ScExportTest::test()
SFXMODEL_DISABLE_DOCUMENT_RECOVERY);
pShell->DoInitNew();
- ScDocument* pDoc = pShell->GetDocument();
+ ScDocument& rDoc = pShell->GetDocument();
- pDoc->SetValue(0,0,0, 1.0);
- CPPUNIT_ASSERT(pDoc);
+ rDoc.SetValue(0,0,0, 1.0);
ScDocShellRef xDocSh = saveAndReload( pShell, ODS );
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pLoadedDoc = xDocSh->GetDocument();
- double aVal = pLoadedDoc->GetValue(0,0,0);
+ ScDocument& rLoadedDoc = xDocSh->GetDocument();
+ double aVal = rLoadedDoc.GetValue(0,0,0);
ASSERT_DOUBLES_EQUAL(aVal, 1.0);
}
@@ -224,10 +223,9 @@ void ScExportTest::testPasswordExport()
SFXMODEL_DISABLE_DOCUMENT_RECOVERY);
pShell->DoInitNew();
- ScDocument* pDoc = pShell->GetDocument();
+ ScDocument& rDoc = pShell->GetDocument();
- pDoc->SetValue(0,0,0, 1.0);
- CPPUNIT_ASSERT(pDoc);
+ rDoc.SetValue(0,0,0, 1.0);
sal_Int32 nFormat = ODS;
OUString aFilterName(getFileFormats()[nFormat].pFilterName, strlen(getFileFormats()[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ;
@@ -235,8 +233,8 @@ void ScExportTest::testPasswordExport()
ScDocShellRef xDocSh = saveAndReloadPassword(pShell, aFilterName, OUString(), aFilterType, getFileFormats()[nFormat].nFormatType);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pLoadedDoc = xDocSh->GetDocument();
- double aVal = pLoadedDoc->GetValue(0,0,0);
+ ScDocument& rLoadedDoc = xDocSh->GetDocument();
+ double aVal = rLoadedDoc.GetValue(0,0,0);
ASSERT_DOUBLES_EQUAL(aVal, 1.0);
xDocSh->DoClose();
@@ -250,11 +248,11 @@ void ScExportTest::testConditionalFormatExportODS()
ScDocShellRef xDocSh = saveAndReload(&(*xShell), ODS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
OUString aCSVFile("new_cond_format_test.");
OUString aCSVPath;
createCSVPath( aCSVFile, aCSVPath );
- testCondFile(aCSVPath, pDoc, 0);
+ testCondFile(aCSVPath, &rDoc, 0);
xDocSh->DoClose();
}
@@ -266,18 +264,18 @@ void ScExportTest::testConditionalFormatExportXLSX()
ScDocShellRef xDocSh = saveAndReload(&(*xShell), XLSX);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
{
OUString aCSVFile("new_cond_format_test.");
OUString aCSVPath;
createCSVPath( aCSVFile, aCSVPath );
- testCondFile(aCSVPath, pDoc, 0);
+ testCondFile(aCSVPath, &rDoc, 0);
}
{
OUString aCSVFile("new_cond_format_test_sheet2.");
OUString aCSVPath;
createCSVPath( aCSVFile, aCSVPath );
- testCondFile(aCSVPath, pDoc, 1);
+ testCondFile(aCSVPath, &rDoc, 1);
}
@@ -292,11 +290,10 @@ void ScExportTest::testColorScaleExportODS()
ScDocShellRef xDocSh = saveAndReload(xShell, ODS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
- testColorScale2Entry_Impl(pDoc);
- testColorScale3Entry_Impl(pDoc);
+ testColorScale2Entry_Impl(rDoc);
+ testColorScale3Entry_Impl(rDoc);
xDocSh->DoClose();
}
@@ -309,11 +306,10 @@ void ScExportTest::testColorScaleExportXLSX()
ScDocShellRef xDocSh = saveAndReload(xShell, XLSX);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
- testColorScale2Entry_Impl(pDoc);
- testColorScale3Entry_Impl(pDoc);
+ testColorScale2Entry_Impl(rDoc);
+ testColorScale3Entry_Impl(rDoc);
xDocSh->DoClose();
}
@@ -326,10 +322,9 @@ void ScExportTest::testDataBarExportODS()
ScDocShellRef xDocSh = saveAndReload(xShell, ODS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
- testDataBar_Impl(pDoc);
+ testDataBar_Impl(rDoc);
xDocSh->DoClose();
}
@@ -342,9 +337,9 @@ void ScExportTest::testFormatExportODS()
ScDocShellRef xDocSh = saveAndReload(xShell, ODS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- testFormats(this, pDoc, ODS);
+ testFormats(this, &rDoc, ODS);
xDocSh->DoClose();
}
@@ -357,10 +352,9 @@ void ScExportTest::testDataBarExportXLSX()
ScDocShellRef xDocSh = saveAndReload(xShell, XLSX);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
- testDataBar_Impl(pDoc);
+ testDataBar_Impl(rDoc);
xDocSh->DoClose();
}
@@ -476,23 +470,21 @@ void ScExportTest::testNamedRangeBugfdo62729()
{
ScDocShellRef xShell = loadDoc("fdo62729.", ODS);
CPPUNIT_ASSERT(xShell.Is());
- ScDocument* pDoc = xShell->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xShell->GetDocument();
- ScRangeName* pNames = pDoc->GetRangeName();
+ ScRangeName* pNames = rDoc.GetRangeName();
//should be just a single named range
CPPUNIT_ASSERT(pNames->size() == 1 );
- pDoc->DeleteTab(0);
+ rDoc.DeleteTab(0);
//should be still a single named range
CPPUNIT_ASSERT(pNames->size() == 1 );
ScDocShellRef xDocSh = saveAndReload(xShell, ODS);
xShell->DoClose();
CPPUNIT_ASSERT(xDocSh.Is());
- pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc2 = xDocSh->GetDocument();
- pNames = pDoc->GetRangeName();
+ pNames = rDoc2.GetRangeName();
//after reload should still have a named range
CPPUNIT_ASSERT(pNames->size() == 1 );
@@ -804,106 +796,111 @@ void ScExportTest::testRichTextExportODS()
// Start with an empty document, put one edit text cell, and make sure it
// survives the save and reload.
ScDocShellRef xOrigDocSh = loadDoc("empty.", ODS, true);
- ScDocument* pDoc = xOrigDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
- CPPUNIT_ASSERT_MESSAGE("This document should at least have one sheet.", pDoc->GetTableCount() > 0);
-
- // Insert an edit text cell.
- ScFieldEditEngine* pEE = &pDoc->GetEditEngine();
- pEE->SetText("Bold and Italic");
- // Set the 'Bold' part bold.
- setAttribute(*pEE, 0, 0, 4, EE_CHAR_WEIGHT);
- // Set the 'Italic' part italic.
- setAttribute(*pEE, 0, 9, 15, EE_CHAR_ITALIC);
- ESelection aSel;
- aSel.nStartPara = aSel.nEndPara = 0;
-
- // Set this edit text to cell B2.
- pDoc->SetEditText(ScAddress(1,1,0), pEE->CreateTextObject());
- const EditTextObject* pEditText = pDoc->GetEditText(ScAddress(1,1,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B2 value.", aCheckFunc.checkB2(pEditText));
+ const EditTextObject* pEditText;
+ {
+ ScDocument& rDoc = xOrigDocSh->GetDocument();
+ CPPUNIT_ASSERT_MESSAGE("This document should at least have one sheet.", rDoc.GetTableCount() > 0);
+
+ // Insert an edit text cell.
+ ScFieldEditEngine* pEE = &rDoc.GetEditEngine();
+ pEE->SetText("Bold and Italic");
+ // Set the 'Bold' part bold.
+ setAttribute(*pEE, 0, 0, 4, EE_CHAR_WEIGHT);
+ // Set the 'Italic' part italic.
+ setAttribute(*pEE, 0, 9, 15, EE_CHAR_ITALIC);
+ ESelection aSel;
+ aSel.nStartPara = aSel.nEndPara = 0;
+
+ // Set this edit text to cell B2.
+ rDoc.SetEditText(ScAddress(1,1,0), pEE->CreateTextObject());
+ pEditText = rDoc.GetEditText(ScAddress(1,1,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorret B2 value.", aCheckFunc.checkB2(pEditText));
+ }
// Now, save and reload this document.
ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh, ODS);
- xOrigDocSh->DoClose();
- CPPUNIT_ASSERT(xNewDocSh.Is());
- pDoc = xNewDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
- CPPUNIT_ASSERT_MESSAGE("Reloaded document should at least have one sheet.", pDoc->GetTableCount() > 0);
- pEE = &pDoc->GetEditEngine();
-
- // Make sure the content of B2 is still intact.
- CPPUNIT_ASSERT_MESSAGE("Incorret B2 value.", aCheckFunc.checkB2(pEditText));
-
- // Insert a multi-line content to B4.
- pEE->Clear();
- pEE->SetText("One\nTwo\nThree");
- pDoc->SetEditText(ScAddress(1,3,0), pEE->CreateTextObject());
- pEditText = pDoc->GetEditText(ScAddress(1,3,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B4 value.", aCheckFunc.checkB4(pEditText));
+ {
+ xOrigDocSh->DoClose();
+ CPPUNIT_ASSERT(xNewDocSh.Is());
+ ScDocument& rDoc2 = xNewDocSh->GetDocument();
+ CPPUNIT_ASSERT_MESSAGE("Reloaded document should at least have one sheet.", rDoc2.GetTableCount() > 0);
+ ScFieldEditEngine* pEE = &rDoc2.GetEditEngine();
+
+ // Make sure the content of B2 is still intact.
+ CPPUNIT_ASSERT_MESSAGE("Incorret B2 value.", aCheckFunc.checkB2(pEditText));
+
+ // Insert a multi-line content to B4.
+ pEE->Clear();
+ pEE->SetText("One\nTwo\nThree");
+ rDoc2.SetEditText(ScAddress(1,3,0), pEE->CreateTextObject());
+ pEditText = rDoc2.GetEditText(ScAddress(1,3,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorrect B4 value.", aCheckFunc.checkB4(pEditText));
+ }
// Reload the doc again, and check the content of B2 and B4.
ScDocShellRef xNewDocSh2 = saveAndReload(xNewDocSh, ODS);
- pDoc = xNewDocSh2->GetDocument();
- pEE = &pDoc->GetEditEngine();
- xNewDocSh->DoClose();
-
- pEditText = pDoc->GetEditText(ScAddress(1,1,0));
- CPPUNIT_ASSERT_MESSAGE("B2 should be an edit text.", pEditText);
- pEditText = pDoc->GetEditText(ScAddress(1,3,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B4 value.", aCheckFunc.checkB4(pEditText));
-
- // Insert a multi-line content to B5, but this time, set some empty paragraphs.
- pEE->Clear();
- pEE->SetText("\nTwo\nThree\n\nFive\n");
- pDoc->SetEditText(ScAddress(1,4,0), pEE->CreateTextObject());
- pEditText = pDoc->GetEditText(ScAddress(1,4,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B5 value.", aCheckFunc.checkB5(pEditText));
-
- // Insert a text with strikethrough in B6.
- pEE->Clear();
- pEE->SetText("Strike Me");
- // Set the 'Strike' part strikethrough.
- setAttribute(*pEE, 0, 0, 6, EE_CHAR_STRIKEOUT);
- pDoc->SetEditText(ScAddress(1,5,0), pEE->CreateTextObject());
- pEditText = pDoc->GetEditText(ScAddress(1,5,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B6 value.", aCheckFunc.checkB6(pEditText));
-
- // Insert a text with different font segments in B7.
- pEE->Clear();
- pEE->SetText("Font1 and Font2");
- setFont(*pEE, 0, 0, 5, "Courier");
- setFont(*pEE, 0, 10, 15, "Luxi Mono");
- pDoc->SetEditText(ScAddress(1,6,0), pEE->CreateTextObject());
- pEditText = pDoc->GetEditText(ScAddress(1,6,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B7 value.", aCheckFunc.checkB7(pEditText));
-
- // Insert a text with overline and underline in B8.
- pEE->Clear();
- pEE->SetText("Over and Under");
- setAttribute(*pEE, 0, 0, 4, EE_CHAR_OVERLINE);
- setAttribute(*pEE, 0, 9, 14, EE_CHAR_UNDERLINE);
- pDoc->SetEditText(ScAddress(1,7,0), pEE->CreateTextObject());
- pEditText = pDoc->GetEditText(ScAddress(1,7,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B8 value.", aCheckFunc.checkB8(pEditText));
+ {
+ ScDocument& rDoc3 = xNewDocSh2->GetDocument();
+ ScFieldEditEngine* pEE = &rDoc3.GetEditEngine();
+ xNewDocSh->DoClose();
+
+ pEditText = rDoc3.GetEditText(ScAddress(1,1,0));
+ CPPUNIT_ASSERT_MESSAGE("B2 should be an edit text.", pEditText);
+ pEditText = rDoc3.GetEditText(ScAddress(1,3,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorrect B4 value.", aCheckFunc.checkB4(pEditText));
+
+ // Insert a multi-line content to B5, but this time, set some empty paragraphs.
+ pEE->Clear();
+ pEE->SetText("\nTwo\nThree\n\nFive\n");
+ rDoc3.SetEditText(ScAddress(1,4,0), pEE->CreateTextObject());
+ pEditText = rDoc3.GetEditText(ScAddress(1,4,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorrect B5 value.", aCheckFunc.checkB5(pEditText));
+
+ // Insert a text with strikethrough in B6.
+ pEE->Clear();
+ pEE->SetText("Strike Me");
+ // Set the 'Strike' part strikethrough.
+ setAttribute(*pEE, 0, 0, 6, EE_CHAR_STRIKEOUT);
+ rDoc3.SetEditText(ScAddress(1,5,0), pEE->CreateTextObject());
+ pEditText = rDoc3.GetEditText(ScAddress(1,5,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorrect B6 value.", aCheckFunc.checkB6(pEditText));
+
+ // Insert a text with different font segments in B7.
+ pEE->Clear();
+ pEE->SetText("Font1 and Font2");
+ setFont(*pEE, 0, 0, 5, "Courier");
+ setFont(*pEE, 0, 10, 15, "Luxi Mono");
+ rDoc3.SetEditText(ScAddress(1,6,0), pEE->CreateTextObject());
+ pEditText = rDoc3.GetEditText(ScAddress(1,6,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorrect B7 value.", aCheckFunc.checkB7(pEditText));
+
+ // Insert a text with overline and underline in B8.
+ pEE->Clear();
+ pEE->SetText("Over and Under");
+ setAttribute(*pEE, 0, 0, 4, EE_CHAR_OVERLINE);
+ setAttribute(*pEE, 0, 9, 14, EE_CHAR_UNDERLINE);
+ rDoc3.SetEditText(ScAddress(1,7,0), pEE->CreateTextObject());
+ pEditText = rDoc3.GetEditText(ScAddress(1,7,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorrect B8 value.", aCheckFunc.checkB8(pEditText));
+ }
// Reload the doc again, and check the content of B2, B4, B6 and B7.
ScDocShellRef xNewDocSh3 = saveAndReload(xNewDocSh2, ODS);
- pDoc = xNewDocSh3->GetDocument();
+ ScDocument& rDoc4 = xNewDocSh3->GetDocument();
xNewDocSh2->DoClose();
- pEditText = pDoc->GetEditText(ScAddress(1,1,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B2 value after save and reload.", aCheckFunc.checkB2(pEditText));
- pEditText = pDoc->GetEditText(ScAddress(1,3,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B4 value after save and reload.", aCheckFunc.checkB4(pEditText));
- pEditText = pDoc->GetEditText(ScAddress(1,4,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B5 value after save and reload.", aCheckFunc.checkB5(pEditText));
- pEditText = pDoc->GetEditText(ScAddress(1,5,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B6 value after save and reload.", aCheckFunc.checkB6(pEditText));
- pEditText = pDoc->GetEditText(ScAddress(1,6,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B7 value after save and reload.", aCheckFunc.checkB7(pEditText));
- pEditText = pDoc->GetEditText(ScAddress(1,7,0));
- CPPUNIT_ASSERT_MESSAGE("Incorret B8 value after save and reload.", aCheckFunc.checkB8(pEditText));
+ pEditText = rDoc4.GetEditText(ScAddress(1,1,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorrect B2 value after save and reload.", aCheckFunc.checkB2(pEditText));
+ pEditText = rDoc4.GetEditText(ScAddress(1,3,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorrect B4 value after save and reload.", aCheckFunc.checkB4(pEditText));
+ pEditText = rDoc4.GetEditText(ScAddress(1,4,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorrect B5 value after save and reload.", aCheckFunc.checkB5(pEditText));
+ pEditText = rDoc4.GetEditText(ScAddress(1,5,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorrect B6 value after save and reload.", aCheckFunc.checkB6(pEditText));
+ pEditText = rDoc4.GetEditText(ScAddress(1,6,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorrect B7 value after save and reload.", aCheckFunc.checkB7(pEditText));
+ pEditText = rDoc4.GetEditText(ScAddress(1,7,0));
+ CPPUNIT_ASSERT_MESSAGE("Incorrect B8 value after save and reload.", aCheckFunc.checkB8(pEditText));
xNewDocSh3->DoClose();
}
@@ -911,22 +908,23 @@ void ScExportTest::testRichTextExportODS()
void ScExportTest::testFormulaRefSheetNameODS()
{
ScDocShellRef xDocSh = loadDoc("formula-quote-in-sheet-name.", ODS, true);
- ScDocument* pDoc = xDocSh->GetDocument();
-
- sc::AutoCalcSwitch aACSwitch(*pDoc, true); // turn on auto calc.
- pDoc->SetString(ScAddress(1,1,0), "='90''s Data'.B2");
- CPPUNIT_ASSERT_EQUAL(1.1, pDoc->GetValue(ScAddress(1,1,0)));
- if (!checkFormula(*pDoc, ScAddress(1,1,0), "'90''s Data'.B2"))
- CPPUNIT_FAIL("Wrong formula");
+ {
+ ScDocument& rDoc = xDocSh->GetDocument();
+ sc::AutoCalcSwitch aACSwitch(rDoc, true); // turn on auto calc.
+ rDoc.SetString(ScAddress(1,1,0), "='90''s Data'.B2");
+ CPPUNIT_ASSERT_EQUAL(1.1, rDoc.GetValue(ScAddress(1,1,0)));
+ if (!checkFormula(rDoc, ScAddress(1,1,0), "'90''s Data'.B2"))
+ CPPUNIT_FAIL("Wrong formula");
+ }
// Now, save and reload this document.
ScDocShellRef xNewDocSh = saveAndReload(xDocSh, ODS);
xDocSh->DoClose();
- pDoc = xNewDocSh->GetDocument();
- pDoc->CalcAll();
- CPPUNIT_ASSERT_EQUAL(1.1, pDoc->GetValue(ScAddress(1,1,0)));
- if (!checkFormula(*pDoc, ScAddress(1,1,0), "'90''s Data'.B2"))
+ ScDocument& rDoc = xNewDocSh->GetDocument();
+ rDoc.CalcAll();
+ CPPUNIT_ASSERT_EQUAL(1.1, rDoc.GetValue(ScAddress(1,1,0)));
+ if (!checkFormula(rDoc, ScAddress(1,1,0), "'90''s Data'.B2"))
CPPUNIT_FAIL("Wrong formula");
xNewDocSh->DoClose();
@@ -936,73 +934,72 @@ void ScExportTest::testCellValuesExportODS()
{
// Start with an empty document
ScDocShellRef xOrigDocSh = loadDoc("empty.", ODS);
- ScDocument* pDoc = xOrigDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
- CPPUNIT_ASSERT_MESSAGE("This document should at least have one sheet.", pDoc->GetTableCount() > 0);
-
- // set a value double
- pDoc->SetValue(ScAddress(0,0,0), 2.0); // A1
-
- // set a formula
- pDoc->SetValue(ScAddress(2,0,0), 3.0); // C1
- pDoc->SetValue(ScAddress(3,0,0), 3); // D1
- pDoc->SetString(ScAddress(4,0,0), "=10*C1/4"); // E1
- pDoc->SetValue(ScAddress(5,0,0), 3.0); // F1
- pDoc->SetString(ScAddress(7,0,0), "=SUM(C1:F1)"); //H1
-
- // set a string
- pDoc->SetString(ScAddress(0,2,0), "a simple line"); //A3
-
- // set a digit string
- pDoc->SetString(ScAddress(0,4,0), "'12"); //A5
- // set a contiguous value
- pDoc->SetValue(ScAddress(0,5,0), 12.0); //A6
- // set acontiguous string
- pDoc->SetString(ScAddress(0,6,0), "a string"); //A7
- // set a contiguous formula
- pDoc->SetString(ScAddress(0,7,0), "=$A$6"); //A8
-
+ {
+ ScDocument& rDoc = xOrigDocSh->GetDocument();
+ CPPUNIT_ASSERT_MESSAGE("This document should at least have one sheet.", rDoc.GetTableCount() > 0);
+
+ // set a value double
+ rDoc.SetValue(ScAddress(0,0,0), 2.0); // A1
+
+ // set a formula
+ rDoc.SetValue(ScAddress(2,0,0), 3.0); // C1
+ rDoc.SetValue(ScAddress(3,0,0), 3); // D1
+ rDoc.SetString(ScAddress(4,0,0), "=10*C1/4"); // E1
+ rDoc.SetValue(ScAddress(5,0,0), 3.0); // F1
+ rDoc.SetString(ScAddress(7,0,0), "=SUM(C1:F1)"); //H1
+
+ // set a string
+ rDoc.SetString(ScAddress(0,2,0), "a simple line"); //A3
+
+ // set a digit string
+ rDoc.SetString(ScAddress(0,4,0), "'12"); //A5
+ // set a contiguous value
+ rDoc.SetValue(ScAddress(0,5,0), 12.0); //A6
+ // set acontiguous string
+ rDoc.SetString(ScAddress(0,6,0), "a string"); //A7
+ // set a contiguous formula
+ rDoc.SetString(ScAddress(0,7,0), "=$A$6"); //A8
+ }
// save and reload
ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh, ODS);
xOrigDocSh->DoClose();
CPPUNIT_ASSERT(xNewDocSh.Is());
- pDoc = xNewDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
- CPPUNIT_ASSERT_MESSAGE("Reloaded document should at least have one sheet.", pDoc->GetTableCount() > 0);
+ ScDocument& rDoc = xNewDocSh->GetDocument();
+ CPPUNIT_ASSERT_MESSAGE("Reloaded document should at least have one sheet.", rDoc.GetTableCount() > 0);
// check value
- CPPUNIT_ASSERT_EQUAL(2.0, pDoc->GetValue(0,0,0));
- CPPUNIT_ASSERT_EQUAL(3.0, pDoc->GetValue(2,0,0));
- CPPUNIT_ASSERT_EQUAL(3.0, pDoc->GetValue(3,0,0));
- CPPUNIT_ASSERT_EQUAL(7.5, pDoc->GetValue(4,0,0));
- CPPUNIT_ASSERT_EQUAL(3.0, pDoc->GetValue(5,0,0));
+ CPPUNIT_ASSERT_EQUAL(2.0, rDoc.GetValue(0,0,0));
+ CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(2,0,0));
+ CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(3,0,0));
+ CPPUNIT_ASSERT_EQUAL(7.5, rDoc.GetValue(4,0,0));
+ CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(5,0,0));
// check formula
- if (!checkFormula(*pDoc, ScAddress(4,0,0), "10*C1/4"))
+ if (!checkFormula(rDoc, ScAddress(4,0,0), "10*C1/4"))
CPPUNIT_FAIL("Wrong formula =10*C1/4");
- if (!checkFormula(*pDoc, ScAddress(7,0,0), "SUM(C1:F1)"))
+ if (!checkFormula(rDoc, ScAddress(7,0,0), "SUM(C1:F1)"))
CPPUNIT_FAIL("Wrong formula =SUM(C1:F1)");
- CPPUNIT_ASSERT_EQUAL(16.5, pDoc->GetValue(7,0,0));
+ CPPUNIT_ASSERT_EQUAL(16.5, rDoc.GetValue(7,0,0));
// check string
ScRefCellValue aCell;
- aCell.assign(*pDoc, ScAddress(0,2,0));
+ aCell.assign(rDoc, ScAddress(0,2,0));
CPPUNIT_ASSERT_EQUAL( CELLTYPE_STRING, aCell.meType );
// check for an empty cell
- aCell.assign(*pDoc, ScAddress(0,3,0));
+ aCell.assign(rDoc, ScAddress(0,3,0));
CPPUNIT_ASSERT_EQUAL( CELLTYPE_NONE, aCell.meType);
// check a digit string
- aCell.assign(*pDoc, ScAddress(0,4,0));
+ aCell.assign(rDoc, ScAddress(0,4,0));
CPPUNIT_ASSERT_EQUAL( CELLTYPE_STRING, aCell.meType);
//check contiguous values
- CPPUNIT_ASSERT_EQUAL( 12.0, pDoc->GetValue(0,5,0) );
- CPPUNIT_ASSERT_EQUAL( OUString("a string"), pDoc->GetString(0,6,0) );
- if (!checkFormula(*pDoc, ScAddress(0,7,0), "$A$6"))
+ CPPUNIT_ASSERT_EQUAL( 12.0, rDoc.GetValue(0,5,0) );
+ CPPUNIT_ASSERT_EQUAL( OUString("a string"), rDoc.GetString(0,6,0) );
+ if (!checkFormula(rDoc, ScAddress(0,7,0), "$A$6"))
CPPUNIT_FAIL("Wrong formula =$A$6");
- CPPUNIT_ASSERT_EQUAL( pDoc->GetValue(0,5,0), pDoc->GetValue(0,7,0) );
+ CPPUNIT_ASSERT_EQUAL( rDoc.GetValue(0,5,0), rDoc.GetValue(0,7,0) );
xNewDocSh->DoClose();
}
@@ -1010,27 +1007,28 @@ void ScExportTest::testCellValuesExportODS()
void ScExportTest::testCellNoteExportODS()
{
ScDocShellRef xOrigDocSh = loadDoc("single-note.", ODS);
- ScDocument* pDoc = xOrigDocSh->GetDocument();
-
ScAddress aPos(0,0,0); // Start with A1.
- CPPUNIT_ASSERT_MESSAGE("There should be a note at A1.", pDoc->HasNote(aPos));
+ {
+ ScDocument& rDoc = xOrigDocSh->GetDocument();
- aPos.IncRow(); // Move to A2.
- ScPostIt* pNote = pDoc->GetOrCreateNote(aPos);
- pNote->SetText(aPos, "Note One");
- pNote->SetAuthor("Author One");
- CPPUNIT_ASSERT_MESSAGE("There should be a note at A2.", pDoc->HasNote(aPos));
+ CPPUNIT_ASSERT_MESSAGE("There should be a note at A1.", rDoc.HasNote(aPos));
+ aPos.IncRow(); // Move to A2.
+ ScPostIt* pNote = rDoc.GetOrCreateNote(aPos);
+ pNote->SetText(aPos, "Note One");
+ pNote->SetAuthor("Author One");
+ CPPUNIT_ASSERT_MESSAGE("There should be a note at A2.", rDoc.HasNote(aPos));
+ }
// save and reload
ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh, ODS);
xOrigDocSh->DoClose();
CPPUNIT_ASSERT(xNewDocSh.Is());
- pDoc = xNewDocSh->GetDocument();
+ ScDocument& rDoc = xNewDocSh->GetDocument();
aPos.SetRow(0); // Move back to A1.
- CPPUNIT_ASSERT_MESSAGE("There should be a note at A1.", pDoc->HasNote(aPos));
+ CPPUNIT_ASSERT_MESSAGE("There should be a note at A1.", rDoc.HasNote(aPos));
aPos.IncRow(); // Move to A2.
- CPPUNIT_ASSERT_MESSAGE("There should be a note at A2.", pDoc->HasNote(aPos));
+ CPPUNIT_ASSERT_MESSAGE("There should be a note at A2.", rDoc.HasNote(aPos));
xNewDocSh->DoClose();
}
@@ -1039,43 +1037,46 @@ void ScExportTest::testCellNoteExportXLS()
{
// Start with an empty document.s
ScDocShellRef xOrigDocSh = loadDoc("notes-on-3-sheets.", ODS);
- ScDocument* pDoc = xOrigDocSh->GetDocument();
- CPPUNIT_ASSERT_MESSAGE("This document should have 3 sheets.", pDoc->GetTableCount() == 3);
-
- // Check note's presence.
- CPPUNIT_ASSERT( pDoc->HasNote(ScAddress(0,0,0)));
- CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,1,0)));
- CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,2,0)));
+ {
+ ScDocument& rDoc = xOrigDocSh->GetDocument();
+ CPPUNIT_ASSERT_MESSAGE("This document should have 3 sheets.", rDoc.GetTableCount() == 3);
- CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,0,1)));
- CPPUNIT_ASSERT( pDoc->HasNote(ScAddress(0,1,1)));
- CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,2,1)));
+ // Check note's presence.
+ CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,0,0)));
+ CPPUNIT_ASSERT(!rDoc.HasNote(ScAddress(0,1,0)));
+ CPPUNIT_ASSERT(!rDoc.HasNote(ScAddress(0,2,0)));
- CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,0,2)));
- CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,1,2)));
- CPPUNIT_ASSERT( pDoc->HasNote(ScAddress(0,2,2)));
+ CPPUNIT_ASSERT(!rDoc.HasNote(ScAddress(0,0,1)));
+ CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,1,1)));
+ CPPUNIT_ASSERT(!rDoc.HasNote(ScAddress(0,2,1)));
+ CPPUNIT_ASSERT(!rDoc.HasNote(ScAddress(0,0,2)));
+ CPPUNIT_ASSERT(!rDoc.HasNote(ScAddress(0,1,2)));
+ CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,2,2)));
+ }
// save and reload as XLS.
ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh, XLS);
- xOrigDocSh->DoClose();
- CPPUNIT_ASSERT(xNewDocSh.Is());
- pDoc = xNewDocSh->GetDocument();
- CPPUNIT_ASSERT_MESSAGE("This document should have 3 sheets.", pDoc->GetTableCount() == 3);
+ {
+ xOrigDocSh->DoClose();
+ CPPUNIT_ASSERT(xNewDocSh.Is());
+ ScDocument& rDoc = xNewDocSh->GetDocument();
+ CPPUNIT_ASSERT_MESSAGE("This document should have 3 sheets.", rDoc.GetTableCount() == 3);
- // Check note's presence again.
- CPPUNIT_ASSERT( pDoc->HasNote(ScAddress(0,0,0)));
- CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,1,0)));
- CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,2,0)));
+ // Check note's presence again.
+ CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,0,0)));
+ CPPUNIT_ASSERT(!rDoc.HasNote(ScAddress(0,1,0)));
+ CPPUNIT_ASSERT(!rDoc.HasNote(ScAddress(0,2,0)));
- CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,0,1)));
- CPPUNIT_ASSERT( pDoc->HasNote(ScAddress(0,1,1)));
- CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,2,1)));
+ CPPUNIT_ASSERT(!rDoc.HasNote(ScAddress(0,0,1)));
+ CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,1,1)));
+ CPPUNIT_ASSERT(!rDoc.HasNote(ScAddress(0,2,1)));
- CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,0,2)));
- CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,1,2)));
- CPPUNIT_ASSERT( pDoc->HasNote(ScAddress(0,2,2)));
+ CPPUNIT_ASSERT(!rDoc.HasNote(ScAddress(0,0,2)));
+ CPPUNIT_ASSERT(!rDoc.HasNote(ScAddress(0,1,2)));
+ CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,2,2)));
- xNewDocSh->DoClose();
+ xNewDocSh->DoClose();
+ }
}
namespace {
@@ -1113,17 +1114,16 @@ void ScExportTest::testInlineArrayXLS()
xShell->DoClose();
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
// B2:C3 contains a matrix.
- checkMatrixRange(*pDoc, ScRange(1,1,0,2,2,0));
+ checkMatrixRange(rDoc, ScRange(1,1,0,2,2,0));
// B5:D6 contains a matrix.
- checkMatrixRange(*pDoc, ScRange(1,4,0,3,5,0));
+ checkMatrixRange(rDoc, ScRange(1,4,0,3,5,0));
// B8:C10 as well.
- checkMatrixRange(*pDoc, ScRange(1,7,0,2,9,0));
+ checkMatrixRange(rDoc, ScRange(1,7,0,2,9,0));
xDocSh->DoClose();
}
@@ -1137,18 +1137,17 @@ void ScExportTest::testEmbeddedChartXLS()
xShell->DoClose();
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
// Make sure the 2nd sheet is named 'Chart1'.
OUString aName;
- pDoc->GetName(1, aName);
+ rDoc.GetName(1, aName);
CPPUNIT_ASSERT_EQUAL(OUString("Chart1"), aName);
- const SdrOle2Obj* pOleObj = getSingleChartObject(*pDoc, 1);
+ const SdrOle2Obj* pOleObj = getSingleChartObject(rDoc, 1);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve a chart object from the 2nd sheet.", pOleObj);
- ScRangeList aRanges = getChartRanges(*pDoc, *pOleObj);
+ ScRangeList aRanges = getChartRanges(rDoc, *pOleObj);
CPPUNIT_ASSERT_MESSAGE("Label range (B3:B5) not found.", aRanges.In(ScRange(1,2,1,1,4,1)));
CPPUNIT_ASSERT_MESSAGE("Data label (C2) not found.", aRanges.In(ScAddress(2,1,1)));
CPPUNIT_ASSERT_MESSAGE("Data range (C3:C5) not found.", aRanges.In(ScRange(2,2,1,2,4,1)));
@@ -1165,31 +1164,30 @@ void ScExportTest::testFormulaReferenceXLS()
xShell->DoClose();
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
- if (!checkFormula(*pDoc, ScAddress(3,1,0), "$A$2+$B$2+$C$2"))
+ if (!checkFormula(rDoc, ScAddress(3,1,0), "$A$2+$B$2+$C$2"))
CPPUNIT_FAIL("Wrong formula in D2");
- if (!checkFormula(*pDoc, ScAddress(3,2,0), "A3+B3+C3"))
+ if (!checkFormula(rDoc, ScAddress(3,2,0), "A3+B3+C3"))
CPPUNIT_FAIL("Wrong formula in D3");
- if (!checkFormula(*pDoc, ScAddress(3,5,0), "SUM($A$6:$C$6)"))
+ if (!checkFormula(rDoc, ScAddress(3,5,0), "SUM($A$6:$C$6)"))
CPPUNIT_FAIL("Wrong formula in D6");
- if (!checkFormula(*pDoc, ScAddress(3,6,0), "SUM(A7:C7)"))
+ if (!checkFormula(rDoc, ScAddress(3,6,0), "SUM(A7:C7)"))
CPPUNIT_FAIL("Wrong formula in D7");
- if (!checkFormula(*pDoc, ScAddress(3,9,0), "$Two.$A$2+$Two.$B$2+$Two.$C$2"))
+ if (!checkFormula(rDoc, ScAddress(3,9,0), "$Two.$A$2+$Two.$B$2+$Two.$C$2"))
CPPUNIT_FAIL("Wrong formula in D10");
- if (!checkFormula(*pDoc, ScAddress(3,10,0), "$Two.A3+$Two.B3+$Two.C3"))
+ if (!checkFormula(rDoc, ScAddress(3,10,0), "$Two.A3+$Two.B3+$Two.C3"))
CPPUNIT_FAIL("Wrong formula in D11");
- if (!checkFormula(*pDoc, ScAddress(3,13,0), "MIN($Two.$A$2:$C$2)"))
+ if (!checkFormula(rDoc, ScAddress(3,13,0), "MIN($Two.$A$2:$C$2)"))
CPPUNIT_FAIL("Wrong formula in D14");
- if (!checkFormula(*pDoc, ScAddress(3,14,0), "MAX($Two.A3:C3)"))
+ if (!checkFormula(rDoc, ScAddress(3,14,0), "MAX($Two.A3:C3)"))
CPPUNIT_FAIL("Wrong formula in D15");
xDocSh->DoClose();
@@ -1203,9 +1201,8 @@ void ScExportTest::testSheetProtectionXLSX()
ScDocShellRef xDocSh = saveAndReload(xShell, XLSX);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
- const ScTableProtection* pTabProtect = pDoc->GetTabProtection(0);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ const ScTableProtection* pTabProtect = rDoc.GetTabProtection(0);
CPPUNIT_ASSERT(pTabProtect);
if ( pTabProtect )
{
@@ -1247,11 +1244,6 @@ const char* toBorderName( sal_Int16 eStyle )
void ScExportTest::testExcelCellBorders( sal_uLong nFormatType )
{
- ScDocShellRef xDocSh = loadDoc("cell-borders.", nFormatType);
-
- CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
-
struct
{
SCROW mnRow;
@@ -1272,23 +1264,29 @@ void ScExportTest::testExcelCellBorders( sal_uLong nFormatType )
{ 25, table::BorderLineStyle::DOUBLE_THIN, -1L }, // double (don't check width)
};
- for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
+ ScDocShellRef xDocSh = loadDoc("cell-borders.", nFormatType);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is());
{
- const editeng::SvxBorderLine* pLine = NULL;
- pDoc->GetBorderLines(2, aChecks[i].mnRow, 0, NULL, &pLine, NULL, NULL);
- CPPUNIT_ASSERT(pLine);
- CPPUNIT_ASSERT_EQUAL(toBorderName(aChecks[i].mnStyle), toBorderName(pLine->GetBorderLineStyle()));
- if (aChecks[i].mnWidth >= 0)
- CPPUNIT_ASSERT_EQUAL(aChecks[i].mnWidth, pLine->GetWidth());
+ ScDocument& rDoc = xDocSh->GetDocument();
+
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
+ {
+ const editeng::SvxBorderLine* pLine = NULL;
+ rDoc.GetBorderLines(2, aChecks[i].mnRow, 0, NULL, &pLine, NULL, NULL);
+ CPPUNIT_ASSERT(pLine);
+ CPPUNIT_ASSERT_EQUAL(toBorderName(aChecks[i].mnStyle), toBorderName(pLine->GetBorderLineStyle()));
+ if (aChecks[i].mnWidth >= 0)
+ CPPUNIT_ASSERT_EQUAL(aChecks[i].mnWidth, pLine->GetWidth());
+ }
}
ScDocShellRef xNewDocSh = saveAndReload(xDocSh, nFormatType);
xDocSh->DoClose();
- pDoc = xNewDocSh->GetDocument();
+ ScDocument& rDoc = xNewDocSh->GetDocument();
for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
{
const editeng::SvxBorderLine* pLine = NULL;
- pDoc->GetBorderLines(2, aChecks[i].mnRow, 0, NULL, &pLine, NULL, NULL);
+ rDoc.GetBorderLines(2, aChecks[i].mnRow, 0, NULL, &pLine, NULL, NULL);
CPPUNIT_ASSERT(pLine);
CPPUNIT_ASSERT_EQUAL(toBorderName(aChecks[i].mnStyle), toBorderName(pLine->GetBorderLineStyle()));
if (aChecks[i].mnWidth >= 0)
@@ -1312,10 +1310,10 @@ void ScExportTest::testSheetTabColorsXLSX()
{
struct
{
- bool checkContent( ScDocument* pDoc )
+ bool checkContent( ScDocument& rDoc )
{
- std::vector<OUString> aTabNames = pDoc->GetAllTableNames();
+ std::vector<OUString> aTabNames = rDoc.GetAllTableNames();
// green, red, blue, yellow (from left to right).
if (aTabNames.size() != 4)
@@ -1345,7 +1343,7 @@ void ScExportTest::testSheetTabColorsXLSX()
for (size_t i = 0, n = SAL_N_ELEMENTS(aXclColors); i < n; ++i)
{
- if (aXclColors[i] != pDoc->GetTabBgColor(i).GetColor())
+ if (aXclColors[i] != rDoc.GetTabBgColor(i).GetColor())
{
cerr << "wrong sheet color for sheet " << i << endl;
return false;
@@ -1358,16 +1356,18 @@ void ScExportTest::testSheetTabColorsXLSX()
} aTest;
ScDocShellRef xDocSh = loadDoc("sheet-tab-color.", XLSX);
- CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- bool bRes = aTest.checkContent(pDoc);
- CPPUNIT_ASSERT_MESSAGE("Failed on the initial content check.", bRes);
+ {
+ CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocSh.Is());
+ ScDocument& rDoc = xDocSh->GetDocument();
+ bool bRes = aTest.checkContent(rDoc);
+ CPPUNIT_ASSERT_MESSAGE("Failed on the initial content check.", bRes);
+ }
ScDocShellRef xDocSh2 = saveAndReload(xDocSh, XLSX);
CPPUNIT_ASSERT_MESSAGE("Failed to reload file.", xDocSh2.Is());
xDocSh->DoClose();
- pDoc = xDocSh2->GetDocument();
- bRes = aTest.checkContent(pDoc);
+ ScDocument& rDoc = xDocSh2->GetDocument();
+ bool bRes = aTest.checkContent(rDoc);
CPPUNIT_ASSERT_MESSAGE("Failed on the content check after reload.", bRes);
xDocSh2->DoClose();
@@ -1377,15 +1377,15 @@ void ScExportTest::testSharedFormulaExportXLS()
{
struct
{
- bool checkContent( ScDocument* pDoc )
+ bool checkContent( ScDocument& rDoc )
{
formula::FormulaGrammar::Grammar eGram = formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1;
- pDoc->SetGrammar(eGram);
- sc::TokenStringContext aCxt(pDoc, eGram);
+ rDoc.SetGrammar(eGram);
+ sc::TokenStringContext aCxt(&rDoc, eGram);
// Check the title row.
- OUString aActual = pDoc->GetString(0,1,0);
+ OUString aActual = rDoc.GetString(0,1,0);
OUString aExpected = "Response";
if (aActual != aExpected)
{
@@ -1393,7 +1393,7 @@ void ScExportTest::testSharedFormulaExportXLS()
return false;
}
- aActual = pDoc->GetString(1,1,0);
+ aActual = rDoc.GetString(1,1,0);
aExpected = "Response";
if (aActual != aExpected)
{
@@ -1406,7 +1406,7 @@ void ScExportTest::testSharedFormulaExportXLS()
{
double fExpected = i + 1.0;
ScAddress aPos(0,i+2,0);
- double fActual = pDoc->GetValue(aPos);
+ double fActual = rDoc.GetValue(aPos);
if (fExpected != fActual)
{
cerr << "Wrong value in A" << (i+2) << ": expected=" << fExpected << ", actual=" << fActual << endl;
@@ -1414,7 +1414,7 @@ void ScExportTest::testSharedFormulaExportXLS()
}
aPos.IncCol();
- ScFormulaCell* pFC = pDoc->GetFormulaCell(aPos);
+ ScFormulaCell* pFC = rDoc.GetFormulaCell(aPos);
if (!pFC)
{
cerr << "B" << (i+2) << " should be a formula cell." << endl;
@@ -1429,7 +1429,7 @@ void ScExportTest::testSharedFormulaExportXLS()
return false;
}
- fActual = pDoc->GetValue(aPos);
+ fActual = rDoc.GetValue(aPos);
if (fExpected != fActual)
{
cerr << "Wrong value in B" << (i+2) << ": expected=" << fExpected << ", actual=" << fActual << endl;
@@ -1443,21 +1443,23 @@ void ScExportTest::testSharedFormulaExportXLS()
} aTest;
ScDocShellRef xDocSh = loadDoc("shared-formula/3d-reference.", ODS);
- CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ {
+ CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocSh.Is());
+ ScDocument& rDoc = xDocSh->GetDocument();
- // Check the content of the original.
- bool bRes = aTest.checkContent(pDoc);
- CPPUNIT_ASSERT_MESSAGE("Content check on the original document failed.", bRes);
+ // Check the content of the original.
+ bool bRes = aTest.checkContent(rDoc);
+ CPPUNIT_ASSERT_MESSAGE("Content check on the original document failed.", bRes);
+ }
ScDocShellRef xDocSh2 = saveAndReload(xDocSh, XLS);
xDocSh->DoClose();
CPPUNIT_ASSERT_MESSAGE("Failed to reload file.", xDocSh2.Is());
- pDoc = xDocSh2->GetDocument();
+ ScDocument& rDoc = xDocSh2->GetDocument();
// Check the content of the reloaded. This should be identical.
- bRes = aTest.checkContent(pDoc);
+ bool bRes = aTest.checkContent(rDoc);
CPPUNIT_ASSERT_MESSAGE("Content check on the reloaded document failed.", bRes);
xDocSh2->DoClose();
@@ -1467,14 +1469,14 @@ void ScExportTest::testSharedFormulaExportXLSX()
{
struct
{
- bool checkContent( ScDocument* pDoc )
+ bool checkContent( ScDocument& rDoc )
{
// B2:B7 should show 1,2,3,4,5,6.
double fExpected = 1.0;
for (SCROW i = 1; i <= 6; ++i, ++fExpected)
{
ScAddress aPos(1,i,0);
- double fVal = pDoc->GetValue(aPos);
+ double fVal = rDoc.GetValue(aPos);
if (fVal != fExpected)
{
cerr << "Wrong value in B" << (i+1) << ": expected=" << fExpected << ", actual=" << fVal << endl;
@@ -1487,7 +1489,7 @@ void ScExportTest::testSharedFormulaExportXLSX()
for (SCROW i = 1; i <= 6; ++i, fExpected+=10.0)
{
ScAddress aPos(2,i,0);
- double fVal = pDoc->GetValue(aPos);
+ double fVal = rDoc.GetValue(aPos);
if (fVal != fExpected)
{
cerr << "Wrong value in C" << (i+1) << ": expected=" << fExpected << ", actual=" << fVal << endl;
@@ -1500,7 +1502,7 @@ void ScExportTest::testSharedFormulaExportXLSX()
for (SCROW i = 1; i <= 6; ++i, ++fExpected)
{
ScAddress aPos(3,i,0);
- double fVal = pDoc->GetValue(aPos);
+ double fVal = rDoc.GetValue(aPos);
if (fVal != fExpected)
{
cerr << "Wrong value in D" << (i+1) << ": expected=" << fExpected << ", actual=" << fVal << endl;
@@ -1514,25 +1516,27 @@ void ScExportTest::testSharedFormulaExportXLSX()
} aTest;
ScDocShellRef xDocSh = loadDoc("shared-formula/3d-reference.", XLSX);
- CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ {
+ CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocSh.Is());
+ ScDocument& rDoc = xDocSh->GetDocument();
- bool bRes = aTest.checkContent(pDoc);
- CPPUNIT_ASSERT_MESSAGE("Content check on the initial document failed.", bRes);
+ bool bRes = aTest.checkContent(rDoc);
+ CPPUNIT_ASSERT_MESSAGE("Content check on the initial document failed.", bRes);
- pDoc->CalcAll(); // Recalculate to flush all cached results.
- bRes = aTest.checkContent(pDoc);
- CPPUNIT_ASSERT_MESSAGE("Content check on the initial recalculated document failed.", bRes);
+ rDoc.CalcAll(); // Recalculate to flush all cached results.
+ bRes = aTest.checkContent(rDoc);
+ CPPUNIT_ASSERT_MESSAGE("Content check on the initial recalculated document failed.", bRes);
+ }
// Save and reload, and check the content again.
ScDocShellRef xDocSh2 = saveAndReload(xDocSh, XLSX);
xDocSh->DoClose();
CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocSh2.Is());
- pDoc = xDocSh2->GetDocument();
- pDoc->CalcAll(); // Recalculate to flush all cached results.
+ ScDocument& rDoc = xDocSh2->GetDocument();
+ rDoc.CalcAll(); // Recalculate to flush all cached results.
- bRes = aTest.checkContent(pDoc);
+ bool bRes = aTest.checkContent(rDoc);
CPPUNIT_ASSERT_MESSAGE("Content check on the reloaded document failed.", bRes);
xDocSh2->DoClose();
@@ -1542,7 +1546,7 @@ void ScExportTest::testSharedFormulaStringResultExportXLSX()
{
struct
{
- bool checkContent( ScDocument* pDoc )
+ bool checkContent( ScDocument& rDoc )
{
{
// B2:B7 should show A,B,....,F.
@@ -1550,7 +1554,7 @@ void ScExportTest::testSharedFormulaStringResultExportXLSX()
for (SCROW i = 0; i <= 5; ++i)
{
ScAddress aPos(1,i+1,0);
- OUString aStr = pDoc->GetString(aPos);
+ OUString aStr = rDoc.GetString(aPos);
OUString aExpected = OUString::createFromAscii(expected[i]);
if (aStr != aExpected)
{
@@ -1566,7 +1570,7 @@ void ScExportTest::testSharedFormulaStringResultExportXLSX()
for (SCROW i = 0; i <= 5; ++i)
{
ScAddress aPos(2,i+1,0);
- OUString aStr = pDoc->GetString(aPos);
+ OUString aStr = rDoc.GetString(aPos);
OUString aExpected = OUString::createFromAscii(expected[i]);
if (aStr != aExpected)
{
@@ -1582,25 +1586,26 @@ void ScExportTest::testSharedFormulaStringResultExportXLSX()
} aTest;
ScDocShellRef xDocSh = loadDoc("shared-formula/text-results.", XLSX);
- CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
-
- // Check content without re-calculation, to test cached formula results.
- bool bRes = aTest.checkContent(pDoc);
- CPPUNIT_ASSERT_MESSAGE("Content check on the initial document failed.", bRes);
+ {
+ CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocSh.Is());
+ ScDocument& rDoc = xDocSh->GetDocument();
- // Now, re-calculate and check the results.
- pDoc->CalcAll();
- bRes = aTest.checkContent(pDoc);
- CPPUNIT_ASSERT_MESSAGE("Content check on the initial recalculated document failed.", bRes);
+ // Check content without re-calculation, to test cached formula results.
+ bool bRes = aTest.checkContent(rDoc);
+ CPPUNIT_ASSERT_MESSAGE("Content check on the initial document failed.", bRes);
+ // Now, re-calculate and check the results.
+ rDoc.CalcAll();
+ bRes = aTest.checkContent(rDoc);
+ CPPUNIT_ASSERT_MESSAGE("Content check on the initial recalculated document failed.", bRes);
+ }
// Reload and check again.
ScDocShellRef xDocSh2 = saveAndReload(xDocSh, XLSX);
xDocSh->DoClose();
CPPUNIT_ASSERT_MESSAGE("Failed to re-load file.", xDocSh2.Is());
- pDoc = xDocSh2->GetDocument();
+ ScDocument& rDoc = xDocSh2->GetDocument();
- bRes = aTest.checkContent(pDoc);
+ bool bRes = aTest.checkContent(rDoc);
CPPUNIT_ASSERT_MESSAGE("Content check on the reloaded document failed.", bRes);
xDocSh2->DoClose();
@@ -1612,11 +1617,10 @@ void ScExportTest::testFunctionsExcel2010( sal_uLong nFormatType )
CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xShell.Is());
ScDocShellRef xDocSh = saveAndReload(xShell, nFormatType);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
- pDoc->CalcAll(); // perform hard re-calculation.
+ ScDocument& rDoc = xDocSh->GetDocument();
+ rDoc.CalcAll(); // perform hard re-calculation.
- testFunctionsExcel2010_Impl(pDoc);
+ testFunctionsExcel2010_Impl(rDoc);
xDocSh->DoClose();
}
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index bdc58b840d0f..4374d6fb6988 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -280,34 +280,34 @@ bool ScFiltersTest::load(const OUString &rFilter, const OUString &rURL,
namespace {
-void testRangeNameImpl(ScDocument* pDoc)
+void testRangeNameImpl(ScDocument& rDoc)
{
//check one range data per sheet and one global more detailed
//add some more checks here
- ScRangeData* pRangeData = pDoc->GetRangeName()->findByUpperName(OUString("GLOBAL1"));
+ ScRangeData* pRangeData = rDoc.GetRangeName()->findByUpperName(OUString("GLOBAL1"));
CPPUNIT_ASSERT_MESSAGE("range name Global1 not found", pRangeData);
double aValue;
- pDoc->GetValue(1,0,0,aValue);
+ rDoc.GetValue(1,0,0,aValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE("range name Global1 should reference Sheet1.A1", 1.0, aValue);
- pRangeData = pDoc->GetRangeName(0)->findByUpperName(OUString("LOCAL1"));
+ pRangeData = rDoc.GetRangeName(0)->findByUpperName(OUString("LOCAL1"));
CPPUNIT_ASSERT_MESSAGE("range name Sheet1.Local1 not found", pRangeData);
- pDoc->GetValue(1,2,0,aValue);
+ rDoc.GetValue(1,2,0,aValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE("range name Sheet1.Local1 should reference Sheet1.A3", 3.0, aValue);
- pRangeData = pDoc->GetRangeName(1)->findByUpperName(OUString("LOCAL2"));
+ pRangeData = rDoc.GetRangeName(1)->findByUpperName(OUString("LOCAL2"));
CPPUNIT_ASSERT_MESSAGE("range name Sheet2.Local2 not found", pRangeData);
- pDoc->GetValue(1,1,1,aValue);
+ rDoc.GetValue(1,1,1,aValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE("range name Sheet2.Local2 should reference Sheet2.A2", 7.0, aValue);
//check for correct results for the remaining formulas
- pDoc->GetValue(1,1,0, aValue);
+ rDoc.GetValue(1,1,0, aValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE("=global2 should be 2", 2.0, aValue);
- pDoc->GetValue(1,3,0, aValue);
+ rDoc.GetValue(1,3,0, aValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE("=local2 should be 4", 4.0, aValue);
- pDoc->GetValue(2,0,0, aValue);
+ rDoc.GetValue(2,0,0, aValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE("=SUM(global3) should be 10", 10.0, aValue);
- pDoc->GetValue(1,0,1,aValue);
+ rDoc.GetValue(1,0,1,aValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE("range name Sheet2.local1 should reference Sheet1.A5", 5.0, aValue);
// Test if Global5 ( which depends on Global6 ) is evaluated
- pDoc->GetValue(0,5,1, aValue);
+ rDoc.GetValue(0,5,1, aValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE("formula Global5 should reference Global6 ( which is evaluated as local1 )", 5.0, aValue);
}
@@ -318,17 +318,17 @@ void ScFiltersTest::testBasicCellContentODS()
ScDocShellRef xDocSh = loadDoc("basic-cell-content.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load basic-cell-content.ods", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- OUString aStr = pDoc->GetString(1, 1, 0); // B2
+ ScDocument& rDoc = xDocSh->GetDocument();
+ OUString aStr = rDoc.GetString(1, 1, 0); // B2
CPPUNIT_ASSERT_EQUAL(OUString("LibreOffice Calc"), aStr);
- double fVal = pDoc->GetValue(1, 2, 0); // B3
+ double fVal = rDoc.GetValue(1, 2, 0); // B3
CPPUNIT_ASSERT_EQUAL(12345.0, fVal);
- aStr = pDoc->GetString(1, 3, 0); // B4
+ aStr = rDoc.GetString(1, 3, 0); // B4
CPPUNIT_ASSERT_EQUAL(OUString("A < B"), aStr);
// Numeric value of 0.
ScRefCellValue aCell;
- aCell.assign(*pDoc, ScAddress(1,4,0)); // B5
+ aCell.assign(rDoc, ScAddress(1,4,0)); // B5
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"This cell must be numeric.", CELLTYPE_VALUE, aCell.meType);
CPPUNIT_ASSERT_EQUAL(0.0, aCell.mfValue);
@@ -341,14 +341,14 @@ void ScFiltersTest::testRangeNameXLS()
ScDocShellRef xDocSh = loadDoc("named-ranges-global.", XLS);
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
- testRangeNameImpl(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ testRangeNameImpl(rDoc);
OUString aSheet2CSV("rangeExp_Sheet2.");
OUString aCSVPath;
createCSVPath( aSheet2CSV, aCSVPath );
// fdo#44587
- testFile( aCSVPath, pDoc, 1);
+ testFile( aCSVPath, rDoc, 1);
xDocSh->DoClose();
}
@@ -358,8 +358,8 @@ void ScFiltersTest::testRangeNameXLSX()
ScDocShellRef xDocSh = loadDoc("named-ranges-global.", XLSX);
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
- testRangeNameImpl(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ testRangeNameImpl(rDoc);
xDocSh->DoClose();
}
@@ -367,11 +367,11 @@ void ScFiltersTest::testRangeNameXLSX()
void ScFiltersTest::testHyperlinksXLSX()
{
ScDocShellRef xDocSh = loadDoc("hyperlinks.", XLSX);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT_EQUAL(OUString("10:ABC10"), pDoc->GetString(ScAddress(0,1,0)));
- CPPUNIT_ASSERT_EQUAL(OUString("10:ABC11"), pDoc->GetString(ScAddress(0,2,0)));
- CPPUNIT_ASSERT_EQUAL(OUString("10:ABC12"), pDoc->GetString(ScAddress(0,3,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("10:ABC10"), rDoc.GetString(ScAddress(0,1,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("10:ABC11"), rDoc.GetString(ScAddress(0,2,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("10:ABC12"), rDoc.GetString(ScAddress(0,3,0)));
xDocSh->DoClose();
}
@@ -382,13 +382,13 @@ void ScFiltersTest::testHardRecalcODS()
xDocSh->DoHardRecalc(true);
CPPUNIT_ASSERT_MESSAGE("Failed to load hard-recalc.*", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
OUString aCSVFileName;
//test hard recalc: document has an incorrect cached formula result
//hard recalc should have updated to the correct result
createCSVPath(OUString("hard-recalc."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 0);
+ testFile(aCSVFileName, rDoc, 0);
xDocSh->DoClose();
}
@@ -399,59 +399,59 @@ void ScFiltersTest::testFunctionsODS()
xDocSh->DoHardRecalc(true);
CPPUNIT_ASSERT_MESSAGE("Failed to load functions.*", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
OUString aCSVFileName;
//test logical functions
createCSVPath(OUString("logical-functions."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 0);
+ testFile(aCSVFileName, rDoc, 0);
//test spreadsheet functions
createCSVPath(OUString("spreadsheet-functions."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 1);
+ testFile(aCSVFileName, rDoc, 1);
//test mathematical functions
createCSVPath(OUString("mathematical-functions."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 2, PureString);
+ testFile(aCSVFileName, rDoc, 2, PureString);
//test information functions
createCSVPath(OUString("information-functions."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 3);
+ testFile(aCSVFileName, rDoc, 3);
// text functions
createCSVPath(OUString("text-functions."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 4, PureString);
+ testFile(aCSVFileName, rDoc, 4, PureString);
// statistical functions
createCSVPath(OUString("statistical-functions."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 5);
+ testFile(aCSVFileName, rDoc, 5);
// financial functions
createCSVPath("financial-functions.", aCSVFileName);
- testFile(aCSVFileName, pDoc, 6);
+ testFile(aCSVFileName, rDoc, 6);
xDocSh->DoClose();
xDocSh = loadDoc("database-functions.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load functions.*", xDocSh.Is());
xDocSh->DoHardRecalc(true);
- pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc2 = xDocSh->GetDocument();
createCSVPath("database-functions.", aCSVFileName);
- testFile(aCSVFileName, pDoc, 0);
+ testFile(aCSVFileName, rDoc2, 0);
xDocSh->DoClose();
xDocSh = loadDoc("date-time-functions.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load functions.*", xDocSh.Is());
xDocSh->DoHardRecalc(true);
- pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc3 = xDocSh->GetDocument();
createCSVPath("date-time-functions.", aCSVFileName);
- testFile(aCSVFileName, pDoc, 0, PureString);
+ testFile(aCSVFileName, rDoc3, 0, PureString);
}
void ScFiltersTest::testFunctionsExcel2010()
{
ScDocShellRef xDocSh = loadDoc("functions-excel-2010.", XLSX);
CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- pDoc->CalcAll(); // perform hard re-calculation.
+ ScDocument& rDoc = xDocSh->GetDocument();
+ rDoc.CalcAll(); // perform hard re-calculation.
- testFunctionsExcel2010_Impl(pDoc);
+ testFunctionsExcel2010_Impl(rDoc);
xDocSh->DoClose();
}
@@ -462,24 +462,24 @@ void ScFiltersTest::testCachedFormulaResultsODS()
ScDocShellRef xDocSh = loadDoc("functions.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load functions.*", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
OUString aCSVFileName;
//test cached formula results of logical functions
createCSVPath(OUString("logical-functions."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 0);
+ testFile(aCSVFileName, rDoc, 0);
//test cached formula results of spreadsheet functions
createCSVPath(OUString("spreadsheet-functions."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 1);
+ testFile(aCSVFileName, rDoc, 1);
//test cached formula results of mathematical functions
createCSVPath(OUString("mathematical-functions."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 2, PureString);
+ testFile(aCSVFileName, rDoc, 2, PureString);
//test cached formula results of information functions
createCSVPath(OUString("information-functions."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 3);
+ testFile(aCSVFileName, rDoc, 3);
// text functions
createCSVPath(OUString("text-functions."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 4, PureString);
+ testFile(aCSVFileName, rDoc, 4, PureString);
xDocSh->DoClose();
}
@@ -488,21 +488,21 @@ void ScFiltersTest::testCachedFormulaResultsODS()
ScDocShellRef xDocSh = loadDoc("cachedValue.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load cachedValue.*", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
OUString aCSVFileName;
createCSVPath("cachedValue.", aCSVFileName);
- testFile(aCSVFileName, pDoc, 0);
+ testFile(aCSVFileName, rDoc, 0);
//we want to me sure that volatile functions are always recalculated
//regardless of cached results. if you update the ods file, you must
//update the values here.
//if NOW() is recacluated, then it should never equal sTodayCache
OUString sTodayCache("01/25/13 01:06 PM");
- OUString sTodayRecalc(pDoc->GetString(0,0,1));
+ OUString sTodayRecalc(rDoc.GetString(0,0,1));
CPPUNIT_ASSERT(sTodayCache != sTodayRecalc);
- OUString sTodayRecalcRef(pDoc->GetString(1,0,1));
+ OUString sTodayRecalcRef(rDoc.GetString(1,0,1));
CPPUNIT_ASSERT_EQUAL(sTodayRecalc, sTodayRecalcRef);
// make sure that error values are not being treated as string values
@@ -514,14 +514,14 @@ void ScFiltersTest::testCachedFormulaResultsODS()
aIsErrorFormula.append((char)('A'+nCol)).append(OUString::number(nRow));
aIsErrorFormula.append(")");
OUString aFormula = aIsErrorFormula.makeStringAndClear();
- pDoc->SetString(nCol, nRow + 2, 2, aFormula);
- CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(aFormula, RTL_TEXTENCODING_UTF8).getStr(), pDoc->GetString(nCol, nRow +2, 2), OUString("TRUE"));
+ rDoc.SetString(nCol, nRow + 2, 2, aFormula);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(aFormula, RTL_TEXTENCODING_UTF8).getStr(), rDoc.GetString(nCol, nRow +2, 2), OUString("TRUE"));
OUStringBuffer aIsTextFormula("=ISTEXT(");
aIsTextFormula.append((char)('A'+nCol)).append(OUString::number(nRow));
aIsTextFormula.append(")");
- pDoc->SetString(nCol, nRow + 4, 2, aIsTextFormula.makeStringAndClear());
- CPPUNIT_ASSERT_EQUAL_MESSAGE("", pDoc->GetString(nCol, nRow +4, 2), OUString("FALSE"));
+ rDoc.SetString(nCol, nRow + 4, 2, aIsTextFormula.makeStringAndClear());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("", rDoc.GetString(nCol, nRow +4, 2), OUString("FALSE"));
}
}
@@ -534,17 +534,17 @@ void ScFiltersTest::testCachedMatrixFormulaResultsODS()
ScDocShellRef xDocSh = loadDoc("matrix.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load matrix.*", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
//test matrix
OUString aCSVFileName;
createCSVPath("matrix.", aCSVFileName);
- testFile(aCSVFileName, pDoc, 0);
+ testFile(aCSVFileName, rDoc, 0);
//test matrices with special cases
createCSVPath("matrix2.", aCSVFileName);
- testFile(aCSVFileName, pDoc, 1);
+ testFile(aCSVFileName, rDoc, 1);
createCSVPath("matrix3.", aCSVFileName);
- testFile(aCSVFileName, pDoc, 2);
+ testFile(aCSVFileName, rDoc, 2);
//The above testFile() does not catch the below case.
//If a matrix formula has a matrix reference cell that is intended to have
//a blank text result, the matrix reference cell is actually saved(export)
@@ -552,12 +552,12 @@ void ScFiltersTest::testCachedMatrixFormulaResultsODS()
//Import works around this by setting these cells as text cells so that
//the blank text is used for display instead of the number 0.
//If this is working properly, the following cell should NOT have value data.
- CPPUNIT_ASSERT_EQUAL(OUString(), pDoc->GetString(3,0,2));
+ CPPUNIT_ASSERT_EQUAL(OUString(), rDoc.GetString(3,0,2));
// fdo#59293 with cached value import error formulas require special
// treatment
- pDoc->SetString(2, 5, 2, "=ISERROR(A6)");
- double nVal = pDoc->GetValue(2,5,2);
+ rDoc.SetString(2, 5, 2, "=ISERROR(A6)");
+ double nVal = rDoc.GetValue(2,5,2);
CPPUNIT_ASSERT_EQUAL(1.0, nVal);
xDocSh->DoClose();
@@ -567,22 +567,22 @@ void ScFiltersTest::testFormulaDepAcrossSheetsODS()
{
ScDocShellRef xDocSh = loadDoc("formula-across-sheets.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load the file.", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- sc::AutoCalcSwitch aACSwitch(*pDoc, true); // Make sure auto calc is turned on.
+ sc::AutoCalcSwitch aACSwitch(rDoc, true); // Make sure auto calc is turned on.
// Save the original values of A4:C4.
- double fA4 = pDoc->GetValue(ScAddress(0,3,2));
- double fB4 = pDoc->GetValue(ScAddress(1,3,2));
- double fC4 = pDoc->GetValue(ScAddress(2,3,2));
+ double fA4 = rDoc.GetValue(ScAddress(0,3,2));
+ double fB4 = rDoc.GetValue(ScAddress(1,3,2));
+ double fC4 = rDoc.GetValue(ScAddress(2,3,2));
// Change the value of D4. This should trigger A4:C4 to be recalculated.
- double fD4 = pDoc->GetValue(ScAddress(3,3,2));
- pDoc->SetValue(ScAddress(3,3,2), fD4+1.0);
+ double fD4 = rDoc.GetValue(ScAddress(3,3,2));
+ rDoc.SetValue(ScAddress(3,3,2), fD4+1.0);
- CPPUNIT_ASSERT_MESSAGE("The value must differ from the original.", fA4 != pDoc->GetValue(ScAddress(0,3,2)));
- CPPUNIT_ASSERT_MESSAGE("The value must differ from the original.", fB4 != pDoc->GetValue(ScAddress(1,3,2)));
- CPPUNIT_ASSERT_MESSAGE("The value must differ from the original.", fC4 != pDoc->GetValue(ScAddress(2,3,2)));
+ CPPUNIT_ASSERT_MESSAGE("The value must differ from the original.", fA4 != rDoc.GetValue(ScAddress(0,3,2)));
+ CPPUNIT_ASSERT_MESSAGE("The value must differ from the original.", fB4 != rDoc.GetValue(ScAddress(1,3,2)));
+ CPPUNIT_ASSERT_MESSAGE("The value must differ from the original.", fC4 != rDoc.GetValue(ScAddress(2,3,2)));
xDocSh->DoClose();
}
@@ -591,12 +591,12 @@ void ScFiltersTest::testFormulaDepDeleteContentsODS()
{
ScDocShellRef xDocSh = loadDoc("formula-delete-contents.", ODS, true);
CPPUNIT_ASSERT_MESSAGE("Failed to load the file.", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- sc::UndoSwitch aUndoSwitch(*pDoc, true); // Enable undo.
- sc::AutoCalcSwitch aACSwitch(*pDoc, true); // Make sure auto calc is turned on.
+ sc::UndoSwitch aUndoSwitch(rDoc, true); // Enable undo.
+ sc::AutoCalcSwitch aACSwitch(rDoc, true); // Make sure auto calc is turned on.
- CPPUNIT_ASSERT_EQUAL(195.0, pDoc->GetValue(ScAddress(3,15,0))); // formula in D16
+ CPPUNIT_ASSERT_EQUAL(195.0, rDoc.GetValue(ScAddress(3,15,0))); // formula in D16
// Delete D2:D5.
ScDocFunc& rFunc = xDocSh->GetDocFunc();
@@ -606,55 +606,55 @@ void ScFiltersTest::testFormulaDepDeleteContentsODS()
aMark.MarkToMulti();
bool bGood = rFunc.DeleteContents(aMark, IDF_ALL, true, true);
CPPUNIT_ASSERT(bGood);
- CPPUNIT_ASSERT_EQUAL(0.0, pDoc->GetValue(ScAddress(3,1,0)));
- CPPUNIT_ASSERT_EQUAL(0.0, pDoc->GetValue(ScAddress(3,2,0)));
- CPPUNIT_ASSERT_EQUAL(0.0, pDoc->GetValue(ScAddress(3,3,0)));
- CPPUNIT_ASSERT_EQUAL(0.0, pDoc->GetValue(ScAddress(3,4,0)));
+ CPPUNIT_ASSERT_EQUAL(0.0, rDoc.GetValue(ScAddress(3,1,0)));
+ CPPUNIT_ASSERT_EQUAL(0.0, rDoc.GetValue(ScAddress(3,2,0)));
+ CPPUNIT_ASSERT_EQUAL(0.0, rDoc.GetValue(ScAddress(3,3,0)));
+ CPPUNIT_ASSERT_EQUAL(0.0, rDoc.GetValue(ScAddress(3,4,0)));
- CPPUNIT_ASSERT_EQUAL(94.0, pDoc->GetValue(ScAddress(3,15,0))); // formula in D16
+ CPPUNIT_ASSERT_EQUAL(94.0, rDoc.GetValue(ScAddress(3,15,0))); // formula in D16
- SfxUndoManager* pUndoMgr = pDoc->GetUndoManager();
+ SfxUndoManager* pUndoMgr = rDoc.GetUndoManager();
CPPUNIT_ASSERT(pUndoMgr);
pUndoMgr->Undo();
- CPPUNIT_ASSERT_EQUAL(195.0, pDoc->GetValue(ScAddress(3,15,0))); // formula in D16
+ CPPUNIT_ASSERT_EQUAL(195.0, rDoc.GetValue(ScAddress(3,15,0))); // formula in D16
xDocSh->DoClose();
}
namespace {
-void testDBRanges_Impl(ScDocument* pDoc, sal_Int32 nFormat)
+void testDBRanges_Impl(ScDocument& rDoc, sal_Int32 nFormat)
{
- ScDBCollection* pDBCollection = pDoc->GetDBCollection();
+ ScDBCollection* pDBCollection = rDoc.GetDBCollection();
CPPUNIT_ASSERT_MESSAGE("no database collection", pDBCollection);
- ScDBData* pAnonDBData = pDoc->GetAnonymousDBData(0);
+ ScDBData* pAnonDBData = rDoc.GetAnonymousDBData(0);
CPPUNIT_ASSERT_MESSAGE("missing anonymous DB data in sheet 1", pAnonDBData);
//control hidden rows
bool bHidden;
SCROW nRow1, nRow2;
- bHidden = pDoc->RowHidden(0, 0, &nRow1, &nRow2);
+ bHidden = rDoc.RowHidden(0, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("Sheet1: row 0 should be visible", !bHidden && nRow1 == 0 && nRow2 == 0);
- bHidden = pDoc->RowHidden(1, 0, &nRow1, &nRow2);
+ bHidden = rDoc.RowHidden(1, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("Sheet1: rows 1-2 should be hidden", bHidden && nRow1 == 1 && nRow2 == 2);
- bHidden = pDoc->RowHidden(3, 0, &nRow1, &nRow2);
+ bHidden = rDoc.RowHidden(3, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("Sheet1: row 3 should be visible", !bHidden && nRow1 == 3 && nRow2 == 3);
- bHidden = pDoc->RowHidden(4, 0, &nRow1, &nRow2);
+ bHidden = rDoc.RowHidden(4, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("Sheet1: row 4-5 should be hidden", bHidden && nRow1 == 4 && nRow2 == 5);
- bHidden = pDoc->RowHidden(6, 0, &nRow1, &nRow2);
+ bHidden = rDoc.RowHidden(6, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("Sheet1: row 6-end should be visible", !bHidden && nRow1 == 6 && nRow2 == MAXROW);
if(nFormat == ODS) //excel doesn't support named db ranges
{
double aValue;
- pDoc->GetValue(0,10,1, aValue);
+ rDoc.GetValue(0,10,1, aValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Sheet2: A11: formula result is incorrect", 4.0, aValue);
- pDoc->GetValue(1, 10, 1, aValue);
+ rDoc.GetValue(1, 10, 1, aValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Sheet2: B11: formula result is incorrect", 2.0, aValue);
}
double aValue;
- pDoc->GetValue(3,10,1, aValue);
+ rDoc.GetValue(3,10,1, aValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Sheet2: D11: formula result is incorrect", 4.0, aValue);
- pDoc->GetValue(4, 10, 1, aValue);
+ rDoc.GetValue(4, 10, 1, aValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Sheet2: E11: formula result is incorrect", 2.0, aValue);
}
@@ -666,9 +666,9 @@ void ScFiltersTest::testDatabaseRangesODS()
ScDocShellRef xDocSh = loadDoc("database.", ODS);
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- testDBRanges_Impl(pDoc, ODS);
+ testDBRanges_Impl(rDoc, ODS);
xDocSh->DoClose();
}
@@ -677,9 +677,9 @@ void ScFiltersTest::testDatabaseRangesXLS()
ScDocShellRef xDocSh = loadDoc("database.", XLS);
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- testDBRanges_Impl(pDoc, XLS);
+ testDBRanges_Impl(rDoc, XLS);
xDocSh->DoClose();
}
@@ -688,9 +688,9 @@ void ScFiltersTest::testDatabaseRangesXLSX()
ScDocShellRef xDocSh = loadDoc("database.", XLSX);
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- testDBRanges_Impl(pDoc, XLSX);
+ testDBRanges_Impl(rDoc, XLSX);
xDocSh->DoClose();
}
@@ -699,9 +699,9 @@ void ScFiltersTest::testFormatsODS()
ScDocShellRef xDocSh = loadDoc("formats.", ODS);
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- testFormats(this, pDoc, ODS);
+ testFormats(this, &rDoc, ODS);
xDocSh->DoClose();
}
@@ -710,9 +710,9 @@ void ScFiltersTest::testFormatsODS()
// ScDocShellRef xDocSh = loadDoc("formats.", XLS);
// xDocSh->DoHardRecalc(true);
//
-// ScDocument* pDoc = xDocSh->GetDocument();
+// ScDocument& rDoc = xDocSh->GetDocument();
//
-// testFormats(this, pDoc, XLS);
+// testFormats(this, rDoc, XLS);
// xDocSh->DoClose();
// }
@@ -721,9 +721,9 @@ void ScFiltersTest::testFormatsODS()
// ScDocShellRef xDocSh = loadDoc("formats.", XLSX);
// xDocSh->DoHardRecalc(true);
//
-// ScDocument* pDoc = xDocSh->GetDocument();
+// ScDocument& rDoc = xDocSh->GetDocument();
//
-// testFormats(this, pDoc, XLSX);
+// testFormats(this, rDoc, XLSX);
// xDocSh->DoClose();
// }
@@ -732,11 +732,11 @@ void ScFiltersTest::testMatrixODS()
ScDocShellRef xDocSh = loadDoc("matrix.", ODS);
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
OUString aCSVFileName;
createCSVPath(OUString("matrix."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 0);
+ testFile(aCSVFileName, rDoc, 0);
xDocSh->DoClose();
}
@@ -747,11 +747,11 @@ void ScFiltersTest::testMatrixXLS()
xDocSh->DoHardRecalc(true);
CPPUNIT_ASSERT_MESSAGE("Failed to load matrix.*", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
OUString aCSVFileName;
createCSVPath(OUString("matrix."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 0);
+ testFile(aCSVFileName, rDoc, 0);
xDocSh->DoClose();
}
@@ -761,14 +761,14 @@ void ScFiltersTest::testBorderODS()
ScDocShellRef xDocSh = loadDoc("border.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load border.*", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
const editeng::SvxBorderLine* pLeft = NULL;
const editeng::SvxBorderLine* pTop = NULL;
const editeng::SvxBorderLine* pRight = NULL;
const editeng::SvxBorderLine* pBottom = NULL;
- pDoc->GetBorderLines( 0, 1, 0, &pLeft, &pTop, &pRight, &pBottom );
+ rDoc.GetBorderLines( 0, 1, 0, &pLeft, &pTop, &pRight, &pBottom );
CPPUNIT_ASSERT(!pLeft);
CPPUNIT_ASSERT(!pTop);
CPPUNIT_ASSERT(!pBottom);
@@ -776,7 +776,7 @@ void ScFiltersTest::testBorderODS()
CPPUNIT_ASSERT_EQUAL(
table::BorderLineStyle::SOLID, pRight->GetBorderLineStyle());
- pDoc->GetBorderLines( 2, 1, 0, &pLeft, &pTop, &pRight, &pBottom );
+ rDoc.GetBorderLines( 2, 1, 0, &pLeft, &pTop, &pRight, &pBottom );
CPPUNIT_ASSERT(!pLeft);
CPPUNIT_ASSERT(!pTop);
CPPUNIT_ASSERT(!pBottom);
@@ -786,7 +786,7 @@ void ScFiltersTest::testBorderODS()
table::BorderLineStyle::SOLID, pRight->GetBorderLineStyle());
CPPUNIT_ASSERT_EQUAL(20L, pRight->GetWidth());
- pDoc->GetBorderLines( 2, 8, 0, &pLeft, &pTop, &pRight, &pBottom );
+ rDoc.GetBorderLines( 2, 8, 0, &pLeft, &pTop, &pRight, &pBottom );
CPPUNIT_ASSERT(pLeft);
CPPUNIT_ASSERT(pTop);
@@ -857,7 +857,7 @@ void ScFiltersTest::testBordersOoo33()
ScDocShellRef xDocSh = loadDoc("borders_ooo33.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load borders_ooo33.*", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
const editeng::SvxBorderLine* pLeft = NULL;
const editeng::SvxBorderLine* pTop = NULL;
@@ -868,7 +868,7 @@ void ScFiltersTest::testBordersOoo33()
{
for(sal_Int32 j = 0; j<22; ++j)
{
- pDoc->GetBorderLines( i, j, 0, &pLeft, &pTop, &pRight, &pBottom );
+ rDoc.GetBorderLines( i, j, 0, &pLeft, &pTop, &pRight, &pBottom );
if(pLeft!=NULL && pTop!=NULL && pRight!=NULL && pBottom!=NULL)
{
CPPUNIT_ASSERT_EQUAL(borders[temp].column, i);
@@ -911,22 +911,22 @@ void ScFiltersTest::testBugFixesODS()
CPPUNIT_ASSERT_MESSAGE("Failed to load bugFixes.ods", xDocSh.Is());
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
{
// fdo#40967
OUString aCSVFileName;
createCSVPath(OUString("bugFix_Sheet2."), aCSVFileName);
- testFile(aCSVFileName, pDoc, 1);
+ testFile(aCSVFileName, rDoc, 1);
}
{
// fdo#40426
- ScDBData* pDBData = pDoc->GetDBCollection()->getNamedDBs().findByUpperName("DBRANGE1");
+ ScDBData* pDBData = rDoc.GetDBCollection()->getNamedDBs().findByUpperName("DBRANGE1");
CPPUNIT_ASSERT(pDBData);
CPPUNIT_ASSERT(pDBData->HasHeader());
// no header
- pDBData = pDoc->GetDBCollection()->getNamedDBs().findByUpperName("DBRANGE2");
+ pDBData = rDoc.GetDBCollection()->getNamedDBs().findByUpperName("DBRANGE2");
CPPUNIT_ASSERT(pDBData);
CPPUNIT_ASSERT(!pDBData->HasHeader());
}
@@ -935,7 +935,7 @@ void ScFiltersTest::testBugFixesODS()
// fdo#59240
OUString aCSVFileName;
createCSVPath("bugFix_Sheet4.", aCSVFileName);
- testFile(aCSVFileName, pDoc, 3);
+ testFile(aCSVFileName, rDoc, 3);
}
xDocSh->DoClose();
@@ -947,8 +947,7 @@ void ScFiltersTest::testBugFixesXLS()
CPPUNIT_ASSERT_MESSAGE("Failed to load bugFixes.xls", xDocSh.Is());
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT_MESSAGE("No Document", pDoc); //remove with first test
+ xDocSh->GetDocument();
xDocSh->DoClose();
}
@@ -958,19 +957,18 @@ void ScFiltersTest::testBugFixesXLSX()
CPPUNIT_ASSERT_MESSAGE("Failed to load bugFixes.xls", xDocSh.Is());
xDocSh->DoHardRecalc(true);
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT_MESSAGE("No Document", pDoc); //remove with first test
+ xDocSh->GetDocument();
xDocSh->DoClose();
}
namespace {
-void checkMergedCells( ScDocument* pDoc, const ScAddress& rStartAddress,
+void checkMergedCells( ScDocument& rDoc, const ScAddress& rStartAddress,
const ScAddress& rExpectedEndAddress )
{
SCCOL nActualEndCol = rStartAddress.Col();
SCROW nActualEndRow = rStartAddress.Row();
- pDoc->ExtendMerge( rStartAddress.Col(), rStartAddress.Row(),
+ rDoc.ExtendMerge( rStartAddress.Col(), rStartAddress.Row(),
nActualEndCol, nActualEndRow, rStartAddress.Tab(), false );
OString sTab = OString::number( rStartAddress.Tab() + 1 );
OString msg = "Merged cells are not correctly imported on sheet" + sTab;
@@ -985,25 +983,25 @@ void checkMergedCells( ScDocument* pDoc, const ScAddress& rStartAddress,
void ScFiltersTest::testMergedCellsODS()
{
ScDocShellRef xDocSh = loadDoc("merged.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
//check sheet1 content
OUString aCSVFileName1;
createCSVPath(OUString("merged1."), aCSVFileName1);
- testFile(aCSVFileName1, pDoc, 0);
+ testFile(aCSVFileName1, rDoc, 0);
//check sheet1 merged cells
- checkMergedCells( pDoc, ScAddress( 0, 0, 0 ), ScAddress( 5, 11, 0 ) );
- checkMergedCells( pDoc, ScAddress( 7, 2, 0 ), ScAddress( 9, 12, 0 ) );
- checkMergedCells( pDoc, ScAddress( 3, 15, 0 ), ScAddress( 7, 23, 0 ) );
+ checkMergedCells( rDoc, ScAddress( 0, 0, 0 ), ScAddress( 5, 11, 0 ) );
+ checkMergedCells( rDoc, ScAddress( 7, 2, 0 ), ScAddress( 9, 12, 0 ) );
+ checkMergedCells( rDoc, ScAddress( 3, 15, 0 ), ScAddress( 7, 23, 0 ) );
//check sheet2 content
OUString aCSVFileName2;
createCSVPath(OUString("merged2."), aCSVFileName2);
- testFile(aCSVFileName2, pDoc, 1);
+ testFile(aCSVFileName2, rDoc, 1);
//check sheet2 merged cells
- checkMergedCells( pDoc, ScAddress( 4, 3, 1 ), ScAddress( 6, 15, 1 ) );
+ checkMergedCells( rDoc, ScAddress( 4, 3, 1 ), ScAddress( 6, 15, 1 ) );
xDocSh->DoClose();
}
@@ -1011,17 +1009,17 @@ void ScFiltersTest::testMergedCellsODS()
void ScFiltersTest::testRepeatedColumnsODS()
{
ScDocShellRef xDocSh = loadDoc("repeatedColumns.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
//text
OUString aCSVFileName1;
createCSVPath(OUString("repeatedColumns1."), aCSVFileName1);
- testFile(aCSVFileName1, pDoc, 0);
+ testFile(aCSVFileName1, rDoc, 0);
//numbers
OUString aCSVFileName2;
createCSVPath(OUString("repeatedColumns2."), aCSVFileName2);
- testFile(aCSVFileName2, pDoc, 1);
+ testFile(aCSVFileName2, rDoc, 1);
xDocSh->DoClose();
}
@@ -1035,7 +1033,7 @@ struct ValDataTestParams
ScConditionMode eCondOp;
OUString aStrVal1;
OUString aStrVal2;
- ScDocument* pDocument;
+ ScDocument& rDocument;
ScAddress aPosition;
OUString aErrorTitle;
OUString aErrorMessage;
@@ -1043,24 +1041,24 @@ struct ValDataTestParams
sal_uLong nExpectedIndex;
ValDataTestParams( ScValidationMode eMode, ScConditionMode eOp,
- const OUString& aExpr1, const OUString& aExpr2, ScDocument* pDoc,
+ const OUString& aExpr1, const OUString& aExpr2, ScDocument& rDoc,
ScAddress aPos, const OUString& aETitle, const OUString& aEMsg,
ScValidErrorStyle eEStyle, sal_uLong nIndex ):
eValMode(eMode), eCondOp(eOp), aStrVal1(aExpr1),
- aStrVal2(aExpr2), pDocument(pDoc), aPosition(aPos),
+ aStrVal2(aExpr2), rDocument(rDoc), aPosition(aPos),
aErrorTitle(aETitle), aErrorMessage(aEMsg),
eErrorStyle(eEStyle), nExpectedIndex(nIndex) { };
};
void checkValiditationEntries( const ValDataTestParams& rVDTParams )
{
- ScDocument* pDoc = rVDTParams.pDocument;
+ ScDocument& rDoc = rVDTParams.rDocument;
//create expected data validation entry
ScValidationData aValData(
rVDTParams.eValMode, rVDTParams.eCondOp, rVDTParams.aStrVal1,
- rVDTParams.aStrVal2, pDoc, rVDTParams.aPosition, EMPTY_OUSTRING,
- EMPTY_OUSTRING, pDoc->GetStorageGrammar(), pDoc->GetStorageGrammar()
+ rVDTParams.aStrVal2, &rDoc, rVDTParams.aPosition, EMPTY_OUSTRING,
+ EMPTY_OUSTRING, rDoc.GetStorageGrammar(), rDoc.GetStorageGrammar()
);
aValData.SetIgnoreBlank( true );
aValData.SetListType( 1 );
@@ -1069,7 +1067,7 @@ void checkValiditationEntries( const ValDataTestParams& rVDTParams )
aValData.SetSrcString( EMPTY_OUSTRING );
//get actual data validation entry from document
- const ScValidationData* pValDataTest = pDoc->GetValidationEntry( rVDTParams.nExpectedIndex );
+ const ScValidationData* pValDataTest = rDoc.GetValidationEntry( rVDTParams.nExpectedIndex );
sal_Int32 nCol( static_cast<sal_Int32>(rVDTParams.aPosition.Col()) );
sal_Int32 nRow( static_cast<sal_Int32>(rVDTParams.aPosition.Row()) );
@@ -1089,14 +1087,14 @@ void checkValiditationEntries( const ValDataTestParams& rVDTParams )
}
}
-void checkCellValidity( const ScAddress& rValBaseAddr, const ScRange& rRange, const ScDocument* pDoc )
+void checkCellValidity( const ScAddress& rValBaseAddr, const ScRange& rRange, const ScDocument& rDoc )
{
SCCOL nBCol( rValBaseAddr.Col() );
SCROW nBRow( rValBaseAddr.Row() );
SCTAB nTab( static_cast<const sal_Int32>(rValBaseAddr.Tab()) );
//get from the document the data validation entry we are checking against
- const SfxUInt32Item* pItem = static_cast<const SfxUInt32Item*>(pDoc->GetAttr(nBCol, nBRow, nTab, ATTR_VALIDDATA) );
- const ScValidationData* pValData = pDoc->GetValidationEntry( pItem->GetValue() );
+ const SfxUInt32Item* pItem = static_cast<const SfxUInt32Item*>(rDoc.GetAttr(nBCol, nBRow, nTab, ATTR_VALIDDATA) );
+ const ScValidationData* pValData = rDoc.GetValidationEntry( pItem->GetValue() );
CPPUNIT_ASSERT(pValData);
//check that each cell in the expected range is associated with the data validation entry
@@ -1104,8 +1102,8 @@ void checkCellValidity( const ScAddress& rValBaseAddr, const ScRange& rRange, co
{
for(SCROW j = rRange.aStart.Row(); j <= rRange.aEnd.Row(); ++j)
{
- const SfxUInt32Item* pItemTest = static_cast<const SfxUInt32Item*>( pDoc->GetAttr(i, j, nTab, ATTR_VALIDDATA) );
- const ScValidationData* pValDataTest = pDoc->GetValidationEntry( pItemTest->GetValue() );
+ const SfxUInt32Item* pItemTest = static_cast<const SfxUInt32Item*>( rDoc.GetAttr(i, j, nTab, ATTR_VALIDDATA) );
+ const ScValidationData* pValDataTest = rDoc.GetValidationEntry( pItemTest->GetValue() );
//prevent string operations for occurring unnecessarily
if(!(pValDataTest && pValData->GetKey() == pValDataTest->GetKey()))
{
@@ -1132,21 +1130,21 @@ void checkCellValidity( const ScAddress& rValBaseAddr, const ScRange& rRange, co
void ScFiltersTest::testDataValidityODS()
{
ScDocShellRef xDocSh = loadDoc("dataValidity.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
ScAddress aValBaseAddr1( 2,6,0 ); //sheet1
ScAddress aValBaseAddr2( 2,3,1 ); //sheet2
//sheet1's expected Data Validation Entry values
ValDataTestParams aVDTParams1(
- SC_VALID_DECIMAL, SC_COND_GREATER, "3.14", EMPTY_OUSTRING, pDoc,
+ SC_VALID_DECIMAL, SC_COND_GREATER, "3.14", EMPTY_OUSTRING, rDoc,
aValBaseAddr1, "Too small",
"The number you are trying to enter is not greater than 3.14! Are you sure you want to enter it anyway?",
SC_VALERR_WARNING, 1
);
//sheet2's expected Data Validation Entry values
ValDataTestParams aVDTParams2(
- SC_VALID_WHOLE, SC_COND_BETWEEN, "1", "10", pDoc,
+ SC_VALID_WHOLE, SC_COND_BETWEEN, "1", "10", rDoc,
aValBaseAddr2, "Error sheet 2",
"Must be a whole number between 1 and 10.",
SC_VALERR_STOP, 2
@@ -1160,17 +1158,17 @@ void ScFiltersTest::testDataValidityODS()
ScRange aRange2( 2,3,1, 6,7,1 ); //sheet2
//check each sheet's cells for data validity
- checkCellValidity( aValBaseAddr1, aRange1, pDoc );
- checkCellValidity( aValBaseAddr2, aRange2, pDoc );
+ checkCellValidity( aValBaseAddr1, aRange1, rDoc );
+ checkCellValidity( aValBaseAddr2, aRange2, rDoc );
//check each sheet's content
OUString aCSVFileName1;
createCSVPath(OUString("dataValidity1."), aCSVFileName1);
- testFile(aCSVFileName1, pDoc, 0);
+ testFile(aCSVFileName1, rDoc, 0);
OUString aCSVFileName2;
createCSVPath(OUString("dataValidity2."), aCSVFileName2);
- testFile(aCSVFileName2, pDoc, 1);
+ testFile(aCSVFileName2, rDoc, 1);
xDocSh->DoClose();
}
@@ -1186,43 +1184,43 @@ void ScFiltersTest::testDataTableMortgageXLS()
aOptions.SetFormulaSepArrayRow(";");
xDocSh->SetFormulaOptions(aOptions);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// One-variable table
- if (!checkFormula(*pDoc, ScAddress(3,1,0), "PMT(B3/12,B4,-B5)"))
+ if (!checkFormula(rDoc, ScAddress(3,1,0), "PMT(B3/12,B4,-B5)"))
CPPUNIT_FAIL("Wrong formula!");
- if (!checkFormula(*pDoc, ScAddress(3,2,0), "MULTIPLE.OPERATIONS(D$2,$B$3,$C3)"))
+ if (!checkFormula(rDoc, ScAddress(3,2,0), "MULTIPLE.OPERATIONS(D$2,$B$3,$C3)"))
CPPUNIT_FAIL("Wrong formula!");
- if (!checkFormula(*pDoc, ScAddress(3,3,0), "MULTIPLE.OPERATIONS(D$2,$B$3,$C4)"))
+ if (!checkFormula(rDoc, ScAddress(3,3,0), "MULTIPLE.OPERATIONS(D$2,$B$3,$C4)"))
CPPUNIT_FAIL("Wrong formula!");
- if (!checkFormula(*pDoc, ScAddress(3,4,0), "MULTIPLE.OPERATIONS(D$2,$B$3,$C5)"))
+ if (!checkFormula(rDoc, ScAddress(3,4,0), "MULTIPLE.OPERATIONS(D$2,$B$3,$C5)"))
CPPUNIT_FAIL("Wrong formula!");
// Two-variable table
- if (!checkFormula(*pDoc, ScAddress(2,7,0), "PMT(B9/12,B10,-B11)"))
+ if (!checkFormula(rDoc, ScAddress(2,7,0), "PMT(B9/12,B10,-B11)"))
CPPUNIT_FAIL("Wrong formula!");
- if (!checkFormula(*pDoc, ScAddress(3,8,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C9,$B$10,D$8)"))
+ if (!checkFormula(rDoc, ScAddress(3,8,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C9,$B$10,D$8)"))
CPPUNIT_FAIL("Wrong formula!");
- if (!checkFormula(*pDoc, ScAddress(3,9,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C10,$B$10,D$8)"))
+ if (!checkFormula(rDoc, ScAddress(3,9,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C10,$B$10,D$8)"))
CPPUNIT_FAIL("Wrong formula!");
- if (!checkFormula(*pDoc, ScAddress(3,10,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C11,$B$10,D$8)"))
+ if (!checkFormula(rDoc, ScAddress(3,10,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C11,$B$10,D$8)"))
CPPUNIT_FAIL("Wrong formula!");
- if (!checkFormula(*pDoc, ScAddress(4,8,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C9,$B$10,E$8)"))
+ if (!checkFormula(rDoc, ScAddress(4,8,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C9,$B$10,E$8)"))
CPPUNIT_FAIL("Wrong formula!");
- if (!checkFormula(*pDoc, ScAddress(4,9,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C10,$B$10,E$8)"))
+ if (!checkFormula(rDoc, ScAddress(4,9,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C10,$B$10,E$8)"))
CPPUNIT_FAIL("Wrong formula!");
- if (!checkFormula(*pDoc, ScAddress(4,10,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C11,$B$10,E$8)"))
+ if (!checkFormula(rDoc, ScAddress(4,10,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C11,$B$10,E$8)"))
CPPUNIT_FAIL("Wrong formula!");
xDocSh->DoClose();
@@ -1239,38 +1237,38 @@ void ScFiltersTest::testDataTableOneVarXLSX()
aOptions.SetFormulaSepArrayRow(";");
xDocSh->SetFormulaOptions(aOptions);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// Right now, we have a bug that prevents Calc from re-calculating these
// cells automatically upon file load. We can remove this call if/when we
// fix the aforementioned bug.
- pDoc->CalcAll();
+ rDoc.CalcAll();
// B5:B11 should have multiple operations formula cells. Just check the
// top and bottom cells.
- if (!checkFormula(*pDoc, ScAddress(1,4,0), "MULTIPLE.OPERATIONS(B$4,$A$2,$A5)"))
+ if (!checkFormula(rDoc, ScAddress(1,4,0), "MULTIPLE.OPERATIONS(B$4,$A$2,$A5)"))
CPPUNIT_FAIL("Wrong formula!");
- CPPUNIT_ASSERT_EQUAL(2.0, pDoc->GetValue(ScAddress(1,4,0)));
+ CPPUNIT_ASSERT_EQUAL(2.0, rDoc.GetValue(ScAddress(1,4,0)));
- if (!checkFormula(*pDoc, ScAddress(1,10,0), "MULTIPLE.OPERATIONS(B$4,$A$2,$A11)"))
+ if (!checkFormula(rDoc, ScAddress(1,10,0), "MULTIPLE.OPERATIONS(B$4,$A$2,$A11)"))
CPPUNIT_FAIL("Wrong formula!");
- CPPUNIT_ASSERT_EQUAL(14.0, pDoc->GetValue(ScAddress(1,10,0)));
+ CPPUNIT_ASSERT_EQUAL(14.0, rDoc.GetValue(ScAddress(1,10,0)));
// Likewise, E5:I5 should have multiple operations formula cells. Just
// check the left- and right-most cells.
- if (!checkFormula(*pDoc, ScAddress(4,4,0), "MULTIPLE.OPERATIONS($D5,$B$2,E$4)"))
+ if (!checkFormula(rDoc, ScAddress(4,4,0), "MULTIPLE.OPERATIONS($D5,$B$2,E$4)"))
CPPUNIT_FAIL("Wrong formula!");
- CPPUNIT_ASSERT_EQUAL(10.0, pDoc->GetValue(ScAddress(4,4,0)));
+ CPPUNIT_ASSERT_EQUAL(10.0, rDoc.GetValue(ScAddress(4,4,0)));
- if (!checkFormula(*pDoc, ScAddress(8,4,0), "MULTIPLE.OPERATIONS($D5,$B$2,I$4)"))
+ if (!checkFormula(rDoc, ScAddress(8,4,0), "MULTIPLE.OPERATIONS($D5,$B$2,I$4)"))
CPPUNIT_FAIL("Wrong formula!");
- CPPUNIT_ASSERT_EQUAL(50.0, pDoc->GetValue(ScAddress(8,4,0)));
+ CPPUNIT_ASSERT_EQUAL(50.0, rDoc.GetValue(ScAddress(8,4,0)));
xDocSh->DoClose();
}
@@ -1286,25 +1284,25 @@ void ScFiltersTest::testDataTableMultiTableXLSX()
aOptions.SetFormulaSepArrayRow(";");
xDocSh->SetFormulaOptions(aOptions);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// Right now, we have a bug that prevents Calc from re-calculating these
// cells automatically upon file load. We can remove this call if/when we
// fix the aforementioned bug.
- pDoc->CalcAll();
+ rDoc.CalcAll();
// B4:M15 should have multiple operations formula cells. We'll just check
// the top-left and bottom-right ones.
- if (!checkFormula(*pDoc, ScAddress(1,3,0), "MULTIPLE.OPERATIONS($A$3,$E$1,$A4,$D$1,B$3)"))
+ if (!checkFormula(rDoc, ScAddress(1,3,0), "MULTIPLE.OPERATIONS($A$3,$E$1,$A4,$D$1,B$3)"))
CPPUNIT_FAIL("Wrong formula!");
- CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(ScAddress(1,3,0)));
+ CPPUNIT_ASSERT_EQUAL(1.0, rDoc.GetValue(ScAddress(1,3,0)));
- if (!checkFormula(*pDoc, ScAddress(12,14,0), "MULTIPLE.OPERATIONS($A$3,$E$1,$A15,$D$1,M$3)"))
+ if (!checkFormula(rDoc, ScAddress(12,14,0), "MULTIPLE.OPERATIONS($A$3,$E$1,$A15,$D$1,M$3)"))
CPPUNIT_FAIL("Wrong formula!");
- CPPUNIT_ASSERT_EQUAL(144.0, pDoc->GetValue(ScAddress(12,14,0)));
+ CPPUNIT_ASSERT_EQUAL(144.0, rDoc.GetValue(ScAddress(12,14,0)));
xDocSh->DoClose();
}
@@ -1325,14 +1323,13 @@ void ScFiltersTest::testBrokenQuotesCSV()
nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
CPPUNIT_ASSERT_MESSAGE("Failed to load fdo48621_broken_quotes.csv", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT_MESSAGE("No Document", pDoc); //remove with first test
+ ScDocument& rDoc = xDocSh->GetDocument();
OUString aSheet2CSV("fdo48621_broken_quotes_exported.");
OUString aCSVPath;
createCSVPath( aSheet2CSV, aCSVPath );
// fdo#48621
- testFile( aCSVPath, pDoc, 0, PureString);
+ testFile( aCSVPath, rDoc, 0, PureString);
xDocSh->DoClose();
}
@@ -1353,12 +1350,11 @@ void ScFiltersTest::testCellValueXLSX()
nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
CPPUNIT_ASSERT_MESSAGE("Failed to load cell-value.xlsx", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT_MESSAGE("No Document", pDoc); //remove with first test
+ ScDocument& rDoc = xDocSh->GetDocument();
OUString aCSVPath;
createCSVPath( aFileNameBase, aCSVPath );
- testFile( aCSVPath, pDoc, 0 );
+ testFile( aCSVPath, rDoc, 0 );
xDocSh->DoClose();
}
@@ -1367,22 +1363,22 @@ void ScFiltersTest::testRowIndex1BasedXLSX()
{
ScDocShellRef xDocSh = loadDoc("row-index-1-based.", XLSX);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// A1
- OUString aStr = pDoc->GetString(ScAddress(0,0,0));
+ OUString aStr = rDoc.GetString(ScAddress(0,0,0));
CPPUNIT_ASSERT_EQUAL(OUString("Action Plan.Name"), aStr);
// B1
- aStr = pDoc->GetString(ScAddress(1,0,0));
+ aStr = rDoc.GetString(ScAddress(1,0,0));
CPPUNIT_ASSERT_EQUAL(OUString("Action Plan.Description"), aStr);
// A2
- aStr = pDoc->GetString(ScAddress(0,1,0));
+ aStr = rDoc.GetString(ScAddress(0,1,0));
CPPUNIT_ASSERT_EQUAL(OUString("Jerry"), aStr);
// B2 - multi-line text.
- const EditTextObject* pText = pDoc->GetEditText(ScAddress(1,1,0));
+ const EditTextObject* pText = rDoc.GetEditText(ScAddress(1,1,0));
CPPUNIT_ASSERT(pText);
CPPUNIT_ASSERT(pText->GetParagraphCount() == 3);
aStr = pText->GetText(0);
@@ -1424,10 +1420,8 @@ void ScFiltersTest::testPassword_Impl(const OUString& aFileNameBase)
}
CPPUNIT_ASSERT_MESSAGE("Failed to load password.ods", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT_MESSAGE("No Document", pDoc); //remove with first test
+ xDocSh->GetDocument();
xDocSh->DoClose();
-
}
void ScFiltersTest::testPasswordNew()
@@ -1474,27 +1468,27 @@ void ScFiltersTest::testChartImportODS()
ScDocShellRef xDocSh = loadDoc("chart-import-basic.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load chart-import-basic.ods.", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// Ensure that the document contains "Empty", "Chart", "Data" and "Title" sheets in this exact order.
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"There should be 4 sheets in this document.", sal_Int16(4),
- pDoc->GetTableCount());
+ rDoc.GetTableCount());
OUString aName;
- pDoc->GetName(0, aName);
+ rDoc.GetName(0, aName);
CPPUNIT_ASSERT_EQUAL(OUString("Empty"), aName);
- pDoc->GetName(1, aName);
+ rDoc.GetName(1, aName);
CPPUNIT_ASSERT_EQUAL(OUString("Chart"), aName);
- pDoc->GetName(2, aName);
+ rDoc.GetName(2, aName);
CPPUNIT_ASSERT_EQUAL(OUString("Data"), aName);
- pDoc->GetName(3, aName);
+ rDoc.GetName(3, aName);
CPPUNIT_ASSERT_EQUAL(OUString("Title"), aName);
// Retrieve the chart object instance from the 2nd page (for the 2nd sheet).
- const SdrOle2Obj* pOleObj = getSingleChartObject(*pDoc, 1);
+ const SdrOle2Obj* pOleObj = getSingleChartObject(rDoc, 1);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve a chart object from the 2nd sheet.", pOleObj);
- ScRangeList aRanges = getChartRanges(*pDoc, *pOleObj);
+ ScRangeList aRanges = getChartRanges(rDoc, *pOleObj);
CPPUNIT_ASSERT_MESSAGE("Data series title cell not found.", aRanges.In(ScAddress(1,0,3))); // B1 on Title
CPPUNIT_ASSERT_MESSAGE("Data series label range not found.", aRanges.In(ScRange(0,1,2,0,3,2))); // A2:A4 on Data
@@ -1508,24 +1502,24 @@ void ScFiltersTest::testNumberFormatHTML()
ScDocShellRef xDocSh = loadDoc("numberformat.", HTML);
CPPUNIT_ASSERT_MESSAGE("Failed to load numberformat.html", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// Check the header just in case.
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Cell value is not as expected", OUString("Product"),
- pDoc->GetString(0, 0, 0));
+ rDoc.GetString(0, 0, 0));
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Cell value is not as expected", OUString("Price"),
- pDoc->GetString(1, 0, 0));
+ rDoc.GetString(1, 0, 0));
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Cell value is not as expected", OUString("Note"),
- pDoc->GetString(2, 0, 0));
+ rDoc.GetString(2, 0, 0));
// B2 should be imported as a value cell.
- bool bHasValue = pDoc->HasValueData(1, 1, 0);
+ bool bHasValue = rDoc.HasValueData(1, 1, 0);
CPPUNIT_ASSERT_MESSAGE("Fail to import number as a value cell.", bHasValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE(
- "Incorrect value.", 199.98, pDoc->GetValue(1, 1, 0));
+ "Incorrect value.", 199.98, rDoc.GetValue(1, 1, 0));
xDocSh->DoClose();
}
@@ -1535,24 +1529,24 @@ void ScFiltersTest::testNumberFormatCSV()
ScDocShellRef xDocSh = loadDoc("numberformat.", CSV);
CPPUNIT_ASSERT_MESSAGE("Failed to load numberformat.csv", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// Check the header just in case.
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Cell value is not as expected", OUString("Product"),
- pDoc->GetString(0, 0, 0));
+ rDoc.GetString(0, 0, 0));
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Cell value is not as expected", OUString("Price"),
- pDoc->GetString(1, 0, 0));
+ rDoc.GetString(1, 0, 0));
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Cell value is not as expected", OUString("Note"),
- pDoc->GetString(2, 0, 0));
+ rDoc.GetString(2, 0, 0));
// B2 should be imported as a value cell.
- bool bHasValue = pDoc->HasValueData(1, 1, 0);
+ bool bHasValue = rDoc.HasValueData(1, 1, 0);
CPPUNIT_ASSERT_MESSAGE("Fail to import number as a value cell.", bHasValue);
CPPUNIT_ASSERT_EQUAL_MESSAGE(
- "Incorrect value.", 199.98, pDoc->GetValue(1, 1, 0));
+ "Incorrect value.", 199.98, rDoc.GetValue(1, 1, 0));
xDocSh->DoClose();
}
@@ -1563,11 +1557,11 @@ void ScFiltersTest::testCellAnchoredShapesODS()
CPPUNIT_ASSERT_MESSAGE("Failed to load cell-anchored-shapes.ods", xDocSh.Is());
// There are two cell-anchored objects on the first sheet.
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT_MESSAGE("There should be at least one sheet.", pDoc->GetTableCount() > 0);
+ CPPUNIT_ASSERT_MESSAGE("There should be at least one sheet.", rDoc.GetTableCount() > 0);
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
SdrPage* pPage = pDrawLayer->GetPage(0);
CPPUNIT_ASSERT_MESSAGE("draw page for sheet 1 should exist.", pPage);
sal_uIntPtr nCount = pPage->GetObjCount();
@@ -1611,12 +1605,12 @@ void ScFiltersTest::testPivotTableBasicODS()
ScDocShellRef xDocSh = loadDoc("pivot-table-basic.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load pivot-table-basic.ods", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"There should be exactly two sheets.", sal_Int16(2),
- pDoc->GetTableCount());
+ rDoc.GetTableCount());
- ScDPCollection* pDPs = pDoc->GetDPCollection();
+ ScDPCollection* pDPs = rDoc.GetDPCollection();
CPPUNIT_ASSERT_MESSAGE("Failed to get a live ScDPCollection instance.", pDPs);
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"There should be exactly one pivot table instance.", size_t(1),
@@ -1674,9 +1668,9 @@ void ScFiltersTest::testPivotTableNamedRangeSourceODS()
ScDocShellRef xDocSh = loadDoc("pivot-table-named-range-source.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load pivot-table-named-range-source.ods", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- ScDPCollection* pDPs = pDoc->GetDPCollection();
+ ScDPCollection* pDPs = rDoc.GetDPCollection();
CPPUNIT_ASSERT(pDPs->GetCount() == 1);
ScDPObject* pDP = (*pDPs)[0];
@@ -1729,11 +1723,11 @@ void ScFiltersTest::testPivotTableSharedCacheGroupODS()
{
ScDocShellRef xDocSh = loadDoc("pivot-table-shared-cache-with-group.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// Make sure that page field's visibility settings are loaded correctly.
- ScDPObject* pDPObj = pDoc->GetDPAtCursor(0, 0, 1); // A1 on 2nd sheet
+ ScDPObject* pDPObj = rDoc.GetDPAtCursor(0, 0, 1); // A1 on 2nd sheet
CPPUNIT_ASSERT_MESSAGE("There should be a pivot table here.", pDPObj);
ScDPSaveData* pSaveData = pDPObj->GetSaveData();
CPPUNIT_ASSERT_MESSAGE("Save data is expected.", pSaveData);
@@ -1743,7 +1737,7 @@ void ScFiltersTest::testPivotTableSharedCacheGroupODS()
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(14), pMembers->size());
CPPUNIT_ASSERT_MESSAGE("Incorrect member visibility.", checkVisiblePageFieldMember(*pMembers, "APL-01-1"));
- pDPObj = pDoc->GetDPAtCursor(0, 1, 2); // A2 on 3rd sheet
+ pDPObj = rDoc.GetDPAtCursor(0, 1, 2); // A2 on 3rd sheet
CPPUNIT_ASSERT_MESSAGE("There should be a pivot table here.", pDPObj);
pSaveData = pDPObj->GetSaveData();
CPPUNIT_ASSERT_MESSAGE("Save data is expected.", pSaveData);
@@ -1755,7 +1749,7 @@ void ScFiltersTest::testPivotTableSharedCacheGroupODS()
// These two pivot tables share the same data range. We should only have
// one pivot cache.
- ScDPCollection* pDPs = pDoc->GetDPCollection();
+ ScDPCollection* pDPs = rDoc.GetDPCollection();
ScDPCollection::SheetCaches& rSheetCaches = pDPs->GetSheetCaches();
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rSheetCaches.size());
@@ -1864,14 +1858,14 @@ void ScFiltersTest::testGetPivotDataXLS()
{
ScDocShellRef xDocSh = loadDoc("pivot-getpivotdata.", XLS);
CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- pDoc->CalcAll();
+ ScDocument& rDoc = xDocSh->GetDocument();
+ rDoc.CalcAll();
// Check GETPIVOTDATA results in E3:E20. Expected results are given in
// F3:F20.
for (SCROW nRow = 2; nRow <= 19; ++nRow)
- CPPUNIT_ASSERT_EQUAL(pDoc->GetValue(ScAddress(4,nRow,1)), pDoc->GetValue(ScAddress(5,nRow,1)));
+ CPPUNIT_ASSERT_EQUAL(rDoc.GetValue(ScAddress(4,nRow,1)), rDoc.GetValue(ScAddress(5,nRow,1)));
xDocSh->DoClose();
}
@@ -1883,37 +1877,37 @@ void ScFiltersTest::testRowHeightODS()
SCTAB nTab = 0;
SCROW nRow = 0;
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// The first 3 rows have manual heights.
- int nHeight = pDoc->GetRowHeight(nRow, nTab, false);
- bool bManual = pDoc->IsManualRowHeight(nRow, nTab);
+ int nHeight = rDoc.GetRowHeight(nRow, nTab, false);
+ bool bManual = rDoc.IsManualRowHeight(nRow, nTab);
CPPUNIT_ASSERT_EQUAL(600, nHeight);
CPPUNIT_ASSERT_MESSAGE("this row should have a manual row height.", bManual);
- nHeight = pDoc->GetRowHeight(++nRow, nTab, false);
- bManual = pDoc->IsManualRowHeight(nRow, nTab);
+ nHeight = rDoc.GetRowHeight(++nRow, nTab, false);
+ bManual = rDoc.IsManualRowHeight(nRow, nTab);
CPPUNIT_ASSERT_EQUAL(1200, nHeight);
CPPUNIT_ASSERT_MESSAGE("this row should have a manual row height.", bManual);
- nHeight = pDoc->GetRowHeight(++nRow, nTab, false);
- bManual = pDoc->IsManualRowHeight(nRow, nTab);
+ nHeight = rDoc.GetRowHeight(++nRow, nTab, false);
+ bManual = rDoc.IsManualRowHeight(nRow, nTab);
CPPUNIT_ASSERT_EQUAL(1800, nHeight);
CPPUNIT_ASSERT_MESSAGE("this row should have a manual row height.", bManual);
// This one should have an automatic row height.
- bManual = pDoc->IsManualRowHeight(++nRow, nTab);
+ bManual = rDoc.IsManualRowHeight(++nRow, nTab);
CPPUNIT_ASSERT_MESSAGE("Row should have an automatic height.", !bManual);
// Followed by a row with manual height.
- nHeight = pDoc->GetRowHeight(++nRow, nTab, false);
- bManual = pDoc->IsManualRowHeight(nRow, nTab);
+ nHeight = rDoc.GetRowHeight(++nRow, nTab, false);
+ bManual = rDoc.IsManualRowHeight(nRow, nTab);
CPPUNIT_ASSERT_EQUAL(2400, nHeight);
CPPUNIT_ASSERT_MESSAGE("this row should have a manual row height.", bManual);
// And all the rest should have automatic heights.
- bManual = pDoc->IsManualRowHeight(++nRow, nTab);
+ bManual = rDoc.IsManualRowHeight(++nRow, nTab);
CPPUNIT_ASSERT_MESSAGE("Row should have an automatic height.", !bManual);
- bManual = pDoc->IsManualRowHeight(MAXROW, nTab);
+ bManual = rDoc.IsManualRowHeight(MAXROW, nTab);
CPPUNIT_ASSERT_MESSAGE("Row should have an automatic height.", !bManual);
xDocSh->DoClose();
@@ -1923,25 +1917,25 @@ void ScFiltersTest::testRichTextContentODS()
{
ScDocShellRef xDocSh = loadDoc("rich-text-cells.", ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load rich-text-cells.ods", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
OUString aTabName;
- CPPUNIT_ASSERT_MESSAGE("Failed to get the name of the first sheet.", pDoc->GetName(0, aTabName));
+ CPPUNIT_ASSERT_MESSAGE("Failed to get the name of the first sheet.", rDoc.GetName(0, aTabName));
// All tested cells are in the first column.
ScAddress aPos(0, 0, 0);
// Normal simple string with no formatting.
aPos.IncRow();
- CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, pDoc->GetCellType(aPos));
- CPPUNIT_ASSERT_EQUAL(OUString("Normal"), pDoc->GetString(aPos.Col(), aPos.Row(), aPos.Tab()));
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, rDoc.GetCellType(aPos));
+ CPPUNIT_ASSERT_EQUAL(OUString("Normal"), rDoc.GetString(aPos.Col(), aPos.Row(), aPos.Tab()));
// Normal string with bold applied to the whole cell.
{
aPos.IncRow();
- CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, pDoc->GetCellType(aPos));
- CPPUNIT_ASSERT_EQUAL(OUString("All bold"), pDoc->GetString(aPos.Col(), aPos.Row(), aPos.Tab()));
- const ScPatternAttr* pAttr = pDoc->GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, rDoc.GetCellType(aPos));
+ CPPUNIT_ASSERT_EQUAL(OUString("All bold"), rDoc.GetString(aPos.Col(), aPos.Row(), aPos.Tab()));
+ const ScPatternAttr* pAttr = rDoc.GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
CPPUNIT_ASSERT_MESSAGE("Failed to get cell attribute.", pAttr);
const SvxWeightItem& rWeightItem =
static_cast<const SvxWeightItem&>(pAttr->GetItem(ATTR_FONT_WEIGHT));
@@ -1951,8 +1945,8 @@ void ScFiltersTest::testRichTextContentODS()
// This cell has an unformatted but multi-line content. Multi-line text is
// stored in edit cell even if it has no formatting applied.
aPos.IncRow();
- CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, pDoc->GetCellType(aPos));
- const EditTextObject* pEditText = pDoc->GetEditText(aPos);
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, rDoc.GetCellType(aPos));
+ const EditTextObject* pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), pEditText->GetParagraphCount());
OUString aParaText = pEditText->GetText(0);
@@ -1964,56 +1958,56 @@ void ScFiltersTest::testRichTextContentODS()
// Cell with sheet name field item.
aPos.IncRow();
- CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, pDoc->GetCellType(aPos));
- pEditText = pDoc->GetEditText(aPos);
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, rDoc.GetCellType(aPos));
+ pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), pEditText->GetParagraphCount());
aParaText = pEditText->GetText(0);
CPPUNIT_ASSERT_MESSAGE("Unexpected text.", aParaText.startsWith("Sheet name is "));
CPPUNIT_ASSERT_MESSAGE("Sheet name field item not found.", pEditText->HasField(text::textfield::Type::TABLE));
- CPPUNIT_ASSERT_EQUAL(OUString("Sheet name is Test."), ScEditUtil::GetString(*pEditText, pDoc));
+ CPPUNIT_ASSERT_EQUAL(OUString("Sheet name is Test."), ScEditUtil::GetString(*pEditText, &rDoc));
CPPUNIT_ASSERT_EQUAL(OUString("Sheet name is ?."), ScEditUtil::GetString(*pEditText, NULL));
// Cell with URL field item.
aPos.IncRow();
- CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, pDoc->GetCellType(aPos));
- pEditText = pDoc->GetEditText(aPos);
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, rDoc.GetCellType(aPos));
+ pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), pEditText->GetParagraphCount());
aParaText = pEditText->GetText(0);
CPPUNIT_ASSERT_MESSAGE("Unexpected text.", aParaText.startsWith("URL: "));
CPPUNIT_ASSERT_MESSAGE("URL field item not found.", pEditText->HasField(text::textfield::Type::URL));
- CPPUNIT_ASSERT_EQUAL(OUString("URL: http://libreoffice.org"), ScEditUtil::GetString(*pEditText, pDoc));
+ CPPUNIT_ASSERT_EQUAL(OUString("URL: http://libreoffice.org"), ScEditUtil::GetString(*pEditText, &rDoc));
CPPUNIT_ASSERT_EQUAL(OUString("URL: http://libreoffice.org"), ScEditUtil::GetString(*pEditText, NULL));
// Cell with Date field item.
aPos.IncRow();
- CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, pDoc->GetCellType(aPos));
- pEditText = pDoc->GetEditText(aPos);
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, rDoc.GetCellType(aPos));
+ pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), pEditText->GetParagraphCount());
aParaText = pEditText->GetText(0);
CPPUNIT_ASSERT_MESSAGE("Unexpected text.", aParaText.startsWith("Date: "));
CPPUNIT_ASSERT_MESSAGE("Date field item not found.", pEditText->HasField(text::textfield::Type::DATE));
- CPPUNIT_ASSERT_MESSAGE("Date field not resolved with pDoc.", ScEditUtil::GetString(*pEditText, pDoc).indexOf("/20") > 0);
+ CPPUNIT_ASSERT_MESSAGE("Date field not resolved with rDoc.", ScEditUtil::GetString(*pEditText, &rDoc).indexOf("/20") > 0);
CPPUNIT_ASSERT_MESSAGE("Date field not resolved with NULL.", ScEditUtil::GetString(*pEditText, NULL).indexOf("/20") > 0);
// Cell with DocInfo title field item.
aPos.IncRow();
- CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, pDoc->GetCellType(aPos));
- pEditText = pDoc->GetEditText(aPos);
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, rDoc.GetCellType(aPos));
+ pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), pEditText->GetParagraphCount());
aParaText = pEditText->GetText(0);
CPPUNIT_ASSERT_MESSAGE("Unexpected text.", aParaText.startsWith("Title: "));
CPPUNIT_ASSERT_MESSAGE("DocInfo title field item not found.", pEditText->HasField(text::textfield::Type::DOCINFO_TITLE));
- CPPUNIT_ASSERT_EQUAL(OUString("Title: Test Document"), ScEditUtil::GetString(*pEditText, pDoc));
+ CPPUNIT_ASSERT_EQUAL(OUString("Title: Test Document"), ScEditUtil::GetString(*pEditText, &rDoc));
CPPUNIT_ASSERT_EQUAL(OUString("Title: ?"), ScEditUtil::GetString(*pEditText, NULL));
// Cell with sentence with both bold and italic sequences.
aPos.IncRow();
- CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, pDoc->GetCellType(aPos));
- pEditText = pDoc->GetEditText(aPos);
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, rDoc.GetCellType(aPos));
+ pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), pEditText->GetParagraphCount());
aParaText = pEditText->GetText(0);
@@ -2044,8 +2038,8 @@ void ScFiltersTest::testRichTextContentODS()
// Cell with multi-line content with formatting applied.
aPos.IncRow();
- CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, pDoc->GetCellType(aPos));
- pEditText = pDoc->GetEditText(aPos);
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, rDoc.GetCellType(aPos));
+ pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), pEditText->GetParagraphCount());
aParaText = pEditText->GetText(0);
@@ -2106,31 +2100,31 @@ void ScFiltersTest::testRichTextContentODS()
// field objects gets imported. Later we should add checks for the
// formats.
aPos.IncRow();
- pEditText = pDoc->GetEditText(aPos);
+ pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_MESSAGE("URL field item not found.", pEditText->HasField(text::textfield::Type::URL));
// Sheet name with formats applied.
aPos.IncRow();
- pEditText = pDoc->GetEditText(aPos);
+ pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_MESSAGE("Sheet name field item not found.", pEditText->HasField(text::textfield::Type::TABLE));
// Date with formats applied.
aPos.IncRow();
- pEditText = pDoc->GetEditText(aPos);
+ pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_MESSAGE("Date field item not found.", pEditText->HasField(text::textfield::Type::DATE));
// Document title with formats applied.
aPos.IncRow();
- pEditText = pDoc->GetEditText(aPos);
+ pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_MESSAGE("Date field item not found.", pEditText->HasField(text::textfield::Type::DOCINFO_TITLE));
// URL for a file in the same directory. It should be converted into an absolute URL on import.
aPos.IncRow();
- pEditText = pDoc->GetEditText(aPos);
+ pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
const SvxFieldData* pData = pEditText->GetFieldData(0, 0, text::textfield::Type::URL);
CPPUNIT_ASSERT_MESSAGE("Failed to get the URL data.", pData && pData->GetClassId() == text::textfield::Type::URL);
@@ -2139,19 +2133,19 @@ void ScFiltersTest::testRichTextContentODS()
// Embedded spaces as <text:s text:c='4' />, normal text
aPos.IncRow();
- CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, pDoc->GetCellType(aPos));
- CPPUNIT_ASSERT_EQUAL(OUString("one two"), pDoc->GetString(aPos.Col(), aPos.Row(), aPos.Tab()));
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, rDoc.GetCellType(aPos));
+ CPPUNIT_ASSERT_EQUAL(OUString("one two"), rDoc.GetString(aPos.Col(), aPos.Row(), aPos.Tab()));
// Leading space as <text:s />.
aPos.IncRow();
- CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, pDoc->GetCellType(aPos));
- CPPUNIT_ASSERT_EQUAL(OUString(" =3+4"), pDoc->GetString(aPos.Col(), aPos.Row(), aPos.Tab()));
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, rDoc.GetCellType(aPos));
+ CPPUNIT_ASSERT_EQUAL(OUString(" =3+4"), rDoc.GetString(aPos.Col(), aPos.Row(), aPos.Tab()));
// Embedded spaces with <text:s text:c='4' /> inside a <text:span>, text
// partly bold.
aPos.IncRow();
- CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, pDoc->GetCellType(aPos));
- pEditText = pDoc->GetEditText(aPos);
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, rDoc.GetCellType(aPos));
+ pEditText = rDoc.GetEditText(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), pEditText->GetParagraphCount());
aParaText = pEditText->GetText(0);
@@ -2184,9 +2178,8 @@ void ScFiltersTest::testDataBarODS()
ScDocShellRef xDocSh = loadDoc("databar.", ODS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
- testDataBar_Impl(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ testDataBar_Impl(rDoc);
xDocSh->DoClose();
}
@@ -2196,9 +2189,8 @@ void ScFiltersTest::testDataBarXLSX()
ScDocShellRef xDocSh = loadDoc("databar.", XLSX);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
- testDataBar_Impl(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ testDataBar_Impl(rDoc);
xDocSh->DoClose();
}
@@ -2207,11 +2199,10 @@ void ScFiltersTest::testColorScaleODS()
{
ScDocShellRef xDocSh = loadDoc("colorscale.", ODS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
- testColorScale2Entry_Impl(pDoc);
- testColorScale3Entry_Impl(pDoc);
+ testColorScale2Entry_Impl(rDoc);
+ testColorScale3Entry_Impl(rDoc);
xDocSh->DoClose();
}
@@ -2220,11 +2211,10 @@ void ScFiltersTest::testColorScaleXLSX()
{
ScDocShellRef xDocSh = loadDoc("colorscale.", XLSX);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
- testColorScale2Entry_Impl(pDoc);
- testColorScale3Entry_Impl(pDoc);
+ testColorScale2Entry_Impl(rDoc);
+ testColorScale3Entry_Impl(rDoc);
xDocSh->DoClose();
}
@@ -2235,12 +2225,12 @@ void ScFiltersTest::testNewCondFormatODS()
CPPUNIT_ASSERT_MESSAGE("Failed to load new_cond_format_test.xlsx", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
OUString aCSVFile("new_cond_format_test.");
OUString aCSVPath;
createCSVPath( aCSVFile, aCSVPath );
- testCondFile(aCSVPath, pDoc, 0);
+ testCondFile(aCSVPath, &rDoc, 0);
xDocSh->DoClose();
}
@@ -2251,12 +2241,12 @@ void ScFiltersTest::testNewCondFormatXLSX()
CPPUNIT_ASSERT_MESSAGE("Failed to load new_cond_format_test.xlsx", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
OUString aCSVFile("new_cond_format_test.");
OUString aCSVPath;
createCSVPath( aCSVFile, aCSVPath );
- testCondFile(aCSVPath, pDoc, 0);
+ testCondFile(aCSVPath, &rDoc, 0);
xDocSh->DoClose();
}
@@ -2266,10 +2256,10 @@ void ScFiltersTest::testLiteralInFormulaXLS()
ScDocShellRef xDocSh = loadDoc("shared-string/literal-in-formula.", XLS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- pDoc->CalcAll();
+ ScDocument& rDoc = xDocSh->GetDocument();
+ rDoc.CalcAll();
- CPPUNIT_ASSERT_EQUAL(2.0, pDoc->GetValue(ScAddress(0,0,0)));
+ CPPUNIT_ASSERT_EQUAL(2.0, rDoc.GetValue(ScAddress(0,0,0)));
xDocSh->DoClose();
}
@@ -2278,17 +2268,17 @@ void ScFiltersTest::testFormulaDependency()
{
ScDocShellRef xDocSh = ScBootstrapFixture::loadDoc( "dependencyTree.", ODS );
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// check if formula in A1 changes value
- double nVal = pDoc->GetValue(0,0,0);
+ double nVal = rDoc.GetValue(0,0,0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(nVal, 1.0, 1e-10);
- pDoc->SetValue(0,1,0, 0.0);
- nVal = pDoc->GetValue(0,0,0);
+ rDoc.SetValue(0,1,0, 0.0);
+ nVal = rDoc.GetValue(0,0,0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(nVal, 2.0, 1e-10);
// check that the number format is implicity inherited
- // CPPUNIT_ASSERT_EQUAL(pDoc->GetString(0,4,0), pDoc->GetString(0,5,0));
+ // CPPUNIT_ASSERT_EQUAL(rDoc.GetString(0,4,0), rDoc.GetString(0,5,0));
xDocSh->DoClose();
}
@@ -2336,11 +2326,11 @@ void ScFiltersTest::testOptimalHeightReset()
ScDocShellRef xDocSh = loadDoc("multilineoptimal.", ODS, true);
SCTAB nTab = 0;
SCROW nRow = 0;
- ScDocument* pDoc = xDocSh->GetDocument();
- pDoc->EnableAdjustHeight( true );
+ ScDocument& rDoc = xDocSh->GetDocument();
+ rDoc.EnableAdjustHeight( true );
// open document in read/write mode ( otherwise optimal height stuff won't
// be triggered ) *and* you can't delete cell contents.
- int nHeight = sc::TwipsToHMM ( pDoc->GetRowHeight(nRow, nTab, false) );
+ int nHeight = sc::TwipsToHMM ( rDoc.GetRowHeight(nRow, nTab, false) );
CPPUNIT_ASSERT_EQUAL(1263, nHeight);
ScDocFunc &rFunc = xDocSh->GetDocFunc();
@@ -2352,14 +2342,14 @@ void ScFiltersTest::testOptimalHeightReset()
rFunc.DeleteContents( aMark, IDF_ALL, false, true );
// get the new height of A1
- nHeight = sc::TwipsToHMM( pDoc->GetRowHeight(nRow, nTab, false) );
+ nHeight = sc::TwipsToHMM( rDoc.GetRowHeight(nRow, nTab, false) );
// set optimal height for empty row 2
std::vector<sc::ColRowSpan> aRowArr(1, sc::ColRowSpan(2,2));
rFunc.SetWidthOrHeight(false, aRowArr, nTab, SC_SIZE_OPTIMAL, 0, true, true);
// retrieve optimal height
- int nOptimalHeight = sc::TwipsToHMM( pDoc->GetRowHeight(aRowArr[0].mnStart, nTab, false) );
+ int nOptimalHeight = sc::TwipsToHMM( rDoc.GetRowHeight(aRowArr[0].mnStart, nTab, false) );
// check if the new height of A1 ( after delete ) is now the optimal height of an empty cell
CPPUNIT_ASSERT_EQUAL(nOptimalHeight, nHeight );
@@ -2369,12 +2359,12 @@ void ScFiltersTest::testOptimalHeightReset()
void ScFiltersTest::testPrintRangeODS()
{
ScDocShellRef xDocSh = loadDoc("print-range.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
- const ScRange* pRange = pDoc->GetRepeatRowRange(0);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ const ScRange* pRange = rDoc.GetRepeatRowRange(0);
CPPUNIT_ASSERT(pRange);
CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,0,1,0), *pRange);
- pRange = pDoc->GetRepeatRowRange(1);
+ pRange = rDoc.GetRepeatRowRange(1);
CPPUNIT_ASSERT(pRange);
CPPUNIT_ASSERT_EQUAL(ScRange(0,2,0,0,4,0), *pRange);
@@ -2384,18 +2374,18 @@ void ScFiltersTest::testPrintRangeODS()
void ScFiltersTest::testOutlineODS()
{
ScDocShellRef xDocSh = loadDoc("outline.", ODS);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
- const ScOutlineTable* pTable = pDoc->GetOutlineTable(0);
+ const ScOutlineTable* pTable = rDoc.GetOutlineTable(0);
CPPUNIT_ASSERT(pTable);
- const ScOutlineArray* pArr = pTable->GetRowArray();
- size_t nDepth = pArr->GetDepth();
+ const ScOutlineArray& rArr = pTable->GetRowArray();
+ size_t nDepth = rArr.GetDepth();
CPPUNIT_ASSERT_EQUAL(size_t(4), nDepth);
for(size_t i = 0; i < nDepth; ++i)
{
- CPPUNIT_ASSERT_EQUAL(size_t(1), pArr->GetCount(i));
+ CPPUNIT_ASSERT_EQUAL(size_t(1), rArr.GetCount(i));
}
struct OutlineData {
@@ -2419,7 +2409,7 @@ void ScFiltersTest::testOutlineODS()
for(size_t i = 0; i < SAL_N_ELEMENTS(aRow); ++i)
{
- const ScOutlineEntry* pEntry = pArr->GetEntry(aRow[i].nDepth, aRow[i].nIndex);
+ const ScOutlineEntry* pEntry = rArr.GetEntry(aRow[i].nDepth, aRow[i].nIndex);
SCCOLROW nStart = pEntry->GetStart();
CPPUNIT_ASSERT_EQUAL(aRow[i].nStart, nStart);
@@ -2440,16 +2430,15 @@ void ScFiltersTest::testColumnStyleXLSX()
{
ScDocShellRef xDocSh = loadDoc("column-style.", XLSX);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(pDoc);
+ ScDocument& rDoc = xDocSh->GetDocument();
- const ScPatternAttr* pPattern = pDoc->GetPattern(0,0,0);
+ const ScPatternAttr* pPattern = rDoc.GetPattern(0,0,0);
CPPUNIT_ASSERT(pPattern);
const ScProtectionAttr& rAttr = static_cast<const ScProtectionAttr&>(pPattern->GetItem(ATTR_PROTECTION));
CPPUNIT_ASSERT(rAttr.GetProtection());
- pPattern = pDoc->GetPattern(0,1,0);
+ pPattern = rDoc.GetPattern(0,1,0);
CPPUNIT_ASSERT(pPattern);
const ScProtectionAttr& rAttrNew = static_cast<const ScProtectionAttr&>(pPattern->GetItem(ATTR_PROTECTION));
@@ -2462,14 +2451,14 @@ void ScFiltersTest::testSharedFormulaHorizontalXLS()
{
ScDocShellRef xDocSh = loadDoc("shared-formula/horizontal.", XLS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// Make sure K2:S2 on the 2nd sheet are all formula cells.
ScAddress aPos(0, 1, 1);
for (SCCOL nCol = 10; nCol <= 18; ++nCol)
{
aPos.SetCol(nCol);
- CPPUNIT_ASSERT_MESSAGE("Formula cell is expected here.", pDoc->GetCellType(aPos) == CELLTYPE_FORMULA);
+ CPPUNIT_ASSERT_MESSAGE("Formula cell is expected here.", rDoc.GetCellType(aPos) == CELLTYPE_FORMULA);
}
// Likewise, B3:J9 all should be formula cells.
@@ -2479,7 +2468,7 @@ void ScFiltersTest::testSharedFormulaHorizontalXLS()
for (SCROW nRow = 2; nRow <= 8; ++nRow)
{
aPos.SetRow(nRow);
- CPPUNIT_ASSERT_MESSAGE("Formula cell is expected here.", pDoc->GetCellType(aPos) == CELLTYPE_FORMULA);
+ CPPUNIT_ASSERT_MESSAGE("Formula cell is expected here.", rDoc.GetCellType(aPos) == CELLTYPE_FORMULA);
}
}
@@ -2488,12 +2477,12 @@ void ScFiltersTest::testSharedFormulaHorizontalXLS()
for (SCCOL nCol = 1; nCol <= 8; ++nCol)
{
aPos.SetCol(nCol);
- CPPUNIT_ASSERT_MESSAGE("Formula cell is expected here.", pDoc->GetCellType(aPos) == CELLTYPE_FORMULA);
+ CPPUNIT_ASSERT_MESSAGE("Formula cell is expected here.", rDoc.GetCellType(aPos) == CELLTYPE_FORMULA);
}
// J2 has a string of "MW".
aPos.SetCol(9);
- CPPUNIT_ASSERT_EQUAL(OUString("MW"), pDoc->GetString(aPos));
+ CPPUNIT_ASSERT_EQUAL(OUString("MW"), rDoc.GetString(aPos));
xDocSh->DoClose();
}
@@ -2502,23 +2491,23 @@ void ScFiltersTest::testSharedFormulaWrappedRefsXLS()
{
ScDocShellRef xDocSh = loadDoc("shared-formula/wrapped-refs.", XLS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- pDoc->CalcAll();
+ ScDocument& rDoc = xDocSh->GetDocument();
+ rDoc.CalcAll();
// Check the values of H7:H10.
- CPPUNIT_ASSERT_EQUAL(7.0, pDoc->GetValue(ScAddress(7,6,0)));
- CPPUNIT_ASSERT_EQUAL(8.0, pDoc->GetValue(ScAddress(7,7,0)));
- CPPUNIT_ASSERT_EQUAL(9.0, pDoc->GetValue(ScAddress(7,8,0)));
- CPPUNIT_ASSERT_EQUAL(10.0, pDoc->GetValue(ScAddress(7,9,0)));
+ CPPUNIT_ASSERT_EQUAL(7.0, rDoc.GetValue(ScAddress(7,6,0)));
+ CPPUNIT_ASSERT_EQUAL(8.0, rDoc.GetValue(ScAddress(7,7,0)));
+ CPPUNIT_ASSERT_EQUAL(9.0, rDoc.GetValue(ScAddress(7,8,0)));
+ CPPUNIT_ASSERT_EQUAL(10.0, rDoc.GetValue(ScAddress(7,9,0)));
// EM7:EM10 should reference H7:H10.
- CPPUNIT_ASSERT_EQUAL(7.0, pDoc->GetValue(ScAddress(142,6,0)));
- CPPUNIT_ASSERT_EQUAL(8.0, pDoc->GetValue(ScAddress(142,7,0)));
- CPPUNIT_ASSERT_EQUAL(9.0, pDoc->GetValue(ScAddress(142,8,0)));
- CPPUNIT_ASSERT_EQUAL(10.0, pDoc->GetValue(ScAddress(142,9,0)));
+ CPPUNIT_ASSERT_EQUAL(7.0, rDoc.GetValue(ScAddress(142,6,0)));
+ CPPUNIT_ASSERT_EQUAL(8.0, rDoc.GetValue(ScAddress(142,7,0)));
+ CPPUNIT_ASSERT_EQUAL(9.0, rDoc.GetValue(ScAddress(142,8,0)));
+ CPPUNIT_ASSERT_EQUAL(10.0, rDoc.GetValue(ScAddress(142,9,0)));
// Make sure EM7:EM10 are grouped.
- const ScFormulaCell *pFC = pDoc->GetFormulaCell(ScAddress(142,6,0));
+ const ScFormulaCell *pFC = rDoc.GetFormulaCell(ScAddress(142,6,0));
CPPUNIT_ASSERT(pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(6), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(4), pFC->GetSharedLength());
@@ -2530,11 +2519,11 @@ void ScFiltersTest::testSharedFormulaBIFF5()
{
ScDocShellRef xDocSh = loadDoc("shared-formula/biff5.", XLS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
- pDoc->CalcAll();
+ ScDocument& rDoc = xDocSh->GetDocument();
+ rDoc.CalcAll();
// E6:E376 should be all formulas, and they should belong to the same group.
- const ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(4,5,0));
+ const ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(4,5,0));
CPPUNIT_ASSERT(pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(5), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(371), pFC->GetSharedLength());
@@ -2546,13 +2535,13 @@ void ScFiltersTest::testExternalRefCacheXLSX()
{
ScDocShellRef xDocSh = loadDoc("external-refs.", XLSX);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// These string values are cached external cell values.
- CPPUNIT_ASSERT_EQUAL(OUString("Name"), pDoc->GetString(ScAddress(0,0,0)));
- CPPUNIT_ASSERT_EQUAL(OUString("Andy"), pDoc->GetString(ScAddress(0,1,0)));
- CPPUNIT_ASSERT_EQUAL(OUString("Bruce"), pDoc->GetString(ScAddress(0,2,0)));
- CPPUNIT_ASSERT_EQUAL(OUString("Charlie"), pDoc->GetString(ScAddress(0,3,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("Name"), rDoc.GetString(ScAddress(0,0,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("Andy"), rDoc.GetString(ScAddress(0,1,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("Bruce"), rDoc.GetString(ScAddress(0,2,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("Charlie"), rDoc.GetString(ScAddress(0,3,0)));
xDocSh->DoClose();
}
@@ -2562,12 +2551,12 @@ void ScFiltersTest::testExternalRefCacheODS()
ScDocShellRef xDocSh = loadDoc("external-ref-cache.", ODS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// Cells B2:B4 have VLOOKUP with external references which should all show "text".
- CPPUNIT_ASSERT_EQUAL(OUString("text"), pDoc->GetString(ScAddress(1,1,0)));
- CPPUNIT_ASSERT_EQUAL(OUString("text"), pDoc->GetString(ScAddress(1,2,0)));
- CPPUNIT_ASSERT_EQUAL(OUString("text"), pDoc->GetString(ScAddress(1,3,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("text"), rDoc.GetString(ScAddress(1,1,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("text"), rDoc.GetString(ScAddress(1,2,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("text"), rDoc.GetString(ScAddress(1,3,0)));
xDocSh->DoClose();
}
@@ -2577,10 +2566,10 @@ void ScFiltersTest::testHybridSharedStringODS()
ScDocShellRef xDocSh = loadDoc("hybrid-shared-string.", ODS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// A2 contains formula with MATCH function. The result must be 2, not #N/A!
- CPPUNIT_ASSERT_EQUAL(2.0, pDoc->GetValue(ScAddress(0,1,0)));
+ CPPUNIT_ASSERT_EQUAL(2.0, rDoc.GetValue(ScAddress(0,1,0)));
xDocSh->DoClose();
}
@@ -2589,16 +2578,16 @@ void ScFiltersTest::testCopyMergedNumberFormats()
{
ScDocShellRef xDocSh = loadDoc("copy-merged-number-formats.", ODS);
CPPUNIT_ASSERT(xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocument& rDoc = xDocSh->GetDocument();
// Cells B1, C1 and D1 are formatted as dates.
- OUString aStrB1 = pDoc->GetString(ScAddress(1,0,0));
- OUString aStrC1 = pDoc->GetString(ScAddress(2,0,0));
- OUString aStrD1 = pDoc->GetString(ScAddress(3,0,0));
+ OUString aStrB1 = rDoc.GetString(ScAddress(1,0,0));
+ OUString aStrC1 = rDoc.GetString(ScAddress(2,0,0));
+ OUString aStrD1 = rDoc.GetString(ScAddress(3,0,0));
ScDocument aCopyDoc;
aCopyDoc.InsertTab(0, "CopyHere");
- pDoc->CopyStaticToDocument(ScRange(1,0,0,3,0,0), 0, &aCopyDoc);
+ rDoc.CopyStaticToDocument(ScRange(1,0,0,3,0,0), 0, &aCopyDoc);
// Make sure the date formats are copied to the new document.
CPPUNIT_ASSERT_EQUAL(aStrB1, aCopyDoc.GetString(ScAddress(1,0,0)));
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 3396446d5f03..d6ed393497b7 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -162,7 +162,7 @@ void Test::setUp()
SFXMODEL_DISABLE_DOCUMENT_RECOVERY);
m_pImpl->m_xDocShell->DoInitUnitTest();
- m_pDoc = m_pImpl->m_xDocShell->GetDocument();
+ m_pDoc = &m_pImpl->m_xDocShell->GetDocument();
}
void Test::tearDown()
@@ -4579,7 +4579,7 @@ void Test::testCopyPasteFormulasExternalDoc()
OUString aDocName("file:///source.fake");
SfxMedium* pMedium = new SfxMedium(aDocName, STREAM_STD_READWRITE);
getDocShell().DoInitNew(pMedium);
- m_pDoc = getDocShell().GetDocument();
+ m_pDoc = &getDocShell().GetDocument();
ScDocShellRef xExtDocSh = new ScDocShell;
OUString aExtDocName("file:///extdata.fake");
@@ -4590,9 +4590,9 @@ void Test::testCopyPasteFormulasExternalDoc()
CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
findLoadedDocShellByName(aExtDocName) != NULL);
- ScDocument* pExtDoc = xExtDocSh->GetDocument();
- pExtDoc->InsertTab(0, aExtSh1Name);
- pExtDoc->InsertTab(1, aExtSh2Name);
+ ScDocument& rExtDoc = xExtDocSh->GetDocument();
+ rExtDoc.InsertTab(0, aExtSh1Name);
+ rExtDoc.InsertTab(1, aExtSh2Name);
m_pDoc->InsertTab(0, "Sheet1");
m_pDoc->InsertTab(1, "Sheet2");
@@ -4615,23 +4615,23 @@ void Test::testCopyPasteFormulasExternalDoc()
aRange = ScRange(1,1,1,1,6,1);
ScMarkData aMarkData2;
aMarkData2.SetMarkArea(aRange);
- pExtDoc->CopyFromClip(aRange, aMarkData2, nFlags, NULL, pClipDoc);
+ rExtDoc.CopyFromClip(aRange, aMarkData2, nFlags, NULL, pClipDoc);
OUString aFormula;
- pExtDoc->GetFormula(1,1,1, aFormula);
+ rExtDoc.GetFormula(1,1,1, aFormula);
//adjust absolute refs pointing to the copy area
CPPUNIT_ASSERT_EQUAL(aFormula, OUString("=COLUMN($B$2)"));
- pExtDoc->GetFormula(1,2,1, aFormula);
+ rExtDoc.GetFormula(1,2,1, aFormula);
//adjust absolute refs and keep relative refs
CPPUNIT_ASSERT_EQUAL(aFormula, OUString("=$B$2+C3"));
- pExtDoc->GetFormula(1,3,1, aFormula);
+ rExtDoc.GetFormula(1,3,1, aFormula);
// make absolute sheet refs external refs
CPPUNIT_ASSERT_EQUAL(aFormula, OUString("='file:///source.fake'#$Sheet2.B2"));
- pExtDoc->GetFormula(1,4,1, aFormula);
+ rExtDoc.GetFormula(1,4,1, aFormula);
CPPUNIT_ASSERT_EQUAL(aFormula, OUString("='file:///source.fake'#$Sheet2.$A$1"));
- pExtDoc->GetFormula(1,5,1, aFormula);
+ rExtDoc.GetFormula(1,5,1, aFormula);
CPPUNIT_ASSERT_EQUAL(aFormula, OUString("='file:///source.fake'#$Sheet2.B$1"));
- pExtDoc->GetFormula(1,6,1, aFormula);
+ rExtDoc.GetFormula(1,6,1, aFormula);
CPPUNIT_ASSERT_EQUAL(aFormula, OUString("=$ExtSheet2.$B$2"));
}
@@ -5466,21 +5466,21 @@ void Test::testNoteDeleteRow()
void Test::testNoteDeleteCol()
{
- ScDocument* pDoc = getDocShell().GetDocument();
- pDoc->InsertTab(0, "Sheet1");
+ ScDocument& rDoc = getDocShell().GetDocument();
+ rDoc.InsertTab(0, "Sheet1");
ScAddress rAddr(1, 1, 0);
ScPostIt* pNote = m_pDoc->GetOrCreateNote(rAddr);
pNote->SetText(rAddr, "Hello");
pNote->SetAuthor("Jim Bob");
- CPPUNIT_ASSERT_MESSAGE("there should be a note", pDoc->HasNote(1, 1, 0));
+ CPPUNIT_ASSERT_MESSAGE("there should be a note", rDoc.HasNote(1, 1, 0));
- pDoc->DeleteCol(0, 0, MAXROW, 0, 1, 1);
+ rDoc.DeleteCol(0, 0, MAXROW, 0, 1, 1);
- CPPUNIT_ASSERT_MESSAGE("there should be no more note", !pDoc->HasNote(1, 1, 0));
+ CPPUNIT_ASSERT_MESSAGE("there should be no more note", !rDoc.HasNote(1, 1, 0));
- pDoc->DeleteTab(0);
+ rDoc.DeleteTab(0);
}
void Test::testNoteLifeCycle()
@@ -5583,8 +5583,8 @@ void Test::testNoteCopyPaste()
void Test::testAreasWithNotes()
{
- ScDocument* pDoc = getDocShell().GetDocument();
- pDoc->InsertTab(0, "Sheet1");
+ ScDocument& rDoc = getDocShell().GetDocument();
+ rDoc.InsertTab(0, "Sheet1");
ScAddress rAddr(1, 5, 0);
ScPostIt* pNote = m_pDoc->GetOrCreateNote(rAddr);
@@ -5600,40 +5600,40 @@ void Test::testAreasWithNotes()
// only cell notes (empty content)
- dataFound = pDoc->GetDataStart(0,col,row);
+ dataFound = rDoc.GetDataStart(0,col,row);
CPPUNIT_ASSERT_MESSAGE("No DataStart found", dataFound);
CPPUNIT_ASSERT_MESSAGE("DataStart wrong col for notes", col == 1);
CPPUNIT_ASSERT_MESSAGE("DataStart wrong row for notes", row == 2);
- dataFound = pDoc->GetCellArea(0,col,row);
+ dataFound = rDoc.GetCellArea(0,col,row);
CPPUNIT_ASSERT_MESSAGE("No CellArea found", dataFound);
CPPUNIT_ASSERT_MESSAGE("CellArea wrong col for notes", col == 2);
CPPUNIT_ASSERT_MESSAGE("CellArea wrong row for notes", row == 5);
bool bNotes = true;
- dataFound = pDoc->GetPrintArea(0,col,row, bNotes);
+ dataFound = rDoc.GetPrintArea(0,col,row, bNotes);
CPPUNIT_ASSERT_MESSAGE("No PrintArea found", dataFound);
CPPUNIT_ASSERT_MESSAGE("PrintArea wrong col for notes", col == 2);
CPPUNIT_ASSERT_MESSAGE("PrintArea wrong row for notes", row == 5);
bNotes = false;
- dataFound = pDoc->GetPrintArea(0,col,row, bNotes);
+ dataFound = rDoc.GetPrintArea(0,col,row, bNotes);
CPPUNIT_ASSERT_MESSAGE("No PrintArea should be found", !dataFound);
bNotes = true;
- dataFound = pDoc->GetPrintAreaVer(0,0,1,row, bNotes); // cols 0 & 1
+ dataFound = rDoc.GetPrintAreaVer(0,0,1,row, bNotes); // cols 0 & 1
CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer found", dataFound);
CPPUNIT_ASSERT_MESSAGE("PrintAreaVer wrong row for notes", row == 5);
- dataFound = pDoc->GetPrintAreaVer(0,2,3,row, bNotes); // cols 2 & 3
+ dataFound = rDoc.GetPrintAreaVer(0,2,3,row, bNotes); // cols 2 & 3
CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer found", dataFound);
CPPUNIT_ASSERT_MESSAGE("PrintAreaVer wrong row for notes", row == 2);
bNotes = false;
- dataFound = pDoc->GetPrintAreaVer(0,0,1,row, bNotes); // col 0 & 1
+ dataFound = rDoc.GetPrintAreaVer(0,0,1,row, bNotes); // col 0 & 1
CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer should be found", !dataFound);
// now add cells with value, check that notes are taken into accompt in good cases
@@ -5641,46 +5641,46 @@ void Test::testAreasWithNotes()
m_pDoc->SetString(0, 3, 0, "Some Text");
m_pDoc->SetString(3, 3, 0, "Some Text");
- dataFound = pDoc->GetDataStart(0,col,row);
+ dataFound = rDoc.GetDataStart(0,col,row);
CPPUNIT_ASSERT_MESSAGE("No DataStart found", dataFound);
CPPUNIT_ASSERT_MESSAGE("DataStart wrong col", col == 0);
CPPUNIT_ASSERT_MESSAGE("DataStart wrong row", row == 2);
- dataFound = pDoc->GetCellArea(0,col,row);
+ dataFound = rDoc.GetCellArea(0,col,row);
CPPUNIT_ASSERT_MESSAGE("No CellArea found", dataFound);
CPPUNIT_ASSERT_MESSAGE("CellArea wrong col", col == 3);
CPPUNIT_ASSERT_MESSAGE("CellArea wrong row", row == 5);
bNotes = true;
- dataFound = pDoc->GetPrintArea(0,col,row, bNotes);
+ dataFound = rDoc.GetPrintArea(0,col,row, bNotes);
CPPUNIT_ASSERT_MESSAGE("No PrintArea found", dataFound);
CPPUNIT_ASSERT_MESSAGE("PrintArea wrong col", col == 3);
CPPUNIT_ASSERT_MESSAGE("PrintArea wrong row", row == 5);
bNotes = false;
- dataFound = pDoc->GetPrintArea(0,col,row, bNotes);
+ dataFound = rDoc.GetPrintArea(0,col,row, bNotes);
CPPUNIT_ASSERT_MESSAGE("No PrintArea found", dataFound);
CPPUNIT_ASSERT_MESSAGE("PrintArea wrong col", col == 3);
CPPUNIT_ASSERT_MESSAGE("PrintArea wrong row", row == 3);
bNotes = true;
- dataFound = pDoc->GetPrintAreaVer(0,0,1,row, bNotes); // cols 0 & 1
+ dataFound = rDoc.GetPrintAreaVer(0,0,1,row, bNotes); // cols 0 & 1
CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer found", dataFound);
CPPUNIT_ASSERT_MESSAGE("PrintAreaVer wrong row", row == 5);
- dataFound = pDoc->GetPrintAreaVer(0,2,3,row, bNotes); // cols 2 & 3
+ dataFound = rDoc.GetPrintAreaVer(0,2,3,row, bNotes); // cols 2 & 3
CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer found", dataFound);
CPPUNIT_ASSERT_MESSAGE("PrintAreaVer wrong row", row == 3);
bNotes = false;
- dataFound = pDoc->GetPrintAreaVer(0,0,1,row, bNotes); // cols 0 & 1
+ dataFound = rDoc.GetPrintAreaVer(0,0,1,row, bNotes); // cols 0 & 1
CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer found", dataFound);
CPPUNIT_ASSERT_MESSAGE("PrintAreaVer wrong row", row == 3);
- pDoc->DeleteTab(0);
+ rDoc.DeleteTab(0);
}
void Test::testAnchoredRotatedShape()
@@ -6460,10 +6460,10 @@ void Test::pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocu
ScUndoPaste* Test::createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* pUndoDoc)
{
- ScDocument* pDoc = rDocSh.GetDocument();
+ ScDocument& rDoc = rDocSh.GetDocument();
ScMarkData aMarkData;
aMarkData.SetMarkArea(rRange);
- ScRefUndoData* pRefUndoData = new ScRefUndoData(pDoc);
+ ScRefUndoData* pRefUndoData = new ScRefUndoData(&rDoc);
return new ScUndoPaste(
&rDocSh, rRange, aMarkData, pUndoDoc, NULL, IDF_ALL, pRefUndoData, false);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 95836004bda9..6d521d6da690 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -3656,10 +3656,10 @@ void Test::testExternalRef()
findLoadedDocShellByName(aExtDocName) != NULL);
// Populate the external source document.
- ScDocument* pExtDoc = xExtDocSh->GetDocument();
- pExtDoc->InsertTab(0, aExtSh1Name);
- pExtDoc->InsertTab(1, aExtSh2Name);
- pExtDoc->InsertTab(2, aExtSh3Name);
+ ScDocument& rExtDoc = xExtDocSh->GetDocument();
+ rExtDoc.InsertTab(0, aExtSh1Name);
+ rExtDoc.InsertTab(1, aExtSh2Name);
+ rExtDoc.InsertTab(2, aExtSh3Name);
OUString name("Name");
OUString value("Value");
@@ -3673,38 +3673,38 @@ void Test::testExternalRef()
OUString henry("Henry");
// Sheet 1
- pExtDoc->SetString(0, 0, 0, name);
- pExtDoc->SetString(0, 1, 0, andy);
- pExtDoc->SetString(0, 2, 0, bruce);
- pExtDoc->SetString(0, 3, 0, charlie);
- pExtDoc->SetString(0, 4, 0, david);
- pExtDoc->SetString(1, 0, 0, value);
+ rExtDoc.SetString(0, 0, 0, name);
+ rExtDoc.SetString(0, 1, 0, andy);
+ rExtDoc.SetString(0, 2, 0, bruce);
+ rExtDoc.SetString(0, 3, 0, charlie);
+ rExtDoc.SetString(0, 4, 0, david);
+ rExtDoc.SetString(1, 0, 0, value);
double val = 10;
- pExtDoc->SetValue(1, 1, 0, val);
+ rExtDoc.SetValue(1, 1, 0, val);
val = 11;
- pExtDoc->SetValue(1, 2, 0, val);
+ rExtDoc.SetValue(1, 2, 0, val);
val = 12;
- pExtDoc->SetValue(1, 3, 0, val);
+ rExtDoc.SetValue(1, 3, 0, val);
val = 13;
- pExtDoc->SetValue(1, 4, 0, val);
+ rExtDoc.SetValue(1, 4, 0, val);
// Sheet 2 remains empty.
// Sheet 3
- pExtDoc->SetString(0, 0, 2, name);
- pExtDoc->SetString(0, 1, 2, edward);
- pExtDoc->SetString(0, 2, 2, frank);
- pExtDoc->SetString(0, 3, 2, george);
- pExtDoc->SetString(0, 4, 2, henry);
- pExtDoc->SetString(1, 0, 2, value);
+ rExtDoc.SetString(0, 0, 2, name);
+ rExtDoc.SetString(0, 1, 2, edward);
+ rExtDoc.SetString(0, 2, 2, frank);
+ rExtDoc.SetString(0, 3, 2, george);
+ rExtDoc.SetString(0, 4, 2, henry);
+ rExtDoc.SetString(1, 0, 2, value);
val = 99;
- pExtDoc->SetValue(1, 1, 2, val);
+ rExtDoc.SetValue(1, 1, 2, val);
val = 98;
- pExtDoc->SetValue(1, 2, 2, val);
+ rExtDoc.SetValue(1, 2, 2, val);
val = 97;
- pExtDoc->SetValue(1, 3, 2, val);
+ rExtDoc.SetValue(1, 3, 2, val);
val = 96;
- pExtDoc->SetValue(1, 4, 2, val);
+ rExtDoc.SetValue(1, 4, 2, val);
// Test external refernces on the main document while the external
// document is still in memory.
@@ -3815,14 +3815,14 @@ void Test::testExternalRef()
m_pDoc->DeleteTab(0);
}
-void testExtRefFuncT(ScDocument* pDoc, ScDocument* pExtDoc)
+void testExtRefFuncT(ScDocument* pDoc, ScDocument& rExtDoc)
{
Test::clearRange(pDoc, ScRange(0, 0, 0, 1, 9, 0));
- Test::clearRange(pExtDoc, ScRange(0, 0, 0, 1, 9, 0));
+ Test::clearRange(&rExtDoc, ScRange(0, 0, 0, 1, 9, 0));
- pExtDoc->SetString(0, 0, 0, OUString("'1.2"));
- pExtDoc->SetString(0, 1, 0, OUString("Foo"));
- pExtDoc->SetValue(0, 2, 0, 12.3);
+ rExtDoc.SetString(0, 0, 0, OUString("'1.2"));
+ rExtDoc.SetString(0, 1, 0, OUString("Foo"));
+ rExtDoc.SetValue(0, 2, 0, 12.3);
pDoc->SetString(0, 0, 0, OUString("=T('file:///extdata.fake'#Data.A1)"));
pDoc->SetString(0, 1, 0, OUString("=T('file:///extdata.fake'#Data.A2)"));
pDoc->SetString(0, 2, 0, OUString("=T('file:///extdata.fake'#Data.A3)"));
@@ -3836,36 +3836,36 @@ void testExtRefFuncT(ScDocument* pDoc, ScDocument* pExtDoc)
CPPUNIT_ASSERT_MESSAGE("Unexpected result with T.", aRes.isEmpty());
}
-void testExtRefFuncOFFSET(ScDocument* pDoc, ScDocument* pExtDoc)
+void testExtRefFuncOFFSET(ScDocument* pDoc, ScDocument& rExtDoc)
{
Test::clearRange(pDoc, ScRange(0, 0, 0, 1, 9, 0));
- Test::clearRange(pExtDoc, ScRange(0, 0, 0, 1, 9, 0));
+ Test::clearRange(&rExtDoc, ScRange(0, 0, 0, 1, 9, 0));
sc::AutoCalcSwitch aACSwitch(*pDoc, true);
// External document has sheet named 'Data', and the internal doc has sheet named 'Test'.
- pExtDoc->SetValue(ScAddress(0,1,0), 1.2); // Set 1.2 to A2.
+ rExtDoc.SetValue(ScAddress(0,1,0), 1.2); // Set 1.2 to A2.
pDoc->SetString(ScAddress(0,0,0), "=OFFSET('file:///extdata.fake'#Data.$A$1;1;0;1;1)");
CPPUNIT_ASSERT_EQUAL(1.2, pDoc->GetValue(ScAddress(0,0,0)));
}
-void testExtRefFuncVLOOKUP(ScDocument* pDoc, ScDocument* pExtDoc)
+void testExtRefFuncVLOOKUP(ScDocument* pDoc, ScDocument& rExtDoc)
{
Test::clearRange(pDoc, ScRange(0, 0, 0, 1, 9, 0));
- Test::clearRange(pExtDoc, ScRange(0, 0, 0, 1, 9, 0));
+ Test::clearRange(&rExtDoc, ScRange(0, 0, 0, 1, 9, 0));
// Populate the external document.
- pExtDoc->SetString(ScAddress(0,0,0), "A1");
- pExtDoc->SetString(ScAddress(0,1,0), "A2");
- pExtDoc->SetString(ScAddress(0,2,0), "A3");
- pExtDoc->SetString(ScAddress(0,3,0), "A4");
- pExtDoc->SetString(ScAddress(0,4,0), "A5");
-
- pExtDoc->SetString(ScAddress(1,0,0), "B1");
- pExtDoc->SetString(ScAddress(1,1,0), "B2");
- pExtDoc->SetString(ScAddress(1,2,0), "B3");
- pExtDoc->SetString(ScAddress(1,3,0), "B4");
- pExtDoc->SetString(ScAddress(1,4,0), "B5");
+ rExtDoc.SetString(ScAddress(0,0,0), "A1");
+ rExtDoc.SetString(ScAddress(0,1,0), "A2");
+ rExtDoc.SetString(ScAddress(0,2,0), "A3");
+ rExtDoc.SetString(ScAddress(0,3,0), "A4");
+ rExtDoc.SetString(ScAddress(0,4,0), "A5");
+
+ rExtDoc.SetString(ScAddress(1,0,0), "B1");
+ rExtDoc.SetString(ScAddress(1,1,0), "B2");
+ rExtDoc.SetString(ScAddress(1,2,0), "B3");
+ rExtDoc.SetString(ScAddress(1,3,0), "B4");
+ rExtDoc.SetString(ScAddress(1,4,0), "B5");
// Put formula in the source document.
@@ -3899,20 +3899,20 @@ void Test::testExternalRefFunctions()
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
// Populate the external source document.
- ScDocument* pExtDoc = xExtDocSh->GetDocument();
- pExtDoc->InsertTab(0, OUString("Data"));
+ ScDocument& rExtDoc = xExtDocSh->GetDocument();
+ rExtDoc.InsertTab(0, OUString("Data"));
double val = 1;
- pExtDoc->SetValue(0, 0, 0, val);
+ rExtDoc.SetValue(0, 0, 0, val);
// leave cell B1 empty.
val = 2;
- pExtDoc->SetValue(0, 1, 0, val);
- pExtDoc->SetValue(1, 1, 0, val);
+ rExtDoc.SetValue(0, 1, 0, val);
+ rExtDoc.SetValue(1, 1, 0, val);
val = 3;
- pExtDoc->SetValue(0, 2, 0, val);
- pExtDoc->SetValue(1, 2, 0, val);
+ rExtDoc.SetValue(0, 2, 0, val);
+ rExtDoc.SetValue(1, 2, 0, val);
val = 4;
- pExtDoc->SetValue(0, 3, 0, val);
- pExtDoc->SetValue(1, 3, 0, val);
+ rExtDoc.SetValue(0, 3, 0, val);
+ rExtDoc.SetValue(1, 3, 0, val);
m_pDoc->InsertTab(0, OUString("Test"));
@@ -3935,9 +3935,9 @@ void Test::testExternalRefFunctions()
}
pRefMgr->clearCache(nFileId);
- testExtRefFuncT(m_pDoc, pExtDoc);
- testExtRefFuncOFFSET(m_pDoc, pExtDoc);
- testExtRefFuncVLOOKUP(m_pDoc, pExtDoc);
+ testExtRefFuncT(m_pDoc, rExtDoc);
+ testExtRefFuncOFFSET(m_pDoc, rExtDoc);
+ testExtRefFuncVLOOKUP(m_pDoc, rExtDoc);
// Unload the external document shell.
xExtDocSh->DoClose();
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index 76ba05eebdcd..06c09b05c929 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -465,13 +465,13 @@ void Test::testSharedFormulasRefUpdateExternal()
SfxMedium* pMed = new SfxMedium(aExtDocName, STREAM_STD_READWRITE);
xExtDocSh->DoInitNew(pMed);
- ScDocument* pExtDoc = xExtDocSh->GetDocument();
+ ScDocument& rExtDoc = xExtDocSh->GetDocument();
// Populate A1:A3.
- pExtDoc->InsertTab(0, "Data");
- pExtDoc->SetString(ScAddress(0,0,0), "A");
- pExtDoc->SetString(ScAddress(0,1,0), "B");
- pExtDoc->SetString(ScAddress(0,2,0), "C");
+ rExtDoc.InsertTab(0, "Data");
+ rExtDoc.SetString(ScAddress(0,0,0), "A");
+ rExtDoc.SetString(ScAddress(0,1,0), "B");
+ rExtDoc.SetString(ScAddress(0,2,0), "C");
// Insert formula cells in A7:A10 of the host document, referencing A1:A3
// of the external document.