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 <comphelper/propertyvalue.hxx>
19 /// Covers sw/source/uibase/dialog/ fixes.
20 class Test
: public SwModelTestBase
24 : SwModelTestBase("/sw/qa/uibase/dialog/data/")
30 CPPUNIT_TEST_FIXTURE(Test
, testInsertSection
)
32 // Given an empty document:
34 SwDoc
* pDoc
= getSwDoc();
36 // When inserting a section with text:
37 uno::Sequence
<css::beans::PropertyValue
> aArgs
= {
38 comphelper::makePropertyValue(
39 "RegionName", uno::Any(OUString("ZOTERO_BIBL {} CSL_BIBLIOGRAPHY RNDRfiit6mXBc"))),
40 comphelper::makePropertyValue("Content", uno::Any(OUString("<p>aaa</p><p>bbb</p>"))),
42 dispatchCommand(mxComponent
, ".uno:InsertSection", aArgs
);
44 // Then make sure that we created a section that covers that text:
45 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
46 pWrtShell
->SttEndDoc(/*bStt=*/true);
47 pWrtShell
->EndOfSection(/*bSelect=*/true);
48 SwCursor
* pCursor
= pWrtShell
->GetCursor();
49 OUString aActualResult
= pCursor
->GetText();
50 // Without the accompanying fix in place, this test would have failed with:
51 // - Expected: aaa\nbbb
53 // i.e. the value of the Content parameter was ignored.
54 CPPUNIT_ASSERT_EQUAL(OUString("aaa\nbbb"), aActualResult
);
57 CPPUNIT_PLUGIN_IMPLEMENT();
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */