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 .
21 import java
.io
.PrintWriter
;
23 import lib
.StatusException
;
25 import lib
.TestEnvironment
;
26 import lib
.TestParameters
;
27 import util
.SOfficeFactory
;
29 import com
.sun
.star
.lang
.XMultiServiceFactory
;
30 import com
.sun
.star
.text
.XTextDocument
;
31 import com
.sun
.star
.text
.XTextViewCursorSupplier
;
32 import com
.sun
.star
.uno
.UnoRuntime
;
33 import com
.sun
.star
.uno
.XInterface
;
37 * @see com.sun.star.beans.XPropertySet
38 * @see com.sun.star.beans.XPropertyState
39 * @see com.sun.star.document.XDocumentInsertable
40 * @see com.sun.star.style.CharacterProperties
41 * @see com.sun.star.style.ParagraphProperties
42 * @see com.sun.star.text.XPageCursor
43 * @see com.sun.star.text.XParagraphCursor
44 * @see com.sun.star.text.XSentenceCursor
45 * @see com.sun.star.text.XTextCursor
46 * @see com.sun.star.text.XTextRange
47 * @see com.sun.star.text.XWordCursor
48 * @see com.sun.star.util.XSortable
49 * @see com.sun.star.view.XScreenCursor
52 public class SwXTextViewCursor
extends TestCase
{
53 XTextDocument xTextDoc
;
55 protected void initialize( TestParameters tParam
, PrintWriter log
) {
56 SOfficeFactory SOF
= SOfficeFactory
.getFactory( (XMultiServiceFactory
)tParam
.getMSF() );
59 log
.println( "creating a textdocument" );
60 xTextDoc
= SOF
.createTextDoc( null );
61 } catch ( com
.sun
.star
.uno
.Exception e
) {
62 // Some exception occurs.FAILED
63 e
.printStackTrace( log
);
64 throw new StatusException( "Couldn't create document", e
);
68 protected void cleanup( TestParameters tParam
, PrintWriter log
) {
69 log
.println( " disposing xTextDoc " );
70 util
.DesktopTools
.closeDoc(xTextDoc
);
75 * creating a Testenvironment for the interfaces to be tested
77 * @param tParam class which contains additional test parameters
78 * @param log class to log the test state and result
80 * @return Status class
85 public synchronized TestEnvironment createTestEnvironment
86 (TestParameters tParam
, PrintWriter log
) {
88 XInterface oObj
= null;
90 // creation of testobject here
91 // first we write what we are intend to do to log file
92 log
.println( "creating a test environment" );
94 // create testobject here
95 oObj
= xTextDoc
.getCurrentController();
97 XTextViewCursorSupplier oTVCSupp
= UnoRuntime
.queryInterface(XTextViewCursorSupplier
.class, oObj
);
99 oObj
= oTVCSupp
.getViewCursor();
101 log
.println( "creating a new environment for TextViewCursor object" );
102 TestEnvironment tEnv
= new TestEnvironment( oObj
);
104 log
.println( "adding TextDocument as mod relation to environment" );
105 tEnv
.addObjRelation("TEXTDOC", xTextDoc
);
106 tEnv
.addObjRelation("XTEXT", xTextDoc
.getText());
109 } // finish method getTestEnvironment
112 } // finish class SwXTextViewCursor