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

Szabolcs Toth (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 2 11:29:09 UTC 2021


 sc/qa/unit/data/ods/tdf142231.ods                |binary
 sc/qa/unit/subsequent_export-test.cxx            |   14 ++++++++++++++
 sc/source/filter/xml/XMLExportDatabaseRanges.cxx |    4 ++++
 3 files changed, 18 insertions(+)

New commits:
commit 70189564fdbab3c75b4fce7accb2c91a1597b4d2
Author:     Szabolcs Toth <toth.szabolcs at nisz.hu>
AuthorDate: Wed May 19 08:25:11 2021 +0200
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Fri Jul 2 13:28:30 2021 +0200

    tdf#142231 sc odf: fix export of single date filter value
    
    by export the sting value of the filter condition, if its
    filter by date.
    
    Change-Id: I537fbd43810c78c0834480c9f1a480481aedd742
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115775
    Tested-by: Balazs Varga <varga.balazs3 at nisz.hu>
    Reviewed-by: Balazs Varga <varga.balazs3 at nisz.hu>
    (cherry picked from commit f2c9da1ef662d10726a2dc709b46722ec7d4a016)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118262
    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/ods/tdf142231.ods b/sc/qa/unit/data/ods/tdf142231.ods
new file mode 100644
index 000000000000..8b3e235625ce
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf142231.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 9b0aa643b1b4..ff43984bc327 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -212,6 +212,7 @@ public:
     void testTdf95640_ods_to_xlsx_with_standard_list();
     void testTdf95640_xlsx_to_xlsx();
     void testDateAutofilterXLSX();
+    void testDateAutofilterODS();
 
     void testRefStringXLSX();
     void testRefStringConfigXLSX();
@@ -393,6 +394,7 @@ public:
     CPPUNIT_TEST(testTdf95640_ods_to_xlsx_with_standard_list);
     CPPUNIT_TEST(testTdf95640_xlsx_to_xlsx);
     CPPUNIT_TEST(testDateAutofilterXLSX);
+    CPPUNIT_TEST(testDateAutofilterODS);
 
     CPPUNIT_TEST(testRefStringXLSX);
     CPPUNIT_TEST(testRefStringConfigXLSX);
@@ -4470,6 +4472,18 @@ void ScExportTest::testDateAutofilterXLSX()
     xDocSh->DoClose();
 }
 
+void ScExportTest::testDateAutofilterODS()
+{
+    ScDocShellRef xDocSh = loadDoc(u"tdf142231.", FORMAT_ODS);
+    CPPUNIT_ASSERT(xDocSh.is());
+
+    xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "content.xml", FORMAT_ODS);
+    CPPUNIT_ASSERT(pDoc);
+
+    assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[1]", "value", "Calc");
+    assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[2]", "value", "2021-05-04");
+}
+
 void ScExportTest::testTdf88657ODS()
 {
     ScDocShellRef xDocSh = loadDoc("tdf88657.", FORMAT_ODS);
diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
index 73362197a771..7611a2598f79 100644
--- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
+++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
@@ -446,6 +446,10 @@ private:
             const ScQueryEntry::Item& rItem = rItems.front();
             if (rItem.meType == ScQueryEntry::ByString)
                 mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, rItem.maString.getString());
+            else if (rItem.meType == ScQueryEntry::ByDate)
+            {
+                mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, rItem.maString.getString());
+            }
             else
             {
                 mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_NUMBER);


More information about the Libreoffice-commits mailing list