[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source

Tibor Nagy (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 3 08:00:25 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 371ea6a4f60c12df6a35bb4715b8ea92a9266e03
Author:     Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Tue Dec 29 08:36:49 2020 +0100
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Wed Mar 3 08:59:53 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>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108808
    Tested-by: Jenkins
    (cherry picked from commit 9e82c64fa54ce7c0ef18e9de5a06e1243a3a7e44)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111874
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

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 158f1f1a2959..f81437aa6693 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -93,6 +93,7 @@ public:
     ScDocShellRef saveAndReloadPassword( ScDocShell*, const OUString&, const OUString&, const OUString&, SfxFilterFlags );
 
     void test();
+    void testTdf139394();
     void testExtCondFormatXLSX();
     void testTdf90104();
     void testTdf111876();
@@ -277,6 +278,7 @@ public:
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
+    CPPUNIT_TEST(testTdf139394);
     CPPUNIT_TEST(testExtCondFormatXLSX);
     CPPUNIT_TEST(testTdf90104);
     CPPUNIT_TEST(testTdf111876);
@@ -544,6 +546,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("tdf139021.", FORMAT_XLSX);
diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx
index f4a385088d8b..887801174301 100644
--- a/sc/source/filter/excel/xeextlst.cxx
+++ b/sc/source/filter/excel/xeextlst.cxx
@@ -174,16 +174,16 @@ OString GetFixedFormula(ScConditionMode eMode, const ScAddress& rAddress, const
     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("NOT(ISERROR(SEARCH(" + rText + "," + aPos + ")))");
-    case ScConditionMode::NotContainsText:
-        return OString("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("NOT(ISERROR(SEARCH(" + rText + "," + aPos + ")))");
+        case ScConditionMode::NotContainsText:
+            return OString("ISERROR(SEARCH(" + rText + "," + aPos + "))");
+        default:
+            break;
     }
 
     return "";


More information about the Libreoffice-commits mailing list