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(u
"/sw/qa/uibase/dialog/data/"_ustr
)
30 CPPUNIT_TEST_FIXTURE(Test
, testInsertSection
)
32 // Given an empty document:
35 // When inserting a section with text:
36 uno::Sequence
<css::beans::PropertyValue
> aArgs
= {
37 comphelper::makePropertyValue(
38 u
"RegionName"_ustr
, uno::Any(u
"ZOTERO_BIBL {} CSL_BIBLIOGRAPHY RNDRfiit6mXBc"_ustr
)),
39 comphelper::makePropertyValue(u
"Content"_ustr
, uno::Any(u
"<p>aaa</p><p>bbb</p>"_ustr
)),
41 dispatchCommand(mxComponent
, u
".uno:InsertSection"_ustr
, aArgs
);
43 // Then make sure that we created a section that covers that text:
44 SwWrtShell
* pWrtShell
= getSwDocShell()->GetWrtShell();
45 pWrtShell
->SttEndDoc(/*bStt=*/true);
46 pWrtShell
->EndOfSection(/*bSelect=*/true);
47 SwCursor
* pCursor
= pWrtShell
->GetCursor();
48 OUString aActualResult
= pCursor
->GetText();
49 // Without the accompanying fix in place, this test would have failed with:
50 // - Expected: aaa\nbbb
52 // i.e. the value of the Content parameter was ignored.
53 CPPUNIT_ASSERT_EQUAL(u
"aaa\nbbb"_ustr
, aActualResult
);
56 CPPUNIT_PLUGIN_IMPLEMENT();
58 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */