summaryrefslogtreecommitdiff
path: root/sw/qa/extras/odfexport/odfexport.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-05-09 21:13:50 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-05-10 08:30:53 +0200
commit8a26e4b26f0153fb8ca5da880ee4aa44748ee4df (patch)
treeb4d97cfed4beca59d345267adb7a91ce1cec2f54 /sw/qa/extras/odfexport/odfexport.cxx
parent38371d01e0240825f6d8d419214f50bc193e3e6b (diff)
sw btlr writing mode: implement layout for fly frames
The case when a fly frame was first constructed with one direction then switched to btlr was already working. The case when the direction is already set before the SwFlyFrame is constructed was not, as SvxFrameDirection::Vertical_LR_BT was unhandled. Change-Id: I97d15b3fc15ee116181718144dc9bccf8f31529f Reviewed-on: https://gerrit.libreoffice.org/72077 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/extras/odfexport/odfexport.cxx')
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 4ef1128d3118..eeb16f2d9ef7 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -37,6 +37,8 @@
#include <svl/PasswordHelper.hxx>
#include <docufld.hxx> // for SwHiddenTextField::ParseIfFieldDefinition() method call
#include <unoprnms.hxx>
+#include <sortedobjs.hxx>
+#include <flyfrm.hxx>
class Test : public SwModelTestBase
{
@@ -1419,6 +1421,38 @@ DECLARE_ODFEXPORT_TEST(testBtlrFrame, "btlr-frame.odt")
auto nActual = getProperty<sal_Int16>(xTextFrame, "WritingMode");
CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, nActual);
+
+ // Without the accompanying fix in place, this test would have failed, as the fly frame had
+ // mbVertical==true, but mbVertLRBT==false, even if the writing direction in the doc model was
+ // btlr.
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+ CPPUNIT_ASSERT(pDoc);
+
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ CPPUNIT_ASSERT(pLayout);
+
+ SwFrame* pPageFrame = pLayout->GetLower();
+ CPPUNIT_ASSERT(pPageFrame);
+ CPPUNIT_ASSERT(pPageFrame->IsPageFrame());
+
+ SwFrame* pBodyFrame = pPageFrame->GetLower();
+ CPPUNIT_ASSERT(pBodyFrame);
+ CPPUNIT_ASSERT(pBodyFrame->IsBodyFrame());
+
+ SwFrame* pBodyTextFrame = pBodyFrame->GetLower();
+ CPPUNIT_ASSERT(pBodyTextFrame);
+ CPPUNIT_ASSERT(pBodyTextFrame->IsTextFrame());
+
+ CPPUNIT_ASSERT(pBodyTextFrame->GetDrawObjs());
+ const SwSortedObjs& rAnchored = *pBodyTextFrame->GetDrawObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rAnchored.size());
+
+ auto* pFlyFrame = dynamic_cast<SwFlyFrame*>(rAnchored[0]);
+ CPPUNIT_ASSERT(pFlyFrame);
+ CPPUNIT_ASSERT(pFlyFrame->IsVertLRBT());
}
DECLARE_ODFEXPORT_TEST(testFdo86963, "fdo86963.odt")