1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <swmodeltestbase.hxx>
14 #include <IDocumentLayoutAccess.hxx>
17 #include <pagefrm.hxx>
18 #include <rootfrm.hxx>
19 #include <sortedobjs.hxx>
23 /// Covers sw/source/core/text/itratr.cxx fixes.
24 class Test
: public SwModelTestBase
28 : SwModelTestBase("/sw/qa/core/text/data/")
33 CPPUNIT_TEST_FIXTURE(Test
, testFloattableNegativeVertOffsetEmptyAnchor
)
35 // Given a document with 3 floating tables, all of them on page 1, but the anchor of the last
36 // floating table is on page 2, but that anchor has no own text:
37 createSwDoc("floattable-negative-vert-offset-empty.docx");
39 // When laying out that document:
42 // Then make sure the that 3rd floating table is not shifted to page 2:
43 SwDoc
* pDoc
= getSwDoc();
44 SwRootFrame
* pLayout
= pDoc
->getIDocumentLayoutAccess().GetCurrentLayout();
45 auto pPage1
= dynamic_cast<SwPageFrame
*>(pLayout
->Lower());
46 CPPUNIT_ASSERT(pPage1
);
47 CPPUNIT_ASSERT(pPage1
->GetSortedObjs());
48 const SwSortedObjs
& rPage1Objs
= *pPage1
->GetSortedObjs();
49 // Without the accompanying fix in place, this test would have failed with:
52 // i.e. the last floating table was shifted to page 2, which lead to overlapping text in the
54 CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), rPage1Objs
.size());
58 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */