tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _stm / Pipe.java
blobfacd2cafe86cd85902b80ed21d6aa9132e3d9183
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._stm;
21 import java.io.PrintWriter;
23 import lib.TestCase;
24 import lib.TestEnvironment;
25 import lib.TestParameters;
27 import com.sun.star.io.XInputStream;
28 import com.sun.star.lang.XMultiServiceFactory;
29 import com.sun.star.uno.UnoRuntime;
30 import com.sun.star.uno.XInterface;
32 /**
33 * Test for object which is represented by service
34 * <code>com.sun.star.io.Pipe</code>. <p>
35 * Object implements the following interfaces :
36 * <ul>
37 * <li> <code>com::sun::star::io::XInputStream</code></li>
38 * <li> <code>com::sun::star::io::XOutputStream</code></li>
39 * </ul>
40 * @see com.sun.star.io.Pipe
41 * @see com.sun.star.io.XInputStream
42 * @see com.sun.star.io.XOutputStream
43 * @see ifc.io._XInputStream
44 * @see ifc.io._XOutputStream
46 public class Pipe extends TestCase {
48 /**
49 * Creating a TestEnvironment for the interfaces to be tested.
50 * Creates an instance of the service <code>com.sun.star.io.Pipe</code>.
51 * Writes some information to the created pipe.
52 * Object relations created :
53 * <ul>
54 * <li> <code>'XOutputStream.StreamChecker'</code> for
55 * {@link ifc.io._XOutputStream}( implementation of the interface
56 * ifc.io._XOutputStream.StreamChecker ) </li>
57 * </ul>
58 * @see com.sun.star.io.Pipe
60 @Override
61 public TestEnvironment createTestEnvironment(
62 TestParameters Param, PrintWriter log) throws Exception {
64 XInterface oObj = null;
65 Object oInterface = null;
67 XMultiServiceFactory xMSF = Param.getMSF();
68 oInterface = xMSF.createInstance( "com.sun.star.io.Pipe" );
70 oObj = (XInterface) oInterface;
72 // writing some information to the pipe
73 byte[] byteData = new byte[] {
74 1, 2, 3, 4, 5, 6, 7, 8 } ;
76 log.println( "creating a new environment for object" );
77 TestEnvironment tEnv = new TestEnvironment( oObj );
79 //add relation for io.XOutputStream
80 final XInputStream iStream = UnoRuntime.queryInterface(XInputStream.class, oObj);
82 tEnv.addObjRelation("ByteData", byteData);
83 tEnv.addObjRelation("StreamWriter", oObj);
85 tEnv.addObjRelation("XOutputStream.StreamChecker",
86 new ifc.io._XOutputStream.StreamChecker() {
87 public void resetStreams() {
90 public XInputStream getInStream() {
91 return iStream;
93 });
95 return tEnv;
96 } // finish method getTestEnvironment