summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-04-05 10:53:22 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-04-05 15:41:28 +0200
commit8c632d8a837cc722c6e7b3b400f6d97edf9f9800 (patch)
tree5b99a95287744cee5e543b09b841ac86f473631c /sw/qa
parent19d623d54503327e47f6effa3507342ddbea3d73 (diff)
sw content controls: add initial layout support
- portions inside content controls are not text portions but content control portions - teach SwTextPaintInfo::DrawViewOpt() to paint field shadings for content control portions - teach the attribute stack code about RES_TXTATR_CONTENTCONTROL, so if the whole document is just a content control, then adding text before/after the content control is properly text portions, not content control portions Change-Id: Ia9f955a5f7c7a4fd633899fafa8fc723e7c0d050 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132556 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/core/unocore/unocore.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx
index c9bca82ae2f8..19ad5d5fd48b 100644
--- a/sw/qa/core/unocore/unocore.cxx
+++ b/sw/qa/core/unocore/unocore.cxx
@@ -404,6 +404,18 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlTextPortionEnum)
uno::Reference<container::XEnumeration> xContentEnum = xContentEnumAccess->createEnumeration();
uno::Reference<text::XTextRange> xContent(xContentEnum->nextElement(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("test"), xContent->getString());
+
+ // Also test the generated layout:
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwFieldPortion", "expand", "");
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: PortionType::ContentControl
+ // - Actual : PortionType::Text
+ // i.e. SwContentControl generated a plain text portion, not a dedicated content control
+ // portion.
+ assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion", "type",
+ "PortionType::ContentControl");
+ assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion", "portion", "test");
}
CPPUNIT_PLUGIN_IMPLEMENT();