summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2022-04-06 18:54:02 +0200
committerJustin Luth <jluth@mail.com>2022-04-16 05:47:06 +0200
commitd9b33ed6644203141fdb0776c291425c2bc9f5ac (patch)
tree2a48407a9a97af796329152a940cf7cff5a4d5f5 /sw/qa
parent4659fc2f0a7223a89446edff0b77e58758b5edf5 (diff)
tdf#148380 docx export: support CHANGEDATE/PRINTDATE without format
This is the same idea as the earlier patch for CREATEDATE. However, it isn't safe to import these as fields, so a round-trip test can only test the string itself. The unit test here really doesn't test any of the code changes, but is just pre-emptive to ensure that if DI_CHANGE is imported as a field that it will have the right output. (P.S. Expected date output matches MS Word 2003 even after an F9 refresh.) Change-Id: I30a8b1fc851246898a67e6241a35e927f85dfbb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132664 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf148380_modifiedField.docxbin0 -> 7267 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport17.cxx17
2 files changed, 17 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf148380_modifiedField.docx b/sw/qa/extras/ooxmlexport/data/tdf148380_modifiedField.docx
new file mode 100644
index 000000000000..14f6e319e298
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf148380_modifiedField.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 960bb3f16d8b..5d5bdb22471a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -83,6 +83,23 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148380_createField, "tdf148380_createField.docx"
CPPUNIT_ASSERT_EQUAL(OUString("yesterday at noon"), xField->getPresentation(false));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf148380_modifiedField, "tdf148380_modifiedField.docx")
+{
+ getParagraph(2, "4/5/2022 4:29:00 PM"); // default (unspecified) date format
+
+ // Verify that these are fields, and not just plain text
+ uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+ auto xFieldsAccess(xTextFieldsSupplier->getTextFields());
+ uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+ uno::Reference<text::XTextField> xField(xFields->nextElement(), uno::UNO_QUERY);
+ // unspecified SAVEDATE gets default US formatting because style.xml has w:lang w:val="en-US"
+ //CPPUNIT_ASSERT_EQUAL(OUString("4/5/2022 4:29:00 PM"), xField->getPresentation(false));
+ //xField.set(xFields->nextElement(), uno::UNO_QUERY);
+ // FIXME: This was hand-modified and really should be Charlie Brown
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Did you fix me? I really should be Charlie Brown (or a date)",
+ OUString("Charles Brown"), xField->getPresentation(false));
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf135906)
{
loadAndReload("tdf135906.docx");