summaryrefslogtreecommitdiff
path: root/sw/qa/core
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-01-25 09:27:28 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-01-25 12:40:04 +0000
commitfd3d4d894d96f16a28d5b58c5bcf5a44fb83617f (patch)
tree5097f55862c462d23360cba6162c1ebb90204126 /sw/qa/core
parent6053df3ecdf89886a4573a47aac789cacf4df008 (diff)
sw: add UNO API for multi-page fly frames
This exposes the internal property added in 0bb90afaeb193181d7b98b79e962549d8a1dd85a (sw: add document model for multi-page fly frames, 2023-01-24) on the UNO API. Change-Id: If9acd2d2130f727bc9481980445c0da01be04729 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146124 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/qa/core')
-rw-r--r--sw/qa/core/unocore/unocore.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx
index 0c2da1b0524a..d17b1e19940a 100644
--- a/sw/qa/core/unocore/unocore.cxx
+++ b/sw/qa/core/unocore/unocore.cxx
@@ -28,6 +28,7 @@
#include <ndtxt.hxx>
#include <textlinebreak.hxx>
#include <textcontentcontrol.hxx>
+#include <frmmgr.hxx>
using namespace ::com::sun::star;
@@ -902,6 +903,33 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testParagraphMarkerFormattedRun)
getXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwFieldPortion", "font-weight"));
}
+CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testFlySplit)
+{
+ // Given a document with a fly frame:
+ createSwDoc();
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ SwFlyFrameAttrMgr aMgr(true, pWrtShell, Frmmgr_Type::TEXT, nullptr);
+ RndStdIds eAnchor = RndStdIds::FLY_AT_PARA;
+ aMgr.InsertFlyFrame(eAnchor, aMgr.GetPos(), aMgr.GetSize());
+ uno::Reference<text::XTextFramesSupplier> xDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xFrame(xDocument->getTextFrames()->getByName("Frame1"),
+ uno::UNO_QUERY);
+ bool bIsSplitAllowed{};
+ // Without the accompanying fix in place, this test would have failed with:
+ // An uncaught exception of type com.sun.star.beans.UnknownPropertyException
+ // - Unknown property: IsSplitAllowed
+ // i.e. the property was missing.
+ xFrame->getPropertyValue("IsSplitAllowed") >>= bIsSplitAllowed;
+ CPPUNIT_ASSERT(!bIsSplitAllowed);
+
+ // When marking it as IsSplitAllowed=true:
+ xFrame->setPropertyValue("IsSplitAllowed", uno::Any(true));
+
+ // Then make sure that IsSplitAllowed is true when asking back:
+ xFrame->getPropertyValue("IsSplitAllowed") >>= bIsSplitAllowed;
+ CPPUNIT_ASSERT(bIsSplitAllowed);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */