diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-01-25 13:26:50 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-01-25 13:31:59 -0500 |
commit | e5dea1e1a5ca307c6b3b6becfb6486d57efae181 (patch) | |
tree | 4bbdd496a34c5ad2a6eb34a5d93b5ff1d1521670 | |
parent | a79889083b25d69ae6b801ed8cee90b5dd9199c4 (diff) |
New unit test for refreshing a pivot table without data cache.
Also, FillOldParam() and GetMembers() removed since 1) they were not
necessary and 2) it would create a data cache in the process.
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index ec31a04cfc90..e83f50033548 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1174,13 +1174,6 @@ ScDPObject* createDPFromSourceDesc( ScDPObject* pDPObj = new ScDPObject(pDoc); pDPObj->SetSheetDesc(rDesc); pDPObj->SetOutRange(ScAddress(0, 0, 1)); - ScPivotParam aParam; - pDPObj->FillOldParam(aParam); - for (size_t i = 0; i < nFieldCount; ++i) - { - vector<ScDPLabelData::Member> aMembers; - pDPObj->GetMembers(i, 0, aMembers); - } ScDPSaveData aSaveData; // Set data pilot table output options. @@ -1424,6 +1417,30 @@ void Test::testPivotTable() CPPUNIT_ASSERT_MESSAGE("There shouldn't be any more data cache.", pDPs->GetSheetCaches().size() == 0); + // Insert a brand new pivot table object once again, but this time, don't + // create the output to avoid creating a data cache. + m_pDoc->DeleteTab(1); + m_pDoc->InsertTab(1, OUString(RTL_CONSTASCII_USTRINGPARAM("Table"))); + + pDPObj = createDPFromRange( + m_pDoc, ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0), aFields, nFieldCount, false); + bSuccess = pDPs->InsertNewTable(pDPObj); + CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess); + CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", + pDPs->GetCount() == 1); + pDPObj->SetName(pDPs->CreateNewName()); + CPPUNIT_ASSERT_MESSAGE("Data cache shouldn't exist yet before creating the table output.", + pDPs->GetSheetCaches().size() == 0); + + // Now, "refresh" the table. This should still return a reference to self + // even with the absence of data cache. + aRefs.clear(); + pDPs->ReloadCache(pDPObj, aRefs); + CPPUNIT_ASSERT_MESSAGE("It should return the same object as a reference.", + aRefs.size() == 1 && *aRefs.begin() == pDPObj); + + pDPs->FreeTable(pDPObj); + m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); } |