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>
12 #include <IDocumentRedlineAccess.hxx>
13 #include <redline.hxx>
17 /// Covers sw/source/core/docnode/ fixes.
18 class Test
: public SwModelTestBase
22 : SwModelTestBase("/sw/qa/core/docnode/data/")
27 CPPUNIT_TEST_FIXTURE(Test
, testRedlineEndsBeforeToC
)
29 // Load a document where a delete redline ends right before a ToC, then redlines are hidden at a
31 createSwDoc("redline-ends-before-toc.docx");
32 SwDoc
* pDoc
= getSwDoc();
33 const SwRedlineTable
& rTable
= pDoc
->getIDocumentRedlineAccess().GetRedlineTable();
34 // Without the accompanying fix in place, this test would have resulted in an assertion failure
35 // in InsertCnt_(), because the start of the section was hidden, but not its end.
36 CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type
>(2), rTable
.size());
38 // The redline contained the newline, too
39 CPPUNIT_ASSERT_EQUAL(OUString("<add-table-of-content>"), rTable
[0]->GetText());
42 CPPUNIT_TEST_FIXTURE(Test
, testTdf150086
)
44 // Load a document where an insert redline ends right before a ToC
45 createSwDoc("tdf150086.docx");
46 SwDoc
* pDoc
= getSwDoc();
47 const SwRedlineTable
& rTable
= pDoc
->getIDocumentRedlineAccess().GetRedlineTable();
48 CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type
>(8), rTable
.size());
50 // This was "Conte" (stripped redline)
51 CPPUNIT_ASSERT_EQUAL(OUString("Content\n"), rTable
[6]->GetText());
54 CPPUNIT_PLUGIN_IMPLEMENT();
56 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */