1 /* 2 * This file is part of the LibreOffice project. 3 * 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/. 7 * 8 * This file incorporates work covered by the following license notice: 9 * 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 . 17 */ 18 19 package ifc.io; 20 21 import lib.MultiMethodTest; 22 23 import com.sun.star.io.XConnectable; 24 import com.sun.star.uno.UnoRuntime; 25 import com.sun.star.uno.XInterface; 26 27 /** 28 * Testing <code>com.sun.star.io.XConnectable</code> 29 * interface methods: 30 * <ul> 31 * <li><code>setPredecessor()</code></li> 32 * <li><code>getPredecessor()</code></li> 33 * <li><code>setSuccessor()</code></li> 34 * <li><code>getSuccessor()</code></li> 35 * </ul> <p> 36 * This test needs the following object relations : 37 * <ul> 38 * <li> <code>'Connectable'</code> (supports the <code>XConnectable</code> 39 * interface): 40 * another object to connect </li> 41 * </ul> 42 * After test completion object environment has to be recreated. 43 * @see com.sun.star.io.XConnectable 44 */ 45 public class _XConnectable extends MultiMethodTest { 46 47 public XConnectable oObj = null; 48 49 private XConnectable xConnect = null ; 50 51 /** 52 * Get another connectable object from object relations. 53 */ 54 @Override before()55 public void before() { 56 XInterface x = (XInterface)tEnv.getObjRelation("Connectable"); 57 xConnect = UnoRuntime.queryInterface( 58 XConnectable.class, x) ; 59 } 60 61 /** 62 * Test calls the method using interface <code>XConnectable</code> 63 * received in method <code>before()</code> as parameter. <p> 64 * Has <b> OK </b> status if the method successfully returns. <p> 65 */ _setPredecessor()66 public void _setPredecessor() { 67 oObj.setPredecessor(xConnect) ; 68 69 tRes.tested("setPredecessor()", true) ; 70 } 71 72 /** 73 * Test calls the method and compares returned value with value that was 74 * set in the method <code>setPredecessor()</code>. <p> 75 * Has <b> OK </b> status if values are equal. <p> 76 * The following method tests are to be completed successfully before : 77 * <ul> 78 * <li> <code> setPredecessor() </code></li> 79 * </ul> 80 */ _getPredecessor()81 public void _getPredecessor() { 82 requiredMethod("setPredecessor()") ; 83 84 XConnectable gConnect = oObj.getPredecessor() ; 85 86 tRes.tested("getPredecessor()", xConnect.equals(gConnect)) ; 87 } 88 89 /** 90 * Test calls the method using interface <code>XConnectable</code> 91 * received in method <code>before()</code> as parameter. <p> 92 * Has <b> OK </b> status if the method successfully returns. <p> 93 */ _setSuccessor()94 public void _setSuccessor() { 95 oObj.setSuccessor(xConnect) ; 96 97 tRes.tested("setSuccessor()", true) ; 98 } 99 100 /** 101 * Test calls the method and compares returned value with value that was 102 * set in the method <code>setSuccessor()</code>. <p> 103 * Has <b> OK </b> status if values are equal. <p> 104 * The following method tests are to be completed successfully before : 105 * <ul> 106 * <li> <code> setSuccessor() </code></li> 107 * </ul> 108 */ _getSuccessor()109 public void _getSuccessor() { 110 requiredMethod("setSuccessor()") ; 111 112 XConnectable gConnect = oObj.getSuccessor() ; 113 114 tRes.tested("getSuccessor()", xConnect.equals(gConnect)) ; 115 } 116 117 /** 118 * Forces object environment recreation. 119 */ 120 @Override after()121 public void after() { 122 this.disposeEnvironment() ; 123 } 124 } 125 126