diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2016-10-23 11:46:19 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-11-11 12:32:37 +0000 |
commit | 8d811eda74a6b2b249a44a9217328e8d2788ec3c (patch) | |
tree | 2223f4fd12232371a32dd218f09412e15d2fa2b0 /sc | |
parent | 30fefcf71417f8c8644f5c0d3cb28c8c7f92a6c7 (diff) |
tdf#36038 QA test export/import extended LCID to Excel
Change-Id: I5c8a19f62f030913f7e6dcbc0274f5d0aa197056
Reviewed-on: https://gerrit.libreoffice.org/30175
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/ods/tdf36038_ExtendedLCID.ods | bin | 0 -> 10122 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 43 |
2 files changed, 43 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/tdf36038_ExtendedLCID.ods b/sc/qa/unit/data/ods/tdf36038_ExtendedLCID.ods Binary files differnew file mode 100644 index 000000000000..3abb94616088 --- /dev/null +++ b/sc/qa/unit/data/ods/tdf36038_ExtendedLCID.ods diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index b9bbc30e7ff2..1a99a645c4e0 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -181,6 +181,7 @@ public: void testEscapeCharInNumberFormatXLSX(); void testNatNumInNumberFormatXLSX(); void testExponentWithoutSignFormatXLSX(); + void testExtendedLCID(); void testHiddenRepeatedRowsODS(); void testHyperlinkTargetFrameODS(); @@ -267,6 +268,7 @@ public: CPPUNIT_TEST(testEscapeCharInNumberFormatXLSX); CPPUNIT_TEST(testNatNumInNumberFormatXLSX); CPPUNIT_TEST(testExponentWithoutSignFormatXLSX); + CPPUNIT_TEST(testExtendedLCID); CPPUNIT_TEST(testHiddenRepeatedRowsODS); CPPUNIT_TEST(testHyperlinkTargetFrameODS); @@ -3723,6 +3725,47 @@ void ScExportTest::testExponentWithoutSignFormatXLSX() xDocSh->DoClose(); } +void ScExportTest::testExtendedLCID() +{ + ScDocShellRef xDocSh = loadDoc("tdf36038_ExtendedLCID.", FORMAT_ODS); + 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); + // Check export + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "[$-107041E]DD\\-MM\\-YYYY"); + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", "[$-D07041E]DD\\-MM\\-YYYY"); + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[4]", "formatCode", "[$-1030411]DD\\-MM\\-EE"); + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[5]", "formatCode", "[$-1B030411]DD\\-MM\\-EE"); + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[6]", "formatCode", "[$-108040D]DD\\-MM\\-YYYY"); + //assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[7]", "formatCode", "[$-108040D]DD\\-MM\\-YYYY"); + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[7]", "formatCode", "[$-1060401]DD\\-MM\\-YYYY"); + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[8]", "formatCode", "[$-2060401]DD\\-MM\\-YYYY"); + + // Check import + ScDocument& rDoc = xDocSh->GetDocument(); + SvNumberFormatter* pNumFormatter = rDoc.GetFormatTable(); + sal_uInt32 nNumberFormat; + const OUString aLang[4] = { "[$-41E]", "[$-411]", "[$-40D]", "[$-401]" }; + const OUString aCalendar[4] = { "[~buddhist]DD-MM-YYYY", "[~gengou]DD-MM-EE", "[~jewish]DD-MM-YYYY", "[~hijri]DD-MM-YYYY" }; + for ( sal_Int16 nCol = 1; nCol <= 2; nCol++ ) + { + for ( sal_Int16 nRow = 1; nRow <= 4; nRow++ ) + { + rDoc.GetNumberFormat(nCol, nRow, 0, nNumberFormat); + const SvNumberformat* pNumberFormat = pNumFormatter->GetEntry(nNumberFormat); + const OUString& rFormatStr = pNumberFormat->GetFormatstring(); + const OUString aExpectedFormatStr = aLang[nRow-1] + ( (nCol==2 && nRow!=3) ? OUString("[NatNum1]") : OUString("") ) + aCalendar[nRow-1]; + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Number format lost extended LCID during Excel export", aExpectedFormatStr, rFormatStr); + } + } + + xDocSh->DoClose(); +} + void ScExportTest::testHiddenRepeatedRowsODS() { ScDocShellRef xDocSh = loadDoc("empty.", FORMAT_ODS); |