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 .
21 import java
.io
.PrintWriter
;
24 import lib
.TestEnvironment
;
25 import lib
.TestParameters
;
26 import util
.AccessibilityTools
;
27 import util
.SOfficeFactory
;
30 import com
.sun
.star
.accessibility
.AccessibleRole
;
31 import com
.sun
.star
.accessibility
.XAccessible
;
32 import com
.sun
.star
.accessibility
.XAccessibleAction
;
33 import com
.sun
.star
.awt
.XExtendedToolkit
;
34 import com
.sun
.star
.awt
.XWindow
;
35 import com
.sun
.star
.beans
.PropertyValue
;
36 import com
.sun
.star
.uno
.UnoRuntime
;
37 import com
.sun
.star
.uno
.XInterface
;
39 public class ScAccessibleCsvGrid
extends TestCase
{
41 static XAccessibleAction accAction
= null;
44 * Called to create an instance of <code>TestEnvironment</code> with an
45 * object to test and related objects. Subclasses should implement this
46 * method to provide the implementation and related objects. The method is
47 * called from <code>getTestEnvironment()</code>.
49 * @param Param test parameters
50 * @param log writer to log information while testing
52 * @see TestEnvironment
53 * @see #getTestEnvironment
56 protected TestEnvironment
createTestEnvironment(TestParameters Param
, PrintWriter log
) throws Exception
{
58 XInterface oObj
= (XInterface
) Param
.getMSF().createInstance
59 ("com.sun.star.awt.Toolkit") ;
61 XExtendedToolkit tk
= UnoRuntime
.queryInterface(XExtendedToolkit
.class,oObj
);
63 XWindow xWindow
= UnoRuntime
.queryInterface(XWindow
.class,tk
.getActiveTopWindow());
65 XAccessible xRoot
= AccessibilityTools
.getAccessibleObject(xWindow
);
67 oObj
= AccessibilityTools
.getAccessibleObjectForRole
68 (xRoot
, AccessibleRole
.PUSH_BUTTON
, "Cancel");
70 accAction
= UnoRuntime
.queryInterface(XAccessibleAction
.class, oObj
);
72 oObj
= AccessibilityTools
.getAccessibleObjectForRole
73 (xRoot
, AccessibleRole
.TABLE
, true);
75 log
.println("ImplementationName " + utils
.getImplName(oObj
));
77 TestEnvironment tEnv
= new TestEnvironment(oObj
);
83 * Called while disposing a <code>TestEnvironment</code>.
84 * Disposes calc document.
85 * @param Param test parameters
86 * @param log writer to log information while testing
89 protected void cleanup( TestParameters Param
, PrintWriter log
) {
90 log
.println( " closing Dialog " );
92 accAction
.doAccessibleAction(0);
93 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException iae
) {
94 log
.println("Couldn't close dialog");
99 * Called while the <code>TestCase</code> initialization. In the
100 * implementation does nothing. Subclasses can override to initialize
101 * objects shared among all <code>TestEnvironment</code>s.
103 * @param Param test parameters
104 * @param log writer to log information while testing
106 * @see #initializeTestCase
109 protected void initialize(TestParameters Param
, PrintWriter log
) throws Exception
{
110 // get a soffice factory object
111 SOfficeFactory SOF
= SOfficeFactory
.getFactory( Param
.getMSF());
113 log
.println("opening dialog");
115 PropertyValue
[] args
= new PropertyValue
[1];
117 args
[0] = new PropertyValue();
118 args
[0].Name
= "InteractionHandler";
119 args
[0].Value
= Param
.getMSF().createInstance(
120 "com.sun.star.comp.uui.UUIInteractionHandler");
121 } catch(com
.sun
.star
.uno
.Exception e
) {
124 String url
= utils
.getFullTestURL("10test.csv");
125 log
.println("loading "+url
);
126 SOF
.loadDocument(url
,args
);