summaryrefslogtreecommitdiff
path: root/writerfilter/qa/cppunittests/dmapper/TableManager.cxx
blob: 0f27633dce7403ab889ec6dd3e8e551ba313182e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <test/unoapi_test.hxx>

#include <com/sun/star/text/XTextFramesSupplier.hpp>

using namespace com::sun::star;

namespace
{
/// Tests for writerfilter/source/dmapper/TableManager.cxx.
class Test : public UnoApiTest
{
public:
    Test()
        : UnoApiTest("/writerfilter/qa/cppunittests/dmapper/data/")
    {
    }
};

CPPUNIT_TEST_FIXTURE(Test, testFloattableNestedCellStartDOCXImport)
{
    // Given a document with a nested floating table at cell start and an other inner floating table:
    // When importing that document:
    loadFromFile(u"floattable-nested-cellstart.docx");

    // Then make sure that both inner tables are floating:
    uno::Reference<text::XTextFramesSupplier> xFramesSupplier(mxComponent, uno::UNO_QUERY);
    uno::Reference<container::XIndexAccess> xFrames(xFramesSupplier->getTextFrames(),
                                                    uno::UNO_QUERY);
    // Without the accompanying fix in place, this test would have failed with:
    // - Expected: 2
    // - Actual  : 1
    // i.e. the first inner table was not floating.
    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xFrames->getCount());
}
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */