bump product version to 5.0.4.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _toolkit / TabControllerModel.java
blobb7e9e1d56d67672a99a0a20eb400593ebaf1669b
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 .
18 package mod._toolkit;
20 import com.sun.star.drawing.XControlShape;
21 import com.sun.star.text.XTextDocument;
22 import com.sun.star.uno.XInterface;
24 import java.io.PrintWriter;
26 import lib.StatusException;
27 import lib.TestCase;
28 import lib.TestEnvironment;
29 import lib.TestParameters;
31 import util.FormTools;
32 import util.WriterTools;
33 import util.utils;
36 public class TabControllerModel extends TestCase {
37 private static XTextDocument xTextDoc;
39 @Override
40 protected void initialize(TestParameters param, PrintWriter log) {
41 try {
42 log.println("creating a textdocument");
43 xTextDoc = WriterTools.createTextDoc(
44 param.getMSF());
45 } catch (Exception e) {
46 e.printStackTrace(log);
47 throw new StatusException("Couldn't create document", e);
51 @Override
52 protected void cleanup(TestParameters param, PrintWriter log) {
53 log.println("disposing xTextDoc");
54 util.DesktopTools.closeDoc(xTextDoc);
57 @Override
58 public TestEnvironment createTestEnvironment(TestParameters param,
59 PrintWriter log) {
60 XInterface oObj = null;
62 log.println("inserting some ControlShapes");
64 XControlShape shape1 = FormTools.createControlShape(xTextDoc, 3000,
65 4500, 15000, 1000,
66 "CommandButton");
67 XControlShape shape2 = FormTools.createControlShape(xTextDoc, 5000,
68 3500, 7500, 5000,
69 "TextField");
71 try {
72 oObj = (XInterface) param.getMSF().createInstance(
73 "com.sun.star.awt.TabControllerModel");
74 } catch (Exception e) {
75 e.printStackTrace(log);
76 throw new StatusException("Couldn't create " +
77 "TabControllerModel", e);
80 log.println("creating a new environment for TabControllerModel");
82 TestEnvironment tEnv = new TestEnvironment(oObj);
84 tEnv.addObjRelation("OBJNAME",
85 "stardiv.vcl.controlmodel.TabController");
86 tEnv.addObjRelation("Model1", shape1.getControl());
87 tEnv.addObjRelation("Model2", shape2.getControl());
90 //Object Relation for XPersistObject
91 tEnv.addObjRelation("noPS", Boolean.TRUE);
93 System.out.println("ImplementationName: " + utils.getImplName(oObj));
95 return tEnv;
96 } // finish method getTestEnvironment
97 } // finish class TabControllerModel