summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Balland-Poirier <laurent.balland-poirier@laposte.net>2016-10-22 23:51:14 +0200
committerEike Rathke <erack@redhat.com>2016-11-09 14:51:24 +0000
commitb0901f9f0843c2d85da6742780d9aef296f62c60 (patch)
treec90cffabda28d07b4a2a8bab2e2ea62cd07ecaba
parent281b3458940e06f9cb5f679537adc19532a0a80d (diff)
tdf#102370 QA test exponent without sign during export to Excel
Change-Id: I0adf7d97f297a8fe1003c8e4cb9a08c9070ed92e Reviewed-on: https://gerrit.libreoffice.org/30170 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/qa/unit/data/ods/tdf102370_ExponentWithoutSign.odsbin0 -> 7345 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx27
2 files changed, 26 insertions, 1 deletions
diff --git a/sc/qa/unit/data/ods/tdf102370_ExponentWithoutSign.ods b/sc/qa/unit/data/ods/tdf102370_ExponentWithoutSign.ods
new file mode 100644
index 000000000000..ab3fbd7c073b
--- /dev/null
+++ b/sc/qa/unit/data/ods/tdf102370_ExponentWithoutSign.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 9a47f4791d28..b9bbc30e7ff2 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -61,6 +61,7 @@
#include <formula/grammar.hxx>
#include <unotools/useroptions.hxx>
#include <tools/datetime.hxx>
+#include <svl/zformat.hxx>
#include <test/xmltesttools.hxx>
#include <comphelper/processfactory.hxx>
@@ -179,6 +180,7 @@ public:
void testTdf88657();
void testEscapeCharInNumberFormatXLSX();
void testNatNumInNumberFormatXLSX();
+ void testExponentWithoutSignFormatXLSX();
void testHiddenRepeatedRowsODS();
void testHyperlinkTargetFrameODS();
@@ -264,6 +266,7 @@ public:
CPPUNIT_TEST(testTdf88657);
CPPUNIT_TEST(testEscapeCharInNumberFormatXLSX);
CPPUNIT_TEST(testNatNumInNumberFormatXLSX);
+ CPPUNIT_TEST(testExponentWithoutSignFormatXLSX);
CPPUNIT_TEST(testHiddenRepeatedRowsODS);
CPPUNIT_TEST(testHyperlinkTargetFrameODS);
@@ -3698,6 +3701,28 @@ void ScExportTest::testNatNumInNumberFormatXLSX()
xDocSh->DoClose();
}
+void ScExportTest::testExponentWithoutSignFormatXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("tdf102370_ExponentWithoutSign.", FORMAT_ODS);
+ CPPUNIT_ASSERT( xDocSh.Is() );
+ xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX);
+ CPPUNIT_ASSERT( xDocSh.Is() );
+
+ xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS);
+ CPPUNIT_ASSERT(xDocSh.Is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+ sal_uInt32 nNumberFormat;
+ rDoc.GetNumberFormat(0, 0, 0, nNumberFormat);
+ const SvNumberformat* pNumberFormat = rDoc.GetFormatTable()->GetEntry(nNumberFormat);
+ const OUString& rFormatStr = pNumberFormat->GetFormatstring();
+ const OUString aExpectedFormatStr = "0.00E0";
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number format lost exponent without sign during Excel export", aExpectedFormatStr, rFormatStr);
+
+ xDocSh->DoClose();
+}
+
void ScExportTest::testHiddenRepeatedRowsODS()
{
ScDocShellRef xDocSh = loadDoc("empty.", FORMAT_ODS);
@@ -3708,7 +3733,7 @@ void ScExportTest::testHiddenRepeatedRowsODS()
rDoc.SetRowHidden(0, 20, 0, true);
}
- xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS); // Convert [NatNum5] to [DBNum2] in Chinese
+ xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS);
ScDocument& rDoc = xDocSh->GetDocument();
SCROW nFirstRow = 0;
SCROW nLastRow = 0;