android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / qa / core / text / itratr.cxx
blob6913d0037dbd45642aeef24c022b94807a1f931b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include <swmodeltestbase.hxx>
12 #include <memory>
14 #include <IDocumentLayoutAccess.hxx>
15 #include <doc.hxx>
16 #include <frame.hxx>
17 #include <pagefrm.hxx>
18 #include <rootfrm.hxx>
19 #include <sortedobjs.hxx>
21 namespace
23 /// Covers sw/source/core/text/itratr.cxx fixes.
24 class Test : public SwModelTestBase
26 public:
27 Test()
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:
40 calcLayout();
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:
50 // - Expected: 3
51 // - Actual : 2
52 // i.e. the last floating table was shifted to page 2, which lead to overlapping text in the
53 // original document.
54 CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), rPage1Objs.size());
58 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */