1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AccStatisticsObject.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 import java
.io
.PrintWriter
;
34 import lib
.StatusException
;
36 import lib
.TestEnvironment
;
37 import lib
.TestParameters
;
38 import util
.AccessibilityTools
;
39 import util
.SOfficeFactory
;
42 import com
.sun
.star
.accessibility
.AccessibleRole
;
43 import com
.sun
.star
.accessibility
.XAccessible
;
44 import com
.sun
.star
.accessibility
.XAccessibleComponent
;
45 import com
.sun
.star
.accessibility
.XAccessibleContext
;
46 import com
.sun
.star
.awt
.XWindow
;
47 import com
.sun
.star
.beans
.XPropertySet
;
48 import com
.sun
.star
.chart
.XChartDocument
;
49 import com
.sun
.star
.frame
.XModel
;
50 import com
.sun
.star
.lang
.XMultiServiceFactory
;
51 import com
.sun
.star
.uno
.UnoRuntime
;
52 import com
.sun
.star
.uno
.XInterface
;
54 public class AccStatisticsObject
extends TestCase
{
56 XChartDocument xChartDoc
= null;
58 protected TestEnvironment
createTestEnvironment(
59 TestParameters Param
, PrintWriter log
) {
61 if (xChartDoc
!= null) cleanup(Param
, log
);
62 log
.println( "creating a chart document" );
63 SOfficeFactory SOF
= SOfficeFactory
.getFactory( (XMultiServiceFactory
)Param
.getMSF());
65 log
.println( "creating a chartdocument" );
66 xChartDoc
= SOF
.createChartDoc(null);
67 log
.println("Display MeanValue");
68 XPropertySet diagProps
= (XPropertySet
)
69 UnoRuntime
.queryInterface(XPropertySet
.class, xChartDoc
.getDiagram());
70 diagProps
.setPropertyValue("MeanValue",new Boolean(true));
71 } catch (com
.sun
.star
.uno
.Exception e
) {
72 // Some exception occures.FAILED
73 e
.printStackTrace( log
);
74 throw new StatusException( "Couldn't create document", e
);
77 XInterface oObj
= null;
79 XModel aModel
= (XModel
)
80 UnoRuntime
.queryInterface(XModel
.class, xChartDoc
);
82 AccessibilityTools at
= new AccessibilityTools();
84 XWindow xWindow
= at
.getCurrentWindow((XMultiServiceFactory
)Param
.getMSF(), aModel
);
85 XAccessible xRoot
= at
.getAccessibleObject(xWindow
);
87 XAccessibleContext cont
= at
.getAccessibleObjectForRole(
88 xRoot
, AccessibleRole
.SHAPE
, "", "AccStatisticsObject");
93 log
.println("ImplementationName " + utils
.getImplName(oObj
));
94 log
.println("AccessibleName " + cont
.getAccessibleName());
96 TestEnvironment tEnv
= new TestEnvironment(oObj
);
98 final XAccessibleComponent acc
= (XAccessibleComponent
)
99 UnoRuntime
.queryInterface(
100 XAccessibleComponent
.class,oObj
);
101 tEnv
.addObjRelation("EventProducer",
102 new ifc
.accessibility
._XAccessibleEventBroadcaster
.EventProducer() {
103 public void fireEvent() {
113 * Called while disposing a <code>TestEnvironment</code>.
114 * Disposes text document.
115 * @param tParam test parameters
116 * @param tEnv the environment to cleanup
117 * @param log writer to log information while testing
119 protected void cleanup( TestParameters Param
, PrintWriter log
) {
120 log
.println( " closing xChartDoc " );
121 util
.DesktopTools
.closeDoc(xChartDoc
);