Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / qadevOOo / tests / java / ifc / sheet / _XSheetAnnotationAnchor.java
blob76a5b97b0aaf148f3847c40d2554e98fbef5d9f3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 package ifc.sheet;
30 import lib.MultiMethodTest;
32 import com.sun.star.sheet.XSheetAnnotation;
33 import com.sun.star.sheet.XSheetAnnotationAnchor;
34 import com.sun.star.table.CellAddress;
35 import com.sun.star.text.XSimpleText;
36 import com.sun.star.uno.UnoRuntime;
38 /**
39 * Testing <code>com.sun.star.sheet.XSheetAnnotationAnchor</code>
40 * interface methods :
41 * <ul>
42 * <li><code> getAnnotation()</code></li>
43 * </ul>
44 * @see com.sun.star.sheet.XSheetAnnotationAnchor
46 public class _XSheetAnnotationAnchor extends MultiMethodTest {
48 public XSheetAnnotationAnchor oObj = null;
49 protected XSheetAnnotation anno = null;
51 public void _getAnnotation() {
52 anno = oObj.getAnnotation();
53 tRes.tested("getAnnotation()",checkAnnotation());
56 protected boolean checkAnnotation() {
57 boolean res = true;
58 res &= check_getAuthor();
59 res &= check_getDate();
60 res &= check_getIsVisible();
61 res &= check_getPosition();
62 res &= check_setIsVisible();
63 return res;
66 /**
67 * Gets the author of annotation. <p>
68 * Returns <b>true</b> if not null value returned.
70 protected boolean check_getAuthor() {
71 String author = anno.getAuthor();
72 return (author != null);
75 /**
76 * Gets the modification date of annotation. <p>
77 * Returns <b>true</b> if not null value returned.
79 protected boolean check_getDate() {
80 String date = anno.getDate();
81 return (date != null);
84 /**
85 * Sets the string of annotation, then makes it visible and
86 * checks the value returned by <code>getIsVisible</code> method. <p>
87 * Returns <b>true</b> if the method returns <code>true</code>.
89 protected boolean check_getIsVisible() {
90 XSimpleText oText = (XSimpleText)
91 UnoRuntime.queryInterface(XSimpleText.class, anno);
92 oText.setString("XSheetAnnotation");
93 anno.setIsVisible(true);
94 boolean bVis = anno.getIsVisible();
95 return bVis;
98 /**
99 * Gets the position of annotated cell
100 * Returns <b>true</b> if this position is not null.
102 protected boolean check_getPosition() {
103 CellAddress oCAddr = anno.getPosition();
104 return (oCAddr != null);
108 * Sets the string of annotation, makes it hidden and then
109 * visible. Visibility is checked in both cases. <p>
110 * Returns <b>true</b> if the <code>getIsVisible</code> method
111 * returns <code>false</code> in the first case and <code>true</code>
112 * in the second.
114 protected boolean check_setIsVisible() {
115 boolean bResult = true;
116 XSimpleText oText = (XSimpleText)
117 UnoRuntime.queryInterface(XSimpleText.class, anno);
118 oText.setString("XSheetAnnotation");
119 anno.setIsVisible(false);
120 boolean bVis = anno.getIsVisible();
121 if (!bVis) {
122 anno.setIsVisible(true);
123 bVis = anno.getIsVisible();
124 if (bVis) {
125 bResult = true;
129 return bResult;