Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / sheet / _XSheetLinkable.java
blobffd54d19f8d9245b3e6fc07fd8c62f19c9624b3f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XSheetLinkable.java,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 package ifc.sheet;
32 import com.sun.star.sheet.SheetLinkMode;
33 import com.sun.star.sheet.XSheetLinkable;
34 import lib.MultiMethodTest;
35 import util.utils;
37 /**
40 public class _XSheetLinkable extends MultiMethodTest {
41 public XSheetLinkable oObj = null;
42 SheetLinkMode slm = null;
43 String linkSheetName = null;
44 String linkUrl = null;
45 String linkUrl2 = null;
47 public void before() {
48 // get a document for linking.
49 linkUrl = (String)tEnv.getObjRelation("XSheetLinkable.LinkSheet");
50 linkUrl = utils.getFullTestURL(linkUrl);
52 // get a second sheet for changing the link url: if it's not set,
53 // this part of the test is omitted.
54 linkUrl2 = (String)tEnv.getObjRelation("XSheetLinkable.LinkSheet2");
55 if (linkUrl2 != null)
56 linkUrl = utils.getFullTestURL(linkUrl);
58 // set a name for the sheet.
59 linkSheetName = "Sheet1";
62 public void _getLinkMode() {
63 requiredMethod("link()");
64 slm = oObj.getLinkMode();
65 tRes.tested("getLinkMode()", slm == SheetLinkMode.VALUE);
68 public void _getLinkSheetName() {
69 requiredMethod("link()");
70 String lSheetName = oObj.getLinkSheetName();
71 tRes.tested("getLinkSheetName()", linkSheetName.equals(lSheetName));
74 public void _getLinkUrl() {
75 requiredMethod("link()");
76 String lUrl = oObj.getLinkUrl();
77 System.out.println("URL: " + lUrl);
78 tRes.tested("getLinkUrl()", lUrl.equals(linkUrl));
81 public void _link() {
82 oObj.link(linkUrl, linkSheetName, "", "", SheetLinkMode.VALUE);
83 tRes.tested("link()", true);
86 public void _setLinkMode() {
87 requiredMethod("getLinkMode()");
88 oObj.setLinkMode(SheetLinkMode.NONE);
89 slm = oObj.getLinkMode();
90 tRes.tested("setLinkMode()", slm == SheetLinkMode.NONE);
93 public void _setLinkSheetName() {
94 requiredMethod("getLinkSheetName()");
95 oObj.setLinkSheetName("Sheet2");
96 linkSheetName = oObj.getLinkSheetName();
97 tRes.tested("setLinkSheetName()", linkSheetName.equals("Sheet2"));
100 public void _setLinkUrl() {
101 requiredMethod("getLinkUrl()");
102 boolean result = false;
103 if (linkUrl2 == null) {
104 // set back to the original value
105 oObj.setLinkUrl(linkUrl);
106 result = true;
108 else {
109 oObj.setLinkUrl(linkUrl2);
110 linkUrl = oObj.getLinkUrl();
111 result = linkUrl.equals(linkUrl2);
113 tRes.tested("setLinkUrl()", result);