bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / ucb / _XDataContainer.java
blob24a474a64772376a20e2b4f6b5dc7d5e4e80b98c
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.ucb;
21 import lib.MultiMethodTest;
23 import com.sun.star.lang.XMultiServiceFactory;
24 import com.sun.star.ucb.XDataContainer;
26 /**
27 * Testing <code>com.sun.star.ucb.XDataContainer</code>
28 * interface methods :
29 * <ul>
30 * <li><code> getContentType()</code></li>
31 * <li><code> setContentType()</code></li>
32 * <li><code> getData()</code></li>
33 * <li><code> setData()</code></li>
34 * <li><code> getDataURL()</code></li>
35 * <li><code> setDataURL()</code></li>
36 * </ul> <p>
37 * Test is <b> NOT </b> multithread compilant. <p>
38 * @see com.sun.star.ucb.XDataContainer
40 public class _XDataContainer extends MultiMethodTest {
42 public static XDataContainer oObj = null; // oObj filled by MultiMethodTest
43 private byte[] data = new byte[] {34, 35, 36} ;
44 private String dataURL = null;
46 /**
47 * Sets the content type to some value. <p>
48 * Has <b>OK</b> status if no runtime exseptions occurred.
50 public void _setContentType() {
51 oObj.setContentType("image/jpeg") ;
52 tRes.tested("setContentType()", true) ;
55 /**
56 * Check if values 'set' and 'get' are equal. <p>
57 * Has <b>OK</b> status if they are equal. <p>
58 * The following method tests are to be completed successfully before :
59 * <ul>
60 * <li> <code> setContentType() </code> </li>
61 * </ul>
63 public void _getContentType() {
64 requiredMethod("setContentType()") ;
66 String type = oObj.getContentType() ;
67 tRes.tested("getContentType()", "image/jpeg".equals(type)) ;
70 /**
71 * Sets the data to some byte array. <p>
72 * Has <b>OK</b> status if no runtime exseptions occurred.
74 public void _setData() {
75 oObj.setData(data) ;
76 tRes.tested("setData()", true) ;
79 /**
80 * Check if arrays 'set' and 'get' are equal. <p>
81 * Has <b>OK</b> status if they are equal. <p>
82 * The following method tests are to be completed successfully before :
83 * <ul>
84 * <li> <code> setData() </code> </li>
85 * </ul>
87 public void _getData() {
88 requiredMethod("setData()") ;
90 byte[] gData = oObj.getData() ;
91 boolean res = true ;
92 if (res = (gData != null && gData.length == data.length)) {
93 for (int i = 0; i < data.length; i++) {
94 res &= data[i] == gData[i] ;
98 tRes.tested("getData()", res) ;
102 * Sets the data URL to some URL. <p>
103 * Has <b>OK</b> status if no runtime exseptions occurred.
105 public void _setDataURL() {
106 dataURL = util.utils.getOfficeTemp((XMultiServiceFactory)tParam.getMSF()) ;
107 oObj.setDataURL(dataURL) ;
108 tRes.tested("setDataURL()", true) ;
112 * Check if URLs 'set' and 'get' are equal. <p>
113 * Has <b>OK</b> status if they are equal. <p>
114 * The following method tests are to be completed successfully before :
115 * <ul>
116 * <li> <code> setDataURL() </code> </li>
117 * </ul>
119 public void _getDataURL() {
120 requiredMethod("setDataURL()") ;
122 String gURL = oObj.getDataURL() ;
123 tRes.tested("getDataURL()", dataURL.equals(gURL)) ;