diff options
author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2019-03-16 15:21:43 +0100 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@libreoffice.org> | 2019-03-19 08:38:34 +0100 |
commit | 3428ca9c3b98c275bbcd852e733aa42eef89bdd2 (patch) | |
tree | 5fc4d2e8c8705a6556094623a945032b24edaf19 /sw/qa/api/SwXDocumentSettings.cxx | |
parent | 09b9499de17991bbd6b808c0c7923fda6e616e79 (diff) |
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.michaelsen@libreoffice.org>
Diffstat (limited to 'sw/qa/api/SwXDocumentSettings.cxx')
-rw-r--r-- | sw/qa/api/SwXDocumentSettings.cxx | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/sw/qa/api/SwXDocumentSettings.cxx b/sw/qa/api/SwXDocumentSettings.cxx new file mode 100644 index 000000000000..7a2bce7b35e7 --- /dev/null +++ b/sw/qa/api/SwXDocumentSettings.cxx @@ -0,0 +1,97 @@ +/* -*- 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/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> +#include <com/sun/star/frame/DispatchHelper.hpp> + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/uno/XInterface.hpp> + +#include <comphelper/processfactory.hxx> + +using namespace css; + +namespace +{ +/** + * Test for Java API test of file com.sun.star.comp.Writer.DocumentSettings.csv + */ +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; + uno::Reference<lang::XComponent> mxComponent; + +public: + virtual void setUp() override; + virtual void tearDown() override; + + SwXDocumentSettings() + : apitest::XServiceInfo("SwXDocumentSettings", "com.sun.star.text.DocumentSettings"){}; + uno::Reference<uno::XInterface> init() override; + + CPPUNIT_TEST_SUITE(SwXDocumentSettings); + CPPUNIT_TEST(testGetImplementationName); + CPPUNIT_TEST(testGetSupportedServiceNames); + CPPUNIT_TEST(testSupportsService); + CPPUNIT_TEST(testDocumentSettingsProperties); + CPPUNIT_TEST(testSettingsProperties); + CPPUNIT_TEST(testPrinterSettingsProperties); + CPPUNIT_TEST_SUITE_END(); +}; + +void SwXDocumentSettings::setUp() +{ + test::BootstrapFixture::setUp(); + + mxComponentContext.set(comphelper::getComponentContext(getMultiServiceFactory())); + mxDesktop.set(frame::Desktop::create(mxComponentContext)); +} + +void SwXDocumentSettings::tearDown() +{ + if (mxComponent.is()) + mxComponent->dispose(); + + test::BootstrapFixture::tearDown(); +} + +uno::Reference<uno::XInterface> SwXDocumentSettings::init() +{ + mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); + CPPUNIT_ASSERT(mxComponent.is()); + + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY_THROW); + uno::Reference<lang::XMultiServiceFactory> xFactory(xTextDocument, uno::UNO_QUERY_THROW); + + uno::Reference<uno::XInterface> xDocumentSettings( + xFactory->createInstance("com.sun.star.text.DocumentSettings"), uno::UNO_QUERY_THROW); + + return xDocumentSettings; +} + +CPPUNIT_TEST_SUITE_REGISTRATION(SwXDocumentSettings); + +} // end anonymous namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |