From 699372466384113cf015be714e0067e857f8fa5c Mon Sep 17 00:00:00 2001 From: Tibor Nagy Date: Tue, 13 Oct 2020 15:48:31 +0200 Subject: tdf#90104 XLSX export: fix commas in data validation list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comma was exported as list separator instead of decimal separator, messing up the data validation list by breaking integer and fractional parts of a number to two integer numbers, for example the 2-item list 1,5, 2,5 to the bad 4-item list 1, 5, 2, 5. Note: for testing with numbers, it needs to set decimal separator to comma in locale settings. Co-authored-by: Attila Szűcs (NISZ) Change-Id: I6133c402b47aab8ed9f02b412762404fc520badc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104240 Tested-by: László Németh Reviewed-by: László Németh --- sc/qa/unit/subsequent_export-test.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'sc/qa/unit/subsequent_export-test.cxx') diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index e928785d062e..bf015d93eac7 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -93,6 +93,7 @@ public: ScDocShellRef saveAndReloadPassword( ScDocShell*, const OUString&, const OUString&, const OUString&, SfxFilterFlags ); void test(); + void testTdf90104(); void testTdf111876(); void testPasswordExportODS(); void testTdf134332(); @@ -276,6 +277,7 @@ public: CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); + CPPUNIT_TEST(testTdf90104); CPPUNIT_TEST(testTdf111876); CPPUNIT_TEST(testPasswordExportODS); CPPUNIT_TEST(testTdf134332); @@ -478,6 +480,7 @@ void ScExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) { BAD_CAST("ContentType"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/content-types") }, { BAD_CAST("x14"), BAD_CAST("http://schemas.microsoft.com/office/spreadsheetml/2009/9/main") }, { BAD_CAST("xm"), BAD_CAST("http://schemas.microsoft.com/office/excel/2006/main") }, + { BAD_CAST("x12ac"), BAD_CAST("http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac") }, }; for(size_t i = 0; i < SAL_N_ELEMENTS(aNamespaces); ++i) { @@ -541,6 +544,27 @@ void ScExportTest::test() xDocSh->DoClose(); } +void ScExportTest::testTdf90104() +{ + ScDocShellRef xShell = loadDoc("tdf90104.", FORMAT_XLSX); + CPPUNIT_ASSERT(xShell.is()); + + ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); + CPPUNIT_ASSERT(xDocSh.is()); + + std::shared_ptr pXPathFile + = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); + + xmlDocUniquePtr pDoc + = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + CPPUNIT_ASSERT(pDoc); + + assertXPathContent(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation/mc:AlternateContent" + "/mc:Choice/x12ac:list", "1,\"2,3\",4,\"5,6\""); + assertXPathContent(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation/mc:AlternateContent" + "/mc:Fallback/x:formula1", "\"1,2,3,4,5,6\""); +} + void ScExportTest::testTdf111876() { // Document with relative path hyperlink -- cgit v1.2.3