/* -*- 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 "DocumentSettingsTest.hxx" #include "SettingsTest.hxx" #include "PrinterSettingsTest.hxx" using namespace css; 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 { private: uno::Reference mxComponentContext; uno::Reference mxComponent; public: virtual void setUp() override; virtual void tearDown() override; std::unordered_map> init() override; CPPUNIT_TEST_SUITE(DocumentSettingsTest); CPPUNIT_TEST(testDocumentSettingsProperties); CPPUNIT_TEST(testSettingsProperties); CPPUNIT_TEST(testPrinterSettingsProperties); CPPUNIT_TEST_SUITE_END(); }; void DocumentSettingsTest::setUp() { test::BootstrapFixture::setUp(); mxComponentContext.set(comphelper::getComponentContext(getMultiServiceFactory())); mxDesktop.set(frame::Desktop::create(mxComponentContext)); } void DocumentSettingsTest::tearDown() { if (mxComponent.is()) mxComponent->dispose(); test::BootstrapFixture::tearDown(); } std::unordered_map> DocumentSettingsTest::init() { std::unordered_map> map; mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); CPPUNIT_ASSERT(mxComponent.is()); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY_THROW); uno::Reference xFactory(xTextDocument, uno::UNO_QUERY_THROW); uno::Reference xDocumentSettings( xFactory->createInstance("com.sun.star.text.DocumentSettings"), uno::UNO_QUERY_THROW); // DocumentSettings map["text::DocumentSettings"] = xDocumentSettings; // Settings map["document::Settings"] = xDocumentSettings; // Printer Settings map["text::PrinterSettings"] = xDocumentSettings; return map; } CPPUNIT_TEST_SUITE_REGISTRATION(DocumentSettingsTest); } // end anonymous namespace /* vim:set shiftwidth=4 softtabstop=4 expandtab: */