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>
13 #include <comphelper/propertysequence.hxx>
14 #include <comphelper/sequence.hxx>
20 /// Covers sw/source/uibase/shells/textsh.cxx fixes.
21 class Test
: public SwModelTestBase
25 : SwModelTestBase("/sw/qa/uibase/shells/data/")
30 CPPUNIT_TEST_FIXTURE(Test
, testDeleteSections
)
32 // Given a document with a section:
34 SwDoc
* pDoc
= getSwDoc();
35 uno::Sequence
<css::beans::PropertyValue
> aArgs
= {
36 comphelper::makePropertyValue("RegionName",
37 uno::Any(OUString("ZOTERO_BIBL {} CSL_BIBLIOGRAPHY RND"))),
38 comphelper::makePropertyValue("Content", uno::Any(OUString("old content"))),
40 dispatchCommand(mxComponent
, ".uno:InsertSection", aArgs
);
41 CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDoc
->GetSections().size());
43 // When deleting sections:
44 std::vector
<beans::PropertyValue
> aArgsVec
= comphelper::JsonToPropertyValues(R
"json(
46 "SectionNamePrefix
": {
48 "value
": "ZOTERO_BIBL
"
52 aArgs
= comphelper::containerToSequence(aArgsVec
);
53 dispatchCommand(mxComponent
, ".uno:DeleteSections", aArgs
);
55 // Then make sure that the section is deleted:
56 // Without the accompanying fix in place, this test would have failed with:
59 // i.e. the section was not deleted.
60 CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pDoc
->GetSections().size());
64 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */