diff options
author | Serge Krot <Serge.Krot@cib.de> | 2020-06-29 13:23:34 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-09-09 08:49:19 +0200 |
commit | e6bdfaaf572b592f7e8b510cb38f82a4aca41593 (patch) | |
tree | da8ba0930a64745aff520517ba9ee71d2807997a /sc/qa/unit | |
parent | 6be0a806dcce864fb4d604be68e8b3711fc604d6 (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/+/102252
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sc/qa/unit')
-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 d74d4d63d0ec..2f0a7c7fdd0e 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -205,6 +205,12 @@ public: void testTdf129985(); void testTdf73063(); + xmlDocUniquePtr 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(); @@ -352,6 +358,9 @@ public: CPPUNIT_TEST(testTdf55417); CPPUNIT_TEST(testTdf129985); CPPUNIT_TEST(testTdf73063); + 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); @@ -4269,6 +4278,60 @@ void ScExportTest::testTdf73063() xDocSh->DoClose(); } +xmlDocUniquePtr 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 + xmlDocUniquePtr 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 + xmlDocUniquePtr 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 + xmlDocUniquePtr 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); |