[Libreoffice-commits] core.git: sc/qa sc/source
Tibor Nagy (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jan 5 13:34:04 UTC 2021
sc/qa/unit/data/xlsx/tdf139394.xlsx |binary
sc/qa/unit/subsequent_export-test.cxx | 27 +++++++++++++++++++++++++++
sc/source/filter/excel/xeextlst.cxx | 20 ++++++++++----------
3 files changed, 37 insertions(+), 10 deletions(-)
New commits:
commit 9165d5f834a6c831e8683a430bf5911eb4316b68
Author: Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Tue Dec 29 08:36:49 2020 +0100
Commit: Eike Rathke <erack at redhat.com>
CommitDate: Tue Jan 5 14:33:16 2021 +0100
tdf#139394 XLSX export: remove extra quotation marks
This fixes commit 583e2bfba2d72ac8afe7261c23f380daf5486889
(tdf#139021 XLSX export: fix "contains" conditional formatting).
Change-Id: Idae3190b5f87dac551251da19c511f501bdaaa21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108452
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
Reviewed-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/qa/unit/data/xlsx/tdf139394.xlsx b/sc/qa/unit/data/xlsx/tdf139394.xlsx
new file mode 100644
index 000000000000..eac83fb2f3a8
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf139394.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 0261ea9f2dca..8f471b175148 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -89,6 +89,7 @@ public:
virtual void tearDown() override;
void test();
+ void testTdf139394();
void testExtCondFormatXLSX();
void testTdf90104();
void testTdf111876();
@@ -280,6 +281,7 @@ public:
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
+ CPPUNIT_TEST(testTdf139394);
CPPUNIT_TEST(testExtCondFormatXLSX);
CPPUNIT_TEST(testTdf90104);
CPPUNIT_TEST(testTdf111876);
@@ -519,6 +521,31 @@ void ScExportTest::test()
xDocSh->DoClose();
}
+void ScExportTest::testTdf139394()
+{
+ ScDocShellRef xShell = loadDoc(u"tdf139394.", FORMAT_XLSX);
+ CPPUNIT_ASSERT(xShell.is());
+
+ ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+ CPPUNIT_ASSERT(xDocSh.is());
+
+ std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+ xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
+ CPPUNIT_ASSERT(pDoc);
+
+ assertXPathContent(pDoc,
+ "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/"
+ "x14:cfRule/xm:f", "LEFT(A1,LEN(\"+\"))=\"+\"");
+ assertXPathContent(pDoc,
+ "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/"
+ "x14:cfRule/xm:f", "RIGHT(A2,LEN(\"-\"))=\"-\"");
+ assertXPathContent(pDoc,
+ "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[3]/"
+ "x14:cfRule/xm:f", "LEFT(A3,LEN($B$3))=$B$3");
+
+ xDocSh->DoClose();
+}
+
void ScExportTest::testExtCondFormatXLSX()
{
ScDocShellRef xShell = loadDoc(u"tdf139021.", FORMAT_XLSX);
diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx
index 972a9010b342..1f0d8fcc942d 100644
--- a/sc/source/filter/excel/xeextlst.cxx
+++ b/sc/source/filter/excel/xeextlst.cxx
@@ -175,16 +175,16 @@ OString GetFixedFormula(ScConditionMode eMode, const ScAddress& rAddress, std::s
OString aPos = aBuffer.makeStringAndClear();
switch (eMode)
{
- case ScConditionMode::BeginsWith:
- return OString("LEFT(" + aPos + ",LEN(" + rText + "))=\"" + rText + "\"");
- case ScConditionMode::EndsWith:
- return OString("RIGHT(" + aPos + ",LEN(" + rText + "))=\"" + rText + "\"");
- case ScConditionMode::ContainsText:
- return OString(OString::Concat("NOT(ISERROR(SEARCH(") + rText + "," + aPos + ")))");
- case ScConditionMode::NotContainsText:
- return OString(OString::Concat("ISERROR(SEARCH(") + rText + "," + aPos + "))");
- default:
- break;
+ case ScConditionMode::BeginsWith:
+ return OString("LEFT(" + aPos + ",LEN(" + rText + "))=" + rText);
+ case ScConditionMode::EndsWith:
+ return OString("RIGHT(" + aPos + ",LEN(" + rText + "))=" + rText);
+ case ScConditionMode::ContainsText:
+ return OString(OString::Concat("NOT(ISERROR(SEARCH(") + rText + "," + aPos + ")))");
+ case ScConditionMode::NotContainsText:
+ return OString(OString::Concat("ISERROR(SEARCH(") + rText + "," + aPos + "))");
+ default:
+ break;
}
return "";
More information about the Libreoffice-commits
mailing list