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 lib
.MultiMethodTest
;
23 import com
.sun
.star
.sheet
.XSheetAnnotation
;
24 import com
.sun
.star
.sheet
.XSheetAnnotationAnchor
;
25 import com
.sun
.star
.table
.CellAddress
;
26 import com
.sun
.star
.text
.XSimpleText
;
27 import com
.sun
.star
.uno
.UnoRuntime
;
30 * Testing <code>com.sun.star.sheet.XSheetAnnotationAnchor</code>
33 * <li><code> getAnnotation()</code></li>
35 * @see com.sun.star.sheet.XSheetAnnotationAnchor
37 public class _XSheetAnnotationAnchor
extends MultiMethodTest
{
39 public XSheetAnnotationAnchor oObj
= null;
40 protected XSheetAnnotation anno
= null;
42 public void _getAnnotation() {
43 anno
= oObj
.getAnnotation();
44 tRes
.tested("getAnnotation()",checkAnnotation());
47 protected boolean checkAnnotation() {
49 res
&= check_getAuthor();
50 res
&= check_getDate();
51 res
&= check_getIsVisible();
52 res
&= check_getPosition();
53 res
&= check_setIsVisible();
58 * Gets the author of annotation. <p>
59 * Returns <b>true</b> if not null value returned.
61 protected boolean check_getAuthor() {
62 String author
= anno
.getAuthor();
63 return (author
!= null);
67 * Gets the modification date of annotation. <p>
68 * Returns <b>true</b> if not null value returned.
70 protected boolean check_getDate() {
71 String date
= anno
.getDate();
72 return (date
!= null);
76 * Sets the string of annotation, then makes it visible and
77 * checks the value returned by <code>getIsVisible</code> method. <p>
78 * Returns <b>true</b> if the method returns <code>true</code>.
80 protected boolean check_getIsVisible() {
81 XSimpleText oText
= UnoRuntime
.queryInterface(XSimpleText
.class, anno
);
82 oText
.setString("XSheetAnnotation");
83 anno
.setIsVisible(true);
84 boolean bVis
= anno
.getIsVisible();
89 * Gets the position of annotated cell
90 * Returns <b>true</b> if this position is not null.
92 protected boolean check_getPosition() {
93 CellAddress oCAddr
= anno
.getPosition();
94 return (oCAddr
!= null);
98 * Sets the string of annotation, makes it hidden and then
99 * visible. Visibility is checked in both cases. <p>
100 * Returns <b>true</b> if the <code>getIsVisible</code> method
101 * returns <code>false</code> in the first case and <code>true</code>
104 protected boolean check_setIsVisible() {
105 boolean bResult
= true;
106 XSimpleText oText
= UnoRuntime
.queryInterface(XSimpleText
.class, anno
);
107 oText
.setString("XSheetAnnotation");
108 anno
.setIsVisible(false);
109 boolean bVis
= anno
.getIsVisible();
111 anno
.setIsVisible(true);
112 bVis
= anno
.getIsVisible();