summaryrefslogtreecommitdiff
path: root/sc/qa/unit/subsequent_export-test.cxx
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2017-09-13 07:22:06 +0200
committerAndras Timar <andras.timar@collabora.com>2017-09-14 15:50:54 +0200
commite7f8df2636abb605b4f930fb9351474370730f58 (patch)
tree3f4929fa886f80aca199c6206ff7789d3b923b67 /sc/qa/unit/subsequent_export-test.cxx
parente0fa93ded694bd7df3c66b9c14fd75e21bdd4bb0 (diff)
tdf#112337: Pivot table: empty / blank item is not imported from XLS
Reviewed-on: https://gerrit.libreoffice.org/42181 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit d44c7ffda598d4d4e8a3963133735a771ba3fe30) Change-Id: I7ed9e5cacdf6df80b2f100d040cbbeda33b085d3 Reviewed-on: https://gerrit.libreoffice.org/42224 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sc/qa/unit/subsequent_export-test.cxx')
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx39
1 files changed, 39 insertions, 0 deletions
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 2e0ecc0f1cd5..45ee28ce26cb 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -204,6 +204,7 @@ public:
void testPivotTableDateFieldFilter();
void testPivotTableBoolFieldFilter();
void testPivotTableRowColPageFieldFilter();
+ void testPivotTableEmptyItem();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -308,6 +309,7 @@ public:
CPPUNIT_TEST(testPivotTableDateFieldFilter);
CPPUNIT_TEST(testPivotTableBoolFieldFilter);
CPPUNIT_TEST(testPivotTableRowColPageFieldFilter);
+ CPPUNIT_TEST(testPivotTableEmptyItem);
CPPUNIT_TEST_SUITE_END();
@@ -4604,6 +4606,43 @@ void ScExportTest::testPivotTableRowColPageFieldFilter()
xDocSh->DoClose();
}
+void ScExportTest::testPivotTableEmptyItem()
+{
+ ScDocShellRef xDocSh = loadDoc("pivottable_empty_item.", FORMAT_XLS);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is());
+ ScDocument& rDoc = xDocSh->GetDocument();
+ ScDPCollection* pDPs = rDoc.GetDPCollection();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
+
+ // Reload and check filtering of row dimensions
+ xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLS);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is());
+ ScDocument& rLoadedDoc = xDocSh->GetDocument();
+ pDPs = rLoadedDoc.GetDPCollection();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
+ const ScDPObject* pDPObj = &(*pDPs)[0];
+ CPPUNIT_ASSERT(pDPObj);
+ ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+ CPPUNIT_ASSERT(pSaveData);
+
+ ScDPSaveDimension* pSaveDim = pSaveData->GetExistingDimensionByName("Category");
+ CPPUNIT_ASSERT(pSaveDim);
+
+ const ScDPSaveDimension::MemberList& rMembers = pSaveDim->GetMembers();
+ CPPUNIT_ASSERT_EQUAL(size_t(3), rMembers.size());
+ ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("Fruit");
+ CPPUNIT_ASSERT(pMember);
+ CPPUNIT_ASSERT(pMember->HasIsVisible() && pMember->GetIsVisible());
+ pMember = pSaveDim->GetExistingMemberByName("Vegetables");
+ CPPUNIT_ASSERT(pMember);
+ CPPUNIT_ASSERT(pMember->HasIsVisible() && !pMember->GetIsVisible());
+ pMember = pSaveDim->GetExistingMemberByName("");
+ CPPUNIT_ASSERT(pMember);
+ CPPUNIT_ASSERT(pMember->HasIsVisible() && !pMember->GetIsVisible());
+
+ xDocSh->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();