framework/qa/complex/api_internal/api.lst | 1 qadevOOo/Jar_OOoRunner.mk | 1 qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextFieldTypes.csv | 6 qadevOOo/tests/java/mod/_sw/SwXTextFieldTypes.java | 126 ---------- sw/CppunitTest_sw_apitests.mk | 1 sw/qa/api/SwXTextFieldTypes.cxx | 85 ++++++ sw/qa/unoapi/sw_3.sce | 1 7 files changed, 86 insertions(+), 135 deletions(-)
New commits: commit 63464fdf552ce82ec29631f0736edd43c0ba4146 Author: anfanite396 <dipamt1...@gmail.com> AuthorDate: Sat Jul 8 08:59:58 2023 +0530 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Aug 21 10:35:18 2023 +0200 Move SwXTextFieldTypes Java tests to C++ Change-Id: I77ca9bc6cd0db626df826e2084514d34becf39bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154208 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/framework/qa/complex/api_internal/api.lst b/framework/qa/complex/api_internal/api.lst index 0d1d4e10b391..c7bf6a1386a3 100644 --- a/framework/qa/complex/api_internal/api.lst +++ b/framework/qa/complex/api_internal/api.lst @@ -170,7 +170,6 @@ job232=sw.SwXTextDefaults job233=sw.SwXTextEmbeddedObjects job234=sw.SwXTextField job235=sw.SwXTextFieldMasters -job236=sw.SwXTextFieldTypes job237=sw.SwXTextFrameText job238=sw.SwXTextGraphicObjects job239=sw.SwXTextPortionEnumeration diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk index 0ba2007cb2d5..3c2e2d780fa1 100644 --- a/qadevOOo/Jar_OOoRunner.mk +++ b/qadevOOo/Jar_OOoRunner.mk @@ -1137,7 +1137,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ qadevOOo/tests/java/mod/_sw/SwXTextEmbeddedObjects \ qadevOOo/tests/java/mod/_sw/SwXTextField \ qadevOOo/tests/java/mod/_sw/SwXTextFieldMasters \ - qadevOOo/tests/java/mod/_sw/SwXTextFieldTypes \ qadevOOo/tests/java/mod/_sw/SwXTextFrame \ qadevOOo/tests/java/mod/_sw/SwXTextFrameText \ qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject \ diff --git a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextFieldTypes.csv b/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextFieldTypes.csv deleted file mode 100644 index 7a466b54f492..000000000000 --- a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextFieldTypes.csv +++ /dev/null @@ -1,6 +0,0 @@ -"SwXTextFieldTypes";"com::sun::star::util::XRefreshable";"refresh()" -"SwXTextFieldTypes";"com::sun::star::util::XRefreshable";"addRefreshListener()" -"SwXTextFieldTypes";"com::sun::star::util::XRefreshable";"removeRefreshListener()" -"SwXTextFieldTypes";"com::sun::star::container::XElementAccess";"getElementType()" -"SwXTextFieldTypes";"com::sun::star::container::XElementAccess";"hasElements()" -"SwXTextFieldTypes";"com::sun::star::container::XEnumerationAccess";"createEnumeration()" diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextFieldTypes.java b/qadevOOo/tests/java/mod/_sw/SwXTextFieldTypes.java deleted file mode 100644 index 03cb9721e750..000000000000 --- a/qadevOOo/tests/java/mod/_sw/SwXTextFieldTypes.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package mod._sw; - -import java.io.PrintWriter; - -import lib.StatusException; -import lib.TestCase; -import lib.TestEnvironment; -import lib.TestParameters; -import util.SOfficeFactory; - -import com.sun.star.text.XTextDocument; -import com.sun.star.text.XTextFieldsSupplier; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; - -/** - * - * initial description - * @see com.sun.star.container.XContainer - * @see com.sun.star.container.XElementAccess - * @see com.sun.star.container.XEnumerationAccess - * - */ -public class SwXTextFieldTypes extends TestCase { - - XTextDocument xTextDoc; - - /** - * in general this method creates a testdocument - * - * @param tParam class which contains additional test parameters - * @param log class to log the test state and result - * - * - * @see TestParameters - * @see PrintWriter - * - */ - @Override - protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { - SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); - - log.println( "creating a textdocument" ); - xTextDoc = SOF.createTextDoc( null ); - } - - /** - * in general this method disposes the testenvironment and document - * - * @param tParam class which contains additional test parameters - * @param log class to log the test state and result - * - * - * @see TestParameters - * @see PrintWriter - * - */ - @Override - protected void cleanup( TestParameters tParam, PrintWriter log ) { - log.println( " disposing xTextDoc " ); - util.DesktopTools.closeDoc(xTextDoc); - } - - - /** - * creating a TestEnvironment for the interfaces to be tested - * - * @param tParam class which contains additional test parameters - * @param log class to log the test state and result - * - * @return Status class - * - * @see TestParameters - * @see PrintWriter - */ - @Override - public TestEnvironment createTestEnvironment( TestParameters tParam, - PrintWriter log ) - throws StatusException { - - XInterface oObj = null; - - // creation of testobject here - // first we write what we are intend to do to log file - log.println( "creating a test environment" ); - - - // create testobject here - try { - XTextFieldsSupplier oTFS = UnoRuntime.queryInterface( XTextFieldsSupplier.class, xTextDoc ); - - oObj = oTFS.getTextFields(); - - } - catch (Exception ex) { - log.println("Couldn't create instance"); - ex.printStackTrace(log); - } - - log.println( "creating a new environment for FieldTypes object" ); - TestEnvironment tEnv = new TestEnvironment( oObj ); - - - - return tEnv; - } // finish method getTestEnvironment -} // finish class SwXTextFieldTypes - diff --git a/sw/CppunitTest_sw_apitests.mk b/sw/CppunitTest_sw_apitests.mk index 93bc9453113e..f2b361cec272 100644 --- a/sw/CppunitTest_sw_apitests.mk +++ b/sw/CppunitTest_sw_apitests.mk @@ -40,6 +40,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_apitests, \ sw/qa/api/SwXTableCellText \ sw/qa/api/SwXTextFrame \ sw/qa/api/SwXTextField \ + sw/qa/api/SwXTextFieldTypes \ sw/qa/api/SwXTextTable \ )) diff --git a/sw/qa/api/SwXTextFieldTypes.cxx b/sw/qa/api/SwXTextFieldTypes.cxx new file mode 100644 index 000000000000..1a99606c8707 --- /dev/null +++ b/sw/qa/api/SwXTextFieldTypes.cxx @@ -0,0 +1,85 @@ +/* -*- 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/xelementaccess.hxx> +#include <test/container/xenumerationaccess.hxx> +#include <test/util/xrefreshable.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/XTextFieldsSupplier.hpp> +#include <com/sun/star/text/XDependentTextField.hpp> + +#include <comphelper/processfactory.hxx> + +using namespace css; +using namespace css::uno; + +namespace +{ +/** + * Initial tests for SwXTextFieldTypes. + */ +class SwXTextFieldTypes final : public UnoApiTest, + public apitest::XElementAccess, + public apitest::XEnumerationAccess, + public apitest::XRefreshable +{ +public: + SwXTextFieldTypes() + : UnoApiTest("") + , XElementAccess(cppu::UnoType<text::XDependentTextField>::get()) + { + } + + virtual void setUp() override + { + UnoApiTest::setUp(); + mxDesktop.set(frame::Desktop::create(mxComponentContext)); + mxComponent = loadFromDesktop("private:factory/swriter"); + CPPUNIT_ASSERT(mxComponent.is()); + } + + Reference<XInterface> init() override + { + component_ = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); + Reference<text::XTextDocument> xTextDocument(component_, UNO_QUERY_THROW); + + Reference<text::XTextFieldsSupplier> xTFS; + + try + { + xTFS = Reference<text::XTextFieldsSupplier>(xTextDocument, UNO_QUERY_THROW); + } + catch (Exception&) + { + } + + return Reference<XInterface>(xTFS->getTextFields(), UNO_QUERY_THROW); + } + + CPPUNIT_TEST_SUITE(SwXTextFieldTypes); + CPPUNIT_TEST(testGetElementType); + CPPUNIT_TEST(testHasElements); + CPPUNIT_TEST(testCreateEnumeration); + CPPUNIT_TEST(testRefreshListener); + CPPUNIT_TEST_SUITE_END(); + +private: + Reference<lang::XComponent> component_; +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(SwXTextFieldTypes); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/unoapi/sw_3.sce b/sw/qa/unoapi/sw_3.sce index 585a9ba98d6c..8e4d3642a074 100644 --- a/sw/qa/unoapi/sw_3.sce +++ b/sw/qa/unoapi/sw_3.sce @@ -23,7 +23,6 @@ -o sw.SwXTextEmbeddedObjects -o sw.SwXTextField -o sw.SwXTextFieldMasters --o sw.SwXTextFieldTypes -o sw.SwXTextFrame -o sw.SwXTextFrameText -o sw.SwXTextGraphicObject