bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _fps / FilePicker.java
blobe54adfae90de72944b32bf91e0948cacf2423624
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._fps;
21 import java.io.PrintWriter;
23 import lib.StatusException;
24 import lib.TestCase;
25 import lib.TestEnvironment;
26 import lib.TestParameters;
28 import com.sun.star.lang.XMultiServiceFactory;
29 import com.sun.star.uno.XInterface;
31 /**
32 * Test for object which is represented by service
33 * <code>com.sun.star.ui.FilePicker</code>. <p>
34 * Object implements the following interfaces :
35 * <ul>
36 * <li> <code>com::sun::star::ui::XFilePicker</code></li>
37 * <li> <code>com::sun::star::lang::XInitialization</code></li>
38 * <li> <code>com::sun::star::lang::XServiceInfo</code></li>
39 * <li> <code>com::sun::star::lang::XTypeProvider</code></li>
40 * <li> <code>com::sun::star::ui::XExecutableDialog</code></li>
41 * <li> <code>com::sun::star::ui::XFilePickerControlAccess</code></li>
42 * <li> <code>com::sun::star::ui::XFilterManager</code></li>
43 * <li> <code>com::sun::star::lang::XComponent</code></li>
44 * <li> <code>com::sun::star::ui::XFilePickerNotifier</code></li>
45 * </ul>
46 * This object test <b> is NOT </b> designed to be run in several
47 * threads concurently.
48 * @see com.sun.star.ui.XFilePicker
49 * @see com.sun.star.lang.XInitialization
50 * @see com.sun.star.lang.XServiceInfo
51 * @see com.sun.star.lang.XTypeProvider
52 * @see com.sun.star.ui.XExecutableDialog
53 * @see com.sun.star.ui.XFilePickerControlAccess
54 * @see com.sun.star.ui.XFilterManager
55 * @see com.sun.star.lang.XComponent
56 * @see com.sun.star.ui.XFilePickerNotifier
57 * @see com.sun.star.ui.XFilePicker
58 * @see ifc.ui.dialogs._XFilePicker
59 * @see ifc.lang._XInitialization
60 * @see ifc.lang._XServiceInfo
61 * @see ifc.lang._XTypeProvider
62 * @see ifc.ui.dialogs._XExecutableDialog
63 * @see ifc.ui.dialogs._XFilePickerControlAccess
64 * @see ifc.ui.dialogs._XFilterManager
65 * @see ifc.lang._XComponent
66 * @see ifc.ui.dialogs._XFilePickerNotifier
68 public class FilePicker extends TestCase {
70 /**
71 * Creating a Testenvironment for the interfaces to be tested.
72 * Creates an instance of the service
73 * <code>com.sun.star.ui.FilePicker</code>. <p>
74 * Object relations created :
75 * <ul>
76 * <li> <code>'XInitialization.args'</code> for
77 * {@link ifc.lang._XInitialization} : argument
78 * for creating dialog from teamplate. </li>
79 * <li> <code>'XFilePickerControlAccess.ControlID'</code> for
80 * {@link ifc.ui.dialogs._XFilePickerControlAccess} : here
81 * it is identifier of check box.</li>
82 * <li> <code>'XFilePickerControlAccess.ControlValue'</code> for
83 * {@link ifc.ui.dialogs._XFilePickerControlAccess} :
84 * The value for control to set (since the initial value
85 * of the control is empty) .</li>
86 * </ul>
88 public TestEnvironment createTestEnvironment( TestParameters Param,
89 PrintWriter log )
90 throws StatusException {
91 XInterface oObj = null;
92 Object oInterface = null;
93 XMultiServiceFactory xMSF = (XMultiServiceFactory)Param.getMSF();
95 Object[] iniArgs = new Object[] { new Short
96 (com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_READONLY_VERSION)};
97 short ctrlId =
98 com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_READONLY;
99 try {
100 oInterface = xMSF.createInstance
101 ( "com.sun.star.ui.dialogs.FilePicker" );
102 } catch( com.sun.star.uno.Exception e ) {
103 log.println("Can't create an object." );
104 throw new StatusException( "Can't create an object", e );
107 oObj = (XInterface) oInterface;
109 TestEnvironment tEnv = new TestEnvironment( oObj );
111 // adding relation for XInitialization
112 tEnv.addObjRelation("XInitialization.args", iniArgs) ;
114 // adding relation for XFilePickerControlAccess
115 tEnv.addObjRelation("XFilePickerControlAccess.ControlID",
116 new Short(ctrlId)) ;
117 tEnv.addObjRelation("XFilePickerControlAccess.ControlValue",
118 Boolean.FALSE) ;
120 return tEnv;
121 } // finish method getTestEnvironment