summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-09 18:38:02 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-03-09 18:44:07 -0400
commit93e4276addbaaf574e07f7f1a993c653c536645d (patch)
treeadd8d0f7399172b631edcd46c4a4ad97d575d943
parentcbe1fd744e8c9017c080c296f93a6cc30ff59707 (diff)
fdo#75960: Write unit test for this.
The window failed to launch ultimately due to failure of GetHeaderDim() call. Change-Id: I80c99a9ab1f33b4acee5324f417b7a3a26a91a22
-rw-r--r--sc/qa/unit/data/ods/pivot-table-named-range-source.odsbin0 -> 16927 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx29
2 files changed, 29 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/pivot-table-named-range-source.ods b/sc/qa/unit/data/ods/pivot-table-named-range-source.ods
new file mode 100644
index 000000000000..db3b96623cc4
--- /dev/null
+++ b/sc/qa/unit/data/ods/pivot-table-named-range-source.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 5336a5803da2..b34c1924b882 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -142,6 +142,7 @@ public:
void testCellAnchoredShapesODS();
void testPivotTableBasicODS();
+ void testPivotTableNamedRangeSourceODS();
void testPivotTableSharedCacheGroupODS();
void testGetPivotDataXLS();
@@ -210,6 +211,7 @@ public:
CPPUNIT_TEST(testCellAnchoredShapesODS);
CPPUNIT_TEST(testPivotTableBasicODS);
+ CPPUNIT_TEST(testPivotTableNamedRangeSourceODS);
CPPUNIT_TEST(testPivotTableSharedCacheGroupODS);
CPPUNIT_TEST(testGetPivotDataXLS);
CPPUNIT_TEST(testRowHeightODS);
@@ -1687,6 +1689,33 @@ void ScFiltersTest::testPivotTableBasicODS()
xDocSh->DoClose();
}
+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();
+
+ ScDPCollection* pDPs = pDoc->GetDPCollection();
+ CPPUNIT_ASSERT(pDPs->GetCount() == 1);
+
+ ScDPObject* pDP = (*pDPs)[0];
+ CPPUNIT_ASSERT(pDP);
+
+ // Make sure this pivot table is based on a named range source.
+ const ScSheetSourceDesc* pDesc = pDP->GetSheetDesc();
+ CPPUNIT_ASSERT(pDesc);
+ CPPUNIT_ASSERT_EQUAL(OUString("MyRange"), pDesc->GetRangeName());
+
+ sal_uInt16 nOrient;
+ long nDim = pDP->GetHeaderDim(ScAddress(0,1,1), nOrient);
+ CPPUNIT_ASSERT_MESSAGE("Failed to detect header dimension.", nDim == 0);
+ CPPUNIT_ASSERT_MESSAGE("This dimension should be a page dimension.",
+ nOrient == sheet::DataPilotFieldOrientation_PAGE);
+
+ xDocSh->DoClose();
+}
+
namespace {
bool checkVisiblePageFieldMember( const ScDPSaveDimension::MemberList& rMembers, const OUString& rVisibleMember )