diff options
-rw-r--r-- | sw/qa/extras/odfexport/data/midnight_redline.fodt | 19 | ||||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport2.cxx | 15 | ||||
-rw-r--r-- | xmloff/source/text/XMLRedlineExport.cxx | 4 |
3 files changed, 36 insertions, 2 deletions
diff --git a/sw/qa/extras/odfexport/data/midnight_redline.fodt b/sw/qa/extras/odfexport/data/midnight_redline.fodt new file mode 100644 index 000000000000..9d75a32f811c --- /dev/null +++ b/sw/qa/extras/odfexport/data/midnight_redline.fodt @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:body> + <office:text> + <text:tracked-changes text:track-changes="false"> + <text:changed-region xml:id="ct1" text:id="ct1"> + <text:deletion> + <office:change-info> + <dc:creator>John Doe</dc:creator> + <dc:date>2001-01-01T00:00:00</dc:date> + </office:change-info> + </text:deletion> + </text:changed-region> + </text:tracked-changes> + <text:p><text:change-start text:change-id="ct1"/>Deleted text<text:change-end text:change-id="ct1"/></text:p> + </office:text> + </office:body> +</office:document>
\ No newline at end of file diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 01016b5b8ad2..d1977776dc3d 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -1609,6 +1609,21 @@ CPPUNIT_TEST_FIXTURE(Test, testDeletedTableAutostylesExport) loadAndReload("deleted_table.fodt"); } +CPPUNIT_TEST_FIXTURE(Test, testMidnightRedlineDatetime) +{ + // Given a document with a tracked change with a midnight datetime: + // make sure that it succeeds export and import validation. Before the fix, this failed: + // - Error: "2001-01-01" does not satisfy the "dateTime" type + // because "2001-01-01T00:00:00" became "2001-01-01" on roundtrip. + loadAndReload("midnight_redline.fodt"); + + xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + assertXPathContent(pXmlDoc, + "//office:body/office:text/text:tracked-changes/text:changed-region/" + "text:deletion/office:change-info/dc:date"_ostr, + u"2001-01-01T00:00:00"_ustr); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx index 69664f818644..bff3a772779b 100644 --- a/xmloff/source/text/XMLRedlineExport.cxx +++ b/xmloff/source/text/XMLRedlineExport.cxx @@ -469,7 +469,7 @@ void XMLRedlineExport::ExportChangeInfo( OUStringBuffer sBuf; ::sax::Converter::convertDateTime(sBuf, bRemovePersonalInfo ? util::DateTime(0, 0, 0, 0, 1, 1, 1970, true) // Epoch time - : aDateTime, nullptr); + : aDateTime, nullptr, true); SvXMLElementExport aDateElem( rExport, XML_NAMESPACE_DC, XML_DATE, true, false ); @@ -521,7 +521,7 @@ void XMLRedlineExport::ExportChangeInfo( OUStringBuffer sBuf; ::sax::Converter::convertDateTime(sBuf, bRemovePersonalInfo ? util::DateTime(0, 0, 0, 0, 1, 1, 1970, true) // Epoch time - : aDateTime, nullptr); + : aDateTime, nullptr, true); SvXMLElementExport aDateElem( rExport, XML_NAMESPACE_DC, XML_DATE, true, false ); |