Debian Codegraph @

sw/qa/writerfilter/dmapper/DomainMapperTableManager.cxx

raw
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
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 */
9
10 #include <test/unoapi_test.hxx>
11
12 #include <com/sun/star/beans/XPropertySet.hpp>
13 #include <com/sun/star/text/XTextFramesSupplier.hpp>
14
15 using namespace ::com::sun::star;
16
17 namespace
18 {
19 /// Tests for sw/source/writerfilter/dmapper/DomainMapperTableManager.cxx.
20 class Test : public UnoApiTest
21 {
22 public:
23 Test()
24 : UnoApiTest(u"/sw/qa/writerfilter/dmapper/data/"_ustr)
25 {
26 }
27 };
28
29 CPPUNIT_TEST_FIXTURE(Test, testTblOverlap)
30 {
31 // Given a document with 2 floating tables, the second is not allowed to overlap:
32 // When importing that document:
33 loadFromFile(u"floattable-tbl-overlap.docx");
34
35 // Then make sure the second table is marked as "can't overlap":
36 uno::Reference<text::XTextFramesSupplier> xTextDocument(mxComponent, uno::UNO_QUERY);
37 uno::Reference<container::XIndexAccess> xFrames(xTextDocument->getTextFrames(), uno::UNO_QUERY);
38 uno::Reference<beans::XPropertySet> xFrame(xFrames->getByIndex(1), uno::UNO_QUERY);
39 bool bAllowOverlap{};
40 CPPUNIT_ASSERT(xFrame->getPropertyValue(u"AllowOverlap"_ustr) >>= bAllowOverlap);
41 // Without the accompanying fix in place, this test would have failed, the tables were marked as
42 // "can overlap".
43 CPPUNIT_ASSERT(!bAllowOverlap);
44 }
45 }
46
47 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */