/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include #include #include #include #include #include #include #include #include namespace { /// Covers sw/source/uibase/wrtsh/ fixes. class Test : public SwModelTestBase { }; CPPUNIT_TEST_FIXTURE(Test, testInsertLineBreak) { // Given an empty document: SwDoc* pDoc = createSwDoc(); // When inserting a clearing break: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); std::optional oClear = SwLineBreakClear::ALL; pWrtShell->InsertLineBreak(oClear); // Then make sure it's not just a plain linebreak: uno::Reference xTextPortion = getRun(getParagraph(1), 1); auto aPortionType = getProperty(xTextPortion, "TextPortionType"); // Without the accompanying fix in place, this test would have failed with: // - Expected: LineBreak // - Actual : Text // i.e. the line break lost its "clear" property. CPPUNIT_ASSERT_EQUAL(OUString("LineBreak"), aPortionType); auto xLineBreak = getProperty>(xTextPortion, "LineBreak"); auto eClear = getProperty(xLineBreak, "Clear"); CPPUNIT_ASSERT_EQUAL(static_cast(SwLineBreakClear::ALL), eClear); } } CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */