bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _qadevOOo / SelfTest.java
blobb81b5e8326e5e6d78a75d4ce61a032762d673414
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._qadevOOo;
20 import com.sun.star.lang.XMultiServiceFactory;
21 import com.sun.star.uno.XInterface;
23 import java.io.PrintWriter;
25 import lib.StatusException;
26 import lib.TestCase;
27 import lib.TestEnvironment;
28 import lib.TestParameters;
30 import util.SOfficeFactory;
32 import com.sun.star.text.XSimpleText;
33 import com.sun.star.text.XTextCursor;
34 import com.sun.star.text.XTextDocument;
36 public class SelfTest extends TestCase
38 private XTextDocument xTextDoc = null;
40 protected void initialize(TestParameters tParam, PrintWriter log)
42 // get a soffice factory object
43 SOfficeFactory SOF = SOfficeFactory.getFactory((XMultiServiceFactory) tParam.getMSF());
45 log.println("initialize the selftest");
46 try
48 log.println("creating a textdocument");
49 xTextDoc = SOF.createTextDoc(null);
51 catch (com.sun.star.uno.Exception e)
53 e.printStackTrace(log);
54 throw new StatusException("Couldn't create document", e);
58 /**
59 * Disposes text document.
61 protected void cleanup(TestParameters tParam, PrintWriter log)
63 log.println(" cleanup selftest");
64 util.DesktopTools.closeDoc(xTextDoc);
67 protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log)
69 XInterface oObj = null;
70 log.println("creating a test environment");
72 // get the bodytext of textdocument here
73 log.println("getting the TextCursor");
75 final XSimpleText aText = xTextDoc.getText();
76 final XTextCursor textCursor = aText.createTextCursor();
77 oObj = textCursor;
79 TestEnvironment tEnv = new TestEnvironment(oObj);
81 return tEnv;