diff options
-rw-r--r-- | framework/qa/complex/api_internal/api.lst | 1 | ||||
-rw-r--r-- | qadevOOo/Jar_OOoRunner.mk | 1 | ||||
-rw-r--r-- | qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextTables.csv | 7 | ||||
-rw-r--r-- | qadevOOo/tests/java/mod/_sw/SwXTextTables.java | 118 | ||||
-rw-r--r-- | sw/CppunitTest_sw_apitests.mk | 1 | ||||
-rw-r--r-- | sw/qa/api/SwXTextTables.cxx | 97 | ||||
-rw-r--r-- | sw/qa/unoapi/sw_4.sce | 1 |
7 files changed, 98 insertions, 128 deletions
diff --git a/framework/qa/complex/api_internal/api.lst b/framework/qa/complex/api_internal/api.lst index 0104075a89b8..209b3ad1bcb8 100644 --- a/framework/qa/complex/api_internal/api.lst +++ b/framework/qa/complex/api_internal/api.lst @@ -177,7 +177,6 @@ job240=sw.SwXTextRanges job241=sw.SwXTextSearch job242=sw.SwXTextSection job244=sw.SwXTextTableRow -job245=sw.SwXTextTables job246=sw.SwXViewSettings job247=sw.XMLContentExporter job248=sw.XMLExporter diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk index 4347ae7f24fe..4fcb8728eb98 100644 --- a/qadevOOo/Jar_OOoRunner.mk +++ b/qadevOOo/Jar_OOoRunner.mk @@ -1150,7 +1150,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ qadevOOo/tests/java/mod/_sw/SwXTextTable \ qadevOOo/tests/java/mod/_sw/SwXTextTableCursor \ qadevOOo/tests/java/mod/_sw/SwXTextTableRow \ - qadevOOo/tests/java/mod/_sw/SwXTextTables \ qadevOOo/tests/java/mod/_sw/SwXTextView \ qadevOOo/tests/java/mod/_sw/SwXTextViewCursor \ qadevOOo/tests/java/mod/_sw/SwXViewSettings \ diff --git a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextTables.csv b/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextTables.csv deleted file mode 100644 index 7fb1526deef1..000000000000 --- a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextTables.csv +++ /dev/null @@ -1,7 +0,0 @@ -"SwXTextTables";"com::sun::star::container::XNameAccess";"getByName()" -"SwXTextTables";"com::sun::star::container::XNameAccess";"getElementNames()" -"SwXTextTables";"com::sun::star::container::XNameAccess";"hasByName()" -"SwXTextTables";"com::sun::star::container::XIndexAccess";"getCount()" -"SwXTextTables";"com::sun::star::container::XIndexAccess";"getByIndex()" -"SwXTextTables";"com::sun::star::container::XElementAccess";"getElementType()" -"SwXTextTables";"com::sun::star::container::XElementAccess";"hasElements()" diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextTables.java b/qadevOOo/tests/java/mod/_sw/SwXTextTables.java deleted file mode 100644 index 28ad076e4f98..000000000000 --- a/qadevOOo/tests/java/mod/_sw/SwXTextTables.java +++ /dev/null @@ -1,118 +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.TestCase; -import lib.TestEnvironment; -import lib.TestParameters; -import util.SOfficeFactory; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.text.XTextDocument; -import com.sun.star.text.XTextTable; -import com.sun.star.text.XTextTablesSupplier; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; - -/** - * - * initial description - * @see com.sun.star.container.XElementAccess - * @see com.sun.star.container.XIndexAccess - * @see com.sun.star.container.XNameAccess - * - */ -public class SwXTextTables extends TestCase { - XTextDocument xTextDoc; - - @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 ); - } - - @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) { - - XInterface oObj = null; - int nRow = 4; - int nCol = 5; - - - // creation of testobject here - // first we write what we are intend to do to log file - log.println( "creating a test environment" ); - - // get a soffice factory object - SOfficeFactory.getFactory( tParam.getMSF() ); - - // create testobject here - TestEnvironment tEnv = null; - XTextTable oTable = null; - oTable = SOfficeFactory.createTextTable( xTextDoc ); - SOfficeFactory.insertTextContent(xTextDoc, oTable ); - - // Number two - XTextTable oTable2 = null; - oTable2 = SOfficeFactory.createTextTable( xTextDoc ); - SOfficeFactory.insertTextContent(xTextDoc, oTable2 ); - - XMultiServiceFactory msf = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); - XTextTablesSupplier oTTSupp = UnoRuntime.queryInterface(XTextTablesSupplier.class, msf); - oObj = oTTSupp.getTextTables(); - - if ( oTable != null ) { - log.println("Creating instance..."); - tEnv = new TestEnvironment(oObj); - } - - log.println( "adding TextDocument as mod relation to environment" ); - tEnv.addObjRelation( "TEXTDOC", xTextDoc ); - tEnv.addObjRelation( "ROW", Integer.valueOf( nRow ) ); - tEnv.addObjRelation( "COL", Integer.valueOf( nCol ) ); - tEnv.addObjRelation( "INST", SOfficeFactory.createTextTable( xTextDoc )); - - return tEnv; - } // finish method getTestEnvironment - -} // finish class SwXTextTables - diff --git a/sw/CppunitTest_sw_apitests.mk b/sw/CppunitTest_sw_apitests.mk index 67bb6f090ff6..15589d269252 100644 --- a/sw/CppunitTest_sw_apitests.mk +++ b/sw/CppunitTest_sw_apitests.mk @@ -43,6 +43,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_apitests, \ sw/qa/api/SwXTextFieldTypes \ sw/qa/api/SwXTextSections \ sw/qa/api/SwXTextTable \ + sw/qa/api/SwXTextTables \ )) $(eval $(call gb_CppunitTest_use_libraries,sw_apitests, \ diff --git a/sw/qa/api/SwXTextTables.cxx b/sw/qa/api/SwXTextTables.cxx new file mode 100644 index 000000000000..a63a6592c82e --- /dev/null +++ b/sw/qa/api/SwXTextTables.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/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/XText.hpp> +#include <com/sun/star/text/XTextTable.hpp> +#include <com/sun/star/text/XTextTablesSupplier.hpp> + +using namespace css; +using namespace css::uno; + +namespace +{ +/** + * Initial tests for SwXTextTables. + */ +class SwXTextTables final : public UnoApiTest, + public apitest::XElementAccess, + public apitest::XIndexAccess, + public apitest::XNameAccess +{ +public: + SwXTextTables() + : UnoApiTest("") + , XElementAccess(cppu::UnoType<text::XTextTable>::get()) + , XIndexAccess(1) + , XNameAccess("Table1") + { + } + + 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 + { + Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW); + Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW); + + Reference<text::XText> xText = xTextDocument->getText(); + Reference<text::XTextCursor> xCursor = xText->createTextCursor(); + + try + { + Reference<text::XTextTable> xTable(xMSF->createInstance("com.sun.star.text.TextTable"), + UNO_QUERY_THROW); + xTable->initialize(4, 3); + xText->insertTextContent(xCursor, xTable, false); + + Reference<text::XTextTable> xTable2(xMSF->createInstance("com.sun.star.text.TextTable"), + UNO_QUERY_THROW); + xTable->initialize(4, 3); + xText->insertTextContent(xCursor, xTable2, false); + } + catch (Exception&) + { + } + + Reference<text::XTextTablesSupplier> xSupplier(xTextDocument, UNO_QUERY_THROW); + + return Reference<XInterface>(xSupplier->getTextTables(), UNO_QUERY_THROW); + } + + CPPUNIT_TEST_SUITE(SwXTextTables); + 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(SwXTextTables); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/unoapi/sw_4.sce b/sw/qa/unoapi/sw_4.sce index 127f3af17a92..af1ca87bb4c3 100644 --- a/sw/qa/unoapi/sw_4.sce +++ b/sw/qa/unoapi/sw_4.sce @@ -18,7 +18,6 @@ -o sw.SwXTextTable -o sw.SwXTextTableCursor -o sw.SwXTextTableRow --o sw.SwXTextTables #i85580 -o sw.SwXTextView -o sw.SwXTextViewCursor -o sw.SwXViewSettings |