tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _streams / uno / Pipe.java
blob96c4891a1f6f8b31f3538fe76a1de2353f7bdb35
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._streams.uno;
21 import com.sun.star.io.XInputStream;
22 import com.sun.star.lang.XMultiServiceFactory;
23 import com.sun.star.uno.UnoRuntime;
24 import com.sun.star.uno.XInterface;
26 import java.io.PrintWriter;
28 import lib.TestCase;
29 import lib.TestEnvironment;
30 import lib.TestParameters;
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 protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
63 XInterface oObj = null;
64 Object oInterface = null;
66 XMultiServiceFactory xMSF = Param.getMSF();
67 oInterface = xMSF.createInstance( "com.sun.star.io.Pipe" );
69 oObj = (XInterface) oInterface;
71 // writing some information to the pipe
72 byte[] byteData = new byte[] {
73 1, 2, 3, 4, 5, 6, 7, 8 } ;
75 log.println( "creating a new environment for object" );
76 TestEnvironment tEnv = new TestEnvironment( oObj );
78 //add relation for io.XOutputStream
79 final XInputStream iStream = UnoRuntime.queryInterface(XInputStream.class, oObj);
81 tEnv.addObjRelation("ByteData", byteData);
82 tEnv.addObjRelation("StreamWriter", oObj);
84 tEnv.addObjRelation("XOutputStream.StreamChecker",
85 new ifc.io._XOutputStream.StreamChecker() {
86 public void resetStreams() {
89 public XInputStream getInStream() {
90 return iStream;
92 });
94 return tEnv;
95 } // finish method getTestEnvironment