summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-01-05 14:02:35 +0300
committerEike Rathke <erack@redhat.com>2020-01-22 17:30:13 +0100
commit197aa7911d5be5464efd19feaf3370eea1c15ab1 (patch)
tree1aabdeb2ae2b5c09e3f93112cb5534d73132e483 /sc/qa
parenta821d89646ef25428cf5992f86d8f31581313bdb (diff)
tdf#83779: convert TRUE/FALSE constants to functions TRUE()/FALSE()
This avoids problems with round-tripping Excel spreadsheets, where previously a formula like =IF(ISNA(A1)=FALSE;"a";"b") was imported as =IF(ISNA(A1)=0;"a";"b"), and when exported back, it didn't work in Excel, because boolean values had a distinct type in it. Change-Id: I672a631bfa1a4811349794f714293404c6b24381 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86238 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/data/xlsx/tdf83779.xlsxbin0 -> 8620 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx20
2 files changed, 20 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/tdf83779.xlsx b/sc/qa/unit/data/xlsx/tdf83779.xlsx
new file mode 100644
index 000000000000..0a5d645c8122
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf83779.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 1fe48fb464c3..5dad9a32ad66 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -232,6 +232,7 @@ public:
void testRotatedImageODS();
void testTdf128976();
void testTdf120502();
+ void testTdf83779();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -364,6 +365,7 @@ public:
CPPUNIT_TEST(testRotatedImageODS);
CPPUNIT_TEST(testTdf128976);
CPPUNIT_TEST(testTdf120502);
+ CPPUNIT_TEST(testTdf83779);
CPPUNIT_TEST_SUITE_END();
@@ -4706,6 +4708,24 @@ void ScExportTest::testTdf120502()
assertXPath(pSheet1, "/x:worksheet/x:cols/x:col", "max", OUString::number(nMaxCol + 1));
}
+void ScExportTest::testTdf83779()
+{
+ // Roundtripping TRUE/FALSE constants (not functions) must convert them to functions
+ ScDocShellRef xShell = loadDoc("tdf83779.", FORMAT_XLSX);
+ CPPUNIT_ASSERT(xShell);
+
+ auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+
+ const xmlDocPtr pVmlDrawing
+ = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
+ CPPUNIT_ASSERT(pVmlDrawing);
+
+ assertXPathContent(pVmlDrawing, "/x:worksheet/x:sheetData/x:row[1]/x:c/x:f", "FALSE()");
+ assertXPathContent(pVmlDrawing, "/x:worksheet/x:sheetData/x:row[2]/x:c/x:f", "TRUE()");
+
+ xShell->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();