tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / drawing / _XDrawView.java
blob30f54f67daa19dceeeb2ec27b4a30ed545860dae
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.drawing;
21 import lib.MultiMethodTest;
23 import com.sun.star.drawing.XDrawPage;
24 import com.sun.star.drawing.XDrawPages;
25 import com.sun.star.drawing.XDrawView;
26 import com.sun.star.uno.AnyConverter;
27 import com.sun.star.uno.Type;
29 /**
30 * Testing <code>com.sun.star.drawing.XDrawView</code>
31 * interface methods :
32 * <ul>
33 * <li><code> setCurrentPage()</code></li>
34 * <li><code> getCurrentPage()</code></li>
35 * </ul> <p>
36 * This test needs the following object relations :
37 * <ul>
38 * <li> <code>'Pages'</code> (of type <code>XDrawPages</code>):
39 * needed to have the access to pages collection.</li>
40 * <ul> <p>
41 * Test is <b> NOT </b> multithread compliant. <p>
42 * @see com.sun.star.drawing.XDrawView
44 public class _XDrawView extends MultiMethodTest {
46 public XDrawView oObj = null;
47 public XDrawPage the_page = null;
49 /**
50 * This methods gets the current DrawPage.<p>
51 * Has <b> OK </b> status if the returned DrawPage
52 * isn't empty.
54 public void _getCurrentPage(){
55 the_page = oObj.getCurrentPage();
56 tRes.tested("getCurrentPage()",the_page != null);
57 } // end getCurrentPage
59 /**
60 * This methods sets the current DrawPage<br>
61 * First a new DrawPage is inserted in the document.
62 * Then this DrawPage is set as current Page.
63 * Has <b> OK </b> status if the getCurrentPage() method returns
64 * the DrawPage that was previously set.
65 * @see ifc.drawing._XDrawPages
66 * The following method tests are to be completed successfully before :
67 * <ul>
68 * <li> <code> getCurrentPage() </code> </li>
69 * </ul>
71 public void _setCurrentPage(){
72 requiredMethod("getCurrentPage()");
73 try {
74 XDrawPages the_pages = (XDrawPages) tEnv.getObjRelation("Pages");
75 the_pages.insertNewByIndex(0);
76 XDrawPage newPage = (XDrawPage) AnyConverter.toObject(
77 new Type(XDrawPage.class),the_pages.getByIndex(1));
78 oObj.setCurrentPage(newPage);
79 XDrawPage getting = oObj.getCurrentPage();
80 boolean eq = newPage.equals(getting);
81 if (!eq) {
82 log.println("Getting: "+getting.hasElements());
83 log.println("Expected: "+newPage.hasElements());
85 //back to the previous page
86 oObj.setCurrentPage(the_page);
87 tRes.tested("setCurrentPage()",eq);
88 } catch (com.sun.star.lang.WrappedTargetException ex) {
89 log.println("Exception occurred while checking 'setCurrentPage()'");
90 ex.printStackTrace(log);
91 tRes.tested("setCurrentPage()",false);
92 } catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
93 log.println("Exception occurred while checking 'setCurrentPage()'");
94 ex.printStackTrace(log);
95 tRes.tested("setCurrentPage()",false);
96 } catch (com.sun.star.lang.IllegalArgumentException ex) {
97 log.println("Exception occurred while checking 'setCurrentPage()'");
98 ex.printStackTrace(log);
99 tRes.tested("setCurrentPage()",false);
101 } // end setCurrentPage
103 } // end DrawView