fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sc / qa / complex / dataPilot / _XNamed.java
bloba0f048c15b0bcf14f3874d0d8db36b6a5398fdbe
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 complex.dataPilot;
21 import com.sun.star.container.XNamed;
22 import lib.TestParameters;
23 // import share.LogWriter;
24 // import util.utils;
26 /**
27 * Testing <code>com.sun.star.container.XNamed</code>
28 * interface methods :
29 * <ul>
30 * <li><code> getName()</code></li>
31 * <li><code> setName()</code></li>
32 * </ul>
33 * This test need the following object relations :
34 * <ul>
35 * <li> <code>'setName'</code> : of <code>Boolean</code>
36 * type. If it exists then <code>setName</code> method
37 * isn't to be tested and result of this test will be
38 * equal to relation value.</li>
39 * <ul> <p>
40 * Test is <b> NOT </b> multithread compilant. <p>
41 * @see com.sun.star.container.XNamed
43 public class _XNamed {
45 /**
46 * The object that is testsed.
48 public XNamed oObj = null;
50 /**
51 * The test parameters
53 private TestParameters param = null;
55 /**
56 * The log writer
58 // private LogWriter log = null;
60 /**
61 * Constructor: gets the object to test, a logger and the test parameters
62 * @param xObj The test object
63 * @param log A log writer
64 * @param param The test parameters
66 public _XNamed(XNamed xObj/*, LogWriter log*/, TestParameters param) {
67 oObj = xObj;
68 // this.log = log;
69 this.param = param;
72 /**
73 * Test calls the method and checks return value and that
74 * no exceptions were thrown. <p>
75 * Has <b> OK </b> status if the method returns non null value
76 * and no exceptions were thrown. <p>
78 public boolean _getName() {
80 // write to log what we try next
81 System.out.println( "test for getName()" );
83 boolean result = true;
84 boolean loc_result = true;
85 String name = null;
86 String NewName = null;
88 loc_result = ((name = oObj.getName()) != null);
89 System.out.println("getting the name \"" + name + "\"");
91 if (loc_result)
93 System.out.println("... getName() - OK");
95 else
97 System.out.println("... getName() - FAILED");
99 result &= loc_result;
100 return result;
104 * Sets a new name for object and checks if it was properly
105 * set. Special cases for the following objects :
106 * <ul>
107 * <li><code>ScSheetLinkObj</code> : name must be in form of URL.</li>
108 * <li><code>ScDDELinkObj</code> : name must contain link to cell in
109 * some external Sheet.</li>
110 * </ul>
111 * Has <b> OK </b> status if new name was successfully set, or if
112 * object environment contains relation <code>'setName'</code> with
113 * value <code>true</code>. <p>
114 * The following method tests are to be completed successfully before :
115 * <ul>
116 * <li> <code> getName() </code> : to be sure the method works</li>
117 * </ul>
119 public boolean _setName(){
120 // requiredMethod("getName()");
121 System.out.println("testing setName() ... ");
123 String oldName = oObj.getName();
124 String NewName = oldName == null ? "XNamed" : oldName + "X" ;
126 boolean result = true;
127 boolean loc_result = true;
128 System.out.println("set the name of object to \"" + NewName + "\"");
129 oObj.setName(NewName);
130 System.out.println("check that container has element with this name");
132 String name = oObj.getName();
133 System.out.println("getting the name \"" + name + "\"");
134 loc_result = name.equals(NewName);
136 if (loc_result)
138 System.out.println("... setName() - OK");
140 else
142 System.out.println("... setName() - FAILED");
144 result &= loc_result;
145 oObj.setName(oldName);
146 return result;