diff options
author | László Németh <nemeth@numbertext.org> | 2022-03-02 16:41:04 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2022-03-02 21:20:29 +0100 |
commit | 2c51746997478ad5d0e7cc64aa6489769c473d43 (patch) | |
tree | 92401fe8d577bbdf93dc09be6af782ad74bed3eb /sw/qa | |
parent | 89101372c892d2ec3cfa8008101cbfb56ac1cf99 (diff) |
tdf#146171 DOCX: fix loss of change tracking, if no date
was specified, or it was specified as zero date (e.g. in
a LO DOCX export).
DateTime attribute w:date is optional in w:ins/w:del
according to the OOXML standard. Not specified w:date was
imported as invalid zero date "0-00-00T00:00:00Z" resulting
loss of change tracking data completely during an ODF
roundtrip.
Import this invalid zero date as Epoch time to avoid losing
change tracking data.
Change-Id: If8442db9aa5e41c470827545c36c64f598887101
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130885
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf146171.docx | bin | 0 -> 11710 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 4 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 18 |
3 files changed, 20 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf146171.docx b/sw/qa/extras/ooxmlexport/data/tdf146171.docx Binary files differnew file mode 100644 index 000000000000..bdd534527a99 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf146171.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 775f7f4154ab..c568f7228a7b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -1223,9 +1223,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf145720, "tdf104797.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:moveTo/w:moveToRangeStart", "author", u"Tekijä"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:moveFrom/w:moveFromRangeStart", "date", - "0-00-00T00:00:00Z"); + "1970-01-01T00:00:00Z"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:moveTo/w:moveToRangeStart", "date", - "0-00-00T00:00:00Z"); + "1970-01-01T00:00:00Z"); } } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 7fe132b69e68..543a7580bd79 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -645,6 +645,24 @@ CPPUNIT_TEST_FIXTURE(Test, testTextframeHyperlink) assertXPath(pXmlDoc, "//w:pict/v:rect", "href", "https://libreoffice.org/"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf146171_invalid_change_date) +{ + load(mpTestDocumentPath, "tdf146171.docx"); + // false alarm? during ODF roundtrip: + // 'Error: "1970-01-01" does not satisfy the "dateTime" type' + // disable and check only the conversion of the invalid (zeroed) change date + // reload("writer8", "tdf146171.odt"); + reload("Office Open XML Text", "tdf146171.docx"); + + xmlDocUniquePtr pXmlDoc = parseExport(); + // This was 0 + assertXPath(pXmlDoc, "//w:ins", 4); + // This was 0 + assertXPath(pXmlDoc, "//w:del", 1); + // This was 0000-00-00T00:00:00Z, resulting loss of change tracking during ODF roundtrip + assertXPath(pXmlDoc, "//w:del", "date", "1970-01-01T00:00:00Z"); +} + DECLARE_OOXMLEXPORT_TEST(testTdf139580, "tdf139580.odt") { // Without the fix in place, this test would have crashed at export time |