tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / text / _XAutoTextEntry.java
blob5f9b19634cdc80bdec7ea762721592a3161b7919
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 ifc.text;
21 import lib.MultiMethodTest;
22 import lib.Status;
23 import lib.StatusException;
25 import com.sun.star.text.XAutoTextEntry;
26 import com.sun.star.text.XTextDocument;
28 /**
29 * Testing <code>com.sun.star.text.XAutoTextEntry</code>
30 * interface methods :
31 * <ul>
32 * <li><code> applyTo()</code></li>
33 * </ul> <p>
34 * This test needs the following object relations :
35 * <ul>
36 * <li> <code>'TEXTDOC'</code> (of type <code>XTextDocument</code>):
37 * the text document for creating a text range.</li>
38 * <ul> <p>
39 * Test is <b> NOT </b> multithread compliant. <p>
40 * @see com.sun.star.text.XAutoTextEntry
42 public class _XAutoTextEntry extends MultiMethodTest {
44 public XAutoTextEntry oObj = null;
46 /**
47 * Applies the entry to a range created for the text document obtained from
48 * relation 'TEXTDOC'. <p>
49 * Has <b> OK </b> status if text of the document was changed. <p>
51 public void _applyTo() {
52 XTextDocument textDoc = (XTextDocument)tEnv.getObjRelation("TEXTDOC");
53 if (textDoc == null) {
54 throw new StatusException
55 (Status.failed("Couldn't get relation 'TEXTDOC'"));
58 String oldText = textDoc.getText().getString();
59 oObj.applyTo(textDoc.getText().createTextCursor());
60 String newText = textDoc.getText().getString();
62 log.println("Old text:\n" + oldText + "\nNew text:\n" + newText);
64 tRes.tested("applyTo()", ! newText.equals(oldText));
67 } // finish class _XAutoTextEntry