include/test/text/baseindex.hxx | 28 +++++ include/test/text/textdocumentindex.hxx | 31 +++++ include/test/text/textdocumentsettings.hxx | 29 +++++ include/test/text/textprintersettings.hxx | 31 +++++ include/test/text/textsettings.hxx | 26 ++++ include/test/text/xdocumentindex.hxx | 36 ++++++ sw/CppunitTest_sw_apitests.mk | 2 sw/qa/api/ApiTestBase.hxx | 57 ---------- sw/qa/api/BaseIndexTest.hxx | 161 ----------------------------- sw/qa/api/DocumentIndexTest.hxx | 47 -------- sw/qa/api/DocumentSettingsTest.hxx | 47 -------- sw/qa/api/PrinterSettingsTest.hxx | 79 -------------- sw/qa/api/SettingsTest.hxx | 137 ------------------------ sw/qa/api/SwXDocumentIndex.cxx | 50 +++++---- sw/qa/api/SwXDocumentSettings.cxx | 31 ++--- sw/qa/api/XDocumentIndexTest.hxx | 85 --------------- sw/qa/api/XTextContentTest.hxx | 61 ---------- test/Library_subsequenttest.mk | 6 + test/source/text/baseindex.cxx | 153 +++++++++++++++++++++++++++ test/source/text/textdocumentindex.cxx | 36 ++++++ test/source/text/textdocumentsettings.cxx | 42 +++++++ test/source/text/textprintersettings.cxx | 39 +++++++ test/source/text/textsettings.cxx | 153 +++++++++++++++++++++++++++ test/source/text/xdocumentindex.cxx | 67 ++++++++++++ 24 files changed, 724 insertions(+), 710 deletions(-)
New commits: commit 3428ca9c3b98c275bbcd852e733aa42eef89bdd2 Author: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> AuthorDate: Sat Mar 16 15:21:43 2019 +0100 Commit: Björn Michaelsen <bjoern.michael...@libreoffice.org> CommitDate: Tue Mar 19 08:38:34 2019 +0100 name apitest suites consistently while we still can - writer test apitest suites are now called like the UNO implementation they are testing - also mark them final for good measure - move tests to module test and try to match its conventions * BaseIndex * TextDocumentIndex * TextDocumentSettings * TextPrinterSettings * TextSettings * XDocumentIndex - also remove anonymous namespace in header, as that is a bad idea - also remove now obsolete ApiBaseTest - also remove dead code in TextPrinterSettings - remove writer xtextcontent test as it duplicates the impl in module test Change-Id: I71aa5f3755d5c90726f4ff4394117fa2391495d7 Reviewed-on: https://gerrit.libreoffice.org/69374 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michael...@libreoffice.org> diff --git a/include/test/text/baseindex.hxx b/include/test/text/baseindex.hxx new file mode 100644 index 000000000000..2c8d2734fa57 --- /dev/null +++ b/include/test/text/baseindex.hxx @@ -0,0 +1,28 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_TEST_TEXT_BASEINDEXTEST_HXX +#define INCLUDED_TEST_TEXT_BASEINDEXTEST_HXX + +#include <test/testdllapi.hxx> + +namespace apitest +{ +class OOO_DLLPUBLIC_TEST BaseIndex +{ +public: + virtual css::uno::Reference<css::uno::XInterface> init() = 0; + virtual ~BaseIndex(); + void testBaseIndexProperties(); +}; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/test/text/textdocumentindex.hxx b/include/test/text/textdocumentindex.hxx new file mode 100644 index 000000000000..d045954018d2 --- /dev/null +++ b/include/test/text/textdocumentindex.hxx @@ -0,0 +1,31 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_TEST_TEXT_DOCUMENTINDEXTEST_HXX +#define INCLUDED_TEST_TEXT_DOCUMENTINDEXTEST_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <test/unoapi_property_testers.hxx> +#include <test/testdllapi.hxx> + +namespace apitest +{ +class OOO_DLLPUBLIC_TEST TextDocumentIndex +{ +public: + virtual css::uno::Reference<css::uno::XInterface> init() = 0; + virtual ~TextDocumentIndex(); + void testDocumentIndexProperties(); +}; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/test/text/textdocumentsettings.hxx b/include/test/text/textdocumentsettings.hxx new file mode 100644 index 000000000000..e7a28a2f158f --- /dev/null +++ b/include/test/text/textdocumentsettings.hxx @@ -0,0 +1,29 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_TEST_TEXT_TEXTDOCUMENTSETTINGS_HXX +#define INCLUDED_TEST_TEXT_TEXTDOCUMENTSETTINGS_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <test/testdllapi.hxx> + +namespace apitest +{ +class OOO_DLLPUBLIC_TEST TextDocumentSettings +{ +public: + virtual css::uno::Reference<css::uno::XInterface> init() = 0; + virtual ~TextDocumentSettings(); + void testDocumentSettingsProperties(); +}; +} // end namespace apitest + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/test/text/textprintersettings.hxx b/include/test/text/textprintersettings.hxx new file mode 100644 index 000000000000..a0508aa6b304 --- /dev/null +++ b/include/test/text/textprintersettings.hxx @@ -0,0 +1,31 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_TEST_TEXT_TEXTPRINTERSETTINGS_HXX +#define INCLUDED_TEST_TEXT_TEXTPRINTERSETTINGS_HXX + +#include <test/unoapi_property_testers.hxx> +#include <test/testdllapi.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> + +namespace apitest +{ +class OOO_DLLPUBLIC_TEST TextPrinterSettings +{ +public: + virtual css::uno::Reference<css::uno::XInterface> init() = 0; + virtual ~TextPrinterSettings(); + void testPrinterSettingsProperties(); +}; +} // end namespace apitest + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/test/text/textsettings.hxx b/include/test/text/textsettings.hxx new file mode 100644 index 000000000000..960692040ae7 --- /dev/null +++ b/include/test/text/textsettings.hxx @@ -0,0 +1,26 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_TEST_TEXT_TEXTSETTINGS_HXX +#define INCLUDED_TEST_TEXT_TEXTSETTINGS_HXX + +namespace apitest +{ +class OOO_DLLPUBLIC_TEST TextSettings +{ +public: + virtual css::uno::Reference<css::uno::XInterface> init() = 0; + virtual ~TextSettings(); + void testSettingsProperties(); +}; +} // end namespace apitest + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/test/text/xdocumentindex.hxx b/include/test/text/xdocumentindex.hxx new file mode 100644 index 000000000000..4efdaeeec68a --- /dev/null +++ b/include/test/text/xdocumentindex.hxx @@ -0,0 +1,36 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_TEST_TEST_XDOCUMENTINDEX_HXX +#define INCLUDED_TEST_TEST_XDOCUMENTINDEX_HXX + +#include <com/sun/star/text/XTextDocument.hpp> + +#include <test/testdllapi.hxx> + +namespace apitest +{ +/** + * Testing <code>com.sun.star.text.XDocumentIndex</code> + * + * @see com.sun.star.text.XDocumentIndex + */ +class OOO_DLLPUBLIC_TEST XDocumentIndex +{ +public: + virtual css::uno::Reference<css::uno::XInterface> init() = 0; + virtual css::uno::Reference<css::text::XTextDocument> getTextDocument() = 0; + virtual ~XDocumentIndex(); + void testUpdate(); +}; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/CppunitTest_sw_apitests.mk b/sw/CppunitTest_sw_apitests.mk index 1f850da50efc..ca2c919e0aa6 100644 --- a/sw/CppunitTest_sw_apitests.mk +++ b/sw/CppunitTest_sw_apitests.mk @@ -15,7 +15,7 @@ $(eval $(call gb_CppunitTest_use_external,sw_apitests,boost_headers)) $(eval $(call gb_CppunitTest_add_exception_objects,sw_apitests, \ sw/qa/api/SwXDocumentIndex \ - sw/qa/api/DocumentSettings \ + sw/qa/api/SwXDocumentSettings \ sw/qa/api/SwXTextTable \ )) diff --git a/sw/qa/api/ApiTestBase.hxx b/sw/qa/api/ApiTestBase.hxx deleted file mode 100644 index 4abf53eb2462..000000000000 --- a/sw/qa/api/ApiTestBase.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- 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/. - */ - -#ifndef INCLUDED_SW_QA_CORE_APITESTBASE_HXX -#define INCLUDED_SW_QA_CORE_APITESTBASE_HXX - -#include <com/sun/star/uno/XInterface.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/beans/XPropertySetInfo.hpp> -#include <com/sun/star/beans/PropertyAttribute.hpp> - -namespace apitest -{ -class ApiTestBase -{ -protected: - static bool extstsProperty(css::uno::Reference<css::beans::XPropertySet> const& rxPropertySet, - OUString const& rPropertyName) - { - css::uno::Reference<css::beans::XPropertySetInfo> xPropertySetInfo( - rxPropertySet->getPropertySetInfo()); - return xPropertySetInfo->hasPropertyByName(rPropertyName); - } - - static bool - isPropertyReadOnly(css::uno::Reference<css::beans::XPropertySet> const& rxPropertySet, - OUString const& rPropertyName) - { - css::uno::Reference<css::beans::XPropertySetInfo> xPropertySetInfo( - rxPropertySet->getPropertySetInfo()); - css::uno::Sequence<css::beans::Property> xProperties = xPropertySetInfo->getProperties(); - - for (auto const& rProperty : xProperties) - { - if (rProperty.Name == rPropertyName) - return (rProperty.Attributes & com::sun::star::beans::PropertyAttribute::READONLY) - != 0; - } - - return false; - } - - virtual ~ApiTestBase() {} - - virtual css::uno::Reference<css::uno::XInterface> init() = 0; -}; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/api/BaseIndexTest.hxx b/sw/qa/api/BaseIndexTest.hxx deleted file mode 100644 index cfad380ca493..000000000000 --- a/sw/qa/api/BaseIndexTest.hxx +++ /dev/null @@ -1,161 +0,0 @@ -/* -*- 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/. - */ - -#ifndef INCLUDED_SW_QA_API_BASEINDEXTEST_HXX -#define INCLUDED_SW_QA_API_BASEINDEXTEST_HXX - -#include "ApiTestBase.hxx" - -#include <cppunit/TestAssert.h> -#include <test/unoapi_property_testers.hxx> - -#include <com/sun/star/beans/XPropertySet.hpp> - -#include <com/sun/star/text/XTextColumns.hpp> -#include <com/sun/star/text/XTextSection.hpp> -#include <com/sun/star/graphic/XGraphic.hpp> - -#include <vcl/BitmapTools.hxx> -#include <vcl/graph.hxx> -#include <vcl/pngwrite.hxx> -#include <unotools/tempfile.hxx> -#include <tools/stream.hxx> - -namespace apitest -{ -namespace -{ -BitmapEx createExampleBitmap() -{ - vcl::bitmap::RawBitmap aRawBitmap(Size(4, 4), 24); - aRawBitmap.SetPixel(0, 0, COL_LIGHTBLUE); - aRawBitmap.SetPixel(0, 1, COL_LIGHTGREEN); - aRawBitmap.SetPixel(1, 0, COL_LIGHTRED); - aRawBitmap.SetPixel(1, 1, COL_LIGHTMAGENTA); - return vcl::bitmap::CreateFromData(std::move(aRawBitmap)); -} - -void writerFileWithBitmap(OUString const& rURL) -{ - BitmapEx aBitmapEx = createExampleBitmap(); - SvFileStream aFileStream(rURL, StreamMode::READ | StreamMode::WRITE); - vcl::PNGWriter aWriter(aBitmapEx); - aWriter.Write(aFileStream); - aFileStream.Seek(STREAM_SEEK_TO_BEGIN); - aFileStream.Close(); -} - -} // end anonymous namespace - -class BaseIndexTest : public ApiTestBase -{ -public: - void testBaseIndexProperties() - { - css::uno::Reference<css::beans::XPropertySet> xBaseIndex(init(), css::uno::UNO_QUERY_THROW); - testStringProperty(xBaseIndex, "Title", "Value"); - testBooleanProperty(xBaseIndex, "IsProtected"); - - testStringProperty(xBaseIndex, "ParaStyleHeading", "Value"); - testStringProperty(xBaseIndex, "ParaStyleLevel1", "Value"); - testStringOptionalProperty(xBaseIndex, "ParaStyleLevel2"); - testStringOptionalProperty(xBaseIndex, "ParaStyleLevel3"); - testStringOptionalProperty(xBaseIndex, "ParaStyleLevel4"); - testStringOptionalProperty(xBaseIndex, "ParaStyleLevel5"); - testStringOptionalProperty(xBaseIndex, "ParaStyleLevel6"); - testStringOptionalProperty(xBaseIndex, "ParaStyleLevel7"); - testStringOptionalProperty(xBaseIndex, "ParaStyleLevel8"); - testStringOptionalProperty(xBaseIndex, "ParaStyleLevel9"); - testStringOptionalProperty(xBaseIndex, "ParaStyleLevel10"); - testStringOptionalProperty(xBaseIndex, "ParaStyleSeparator"); - - // [property] XTextColumns TextColumns; - { - OUString name = "TextColumns"; - - css::uno::Reference<css::text::XTextColumns> xGetTextColumns; - CPPUNIT_ASSERT(xBaseIndex->getPropertyValue(name) >>= xGetTextColumns); - - xGetTextColumns->setColumnCount(xGetTextColumns->getColumnCount() + 1); - xBaseIndex->setPropertyValue(name, css::uno::makeAny(xGetTextColumns)); - - css::uno::Reference<css::text::XTextColumns> xSetTextColumns; - CPPUNIT_ASSERT(xBaseIndex->getPropertyValue(name) >>= xSetTextColumns); - - //CPPUNIT_ASSERT_EQUAL(xGetTextColumns->getColumnCount(), xSetTextColumns->getColumnCount()); - } - - // [property] com::sun::star::graphic::XGraphic BackGraphic; - // [property] string BackGraphicURL; - { - OUString name = "BackGraphicURL"; - bool bOK = false; - try - { - xBaseIndex->getPropertyValue(name); - } - catch (css::uno::RuntimeException const& /*ex*/) - { - bOK = true; - } - // BackGraphicURL is "set-only" attribute - CPPUNIT_ASSERT_MESSAGE("Expected RuntimeException wasn't thrown", bOK); - - utl::TempFile aTempFile; - aTempFile.EnableKillingFile(); - writerFileWithBitmap(aTempFile.GetURL()); - - css::uno::Reference<css::graphic::XGraphic> xGraphic; - CPPUNIT_ASSERT(xBaseIndex->getPropertyValue("BackGraphic") >>= xGraphic); - CPPUNIT_ASSERT(!xGraphic.is()); - - xBaseIndex->setPropertyValue(name, css::uno::makeAny(aTempFile.GetURL())); - - CPPUNIT_ASSERT(xBaseIndex->getPropertyValue("BackGraphic") >>= xGraphic); - CPPUNIT_ASSERT(xGraphic.is()); - } - - testStringProperty(xBaseIndex, "BackGraphicFilter", "Value"); - - // [property] com::sun::star::style::GraphicLocation BackGraphicLocation; - - testColorProperty(xBaseIndex, "BackColor"); - testBooleanProperty(xBaseIndex, "BackTransparent"); - - // [optional, property] com::sun::star::container::XIndexReplace LevelFormat; - - testBooleanOptionalProperty(xBaseIndex, "CreateFromChapter"); - - // [property] com::sun::star::text::XTextSection ContentSection; - { - OUString name = "ContentSection"; - - css::uno::Reference<css::text::XTextSection> xGetTextSection; - CPPUNIT_ASSERT_MESSAGE(name.toUtf8().getStr(), - xBaseIndex->getPropertyValue(name) >>= xGetTextSection); - CPPUNIT_ASSERT_EQUAL_MESSAGE(name.toUtf8().getStr(), OUString(""), - xGetTextSection->getAnchor()->getString()); - } - - // [property] com::sun::star::text::XTextSection HeaderSection; - { - OUString name = "HeaderSection"; - - css::uno::Reference<css::text::XTextSection> xGetTextSection; - if (xBaseIndex->getPropertyValue(name).hasValue()) - CPPUNIT_ASSERT_MESSAGE(name.toUtf8().getStr(), - xBaseIndex->getPropertyValue(name) >>= xGetTextSection); - } - } -}; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/api/DocumentIndexTest.hxx b/sw/qa/api/DocumentIndexTest.hxx deleted file mode 100644 index 67804388c47d..000000000000 --- a/sw/qa/api/DocumentIndexTest.hxx +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- 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/. - */ - -#ifndef INCLUDED_SW_QA_API_DOCUMENTINDEXTEST_HXX -#define INCLUDED_SW_QA_API_DOCUMENTINDEXTEST_HXX - -#include "ApiTestBase.hxx" - -#include <cppunit/TestAssert.h> -#include <test/unoapi_property_testers.hxx> - -#include <com/sun/star/beans/XPropertySet.hpp> - -namespace apitest -{ -class DocumentIndexTest : public ApiTestBase -{ -public: - void testDocumentIndexProperties() - { - css::uno::Reference<css::beans::XPropertySet> xDocumnetIndex(init(), - css::uno::UNO_QUERY_THROW); - - testBooleanProperty(xDocumnetIndex, "UseAlphabeticalSeparators"); - testBooleanProperty(xDocumnetIndex, "UseKeyAsEntry"); - testBooleanProperty(xDocumnetIndex, "UseCombinedEntries"); - testBooleanProperty(xDocumnetIndex, "IsCaseSensitive"); - testBooleanProperty(xDocumnetIndex, "UsePP"); - testBooleanProperty(xDocumnetIndex, "UseDash"); - testBooleanProperty(xDocumnetIndex, "UseUpperCase"); - testStringOptionalProperty(xDocumnetIndex, "MainEntryCharacterStyleName"); - // [readonly, property] sequence <com::sun::star::text::XDocumentIndexMark> DocumentIndexMarks; - // [property] com::sun::star::lang::Locale Locale; - testStringProperty(xDocumnetIndex, "SortAlgorithm", "Value"); - } -}; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/api/DocumentSettingsTest.hxx b/sw/qa/api/DocumentSettingsTest.hxx deleted file mode 100644 index 4abd8d197d35..000000000000 --- a/sw/qa/api/DocumentSettingsTest.hxx +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- 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/. - */ - -#ifndef INCLUDED_SW_QA_API_DOCUMENTSETTINGSTEST_HXX -#define INCLUDED_SW_QA_API_DOCUMENTSETTINGSTEST_HXX - -#include "ApiTestBase.hxx" - -#include <cppunit/TestAssert.h> -#include <test/unoapi_property_testers.hxx> - -#include <com/sun/star/beans/XPropertySet.hpp> - -namespace apitest -{ -class DocumentSettingsTest : public ApiTestBase -{ -public: - void testDocumentSettingsProperties() - { - css::uno::Reference<css::beans::XPropertySet> xDocumentSettings(init(), - css::uno::UNO_QUERY_THROW); - - testBooleanOptionalProperty(xDocumentSettings, "ChartAutoUpdate"); - testBooleanOptionalProperty(xDocumentSettings, "AddParaTableSpacing"); - testBooleanOptionalProperty(xDocumentSettings, "AddParaTableSpacingAtStart"); - testBooleanOptionalProperty(xDocumentSettings, "AlignTabStopPosition"); - testBooleanOptionalProperty(xDocumentSettings, "SaveGlobalDocumentLinks"); - testBooleanOptionalProperty(xDocumentSettings, "IsLabelDocument"); - testBooleanOptionalProperty(xDocumentSettings, "UseFormerLineSpacing"); - testBooleanOptionalProperty(xDocumentSettings, "AddParaSpacingToTableCells"); - testBooleanOptionalProperty(xDocumentSettings, "UseFormerObjectPositioning"); - testBooleanOptionalProperty(xDocumentSettings, "ConsiderTextWrapOnObjPos"); - testBooleanOptionalProperty(xDocumentSettings, "MathBaselineAlignment"); - } -}; -} // end namespace apitest - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/api/PrinterSettingsTest.hxx b/sw/qa/api/PrinterSettingsTest.hxx deleted file mode 100644 index 8d93564c20ea..000000000000 --- a/sw/qa/api/PrinterSettingsTest.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- 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/. - */ - -#ifndef INCLUDED_SW_QA_API_PRINTERSETTINGSTEST_HXX -#define INCLUDED_SW_QA_API_PRINTERSETTINGSTEST_HXX - -#include "ApiTestBase.hxx" - -#include <cppunit/TestAssert.h> -#include <test/unoapi_property_testers.hxx> - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/text/NotePrintMode.hpp> - -namespace apitest -{ -class PrinterSettingsTest : public ApiTestBase -{ - static void - testPrintAnnotationMode(css::uno::Reference<css::beans::XPropertySet> const& rxPrinterSettings) - { - const OUString rPropertyName = "PrintAnnotationMode"; - - // This property is not optional but it's not set in some cases - if (!extstsProperty(rxPrinterSettings, rPropertyName)) - return; - - /*css::text::NotePrintMode aNotePrintMode_Get; - - CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", - rxPrinterSettings->getPropertyValue(rPropertyName) - >>= aNotePrintMode_Get); - - css::text::NotePrintMode aNotePrintMode_Set; - css::uno::Any aNewValue; - aNewValue <<= css::text::NotePrintMode_ONLY; - rxPrinterSettings->setPropertyValue(rPropertyName, aNewValue); - - CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", - rxPrinterSettings->getPropertyValue(rPropertyName) - >>= aNotePrintMode_Set); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue", css::text::NotePrintMode_ONLY, - aNotePrintMode_Set);*/ - } - -public: - void testPrinterSettingsProperties() - { - css::uno::Reference<css::beans::XPropertySet> xPrinterSettings(init(), - css::uno::UNO_QUERY_THROW); - - testBooleanProperty(xPrinterSettings, "PrintGraphics"); - testBooleanProperty(xPrinterSettings, "PrintTables"); - testBooleanProperty(xPrinterSettings, "PrintDrawings"); - testBooleanProperty(xPrinterSettings, "PrintLeftPages"); - testBooleanProperty(xPrinterSettings, "PrintRightPages"); - testBooleanProperty(xPrinterSettings, "PrintControls"); - testBooleanProperty(xPrinterSettings, "PrintReversed"); - testBooleanProperty(xPrinterSettings, "PrintControls"); - testStringProperty(xPrinterSettings, "PrintFaxName", "FaxName"); - testPrintAnnotationMode( - xPrinterSettings); // it's not set in this case but it's not optional - bug? - testBooleanProperty(xPrinterSettings, "PrintProspect"); - testBooleanProperty(xPrinterSettings, "PrintPageBackground"); - testBooleanProperty(xPrinterSettings, "PrintBlackFonts"); - testBooleanOptionalProperty(xPrinterSettings, "PrintEmptyPages"); - } -}; -} // end namespace apitest - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/api/SettingsTest.hxx b/sw/qa/api/SettingsTest.hxx deleted file mode 100644 index 48e236d6160f..000000000000 --- a/sw/qa/api/SettingsTest.hxx +++ /dev/null @@ -1,137 +0,0 @@ -/* -*- 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/. - */ - -#ifndef INCLUDED_SW_QA_API_SETTINGSTEST_HXX -#define INCLUDED_SW_QA_API_SETTINGSTEST_HXX - -#include "ApiTestBase.hxx" - -#include <cppunit/TestAssert.h> -#include <test/unoapi_property_testers.hxx> - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/i18n/XForbiddenCharacters.hpp> - -namespace apitest -{ -class SettingsTest : public ApiTestBase -{ - // [property] string PrinterName; - static void testPrinterName(css::uno::Reference<css::beans::XPropertySet> const& rxSettings) - { - const OUString rPropertyName("PrinterName"); - - if (!extstsProperty(rxSettings, rPropertyName)) - return; // Property is sometimes not set - bug? it is not defined as optional - - OUString aPrinterName_Get; - - CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", - rxSettings->getPropertyValue(rPropertyName) >>= aPrinterName_Get); - - OUString aPrinterName_Set; - css::uno::Any aNewValue; - aNewValue <<= aPrinterName_Get; - rxSettings->setPropertyValue(rPropertyName, aNewValue); - - CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", - rxSettings->getPropertyValue(rPropertyName) >>= aPrinterName_Set); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue", aPrinterName_Get, - aPrinterName_Set); - } - - // [optional, property] short PrinterIndependentLayout; - static void - testPrinterIndependentLayout(css::uno::Reference<css::beans::XPropertySet> const& rxSettings) - { - const OUString rPropertyName("PrinterIndependentLayout"); - - if (!extstsProperty(rxSettings, rPropertyName)) - return; // Property is optional - - sal_Int16 aValue_Get; - - CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", - rxSettings->getPropertyValue(rPropertyName) >>= aValue_Get); - - sal_Int16 aValue_New; - aValue_New = (aValue_Get == 1 ? 3 : 1); - rxSettings->setPropertyValue(rPropertyName, css::uno::Any(aValue_New)); - - sal_Int16 aValue_Set; - - CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", - rxSettings->getPropertyValue(rPropertyName) >>= aValue_Set); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue", aValue_New, aValue_Set); - } - - // [optional, property] com::sun::star::i18n::XForbiddenCharacters ForbiddenCharacters; - static void - testForbiddenCharacters(css::uno::Reference<css::beans::XPropertySet> const& rxSettings) - { - const OUString rPropertyName("ForbiddenCharacters"); - - if (!extstsProperty(rxSettings, rPropertyName)) - return; // Property is optional - - CPPUNIT_ASSERT_MESSAGE("Property is read-only but shouldn't be", - !isPropertyReadOnly(rxSettings, rPropertyName)); - - css::uno::Reference<css::i18n::XForbiddenCharacters> aValue_Get; - - CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", - rxSettings->getPropertyValue(rPropertyName) >>= aValue_Get); - CPPUNIT_ASSERT_MESSAGE("Empty reference to XForbiddenCharacters", aValue_Get.is()); - } - -public: - void testSettingsProperties() - { - css::uno::Reference<css::beans::XPropertySet> xSettings(init(), css::uno::UNO_QUERY_THROW); - - testForbiddenCharacters(xSettings); - //testShortOptionalProperty(xSettings, "LinkUpdateMode"); - testPrinterName(xSettings); - // [property] sequence< byte > PrinterSetup; - testBooleanOptionalProperty(xSettings, "IsKernAsianPunctuation"); - //testShortOptionalProperty(xSettings, "CharacterCompressionType"); - testBooleanOptionalProperty(xSettings, "ApplyUserData"); - testBooleanOptionalProperty(xSettings, "SaveVersionOnClose"); - testBooleanOptionalProperty(xSettings, "UpdateFromTemplate"); - testBooleanOptionalProperty(xSettings, "FieldAutoUpdate"); - testStringOptionalProperty(xSettings, "CurrentDatabaseDataSource"); - testStringOptionalProperty(xSettings, "CurrentDatabaseCommand"); - testLongOptionalProperty(xSettings, "CurrentDatabaseCommandType"); - testLongOptionalProperty(xSettings, "DefaultTabStop"); - testBooleanOptionalProperty(xSettings, "IsPrintBooklet"); - testBooleanOptionalProperty(xSettings, "IsPrintBookletFront"); - testBooleanOptionalProperty(xSettings, "IsPrintBookletBack"); - testLongOptionalProperty(xSettings, "PrintQuality"); - testStringOptionalProperty(xSettings, "ColorTableURL"); - testStringOptionalProperty(xSettings, "DashTableURL"); - testStringOptionalProperty(xSettings, "LineEndTableURL"); - testStringOptionalProperty(xSettings, "HatchTableURL"); - testStringOptionalProperty(xSettings, "GradientTableURL"); - testStringOptionalProperty(xSettings, "BitmapTableURL"); - testBooleanOptionalProperty(xSettings, "AutoCalculate"); - testPrinterIndependentLayout(xSettings); - testBooleanOptionalProperty(xSettings, "AddExternalLeading"); - testBooleanOptionalProperty(xSettings, "EmbedFonts"); - testBooleanOptionalProperty(xSettings, "EmbedSystemFonts"); - testBooleanOptionalProperty(xSettings, "EmbedOnlyUsedFonts"); - testBooleanOptionalProperty(xSettings, "EmbedLatinScriptFonts"); - testBooleanOptionalProperty(xSettings, "EmbedAsianScriptFonts"); - testBooleanOptionalProperty(xSettings, "EmbedComplexScriptFonts"); - } -}; -} // end namespace apitest - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/api/SwXDocumentIndex.cxx b/sw/qa/api/SwXDocumentIndex.cxx index 74530d4712f4..b04ba82875cb 100644 --- a/sw/qa/api/SwXDocumentIndex.cxx +++ b/sw/qa/api/SwXDocumentIndex.cxx @@ -7,14 +7,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "BaseIndexTest.hxx" -#include "DocumentIndexTest.hxx" -#include "XDocumentIndexTest.hxx" -#include "XTextContentTest.hxx" - #include <test/bootstrapfixture.hxx> #include <test/lang/xserviceinfo.hxx> #include <test/lang/xcomponent.hxx> +#include <test/text/baseindex.hxx> +#include <test/text/textdocumentindex.hxx> +#include <test/text/xdocumentindex.hxx> +#include <test/text/xtextcontent.hxx> #include <unotest/macros_test.hxx> #include <com/sun/star/frame/Desktop.hpp> @@ -26,6 +25,7 @@ #include <com/sun/star/text/XTextContent.hpp> #include <com/sun/star/text/XText.hpp> #include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/text/XTextRange.hpp> #include <com/sun/star/text/XDocumentIndex.hpp> #include <comphelper/processfactory.hxx> @@ -37,29 +37,34 @@ namespace /** * Test for Java API test of file com.sun.star.comp.office.SwXDocumentIndex.csv */ -class SwXDocumentIndexTest : public test::BootstrapFixture, - public unotest::MacrosTest, - public apitest::XDocumentIndexTest, - public apitest::BaseIndexTest, - public apitest::DocumentIndexTest, - public apitest::XTextContentTest, - public apitest::XServiceInfo, - public apitest::XComponent +class SwXDocumentIndex final : public test::BootstrapFixture, + public unotest::MacrosTest, + public apitest::XDocumentIndex, + public apitest::BaseIndex, + public apitest::TextDocumentIndex, + public apitest::XTextContent, + public apitest::XServiceInfo, + public apitest::XComponent { uno::Reference<uno::XComponentContext> mxComponentContext; uno::Reference<text::XTextDocument> mxTextDocument; + uno::Reference<text::XTextRange> mxTextRange; + uno::Reference<text::XTextContent> mxTextContent; public: virtual void setUp() override; virtual void tearDown() override; - SwXDocumentIndexTest() + SwXDocumentIndex() : apitest::XServiceInfo("SwXDocumentIndex", "com.sun.star.text.BaseIndex"){}; uno::Reference<uno::XInterface> init() override; + uno::Reference<text::XTextRange> getTextRange() override; + uno::Reference<text::XTextContent> getTextContent() override; + bool isAttachSupported() override { return true; } uno::Reference<text::XTextDocument> getTextDocument() override { return mxTextDocument; } void triggerDesktopTerminate() override {} - CPPUNIT_TEST_SUITE(SwXDocumentIndexTest); + CPPUNIT_TEST_SUITE(SwXDocumentIndex); CPPUNIT_TEST(testGetImplementationName); CPPUNIT_TEST(testGetSupportedServiceNames); CPPUNIT_TEST(testSupportsService); @@ -73,7 +78,7 @@ public: CPPUNIT_TEST_SUITE_END(); }; -void SwXDocumentIndexTest::setUp() +void SwXDocumentIndex::setUp() { test::BootstrapFixture::setUp(); @@ -85,7 +90,7 @@ void SwXDocumentIndexTest::setUp() CPPUNIT_ASSERT(mxTextDocument.is()); } -void SwXDocumentIndexTest::tearDown() +void SwXDocumentIndex::tearDown() { if (mxTextDocument.is()) mxTextDocument->dispose(); @@ -93,7 +98,7 @@ void SwXDocumentIndexTest::tearDown() test::BootstrapFixture::tearDown(); } -uno::Reference<uno::XInterface> SwXDocumentIndexTest::init() +uno::Reference<uno::XInterface> SwXDocumentIndex::init() { uno::Reference<lang::XMultiServiceFactory> xMSF(mxTextDocument, uno::UNO_QUERY_THROW); uno::Reference<text::XDocumentIndex> xDocumentIndex( @@ -103,10 +108,17 @@ uno::Reference<uno::XInterface> SwXDocumentIndexTest::init() CPPUNIT_ASSERT(xTextCursor.is()); xText->insertTextContent(xTextCursor, xDocumentIndex, false); xTextCursor->gotoEnd(false); + mxTextRange = uno::Reference<text::XTextRange>(xTextCursor, uno::UNO_QUERY_THROW); + mxTextContent = uno::Reference<text::XTextContent>( + xMSF->createInstance("com.sun.star.text.DocumentIndex"), uno::UNO_QUERY_THROW); return xDocumentIndex; } -CPPUNIT_TEST_SUITE_REGISTRATION(SwXDocumentIndexTest); +uno::Reference<text::XTextRange> SwXDocumentIndex::getTextRange() { return mxTextRange; } + +uno::Reference<text::XTextContent> SwXDocumentIndex::getTextContent() { return mxTextContent; } + +CPPUNIT_TEST_SUITE_REGISTRATION(SwXDocumentIndex); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/api/DocumentSettings.cxx b/sw/qa/api/SwXDocumentSettings.cxx similarity index 75% rename from sw/qa/api/DocumentSettings.cxx rename to sw/qa/api/SwXDocumentSettings.cxx index f2b48cc675f9..7a2bce7b35e7 100644 --- a/sw/qa/api/DocumentSettings.cxx +++ b/sw/qa/api/SwXDocumentSettings.cxx @@ -9,6 +9,9 @@ #include <test/bootstrapfixture.hxx> #include <test/lang/xserviceinfo.hxx> +#include <test/text/textdocumentsettings.hxx> +#include <test/text/textprintersettings.hxx> +#include <test/text/textsettings.hxx> #include <unotest/macros_test.hxx> #include <com/sun/star/frame/Desktop.hpp> @@ -21,10 +24,6 @@ #include <comphelper/processfactory.hxx> -#include "DocumentSettingsTest.hxx" -#include "SettingsTest.hxx" -#include "PrinterSettingsTest.hxx" - using namespace css; namespace @@ -32,12 +31,12 @@ namespace /** * Test for Java API test of file com.sun.star.comp.Writer.DocumentSettings.csv */ -class DocumentSettingsTest : public test::BootstrapFixture, - public unotest::MacrosTest, - public apitest::DocumentSettingsTest, - public apitest::SettingsTest, - public apitest::PrinterSettingsTest, - public apitest::XServiceInfo +class SwXDocumentSettings final : public test::BootstrapFixture, + public unotest::MacrosTest, + public apitest::TextDocumentSettings, + public apitest::TextSettings, + public apitest::TextPrinterSettings, + public apitest::XServiceInfo { private: uno::Reference<uno::XComponentContext> mxComponentContext; @@ -47,11 +46,11 @@ public: virtual void setUp() override; virtual void tearDown() override; - DocumentSettingsTest() + SwXDocumentSettings() : apitest::XServiceInfo("SwXDocumentSettings", "com.sun.star.text.DocumentSettings"){}; uno::Reference<uno::XInterface> init() override; - CPPUNIT_TEST_SUITE(DocumentSettingsTest); + CPPUNIT_TEST_SUITE(SwXDocumentSettings); CPPUNIT_TEST(testGetImplementationName); CPPUNIT_TEST(testGetSupportedServiceNames); CPPUNIT_TEST(testSupportsService); @@ -61,7 +60,7 @@ public: CPPUNIT_TEST_SUITE_END(); }; -void DocumentSettingsTest::setUp() +void SwXDocumentSettings::setUp() { test::BootstrapFixture::setUp(); @@ -69,7 +68,7 @@ void DocumentSettingsTest::setUp() mxDesktop.set(frame::Desktop::create(mxComponentContext)); } -void DocumentSettingsTest::tearDown() +void SwXDocumentSettings::tearDown() { if (mxComponent.is()) mxComponent->dispose(); @@ -77,7 +76,7 @@ void DocumentSettingsTest::tearDown() test::BootstrapFixture::tearDown(); } -uno::Reference<uno::XInterface> DocumentSettingsTest::init() +uno::Reference<uno::XInterface> SwXDocumentSettings::init() { mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); CPPUNIT_ASSERT(mxComponent.is()); @@ -91,7 +90,7 @@ uno::Reference<uno::XInterface> DocumentSettingsTest::init() return xDocumentSettings; } -CPPUNIT_TEST_SUITE_REGISTRATION(DocumentSettingsTest); +CPPUNIT_TEST_SUITE_REGISTRATION(SwXDocumentSettings); } // end anonymous namespace diff --git a/sw/qa/api/XDocumentIndexTest.hxx b/sw/qa/api/XDocumentIndexTest.hxx deleted file mode 100644 index cb3eab3ce9bf..000000000000 --- a/sw/qa/api/XDocumentIndexTest.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- 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/. - */ - -#ifndef INCLUDED_SW_QA_API_XDOCUMENTINDEXTEST_HXX -#define INCLUDED_SW_QA_API_XDOCUMENTINDEXTEST_HXX - -#include "ApiTestBase.hxx" - -#include <cppunit/TestAssert.h> - -#include <test/unoapi_property_testers.hxx> - -#include <com/sun/star/text/XTextDocument.hpp> -#include <com/sun/star/text/XTextContent.hpp> -#include <com/sun/star/text/XText.hpp> -#include <com/sun/star/text/XDocumentIndex.hpp> - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -namespace apitest -{ -/** - * Testing <code>com.sun.star.text.XDocumentIndex</code> - * - * @see com.sun.star.text.XDocumentIndex - */ -class XDocumentIndexTest : public ApiTestBase -{ -public: - virtual css::uno::Reference<css::text::XTextDocument> getTextDocument() = 0; - - /** - * Gets the document from relation and insert a new index mark. - * Then it stores the text content of document index before - * update and after.<p> - * - * Has <b> OK </b> status if index content is changed and - * new index contains index mark inserted. <p> - */ - void testUpdate() - { - css::uno::Reference<css::text::XDocumentIndex> xDocumentIndex(init(), - css::uno::UNO_QUERY_THROW); - - bool bOK = true; - try - { - auto xText = getTextDocument()->getText(); - auto xTextRange = xText->getEnd(); - xTextRange->setString("IndexMark"); - css::uno::Reference<css::lang::XMultiServiceFactory> xFactory( - getTextDocument(), css::uno::UNO_QUERY_THROW); - css::uno::Reference<css::text::XTextContent> xTextContentMark( - xFactory->createInstance("com.sun.star.text.DocumentIndexMark"), - css::uno::UNO_QUERY_THROW); - xText->insertTextContent(xTextRange, xTextContentMark, true); - } - catch (css::uno::Exception /*exception*/) - { - bOK = false; - } - - CPPUNIT_ASSERT_MESSAGE("Couldn't create the document index mark", bOK); - - OUString sContentBefore = xDocumentIndex->getAnchor()->getString(); - xDocumentIndex->update(); - OUString sContentAfter = xDocumentIndex->getAnchor()->getString(); - - CPPUNIT_ASSERT_MESSAGE("Before and after shouldn't be equal", - sContentBefore != sContentAfter); - CPPUNIT_ASSERT_MESSAGE("Content after should contain string 'IndexMark'", - sContentAfter.indexOf("IndexMark") >= 0); - } -}; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/api/XTextContentTest.hxx b/sw/qa/api/XTextContentTest.hxx deleted file mode 100644 index e8bf94fbce9c..000000000000 --- a/sw/qa/api/XTextContentTest.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- 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/. - */ - -#ifndef INCLUDED_SW_QA_API_XTEXTCONTENTTEST_HXX -#define INCLUDED_SW_QA_API_XTEXTCONTENTTEST_HXX - -#include "ApiTestBase.hxx" - -#include <cppunit/TestAssert.h> - -#include <test/unoapi_property_testers.hxx> - -#include <com/sun/star/text/XTextContent.hpp> -#include <com/sun/star/text/XTextRange.hpp> - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -namespace apitest -{ -class XTextContentTest : public ApiTestBase -{ -public: - virtual css::uno::Reference<css::text::XTextDocument> getTextDocument() = 0; - /** - * Tries to attach the text content to the test range - * gotten with getAnchor(). If relations are found - * then they are used for testing. <p> - * - * The test is OK if the method works without error. - */ - void testAttach() - { - css::uno::Reference<css::text::XTextContent> xTextContent(init(), - css::uno::UNO_QUERY_THROW); - auto xTextCursor = getTextDocument()->getText()->createTextCursor(); - xTextCursor->gotoEnd(false); - css::uno::Reference<css::lang::XMultiServiceFactory> xMSF(getTextDocument(), - css::uno::UNO_QUERY_THROW); - css::uno::Reference<css::text::XDocumentIndex> xDocumentIndex( - xMSF->createInstance("com.sun.star.text.DocumentIndex"), css::uno::UNO_QUERY_THROW); - xDocumentIndex->attach(xTextCursor); - } - - void testGetAnchor() - { - css::uno::Reference<css::text::XTextContent> xTextContent(init(), - css::uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL(OUString(""), xTextContent->getAnchor()->getString()); - } -}; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk index a1ea3349978f..7fca94314977 100644 --- a/test/Library_subsequenttest.mk +++ b/test/Library_subsequenttest.mk @@ -169,11 +169,17 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ test/source/table/xtablechartssupplier \ test/source/table/xtablecolumns \ test/source/table/xtablerows \ + test/source/text/baseindex \ test/source/text/xsimpletext \ test/source/text/xtext \ test/source/text/xtextcontent \ test/source/text/xtextfield \ test/source/text/xtextrange \ + test/source/text/xdocumentindex \ + test/source/text/textdocumentsettings \ + test/source/text/textprintersettings \ + test/source/text/textsettings \ + test/source/text/textdocumentindex \ test/source/util/xindent \ test/source/util/xmergeable \ test/source/util/xrefreshable \ diff --git a/test/source/text/baseindex.cxx b/test/source/text/baseindex.cxx new file mode 100644 index 000000000000..f65028b49977 --- /dev/null +++ b/test/source/text/baseindex.cxx @@ -0,0 +1,153 @@ +/* -*- 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 <cppunit/extensions/HelperMacros.h> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/text/XTextColumns.hpp> +#include <com/sun/star/text/XTextSection.hpp> + +#include <vcl/BitmapTools.hxx> +#include <vcl/graph.hxx> +#include <vcl/pngwrite.hxx> +#include <unotools/tempfile.hxx> +#include <tools/stream.hxx> + +#include <test/unoapi_property_testers.hxx> +#include <test/text/baseindex.hxx> +#include <test/testdllapi.hxx> + +namespace +{ +BitmapEx createExampleBitmap() +{ + vcl::bitmap::RawBitmap aRawBitmap(Size(4, 4), 24); + aRawBitmap.SetPixel(0, 0, COL_LIGHTBLUE); + aRawBitmap.SetPixel(0, 1, COL_LIGHTGREEN); + aRawBitmap.SetPixel(1, 0, COL_LIGHTRED); + aRawBitmap.SetPixel(1, 1, COL_LIGHTMAGENTA); + return vcl::bitmap::CreateFromData(std::move(aRawBitmap)); +} + +void writerFileWithBitmap(OUString const& rURL) +{ + BitmapEx aBitmapEx = createExampleBitmap(); + SvFileStream aFileStream(rURL, StreamMode::READ | StreamMode::WRITE); + vcl::PNGWriter aWriter(aBitmapEx); + aWriter.Write(aFileStream); + aFileStream.Seek(STREAM_SEEK_TO_BEGIN); + aFileStream.Close(); +} +} + +namespace apitest +{ +BaseIndex::~BaseIndex() {} + +void BaseIndex::testBaseIndexProperties() +{ + css::uno::Reference<css::beans::XPropertySet> xBaseIndex(init(), css::uno::UNO_QUERY_THROW); + testStringProperty(xBaseIndex, "Title", "Value"); + testBooleanProperty(xBaseIndex, "IsProtected"); + + testStringProperty(xBaseIndex, "ParaStyleHeading", "Value"); + testStringProperty(xBaseIndex, "ParaStyleLevel1", "Value"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel2"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel3"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel4"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel5"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel6"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel7"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel8"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel9"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel10"); + testStringOptionalProperty(xBaseIndex, "ParaStyleSeparator"); + + // [property] XTextColumns TextColumns; + { + OUString name = "TextColumns"; + + css::uno::Reference<css::text::XTextColumns> xGetTextColumns; + CPPUNIT_ASSERT(xBaseIndex->getPropertyValue(name) >>= xGetTextColumns); + + xGetTextColumns->setColumnCount(xGetTextColumns->getColumnCount() + 1); + xBaseIndex->setPropertyValue(name, css::uno::makeAny(xGetTextColumns)); + + css::uno::Reference<css::text::XTextColumns> xSetTextColumns; + CPPUNIT_ASSERT(xBaseIndex->getPropertyValue(name) >>= xSetTextColumns); + + //CPPUNIT_ASSERT_EQUAL(xGetTextColumns->getColumnCount(), xSetTextColumns->getColumnCount()); + } + + // [property] com::sun::star::graphic::XGraphic BackGraphic; + // [property] string BackGraphicURL; + { + OUString name = "BackGraphicURL"; + bool bOK = false; + try + { + xBaseIndex->getPropertyValue(name); + } + catch (css::uno::RuntimeException const& /*ex*/) + { + bOK = true; + } + // BackGraphicURL is "set-only" attribute + CPPUNIT_ASSERT_MESSAGE("Expected RuntimeException wasn't thrown", bOK); + + utl::TempFile aTempFile; + aTempFile.EnableKillingFile(); + writerFileWithBitmap(aTempFile.GetURL()); + + css::uno::Reference<css::graphic::XGraphic> xGraphic; + CPPUNIT_ASSERT(xBaseIndex->getPropertyValue("BackGraphic") >>= xGraphic); + CPPUNIT_ASSERT(!xGraphic.is()); + + xBaseIndex->setPropertyValue(name, css::uno::makeAny(aTempFile.GetURL())); + + CPPUNIT_ASSERT(xBaseIndex->getPropertyValue("BackGraphic") >>= xGraphic); + CPPUNIT_ASSERT(xGraphic.is()); + } + + testStringProperty(xBaseIndex, "BackGraphicFilter", "Value"); + + // [property] com::sun::star::style::GraphicLocation BackGraphicLocation; + + testColorProperty(xBaseIndex, "BackColor"); + testBooleanProperty(xBaseIndex, "BackTransparent"); + + // [optional, property] com::sun::star::container::XIndexReplace LevelFormat; + + testBooleanOptionalProperty(xBaseIndex, "CreateFromChapter"); + + // [property] com::sun::star::text::XTextSection ContentSection; + { + OUString name = "ContentSection"; + + css::uno::Reference<css::text::XTextSection> xGetTextSection; + CPPUNIT_ASSERT_MESSAGE(name.toUtf8().getStr(), + xBaseIndex->getPropertyValue(name) >>= xGetTextSection); + CPPUNIT_ASSERT_EQUAL_MESSAGE(name.toUtf8().getStr(), OUString(""), + xGetTextSection->getAnchor()->getString()); + } + + // [property] com::sun::star::text::XTextSection HeaderSection; + { + OUString name = "HeaderSection"; + + css::uno::Reference<css::text::XTextSection> xGetTextSection; + if (xBaseIndex->getPropertyValue(name).hasValue()) + CPPUNIT_ASSERT_MESSAGE(name.toUtf8().getStr(), + xBaseIndex->getPropertyValue(name) >>= xGetTextSection); + } +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/textdocumentindex.cxx b/test/source/text/textdocumentindex.cxx new file mode 100644 index 000000000000..63873e2b4742 --- /dev/null +++ b/test/source/text/textdocumentindex.cxx @@ -0,0 +1,36 @@ +/* -*- 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 <com/sun/star/beans/XPropertySet.hpp> + +#include <test/unoapi_property_testers.hxx> +#include <test/text/textdocumentindex.hxx> + +namespace apitest +{ +TextDocumentIndex::~TextDocumentIndex() {} + +void TextDocumentIndex::testDocumentIndexProperties() +{ + css::uno::Reference<css::beans::XPropertySet> xDocumnetIndex(init(), css::uno::UNO_QUERY_THROW); + + testBooleanProperty(xDocumnetIndex, "UseAlphabeticalSeparators"); + testBooleanProperty(xDocumnetIndex, "UseKeyAsEntry"); + testBooleanProperty(xDocumnetIndex, "UseCombinedEntries"); + testBooleanProperty(xDocumnetIndex, "IsCaseSensitive"); + testBooleanProperty(xDocumnetIndex, "UsePP"); + testBooleanProperty(xDocumnetIndex, "UseDash"); + testBooleanProperty(xDocumnetIndex, "UseUpperCase"); + testStringOptionalProperty(xDocumnetIndex, "MainEntryCharacterStyleName"); + // [readonly, property] sequence <com::sun::star::text::XDocumentIndexMark> DocumentIndexMarks; + // [property] com::sun::star::lang::Locale Locale; + testStringProperty(xDocumnetIndex, "SortAlgorithm", "Value"); +} +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/textdocumentsettings.cxx b/test/source/text/textdocumentsettings.cxx new file mode 100644 index 000000000000..9ef0518b05ca --- /dev/null +++ b/test/source/text/textdocumentsettings.cxx @@ -0,0 +1,42 @@ +/* -*- 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 <test/text/textdocumentsettings.hxx> +#include <test/unoapi_property_testers.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/Reference.hxx> + +using namespace css::uno; + +namespace apitest +{ +TextDocumentSettings::~TextDocumentSettings() {} + +void TextDocumentSettings::testDocumentSettingsProperties() +{ + css::uno::Reference<css::beans::XPropertySet> xDocumentSettings(init(), + css::uno::UNO_QUERY_THROW); + + testBooleanOptionalProperty(xDocumentSettings, "ChartAutoUpdate"); + testBooleanOptionalProperty(xDocumentSettings, "AddParaTableSpacing"); + testBooleanOptionalProperty(xDocumentSettings, "AddParaTableSpacingAtStart"); + testBooleanOptionalProperty(xDocumentSettings, "AlignTabStopPosition"); + testBooleanOptionalProperty(xDocumentSettings, "SaveGlobalDocumentLinks"); + testBooleanOptionalProperty(xDocumentSettings, "IsLabelDocument"); + testBooleanOptionalProperty(xDocumentSettings, "UseFormerLineSpacing"); + testBooleanOptionalProperty(xDocumentSettings, "AddParaSpacingToTableCells"); + testBooleanOptionalProperty(xDocumentSettings, "UseFormerObjectPositioning"); + testBooleanOptionalProperty(xDocumentSettings, "ConsiderTextWrapOnObjPos"); + testBooleanOptionalProperty(xDocumentSettings, "MathBaselineAlignment"); +} + +} // end namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/textprintersettings.cxx b/test/source/text/textprintersettings.cxx new file mode 100644 index 000000000000..b28c652413e5 --- /dev/null +++ b/test/source/text/textprintersettings.cxx @@ -0,0 +1,39 @@ +/* -*- 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 <com/sun/star/beans/XPropertySet.hpp> + +#include <test/unoapi_property_testers.hxx> +#include <test/text/textprintersettings.hxx> + +namespace apitest +{ +TextPrinterSettings::~TextPrinterSettings() {} +void TextPrinterSettings::testPrinterSettingsProperties() +{ + css::uno::Reference<css::beans::XPropertySet> xPrinterSettings(init(), + css::uno::UNO_QUERY_THROW); + + testBooleanProperty(xPrinterSettings, "PrintGraphics"); + testBooleanProperty(xPrinterSettings, "PrintTables"); + testBooleanProperty(xPrinterSettings, "PrintDrawings"); + testBooleanProperty(xPrinterSettings, "PrintLeftPages"); + testBooleanProperty(xPrinterSettings, "PrintRightPages"); + testBooleanProperty(xPrinterSettings, "PrintControls"); + testBooleanProperty(xPrinterSettings, "PrintReversed"); + testBooleanProperty(xPrinterSettings, "PrintControls"); + testStringProperty(xPrinterSettings, "PrintFaxName", "FaxName"); + testBooleanProperty(xPrinterSettings, "PrintProspect"); + testBooleanProperty(xPrinterSettings, "PrintPageBackground"); + testBooleanProperty(xPrinterSettings, "PrintBlackFonts"); + testBooleanOptionalProperty(xPrinterSettings, "PrintEmptyPages"); +} +} // end namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/textsettings.cxx b/test/source/text/textsettings.cxx new file mode 100644 index 000000000000..8371ed54c38d --- /dev/null +++ b/test/source/text/textsettings.cxx @@ -0,0 +1,153 @@ +/* -*- 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 <cppunit/extensions/HelperMacros.h> + +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/i18n/XForbiddenCharacters.hpp> + +#include <test/unoapi_property_testers.hxx> +#include <test/text/textsettings.hxx> + +namespace +{ +bool extstsProperty(css::uno::Reference<css::beans::XPropertySet> const& rxPropertySet, + OUString const& rPropertyName) +{ + css::uno::Reference<css::beans::XPropertySetInfo> xPropertySetInfo( + rxPropertySet->getPropertySetInfo()); + return xPropertySetInfo->hasPropertyByName(rPropertyName); +} + +bool isPropertyReadOnly(css::uno::Reference<css::beans::XPropertySet> const& rxPropertySet, + OUString const& rPropertyName) +{ + css::uno::Reference<css::beans::XPropertySetInfo> xPropertySetInfo( + rxPropertySet->getPropertySetInfo()); + css::uno::Sequence<css::beans::Property> xProperties = xPropertySetInfo->getProperties(); + + for (auto const& rProperty : xProperties) + { + if (rProperty.Name == rPropertyName) + return (rProperty.Attributes & com::sun::star::beans::PropertyAttribute::READONLY) != 0; + } + + return false; +} +// [property] string PrinterName; +void testPrinterName(css::uno::Reference<css::beans::XPropertySet> const& rxSettings) +{ + const OUString rPropertyName("PrinterName"); + + if (!extstsProperty(rxSettings, rPropertyName)) + return; // Property is sometimes not set - bug? it is not defined as optional + + OUString aPrinterName_Get; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", + rxSettings->getPropertyValue(rPropertyName) >>= aPrinterName_Get); + + OUString aPrinterName_Set; + css::uno::Any aNewValue; + aNewValue <<= aPrinterName_Get; + rxSettings->setPropertyValue(rPropertyName, aNewValue); + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", + rxSettings->getPropertyValue(rPropertyName) >>= aPrinterName_Set); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue", aPrinterName_Get, aPrinterName_Set); +} + +// [optional, property] short PrinterIndependentLayout; +void testPrinterIndependentLayout(css::uno::Reference<css::beans::XPropertySet> const& rxSettings) +{ + const OUString rPropertyName("PrinterIndependentLayout"); + + if (!extstsProperty(rxSettings, rPropertyName)) + return; // Property is optional + + sal_Int16 aValue_Get; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", + rxSettings->getPropertyValue(rPropertyName) >>= aValue_Get); + + sal_Int16 aValue_New; + aValue_New = (aValue_Get == 1 ? 3 : 1); + rxSettings->setPropertyValue(rPropertyName, css::uno::Any(aValue_New)); + + sal_Int16 aValue_Set; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", + rxSettings->getPropertyValue(rPropertyName) >>= aValue_Set); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue", aValue_New, aValue_Set); +} + +// [optional, property] com::sun::star::i18n::XForbiddenCharacters ForbiddenCharacters; +void testForbiddenCharacters(css::uno::Reference<css::beans::XPropertySet> const& rxSettings) +{ + const OUString rPropertyName("ForbiddenCharacters"); + + if (!extstsProperty(rxSettings, rPropertyName)) + return; // Property is optional + + CPPUNIT_ASSERT_MESSAGE("Property is read-only but shouldn't be", + !isPropertyReadOnly(rxSettings, rPropertyName)); + + css::uno::Reference<css::i18n::XForbiddenCharacters> aValue_Get; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", + rxSettings->getPropertyValue(rPropertyName) >>= aValue_Get); + CPPUNIT_ASSERT_MESSAGE("Empty reference to XForbiddenCharacters", aValue_Get.is()); +} +} + +namespace apitest +{ +TextSettings::~TextSettings() {} +void TextSettings::testSettingsProperties() +{ + css::uno::Reference<css::beans::XPropertySet> xSettings(init(), css::uno::UNO_QUERY_THROW); + + testForbiddenCharacters(xSettings); + //testShortOptionalProperty(xSettings, "LinkUpdateMode"); + testPrinterName(xSettings); + // [property] sequence< byte > PrinterSetup; + testBooleanOptionalProperty(xSettings, "IsKernAsianPunctuation"); + //testShortOptionalProperty(xSettings, "CharacterCompressionType"); + testBooleanOptionalProperty(xSettings, "ApplyUserData"); + testBooleanOptionalProperty(xSettings, "SaveVersionOnClose"); + testBooleanOptionalProperty(xSettings, "UpdateFromTemplate"); + testBooleanOptionalProperty(xSettings, "FieldAutoUpdate"); + testStringOptionalProperty(xSettings, "CurrentDatabaseDataSource"); + testStringOptionalProperty(xSettings, "CurrentDatabaseCommand"); + testLongOptionalProperty(xSettings, "CurrentDatabaseCommandType"); + testLongOptionalProperty(xSettings, "DefaultTabStop"); + testBooleanOptionalProperty(xSettings, "IsPrintBooklet"); + testBooleanOptionalProperty(xSettings, "IsPrintBookletFront"); + testBooleanOptionalProperty(xSettings, "IsPrintBookletBack"); + testLongOptionalProperty(xSettings, "PrintQuality"); + testStringOptionalProperty(xSettings, "ColorTableURL"); + testStringOptionalProperty(xSettings, "DashTableURL"); + testStringOptionalProperty(xSettings, "LineEndTableURL"); + testStringOptionalProperty(xSettings, "HatchTableURL"); + testStringOptionalProperty(xSettings, "GradientTableURL"); + testStringOptionalProperty(xSettings, "BitmapTableURL"); + testBooleanOptionalProperty(xSettings, "AutoCalculate"); + testPrinterIndependentLayout(xSettings); + testBooleanOptionalProperty(xSettings, "AddExternalLeading"); + testBooleanOptionalProperty(xSettings, "EmbedFonts"); + testBooleanOptionalProperty(xSettings, "EmbedSystemFonts"); + testBooleanOptionalProperty(xSettings, "EmbedOnlyUsedFonts"); + testBooleanOptionalProperty(xSettings, "EmbedLatinScriptFonts"); + testBooleanOptionalProperty(xSettings, "EmbedAsianScriptFonts"); + testBooleanOptionalProperty(xSettings, "EmbedComplexScriptFonts"); +} +} // end namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/xdocumentindex.cxx b/test/source/text/xdocumentindex.cxx new file mode 100644 index 000000000000..0cae3a2986c6 --- /dev/null +++ b/test/source/text/xdocumentindex.cxx @@ -0,0 +1,67 @@ +/* -*- 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 <cppunit/extensions/HelperMacros.h> + +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XTextContent.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XDocumentIndex.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <test/unoapi_property_testers.hxx> +#include <test/text/xdocumentindex.hxx> + +namespace apitest +{ +XDocumentIndex::~XDocumentIndex() {} +/** + * Gets the document from relation and insert a new index mark. + * Then it stores the text content of document index before + * update and after.<p> + * + * Has <b> OK </b> status if index content is changed and + * new index contains index mark inserted. <p> + */ +void XDocumentIndex::testUpdate() +{ + css::uno::Reference<css::text::XDocumentIndex> xDocumentIndex(init(), + css::uno::UNO_QUERY_THROW); + + bool bOK = true; + try + { + auto xText = getTextDocument()->getText(); + auto xTextRange = xText->getEnd(); + xTextRange->setString("IndexMark"); + css::uno::Reference<css::lang::XMultiServiceFactory> xFactory(getTextDocument(), + css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::text::XTextContent> xTextContentMark( + xFactory->createInstance("com.sun.star.text.DocumentIndexMark"), + css::uno::UNO_QUERY_THROW); + xText->insertTextContent(xTextRange, xTextContentMark, true); + } + catch (css::uno::Exception /*exception*/) + { + bOK = false; + } + + CPPUNIT_ASSERT_MESSAGE("Couldn't create the document index mark", bOK); + + OUString sContentBefore = xDocumentIndex->getAnchor()->getString(); + xDocumentIndex->update(); + OUString sContentAfter = xDocumentIndex->getAnchor()->getString(); + + CPPUNIT_ASSERT_MESSAGE("Before and after shouldn't be equal", sContentBefore != sContentAfter); + CPPUNIT_ASSERT_MESSAGE("Content after should contain string 'IndexMark'", + sContentAfter.indexOf("IndexMark") >= 0); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits