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

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 14 08:33:07 UTC 2021


 sc/qa/unit/data/xlsx/tdf142929.xlsx       |binary
 sc/qa/unit/subsequent_export-test2.cxx    |   17 +++++++++++++++++
 sc/source/filter/oox/autofilterbuffer.cxx |    2 +-
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit bbd4d7c1b8a219cd295fd799d39b9cbb7a5b464d
Author:     Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Thu Jul 1 13:40:03 2021 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Wed Jul 14 10:32:31 2021 +0200

    tdf#142929 XLSX: fix import of "Less than" filter condition
    
    "Less than" standard filter condition became <> instead of <.
    
    Change-Id: I53435590de3a03d9fcaf0359e8421ae3ef941316
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118227
    Tested-by: Jenkins
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 0d3398e5d141b79706653c04f1ab6dc9381a5cc1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118809
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/qa/unit/data/xlsx/tdf142929.xlsx b/sc/qa/unit/data/xlsx/tdf142929.xlsx
new file mode 100644
index 000000000000..6bf23b951360
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf142929.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx
index 47a50a3d8ee6..55faefb0ddb3 100644
--- a/sc/qa/unit/subsequent_export-test2.cxx
+++ b/sc/qa/unit/subsequent_export-test2.cxx
@@ -188,6 +188,7 @@ public:
     void testTdf139258_rotated_image();
     void testTdf126541_SheetVisibilityImportXlsx();
     void testTdf140431();
+    void testTdf142929_filterLessThanXLSX();
 
     CPPUNIT_TEST_SUITE(ScExportTest2);
 
@@ -284,6 +285,7 @@ public:
     CPPUNIT_TEST(testTdf139258_rotated_image);
     CPPUNIT_TEST(testTdf126541_SheetVisibilityImportXlsx);
     CPPUNIT_TEST(testTdf140431);
+    CPPUNIT_TEST(testTdf142929_filterLessThanXLSX);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2320,6 +2322,21 @@ void ScExportTest2::testTdf140431()
     xDocSh->DoClose();
 }
 
+void ScExportTest2::testTdf142929_filterLessThanXLSX()
+{
+    // Document contains a standard filter with '<' condition.
+    ScDocShellRef xDocSh = loadDoc(u"tdf142929.", FORMAT_XLSX);
+    CPPUNIT_ASSERT(xDocSh.is());
+
+    xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory,
+                                                     "xl/worksheets/sheet1.xml", FORMAT_XLSX);
+    CPPUNIT_ASSERT(pDoc);
+    assertXPath(pDoc, "//x:customFilters/x:customFilter", "val", "2");
+    assertXPath(pDoc, "//x:customFilters/x:customFilter", "operator", "lessThan");
+
+    xDocSh->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx
index 8eb24f231bd4..ab0ff9a43c68 100644
--- a/sc/source/filter/oox/autofilterbuffer.cxx
+++ b/sc/source/filter/oox/autofilterbuffer.cxx
@@ -77,7 +77,7 @@ bool lclGetApiOperatorFromToken( sal_Int32& rnApiOperator, sal_Int32 nToken )
 {
     switch( nToken )
     {
-        case XML_lessThan:              rnApiOperator = FilterOperator2::NOT_EQUAL;     return true;
+        case XML_lessThan:              rnApiOperator = FilterOperator2::LESS;          return true;
         case XML_equal:                 rnApiOperator = FilterOperator2::EQUAL;         return true;
         case XML_lessThanOrEqual:       rnApiOperator = FilterOperator2::LESS_EQUAL;    return true;
         case XML_greaterThan:           rnApiOperator = FilterOperator2::GREATER;       return true;


More information about the Libreoffice-commits mailing list