bump product version to 5.0.4.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _sd / SdDocLinkTargets.java
blob97364e784adb893a51907e157e0e077e5b9a2ee3
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._sd;
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.document.XLinkTargetSupplier;
30 import com.sun.star.lang.XComponent;
31 import com.sun.star.uno.UnoRuntime;
32 import com.sun.star.uno.XInterface;
34 /**
35 * Test for object which is represented by service
36 * <code>com.sun.star.document.LinkTargets</code>. <p>
37 * Object implements the following interfaces :
38 * <ul>
39 * <li> <code>com::sun::star::container::XNameAccess</code></li>
40 * <li> <code>com::sun::star::container::XElementAccess</code></li>
41 * </ul>
42 * @see com.sun.star.document.LinkTargets
43 * @see com.sun.star.container.XNameAccess
44 * @see com.sun.star.container.XElementAccess
45 * @see ifc.container._XNameAccess
46 * @see ifc.container._XElementAccess
48 public class SdDocLinkTargets extends TestCase {
49 XComponent xDrawDoc;
51 /**
52 * Creates Drawing document.
54 @Override
55 protected void initialize(TestParameters Param, PrintWriter log) {
56 // get a soffice factory object
57 SOfficeFactory SOF = SOfficeFactory.getFactory(
58 Param.getMSF());
60 try {
61 log.println( "creating a draw document" );
62 xDrawDoc = SOF.createDrawDoc(null);
63 } catch (com.sun.star.uno.Exception e) {
64 // Some exception occurs.FAILED
65 e.printStackTrace( log );
66 throw new StatusException( "Couldn't create document", e );
70 /**
71 * Disposes Drawing document.
73 @Override
74 protected void cleanup( TestParameters Param, PrintWriter log) {
75 log.println("disposing xDrawDoc");
76 util.DesktopTools.closeDoc(xDrawDoc);
79 /**
80 * Creating a Testenvironment for the interfaces to be tested.
81 * Retrieves the possible links to children of the drawing document using
82 * the interface <code>XLinkTargetSupplier</code>. The retrieved collection
83 * is the instance of the service <code>com.sun.star.document.LinkTargets</code>.
84 * @see com.sun.star.document.XLinkTargetSupplier
85 * @see com.sun.star.document.LinkTargets
87 @Override
88 public TestEnvironment createTestEnvironment(
89 TestParameters Param, PrintWriter log) throws StatusException {
91 // get the Links here
92 log.println( "getting Links" );
93 XLinkTargetSupplier oLTS = UnoRuntime.queryInterface(XLinkTargetSupplier.class,xDrawDoc);
94 XInterface oObj = oLTS.getLinks();
96 log.println( "creating a new environment for drawpage object" );
97 TestEnvironment tEnv = new TestEnvironment( oObj );
99 return tEnv;
100 } // finish method createTestEnvironment
102 } // finish class SdDocLinkTargets