summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlexport
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-07-27 07:22:02 +0300
committerJustin Luth <justin_luth@sil.org>2018-07-28 06:16:38 +0200
commita56e2bba046b569e8923a438996bc6185037d3ed (patch)
treeed134265c8bb7a1b05659039033e629a7e7516e1 /sw/qa/extras/ooxmlexport
parentf458dabcaa18d66b054d00f5d9a389c06240f0eb (diff)
writerfilter: unit test that no w:default still uses "Normal"
Note: the unit test does NOT test the changes in GetCurrentParaStyleName. That is just a logical change and this unit test asserts the validity of the intention. Word 2013 was used to confirm that Normal is used for styleless paragraphs even if it is not marked as "default". Change-Id: I405591b40ed9028b292e99ba2833c25a24e089ac Reviewed-on: https://gerrit.libreoffice.org/58161 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw/qa/extras/ooxmlexport')
-rw-r--r--sw/qa/extras/ooxmlexport/data/noDefault.docxbin0 -> 9238 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx28
2 files changed, 28 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/noDefault.docx b/sw/qa/extras/ooxmlexport/data/noDefault.docx
new file mode 100644
index 000000000000..56bc2669110a
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/noDefault.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 5f8b5bb2a3b6..bb5d91500cb3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -479,6 +479,34 @@ DECLARE_OOXMLEXPORT_TEST(testOpenDocumentAsReadOnly, "open-as-read-only.docx")
CPPUNIT_ASSERT(pTextDoc->GetDocShell()->IsSecurityOptOpenReadOnly());
}
+DECLARE_OOXMLEXPORT_TEST(testNoDefault, "noDefault.docx")
+{
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+ uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
+
+ // Row 1: color directly applied to the paragraph, overrides table and style colors
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x2E74B5), getProperty<sal_Int32>(getRun(xPara,1), "CharColor"));
+
+ // Row2: (still part of firstRow table-style) ought to use the Normal style color, not the table-style color(5B9BD5)
+ //xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY);
+ //xParaEnumAccess.set(xCell->getText(), uno::UNO_QUERY);
+ //xParaEnum = xParaEnumAccess->createEnumeration();
+ //xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+ //CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_LIGHTMAGENTA), getProperty<sal_Int32>(getRun(xPara,1), "CharColor"));
+
+ // Row 3+: Normal style still applied, even if nothing is specified with w:default="1"
+ xCell.set(xTable->getCellByName("A3"), uno::UNO_QUERY);
+ xParaEnumAccess.set(xCell->getText(), uno::UNO_QUERY);
+ xParaEnum = xParaEnumAccess->createEnumeration();
+ xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_LIGHTMAGENTA), getProperty<sal_Int32>(getRun(xPara,1), "CharColor"));
+}
+
DECLARE_OOXMLEXPORT_TEST(testMarginsFromStyle, "margins_from_style.docx")
{
// tdf#118521 paragraphs with direct formatting of top or bottom margins have