summaryrefslogtreecommitdiffstats
path: root/sw/qa/api/SwXDocumentSettings.cxx
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /sw/qa/api/SwXDocumentSettings.cxx
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/api/SwXDocumentSettings.cxx')
-rw-r--r--sw/qa/api/SwXDocumentSettings.cxx90
1 files changed, 90 insertions, 0 deletions
diff --git a/sw/qa/api/SwXDocumentSettings.cxx b/sw/qa/api/SwXDocumentSettings.cxx
new file mode 100644
index 0000000000..da2b366dae
--- /dev/null
+++ b/sw/qa/api/SwXDocumentSettings.cxx
@@ -0,0 +1,90 @@
+/* -*- 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/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+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<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();
+
+ 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");
+ 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_SET_THROW);
+
+ return xDocumentSettings;
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXDocumentSettings);
+
+} // end anonymous namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */