[Libreoffice-commits] core.git: sc/qa
Laurent Balland-Poirier
laurent.balland-poirier at laposte.net
Sun Jul 3 16:51:46 UTC 2016
sc/qa/unit/data/xlsx/tdf81939.xlsx |binary
sc/qa/unit/subsequent_export-test.cxx | 29 +++++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
New commits:
commit e364e52b9a551f78ff477939abbc555a47eb02ce
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date: Sun Jul 3 10:45:53 2016 +0200
tdf#81939 Add qa unit test
Test removal or not of escape char in number format strings in XLSX
Change-Id: I02a7e1bfd9df1ffd3bbad7dc072cfc85be68f949
Reviewed-on: https://gerrit.libreoffice.org/26877
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/qa/unit/data/xlsx/tdf81939.xlsx b/sc/qa/unit/data/xlsx/tdf81939.xlsx
new file mode 100644
index 0000000..6614a1e
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf81939.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 28e518d..131069b 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -171,6 +171,7 @@ public:
void testHeaderImage();
void testTdf88657();
+ void testEscapeCharInNumberFormatXLSX();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -247,6 +248,7 @@ public:
CPPUNIT_TEST(testHeaderImage);
CPPUNIT_TEST(testTdf88657);
+ CPPUNIT_TEST(testEscapeCharInNumberFormatXLSX);
CPPUNIT_TEST_SUITE_END();
@@ -3323,6 +3325,33 @@ void ScExportTest::testConditionalFormatRangeListXLSX()
assertXPath(pDoc, "//x:conditionalFormatting", "sqref", "F4 F10");
}
+void ScExportTest::testEscapeCharInNumberFormatXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("tdf81939.", FORMAT_XLSX);
+ CPPUNIT_ASSERT( xDocSh.Is() );
+ xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX);
+ CPPUNIT_ASSERT( xDocSh.Is() );
+
+ xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
+ CPPUNIT_ASSERT(pDoc);
+
+ const sal_Unicode cEuro (8364); // € symbol
+ assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "00\\ 00\\ 00\\ 00\\ 00");
+ assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", "00\\.00\\.00\\.000\\.0"); // tdf#81939
+ // "_-* #,##0\ _€_-;\-* #,##0\ _€_-;_-* "- "_€_-;_- at _-" // tdf#81222
+ OUString rFormatStrExpected ( "_-* #,##0\\ _" + OUString(cEuro) + "_-;\\-* #,##0\\ _" +
+ OUString(cEuro) + "_-;_-* \"- \"_" + OUString(cEuro) + "_-;_- at _-" );
+ assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[4]", "formatCode", rFormatStrExpected );
+ // "_-* #,##0" €"_-;\-* #,##0" €"_-;_-* "- €"_-;_- at _-");
+ rFormatStrExpected = "_-* #,##0\" " + OUString(cEuro) + "\"_-;\\-* #,##0\" " +
+ OUString(cEuro) + "\"_-;_-* \"- " + OUString(cEuro) + "\"_-;_- at _-";
+ assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[5]", "formatCode", rFormatStrExpected );
+ // remove escape char in fraction
+ assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[6]", "formatCode", "# ?/?;[RED]\\-# #/#####");
+
+ xDocSh->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list