summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authoranfanite396 <dipamt1729@gmail.com>2023-07-09 12:53:46 +0530
committerTomaž Vajngerl <quikee@gmail.com>2023-07-10 14:32:55 +0200
commit74d286e269b727ae6731b426ec4d12dbfbc0212e (patch)
tree6a945814e8124a38298eda0c8cbdf6c30c24b366 /sw
parenta2589c4972b476937994b7ef546de22f89da134c (diff)
Move SwXAutoTextContainer Java tests to C++
Change-Id: Ib785d9c1d143f0f51247ae73f01d9ee6d3806947 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154230 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/CppunitTest_sw_apitests.mk1
-rw-r--r--sw/qa/api/SwXAutoTextContainer.cxx75
2 files changed, 76 insertions, 0 deletions
diff --git a/sw/CppunitTest_sw_apitests.mk b/sw/CppunitTest_sw_apitests.mk
index b37b8cf0af7d..b750e3d81d56 100644
--- a/sw/CppunitTest_sw_apitests.mk
+++ b/sw/CppunitTest_sw_apitests.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_CppunitTest_use_external,sw_apitests,boost_headers))
$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_apitests))
$(eval $(call gb_CppunitTest_add_exception_objects,sw_apitests, \
+ sw/qa/api/SwXAutoTextContainer \
sw/qa/api/SwXBodyText \
sw/qa/api/SwXBookmark \
sw/qa/api/SwXDocumentIndex \
diff --git a/sw/qa/api/SwXAutoTextContainer.cxx b/sw/qa/api/SwXAutoTextContainer.cxx
new file mode 100644
index 000000000000..838aa5e2adbe
--- /dev/null
+++ b/sw/qa/api/SwXAutoTextContainer.cxx
@@ -0,0 +1,75 @@
+/* -*- 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/unoapi_test.hxx>
+#include <test/container/xnameaccess.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <test/container/xelementaccess.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/text/XAutoTextContainer.hpp>
+#include <com/sun/star/text/AutoTextContainer.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXAutoTextContainer.
+ */
+class SwXAutoTextContainer final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess,
+ public apitest::XNameAccess
+{
+public:
+ SwXAutoTextContainer()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<text::XAutoTextGroup>::get())
+ , XIndexAccess(3)
+ , XNameAccess("standard")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XAutoTextContainer> xAutoTextContainer
+ = text::AutoTextContainer::create(comphelper::getProcessComponentContext());
+
+ return Reference<XInterface>(xAutoTextContainer, UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXAutoTextContainer);
+ CPPUNIT_TEST(testGetByName);
+ CPPUNIT_TEST(testGetElementNames);
+ CPPUNIT_TEST(testHasByName);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXAutoTextContainer);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file