merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / mod / _forms / OScrollBarModel.java
blobcc1f0e3b626ade8f5a6bc9f74b7eb30ae0d73f34
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: OScrollBarModel.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 ************************************************************************/
31 package mod._forms;
33 import com.sun.star.beans.PropertyValue;
34 import com.sun.star.drawing.XControlShape;
35 import com.sun.star.drawing.XShape;
36 import com.sun.star.lang.XMultiServiceFactory;
37 import com.sun.star.text.XTextDocument;
38 import com.sun.star.uno.UnoRuntime;
39 import com.sun.star.uno.XInterface;
40 import com.sun.star.util.XCloseable;
41 import java.io.PrintWriter;
42 import lib.TestCase;
43 import lib.TestEnvironment;
44 import lib.TestParameters;
45 import util.FormTools;
46 import util.WriterTools;
48 public class OScrollBarModel extends TestCase {
50 XTextDocument xTextDoc;
52 /**
53 * Creates Writer document.
55 protected void initialize( TestParameters tParam, PrintWriter log ) {
57 log.println( "creating a textdocument" );
58 xTextDoc = WriterTools.createTextDoc(((XMultiServiceFactory) tParam.getMSF()));
61 /**
62 * Disposes the Writer document.
64 protected void cleanup(TestParameters tParam, PrintWriter log) {
65 log.println(" disposing xTextDoc ");
67 try {
68 XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
69 XCloseable.class, xTextDoc);
70 closer.close(true);
71 } catch (com.sun.star.util.CloseVetoException e) {
72 log.println("couldn't close document");
73 } catch (com.sun.star.lang.DisposedException e) {
74 log.println("couldn't close document");
78 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
80 XInterface oObj = null;
82 XControlShape aShape = FormTools.createControlShape(
83 xTextDoc,3000,4500,15000,10000,"ScrollBar");
85 WriterTools.getDrawPage(xTextDoc).add((XShape) aShape);
86 oObj = aShape.getControl();
87 log.println( "creating a new environment for OScrollBarModel object" );
88 TestEnvironment tEnv = new TestEnvironment( oObj );
90 System.out.println("Implementation Name: "+util.utils.getImplName(oObj));
92 String objName = "ScrollBar";
93 tEnv.addObjRelation("OBJNAME", "com.sun.star.form.component." + objName);
94 PropertyValue prop = new PropertyValue();
95 prop.Name = "HelpText";
96 prop.Value = "new Help Text since XPropertyAccess";
97 tEnv.addObjRelation("XPropertyAccess.propertyToChange", prop);
98 tEnv.addObjRelation("XPropertyContainer.propertyNotRemovable", "HelpText");
99 return tEnv;