summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-12-05 12:53:03 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-12-05 12:58:08 -0500
commit56bb08e75c12cb85041607f7f34451018b09414f (patch)
treed1b150b3341f34999138bade3a396aaac4906f6e /sc/qa
parente2a35977ca056d7bf1dae3a9c41ae135a85892fd (diff)
fdo#57497: Remove group table data when all group dimensions are gone.
Otherwise ungrouping date grouped dimension may crash, or produce incorrect results. Change-Id: I3634e3c0bf8336fc1221f5d234cb7e01eb1f07c6
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.cxx29
1 files changed, 29 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index e3de1762d1dd..250940016321 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2964,6 +2964,35 @@ void Test::testPivotTableDateGrouping()
CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
}
+ // Remove all date grouping. The source dimension "Date" has two
+ // external dimensions ("Years" and "Quarters") and one internal ("Date"
+ // the same name but different hierarchy). Remove all of them.
+ pSaveData = pDPObj->GetSaveData();
+ pSaveData->RemoveAllGroupDimensions(aBaseDimName);
+ pDPObj->SetSaveData(*pSaveData);
+ pDPObj->ReloadGroupTableData();
+ pDPObj->InvalidateData();
+
+ aOutRange = refresh(pDPObj);
+ {
+ // Expected output table content. 0 = empty cell
+ const char* aOutputCheck[][2] = {
+ { "Date", 0 },
+ { "2011-01-01", "1" },
+ { "2011-03-02", "2" },
+ { "2011-09-03", "7" },
+ { "2012-01-04", "3" },
+ { "2012-02-23", "4" },
+ { "2012-02-24", "5" },
+ { "2012-03-15", "6" },
+ { "2012-12-25", "8" },
+ { "Total Result", "36" }
+ };
+
+ bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "Remove all date grouping.");
+ CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
+ }
+
pDPs->FreeTable(pDPObj);
CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.",