[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
Tamás Zolnai
tamas.zolnai at collabora.com
Fri Sep 1 11:27:44 UTC 2017
sc/qa/unit/data/xlsx/tdf112106.xlsx |binary
sc/qa/unit/subsequent_export-test.cxx | 33 +++++++++++++++++++++++++++++++++
sc/source/filter/excel/xepivot.cxx | 4 +---
3 files changed, 34 insertions(+), 3 deletions(-)
New commits:
commit 895c23b97eecd9cd32a145a6267f4b43db479248
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date: Thu Aug 31 14:41:49 2017 +0200
tdf#112106: Corrupted pivot table after XLSX -> XLS conversion in Calc
Always write out a data layout name.
Reviewed-on: https://gerrit.libreoffice.org/41739
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
(cherry picked from commit a2f2a40e37aadc0a32435a33402a21a678464ba4)
Change-Id: Ic0b43d9c0365eca5e417fe9f2fe4b77b538f3278
Reviewed-on: https://gerrit.libreoffice.org/41755
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/sc/qa/unit/data/xlsx/tdf112106.xlsx b/sc/qa/unit/data/xlsx/tdf112106.xlsx
new file mode 100755
index 000000000000..37203d1dbd5b
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf112106.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index b8559ec3f6a4..b5965bcd5aa6 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -42,6 +42,8 @@
#include <dpsave.hxx>
#include <dputil.hxx>
#include <attrib.hxx>
+#include "globstr.hrc"
+#include "global.hxx"
#include <svx/svdoole2.hxx>
#include <svx/svdpage.hxx>
@@ -195,6 +197,7 @@ public:
void testHiddenRepeatedRowsODS();
void testHyperlinkTargetFrameODS();
+ void testTdf112106();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -292,6 +295,7 @@ public:
CPPUNIT_TEST(testHiddenRepeatedRowsODS);
CPPUNIT_TEST(testHyperlinkTargetFrameODS);
+ CPPUNIT_TEST(testTdf112106);
CPPUNIT_TEST_SUITE_END();
private:
@@ -4155,6 +4159,35 @@ void ScExportTest::testPivotTableRowHeaderXLS()
xDocSh->DoClose();
}
+void ScExportTest::testTdf112106()
+{
+ ScDocShellRef xDocSh = loadDoc("tdf112106.", FORMAT_XLSX);
+ 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 data layout dim
+ 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);
+ const ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+ CPPUNIT_ASSERT(pSaveData);
+
+ // Check that we have an existing data layout dimension
+ const ScDPSaveDimension* pDim = pSaveData->GetExistingDataLayoutDimension();
+ CPPUNIT_ASSERT(pDim);
+ const OUString* pLayoutName = pDim->GetLayoutName();
+ CPPUNIT_ASSERT(pLayoutName);
+ CPPUNIT_ASSERT_EQUAL(ScGlobal::GetRscString(STR_PIVOT_DATA), (*pLayoutName));
+
+ xDocSh->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 62f84eb69ae5..2203a83ac1cd 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -1304,10 +1304,8 @@ void XclExpPivotTable::SetPropertiesFromDP( const ScDPSaveData& rSaveData )
::set_flag( maPTExtInfo.mnFlags, EXC_SXEX_DRILLDOWN, rSaveData.GetDrillDown() );
mbFilterBtn = rSaveData.GetFilterButton();
const ScDPSaveDimension* pDim = rSaveData.GetExistingDataLayoutDimension();
- if (!pDim)
- return;
- const OUString* pLayoutName = pDim->GetLayoutName();
+ const OUString* pLayoutName = pDim ? pDim->GetLayoutName() : nullptr;
if (pLayoutName)
maPTInfo.maDataName = *pLayoutName;
else
More information about the Libreoffice-commits
mailing list