merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / mod / _cfgmgr2 / OInnerGroupUpdateAccess.java
blob229acd974bd0b78733706628c175410db9fb4866
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: OInnerGroupUpdateAccess.java,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
30 package mod._cfgmgr2;
32 import java.io.PrintWriter;
34 import lib.TestCase;
35 import lib.TestEnvironment;
36 import lib.TestParameters;
37 import util.utils;
39 import com.sun.star.beans.PropertyState;
40 import com.sun.star.beans.PropertyValue;
41 import com.sun.star.container.XNameAccess;
42 import com.sun.star.container.XNameReplace;
43 import com.sun.star.lang.XMultiServiceFactory;
44 import com.sun.star.uno.UnoRuntime;
45 import com.sun.star.uno.XInterface;
48 public class OInnerGroupUpdateAccess extends TestCase {
49 /** Called to create an instance of <code>TestEnvironment</code> with an
50 * object to test and related objects. <br>
52 * An instance of com.sun.star.comp.configuration.ConfigurationProvider
53 * is created at the MultiServiceFactory of the Office<br>
54 * At this an instance of com.sun.star.configuration.ConfigurationAccess is created
55 * and from the resulting XNameAccess the first element is taken.
57 * @param tParam test parameters
58 * @param log writer to log information while testing
60 * @see TestEnvironment
61 * @see #getTestEnvironment()
64 protected TestEnvironment createTestEnvironment(TestParameters tParam,
65 PrintWriter log) {
66 XInterface oObj = null;
67 log.println("creating the Environment");
69 PropertyValue[] nodeArgs = new PropertyValue[1];
70 PropertyValue nodepath = new PropertyValue();
71 nodepath.Name = "nodepath";
72 nodepath.Value = "org.openoffice.Office.Common";
73 nodepath.Handle = -1;
74 nodepath.State = PropertyState.DEFAULT_VALUE;
75 nodeArgs[0] = nodepath;
77 try {
78 XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF())
79 .createInstance("com.sun.star.comp.configuration.ConfigurationProvider");
80 XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(
81 XMultiServiceFactory.class,
82 Provider);
83 XNameAccess names = (XNameAccess) UnoRuntime.queryInterface(
84 XNameAccess.class,
85 pMSF.createInstanceWithArguments(
86 "com.sun.star.configuration.ConfigurationUpdateAccess",
87 nodeArgs));
88 oObj = (XInterface) names.getByName(names.getElementNames()[0]);
90 names = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class,
91 oObj);
93 String[] theNames = names.getElementNames();
95 log.println("Contains " + theNames.length + " elements");
96 } catch (com.sun.star.uno.Exception e) {
97 e.printStackTrace();
100 log.println("ImplementationName: " + utils.getImplName(oObj));
102 TestEnvironment tEnv = new TestEnvironment(oObj);
104 String[] pNames = new String[] {
105 "AutoDetectSystemHC", "HelpTipSeconds", "IsAllowAnimatedGraphics",
106 "IsAllowAnimatedText", "IsAutomaticFontColor", "IsForPagePreviews",
107 "IsHelpTipsDisappear", "IsSelectionInReadonly", "IsSystemFont"
110 String[] pTypes = new String[] {
111 "Boolean", "Short", "Boolean", "Boolean", "Boolean", "Boolean",
112 "Boolean", "Boolean", "Boolean"
115 tEnv.addObjRelation("PropertyNames", pNames);
116 tEnv.addObjRelation("PropertyTypes", pTypes);
118 tEnv.addObjRelation("ElementName", "AutoDetectSystemHC");
120 tEnv.addObjRelation("cannotSwitchParent",
121 "configmgr: BasicElement::setParent: cannot move Entry");
123 tEnv.addObjRelation("expectedName", "IsSelectionInReadonly");
124 tEnv.addObjRelation("HierachicalName", "/org.openoffice.Office");
126 Short val = new Short((short)3);
127 tEnv.addObjRelation("INSTANCE1", val);
128 tEnv.addObjRelation("NAMEREPLACE", pNames[1]);
129 tEnv.addObjRelation("XContainer.NewValue", val);
130 tEnv.addObjRelation("XContainer.ElementName", pNames[1]);
131 tEnv.addObjRelation("XContainer.Container", (XNameReplace)
132 UnoRuntime.queryInterface(XNameReplace.class, oObj));
133 tEnv.addObjRelation("NoSetName", "OInnerGroupInfoAccess");
135 return tEnv;