bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _forms / OSpinButtonModel.java
blob3dea0c2f06e56ae0b0789e0cc2cf5c690a7aa4aa
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._forms;
21 import com.sun.star.beans.PropertyValue;
22 import com.sun.star.drawing.XControlShape;
23 import com.sun.star.lang.XMultiServiceFactory;
24 import com.sun.star.text.XTextDocument;
25 import com.sun.star.uno.UnoRuntime;
26 import com.sun.star.uno.XInterface;
27 import com.sun.star.util.XCloseable;
28 import java.io.PrintWriter;
29 import lib.TestCase;
30 import lib.TestEnvironment;
31 import lib.TestParameters;
32 import util.FormTools;
33 import util.WriterTools;
35 public class OSpinButtonModel extends TestCase {
37 XTextDocument xTextDoc;
39 /**
40 * Creates a Writer document.
42 protected void initialize( TestParameters tParam, PrintWriter log ) {
44 log.println( "creating a textdocument" );
45 xTextDoc = WriterTools.createTextDoc(((XMultiServiceFactory) tParam.getMSF()));
48 /**
49 * Disposes the Writer document.
51 protected void cleanup(TestParameters tParam, PrintWriter log) {
52 log.println(" disposing xTextDoc ");
54 try {
55 XCloseable closer = UnoRuntime.queryInterface(
56 XCloseable.class, xTextDoc);
57 closer.close(true);
58 } catch (com.sun.star.util.CloseVetoException e) {
59 log.println("couldn't close document");
60 } catch (com.sun.star.lang.DisposedException e) {
61 log.println("couldn't close document");
66 /**
67 * Creating a Testenvironment for the interfaces to be tested.
68 * Adds spin button into text and retrieves it's control model.
70 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
72 XInterface oObj = null;
74 XControlShape aShape = FormTools.createControlShape(
75 xTextDoc,3000,4500,15000,10000,"SpinButton");
77 WriterTools.getDrawPage(xTextDoc).add(aShape);
78 oObj = aShape.getControl();
79 log.println( "creating a new environment for OButtonModel object" );
80 TestEnvironment tEnv = new TestEnvironment( oObj );
81 tEnv.addObjRelation("OBJNAME", "com.sun.star.form.component.SpinButton");
82 PropertyValue prop = new PropertyValue();
83 prop.Name = "HelpText";
84 prop.Value = "new Help Text since XPropertyAccess";
85 tEnv.addObjRelation("XPropertyAccess.propertyToChange", prop);
86 tEnv.addObjRelation("XPropertyContainer.propertyNotRemovable", "HelpText");
88 System.out.println("Implementation name: "+util.utils.getImplName(oObj));
89 return tEnv;
90 } // finish method getTestEnvironment