summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2024-07-23 20:57:37 -0400
committerJustin Luth <jluth@mail.com>2024-07-24 13:52:00 +0200
commit3974c4748b9a2bcd054e0b9f9e3d42bdca45bef2 (patch)
tree817a30d10c29c2b91d8da06635595a2e38047eda /sw/qa
parent62974cf6a8148377091cb709e7e00dacac152093 (diff)
tdf#138093 tdf#131722 docx import: sdt lost first date character #2
While GetIsDummyParaAddedForTableInSection() is true for the entire section, it should only be used against GetIsFirstParagraphInSection() where the dummy para exists. make CppunitTest_sw_ooxmlexport19 CPPUNIT_TEST_NAME=testTdf138093B Change-Id: I457c0aa25eb7bd086c5c15bd889d9cd89c51db95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170921 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf138093B.docxbin0 -> 37762 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport19.cxx37
2 files changed, 37 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf138093B.docx b/sw/qa/extras/ooxmlexport/data/tdf138093B.docx
new file mode 100644
index 000000000000..f6f770a7160e
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf138093B.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
index 8080bd448a55..dc2a291234c3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
@@ -977,6 +977,43 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138093, "tdf138093.docx")
}
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf138093B)
+{
+ loadAndReload("tdf138093B.docx");
+
+ xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
+ assertXPath(pXmlDoc, "//w:sdt"_ostr, 3);
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<table::XCell> xCell = xTable->getCellByName(u"A1"_ustr);
+ uno::Reference<container::XEnumerationAccess> xParagraphsAccess(xCell, uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParagraphs = xParagraphsAccess->createEnumeration();
+ uno::Reference<container::XEnumerationAccess> xParagraph(xParagraphs->nextElement(),
+ uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xPortions = xParagraph->createEnumeration();
+ uno::Reference<beans::XPropertySet> xTextPortion(xPortions->nextElement(), uno::UNO_QUERY);
+
+ OUString aPortionType;
+ xTextPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType;
+ CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, aPortionType);
+
+ uno::Reference<text::XTextContent> xContentControl;
+ xTextPortion->getPropertyValue(u"ContentControl"_ustr) >>= xContentControl;
+ uno::Reference<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY);
+ bool bDate{};
+ xContentControlProps->getPropertyValue(u"Date"_ustr) >>= bDate;
+ CPPUNIT_ASSERT(bDate);
+ uno::Reference<container::XEnumerationAccess> xContentControlEnumAccess(xContentControl,
+ uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xContentControlEnum
+ = xContentControlEnumAccess->createEnumeration();
+ uno::Reference<text::XTextRange> xTextPortionRange(xContentControlEnum->nextElement(),
+ uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(u"2019"_ustr, xTextPortionRange->getString());
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf131722, "tdf131722.docx")
{
if (isExported())