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 .
20 import com
.sun
.star
.drawing
.XControlShape
;
21 import com
.sun
.star
.lang
.XMultiServiceFactory
;
22 import com
.sun
.star
.text
.XTextDocument
;
23 import com
.sun
.star
.uno
.XInterface
;
25 import java
.io
.PrintWriter
;
27 import lib
.StatusException
;
29 import lib
.TestEnvironment
;
30 import lib
.TestParameters
;
32 import util
.FormTools
;
33 import util
.WriterTools
;
37 public class TabControllerModel
extends TestCase
{
38 private static XTextDocument xTextDoc
;
40 protected void initialize(TestParameters param
, PrintWriter log
) {
42 log
.println("creating a textdocument");
43 xTextDoc
= WriterTools
.createTextDoc(
44 (XMultiServiceFactory
) param
.getMSF());
45 } catch (Exception e
) {
46 e
.printStackTrace(log
);
47 throw new StatusException("Couldn't create document", e
);
51 protected void cleanup(TestParameters param
, PrintWriter log
) {
52 log
.println("disposing xTextDoc");
53 util
.DesktopTools
.closeDoc(xTextDoc
);
56 public TestEnvironment
createTestEnvironment(TestParameters param
,
58 XInterface oObj
= null;
60 log
.println("inserting some ControlShapes");
62 XControlShape shape1
= FormTools
.createControlShape(xTextDoc
, 3000,
65 XControlShape shape2
= FormTools
.createControlShape(xTextDoc
, 5000,
70 oObj
= (XInterface
) ((XMultiServiceFactory
) param
.getMSF()).createInstance(
71 "com.sun.star.awt.TabControllerModel");
72 } catch (Exception e
) {
73 e
.printStackTrace(log
);
74 throw new StatusException("Couldn't create " +
75 "TabControllerModel", e
);
78 log
.println("creating a new environment for TabControllerModel");
80 TestEnvironment tEnv
= new TestEnvironment(oObj
);
82 tEnv
.addObjRelation("OBJNAME",
83 "stardiv.vcl.controlmodel.TabController");
84 tEnv
.addObjRelation("Model1", shape1
.getControl());
85 tEnv
.addObjRelation("Model2", shape2
.getControl());
88 //Object Relation for XPersistObject
89 tEnv
.addObjRelation("noPS", new Boolean(true));
91 System
.out
.println("ImplementationName: " + utils
.getImplName(oObj
));
94 } // finish method getTestEnvironment
95 } // finish class TabControllerModel