tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _sw / SwXTableRows.java
blob1dc1be9d251cd7b1c0f27f162081ec2e5bbc8615
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package mod._sw;
21 import java.io.PrintWriter;
23 import lib.StatusException;
24 import lib.TestCase;
25 import lib.TestEnvironment;
26 import lib.TestParameters;
27 import util.SOfficeFactory;
29 import com.sun.star.table.XCellRange;
30 import com.sun.star.text.XTextDocument;
31 import com.sun.star.text.XTextTable;
32 import com.sun.star.uno.UnoRuntime;
33 import com.sun.star.uno.XInterface;
35 /**
36 * Test for object which is represented by service
37 * <code>com.sun.star.table.TableRows</code>. <p>
38 * Object implements the following interfaces :
39 * <ul>
40 * <li> <code>com::sun::star::container::XIndexAccess</code></li>
41 * <li> <code>com::sun::star::container::XElementAccess</code></li>
42 * <li> <code>com::sun::star::table::XTableRows</code></li>
43 * </ul> <p>
44 * This object test <b> is NOT </b> designed to be run in several
45 * threads concurrently.
46 * @see com.sun.star.container.XIndexAccess
47 * @see com.sun.star.container.XElementAccess
48 * @see com.sun.star.table.XTableRows
49 * @see ifc.container._XIndexAccess
50 * @see ifc.container._XElementAccess
51 * @see ifc.table._XTableRows
53 public class SwXTableRows extends TestCase {
54 XTextDocument xTextDoc;
56 /**
57 * Creates text document.
59 @Override
60 protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception {
61 SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() );
62 log.println( "creating a textdocument" );
63 xTextDoc = SOF.createTextDoc( null );
66 /**
67 * Disposes text document.
69 @Override
70 protected void cleanup( TestParameters tParam, PrintWriter log ) {
71 log.println( " disposing xTextDoc " );
72 util.DesktopTools.closeDoc(xTextDoc);
75 /**
76 * Creating a TestEnvironment for the interfaces to be tested. After creation
77 * of text table, it is inserted to text document, then rows are gotten
78 * from table.
80 @Override
81 public TestEnvironment createTestEnvironment(
82 TestParameters tParam, PrintWriter log ) throws StatusException {
83 XInterface oObj = null;
84 XTextTable oTable = null;
86 log.println( "creating a test environment" );
87 SOfficeFactory.getFactory( tParam.getMSF() );
88 oTable = SOfficeFactory.createTextTable( xTextDoc );
90 SOfficeFactory.insertTextContent(xTextDoc, oTable );
91 oObj = oTable.getRows();
93 log.println( "creating a new environment for TableColumns object" );
94 TestEnvironment tEnv = new TestEnvironment( oObj );
96 // adding relation for XTableColumns
97 tEnv.addObjRelation("XTableRows.XCellRange",
98 UnoRuntime.queryInterface(XCellRange.class, oTable));
100 return tEnv;
101 } // finish method getTestEnvironment
103 } // finish class SwXTableRows