summaryrefslogtreecommitdiff
path: root/sc/qa/unit
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-05-03 01:53:34 -0400
committerKohei Yoshida <kyoshida@novell.com>2011-05-03 01:53:34 -0400
commit92d922048845d703328c774218624f71e3056ac9 (patch)
tree08c9d7b64067232362f7b049bf8b7be70f8fc9fd /sc/qa/unit
parentaa00f229cb2180c69f69d5b9d58ee5cf774ba04f (diff)
Added code to test standard query filter in data pilot tables.
Diffstat (limited to 'sc/qa/unit')
-rw-r--r--sc/qa/unit/ucalc.cxx33
1 files changed, 30 insertions, 3 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 30515f0d081c..b2c4a7201b7c 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1084,7 +1084,7 @@ void Test::testDataPilotFilters()
{ "Total Sum - Val2", "80" }
};
- bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
+ bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (unfiltered)");
CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
}
@@ -1111,11 +1111,38 @@ void Test::testDataPilotFilters()
{ "Total Sum - Val2", "40" }
};
- bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
+ bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (filtered by page)");
CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
}
- // TODO: Find out how to set standard filter and test it.
+ // Set query filter.
+ ScSheetSourceDesc aDesc(*pDPObj->GetSheetDesc());
+ ScQueryParam aQueryParam(aDesc.GetQueryParam());
+ CPPUNIT_ASSERT_MESSAGE("There should be at least one query entry.", aQueryParam.GetEntryCount() > 0);
+ ScQueryEntry& rEntry = aQueryParam.GetEntry(0);
+ rEntry.bDoQuery = true;
+ rEntry.nField = 1; // Group1
+ rEntry.nVal = 1;
+ aDesc.SetQueryParam(aQueryParam);
+ pDPObj->SetSheetDesc(aDesc);
+ pDPObj->Output(aOutRange.aStart);
+ aOutRange = pDPObj->GetOutRange();
+ {
+ // Expected output table content. 0 = empty cell
+ const char* aOutputCheck[][2] = {
+ { "Filter", 0 },
+ { "Group2", "A" },
+ { 0, 0 },
+ { "Data", 0 },
+ { "Sum - Val1", "2" },
+ { "Sum - Val2", "20" },
+ { "Total Sum - Val1", "2" },
+ { "Total Sum - Val2", "20" }
+ };
+
+ bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (filtered by query)");
+ CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
+ }
pDPs->FreeTable(pDPObj);
CPPUNIT_ASSERT_MESSAGE("There shouldn't be any data pilot table stored with the document.",