diff options
author | Serge Krot <Serge.Krot@cib.de> | 2020-06-29 13:23:34 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2020-09-19 21:11:04 +0200 |
commit | d8e0001fd8b4702f78ade095b8b2ce09ac2451e2 (patch) | |
tree | 8aa4317a180dd6249ace466326ff5a06703eb9fc /sc/qa | |
parent | 0cb32df8141eb49eb8b44f0523dfd81079abb2ac (diff) |
tdf#95640 XLSX: import/export of custom sort lists
Conflicts:
sc/source/filter/excel/excrecds.cxx
sc/source/filter/oox/autofilterbuffer.cxx
sc/source/filter/oox/tablebuffer.cxx
Change-Id: If5ffef39770bf7abd6e75e8de998d4a2b4749a0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97399
Tested-by: Jenkins
Tested-by: Serge Krot <Serge.Krot@cib.de>
Reviewed-by: Serge Krot <Serge.Krot@cib.de>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102254
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/data/ods/tdf95640.ods | bin | 0 -> 8406 bytes | |||
-rw-r--r-- | sc/qa/unit/data/ods/tdf95640_standard_list.ods | bin | 0 -> 9684 bytes | |||
-rw-r--r-- | sc/qa/unit/data/xlsx/tdf95640.xlsx | bin | 0 -> 8500 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 63 |
4 files changed, 63 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/tdf95640.ods b/sc/qa/unit/data/ods/tdf95640.ods Binary files differnew file mode 100644 index 000000000000..5d435c61cc85 --- /dev/null +++ b/sc/qa/unit/data/ods/tdf95640.ods diff --git a/sc/qa/unit/data/ods/tdf95640_standard_list.ods b/sc/qa/unit/data/ods/tdf95640_standard_list.ods Binary files differnew file mode 100644 index 000000000000..37bea8a0c93e --- /dev/null +++ b/sc/qa/unit/data/ods/tdf95640_standard_list.ods diff --git a/sc/qa/unit/data/xlsx/tdf95640.xlsx b/sc/qa/unit/data/xlsx/tdf95640.xlsx Binary files differnew file mode 100644 index 000000000000..78c2d32c2cf6 --- /dev/null +++ b/sc/qa/unit/data/xlsx/tdf95640.xlsx diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index bf0d74cdf830..80a888f42c39 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -195,6 +195,12 @@ public: void testPreserveTextWhitespace2XLSX(); void testTextDirectionXLSX(); + xmlDocPtr testTdf95640(const OUString& rFileName, sal_Int32 nSourceFormat, + sal_Int32 nDestFormat); + void testTdf95640_ods_to_xlsx(); + void testTdf95640_ods_to_xlsx_with_standard_list(); + void testTdf95640_xlsx_to_xlsx(); + void testRefStringXLSX(); void testRefStringConfigXLSX(); void testRefStringUnspecified(); @@ -327,6 +333,9 @@ public: CPPUNIT_TEST(testMoveCellAnchoredShapesODS); CPPUNIT_TEST(testMatrixMultiplicationXLSX); CPPUNIT_TEST(testTextDirectionXLSX); + CPPUNIT_TEST(testTdf95640_ods_to_xlsx); + CPPUNIT_TEST(testTdf95640_ods_to_xlsx_with_standard_list); + CPPUNIT_TEST(testTdf95640_xlsx_to_xlsx); CPPUNIT_TEST(testRefStringXLSX); CPPUNIT_TEST(testRefStringConfigXLSX); @@ -3956,6 +3965,60 @@ void ScExportTest::testTextDirectionXLSX() assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", "readingOrder", "2");//RTL } +xmlDocPtr ScExportTest::testTdf95640(const OUString& rFileName, sal_Int32 nSourceFormat, + sal_Int32 nDestFormat) +{ + ScDocShellRef xShell = loadDoc(rFileName, nSourceFormat); + CPPUNIT_ASSERT(xShell); + + auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), nDestFormat); + xShell->DoClose(); + + return XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +} + +void ScExportTest::testTdf95640_ods_to_xlsx() +{ + // Roundtripping sort options with user defined list to XLSX + xmlDocPtr pDoc = testTdf95640("tdf95640.", FORMAT_ODS, FORMAT_XLSX); + + assertXPath(pDoc, "//x:worksheet/x:autoFilter", "ref", "A1:B4"); + + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "ref", "A2:A4"); + + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "customList", + "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec"); +} + +void ScExportTest::testTdf95640_ods_to_xlsx_with_standard_list() +{ + // Roundtripping sort options with user defined list to XLSX + xmlDocPtr pDoc = testTdf95640("tdf95640_standard_list.", FORMAT_ODS, FORMAT_XLSX); + + assertXPath(pDoc, "//x:worksheet/x:autoFilter", "ref", "A1:B4"); + + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "ref", "A2:A4"); + + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "customList", + "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"); +} + +void ScExportTest::testTdf95640_xlsx_to_xlsx() +{ + // XLSX Roundtripping sort options with custom sort list - note + // that compared to ODS source documents above, here we _actually_ + // can use custom lists (beyond the global user defines), like + // low, medium, high + xmlDocPtr pDoc = testTdf95640("tdf95640.", FORMAT_XLSX, FORMAT_XLSX); + + assertXPath(pDoc, "//x:worksheet/x:autoFilter", "ref", "A1:B4"); + + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "ref", "A2:A4"); + + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "customList", + "Low,Medium,High"); +} + void ScExportTest::testTdf88657ODS() { ScDocShellRef xDocSh = loadDoc("tdf88657.", FORMAT_ODS); |