[Libreoffice-commits] core.git: sc/qa sc/source
Tünde Tóth (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 13 16:41:31 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 0d3398e5d141b79706653c04f1ab6dc9381a5cc1
Author: Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Thu Jul 1 13:40:03 2021 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Tue Jul 13 18:40:56 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>
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 0a0a7cff9f8c..4eab1c9bf1e9 100644
--- a/sc/qa/unit/subsequent_export-test2.cxx
+++ b/sc/qa/unit/subsequent_export-test2.cxx
@@ -192,6 +192,7 @@ public:
void testTdf140431();
void testCheckboxFormControlXlsxExport();
void testButtonFormControlXlsxExport();
+ void testTdf142929_filterLessThanXLSX();
void testInvalidNamedRange();
CPPUNIT_TEST_SUITE(ScExportTest2);
@@ -293,6 +294,7 @@ public:
CPPUNIT_TEST(testTdf140431);
CPPUNIT_TEST(testCheckboxFormControlXlsxExport);
CPPUNIT_TEST(testButtonFormControlXlsxExport);
+ CPPUNIT_TEST(testTdf142929_filterLessThanXLSX);
CPPUNIT_TEST(testInvalidNamedRange);
CPPUNIT_TEST_SUITE_END();
@@ -2424,6 +2426,21 @@ void ScExportTest2::testButtonFormControlXlsxExport()
assertXPathNoAttribute(pDoc, "//x:controlPr", "macro");
}
+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();
+}
+
void ScExportTest2::testInvalidNamedRange()
{
// Given a document which has a named range (myname) that refers to the "1" external link, but
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