[Libreoffice-commits] core.git: sc/qa sc/source

Szabolcs Toth (via logerrit) logerrit at kemper.freedesktop.org
Wed May 26 07:12:13 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 f2c9da1ef662d10726a2dc709b46722ec7d4a016
Author:     Szabolcs Toth <toth.szabolcs at nisz.hu>
AuthorDate: Wed May 19 08:25:11 2021 +0200
Commit:     Balazs Varga <varga.balazs3 at nisz.hu>
CommitDate: Wed May 26 09:11:26 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>

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 7a74e6ebf1f6..ee9f0ee110e5 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -220,6 +220,7 @@ public:
     void testTdf95640_ods_to_xlsx_with_standard_list();
     void testTdf95640_xlsx_to_xlsx();
     void testDateAutofilterXLSX();
+    void testDateAutofilterODS();
     void testAutofilterColorsODF();
     void testAutofilterColorsOOXML();
     void testAutofilterColorsStyleOOXML();
@@ -410,6 +411,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(testAutofilterColorsODF);
     CPPUNIT_TEST(testAutofilterColorsOOXML);
     CPPUNIT_TEST(testAutofilterColorsStyleOOXML);
@@ -4643,6 +4645,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::testAutofilterColorsODF()
 {
     ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_ODS);
diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
index c3f651e5416b..4e171d5b9da6 100644
--- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
+++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
@@ -459,6 +459,10 @@ private:
                     mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TEXT);
                 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 if (rItem.meType == ScQueryEntry::ByTextColor
                      || rItem.meType == ScQueryEntry::ByBackgroundColor)
             {


More information about the Libreoffice-commits mailing list