diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2016-07-03 10:45:53 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-07-03 16:51:16 +0000 |
commit | e364e52b9a551f78ff477939abbc555a47eb02ce (patch) | |
tree | 0950f9281f761d97e74ab3ac1cd58ef7187f55be /sc | |
parent | 68900bad945c847f62a614cd2c2653ef3a9827ca (diff) |
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@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/xlsx/tdf81939.xlsx | bin | 0 -> 9120 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 29 |
2 files changed, 29 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/tdf81939.xlsx b/sc/qa/unit/data/xlsx/tdf81939.xlsx Binary files differnew file mode 100644 index 000000000000..6614a1e45241 --- /dev/null +++ b/sc/qa/unit/data/xlsx/tdf81939.xlsx diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 28e518d93c03..131069b6eca6 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\ _€_-;_-* "- "_€_-;_-@_-" // tdf#81222 + OUString rFormatStrExpected ( "_-* #,##0\\ _" + OUString(cEuro) + "_-;\\-* #,##0\\ _" + + OUString(cEuro) + "_-;_-* \"- \"_" + OUString(cEuro) + "_-;_-@_-" ); + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[4]", "formatCode", rFormatStrExpected ); + // "_-* #,##0" €"_-;\-* #,##0" €"_-;_-* "- €"_-;_-@_-"); + rFormatStrExpected = "_-* #,##0\" " + OUString(cEuro) + "\"_-;\\-* #,##0\" " + + OUString(cEuro) + "\"_-;_-* \"- " + OUString(cEuro) + "\"_-;_-@_-"; + 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(); |