Add a comment to clarify what kind of inputs the class handles
[LibreOffice.git] / sw / qa / uibase / dialog / dialog.cxx
blob832f4c2a82e55cb09c3cafe9470dd1a7ed58e50b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include <swmodeltestbase.hxx>
12 #include <comphelper/propertyvalue.hxx>
14 #include <wrtsh.hxx>
15 #include <docsh.hxx>
17 namespace
19 /// Covers sw/source/uibase/dialog/ fixes.
20 class Test : public SwModelTestBase
22 public:
23 Test()
24 : SwModelTestBase(u"/sw/qa/uibase/dialog/data/"_ustr)
30 CPPUNIT_TEST_FIXTURE(Test, testInsertSection)
32 // Given an empty document:
33 createSwDoc();
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
51 // - Actual :
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: */