[Libreoffice-commits] .: sc/qa
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Mar 20 14:05:51 PDT 2012
sc/qa/unit/ucalc.cxx | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
New commits:
commit fdcac5fa84b5fba908a0e59b0ceb953da58e8609
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Mar 20 16:27:20 2012 -0400
Added more code to test the integrity of the source data arrays.
Source data array stores item IDs and represents the original data
series before normalization.
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 5324601..43ea584 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -147,6 +147,10 @@ public:
*/
void testPivotTableNamedSource();
+ /**
+ * Test for pivot table cache. Each dimension in the pivot cache stores
+ * only unique values that are sorted in ascending order.
+ */
void testPivotTableCache();
void testSheetCopy();
@@ -1987,6 +1991,52 @@ void Test::testPivotTableCache()
pItem = aCache.GetItemDataById(2, 6);
CPPUNIT_ASSERT_MESSAGE("wrong item value", !pItem);
+ {
+ // Check the integrity of the source data.
+ ScDPItemData aTest;
+ long nDim;
+
+ {
+ // Dimension 0: Z, R, A, F, Y, 12
+ nDim = 0;
+ const char* aChecks[] = { "Z", "R", "A", "F", "Y" };
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
+ {
+ pItem = aCache.GetItemDataById(nDim, aCache.GetItemDataId(nDim, i, false));
+ aTest.SetString(rtl::OUString::createFromAscii(aChecks[i]));
+ CPPUNIT_ASSERT_MESSAGE("wrong data value", pItem && *pItem == aTest);
+ }
+
+ pItem = aCache.GetItemDataById(nDim, aCache.GetItemDataId(nDim, 5, false));
+ aTest.SetValue(12);
+ CPPUNIT_ASSERT_MESSAGE("wrong data value", pItem && *pItem == aTest);
+ }
+
+ {
+ // Dimension 1: A, A, B, B, C, C
+ nDim = 1;
+ const char* aChecks[] = { "A", "A", "B", "B", "C", "C" };
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
+ {
+ pItem = aCache.GetItemDataById(nDim, aCache.GetItemDataId(nDim, i, false));
+ aTest.SetString(rtl::OUString::createFromAscii(aChecks[i]));
+ CPPUNIT_ASSERT_MESSAGE("wrong data value", pItem && *pItem == aTest);
+ }
+ }
+
+ {
+ // Dimension 2: 30, 20, 45, 12, 8, 15
+ nDim = 2;
+ double aChecks[] = { 30, 20, 45, 12, 8, 15 };
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
+ {
+ pItem = aCache.GetItemDataById(nDim, aCache.GetItemDataId(nDim, i, false));
+ aTest.SetValue(aChecks[i]);
+ CPPUNIT_ASSERT_MESSAGE("wrong data value", pItem && *pItem == aTest);
+ }
+ }
+ }
+
m_pDoc->DeleteTab(0);
}
More information about the Libreoffice-commits
mailing list