tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / io / _XObjectOutputStream.java
blob86efebe52c66754278ea6696121887d1a28bc7ca
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 ifc.io;
21 import lib.MultiMethodTest;
22 import lib.Status;
23 import lib.StatusException;
25 import com.sun.star.beans.XPropertySet;
26 import com.sun.star.io.XObjectInputStream;
27 import com.sun.star.io.XObjectOutputStream;
28 import com.sun.star.io.XPersistObject;
29 import com.sun.star.uno.UnoRuntime;
31 /**
32 * Testing <code>com.sun.star.io.XObjectOutputStream</code>
33 * interface methods:
34 * <ul>
35 * <li><code>writeObject()</code></li>
36 * </ul> <p>
37 * This test needs the following object relations :
38 * <ul>
39 * <li> <code>'InputStream'</code> (of type <code>XObjectInputStream</code>)</li>
40 * persist object for testing of write to stream</ul>
41 * @see com.sun.star.io.XObjectInputStream
42 * @see com.sun.star.io.XObjectOutputStream
43 * @see com.sun.star.io.XPersistObject
45 public class _XObjectOutputStream extends MultiMethodTest {
47 public XObjectOutputStream oObj = null;
49 /**
50 * Test creates persist object, sets label of object,
51 * calls the method for created persist object
52 * and checks label of object that was read from input stream. <p>
53 * Has <b> OK </b> status if the method successfully returns
54 * and labels are equals. <p>
56 public void _writeObject() throws Exception {
57 XObjectInputStream oInStream = (XObjectInputStream)
58 tEnv.getObjRelation("InputStream");
59 if (oInStream == null) throw
60 new StatusException(Status.failed("Relation 'InputStream' failed"));
62 // use own implementation of XPersistObject, so test runs
63 // without an office
64 XPersistObject objWrite = (XPersistObject)
65 tEnv.getObjRelation("PersistObject");
66 if (objWrite == null) throw
67 new StatusException(Status.failed("Relation 'PersistObject' failed"));
69 XPropertySet propObjWrite = UnoRuntime.queryInterface(XPropertySet.class, objWrite);
71 // This XPersistObject has a property called 'String'
72 propObjWrite.setPropertyValue("String", "XObjectOutputStream");
74 log.println("Writing object with label 'XObjectOutputStream'");
75 oObj.writeObject(objWrite);
76 XPersistObject readObj = oInStream.readObject();
77 XPropertySet propSet = UnoRuntime.queryInterface(XPropertySet.class, readObj);
78 String label = (String)propSet.getPropertyValue("String");
79 log.println("Object with label '" + label + "' was read");
81 tRes.tested("writeObject()", label.equals("XObjectOutputStream")) ;