bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / sheet / _XSheetLinkable.java
blob347ea628291c3550545d3ac3b0b691b08c9fa8f1
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 .
18 package ifc.sheet;
20 import com.sun.star.sheet.SheetLinkMode;
21 import com.sun.star.sheet.XSheetLinkable;
22 import lib.MultiMethodTest;
23 import util.utils;
25 /**
28 public class _XSheetLinkable extends MultiMethodTest {
29 public XSheetLinkable oObj = null;
30 SheetLinkMode slm = null;
31 String linkSheetName = null;
32 String linkUrl = null;
33 String linkUrl2 = null;
35 public void before() {
36 // get a document for linking.
37 linkUrl = (String)tEnv.getObjRelation("XSheetLinkable.LinkSheet");
38 linkUrl = utils.getFullTestURL(linkUrl);
40 // get a second sheet for changing the link url: if it's not set,
41 // this part of the test is omitted.
42 linkUrl2 = (String)tEnv.getObjRelation("XSheetLinkable.LinkSheet2");
43 if (linkUrl2 != null)
44 linkUrl = utils.getFullTestURL(linkUrl);
46 // set a name for the sheet.
47 linkSheetName = "Sheet1";
50 public void _getLinkMode() {
51 requiredMethod("link()");
52 slm = oObj.getLinkMode();
53 tRes.tested("getLinkMode()", slm == SheetLinkMode.VALUE);
56 public void _getLinkSheetName() {
57 requiredMethod("link()");
58 String lSheetName = oObj.getLinkSheetName();
59 tRes.tested("getLinkSheetName()", linkSheetName.equals(lSheetName));
62 public void _getLinkUrl() {
63 requiredMethod("link()");
64 String lUrl = oObj.getLinkUrl();
65 System.out.println("URL: " + lUrl);
66 tRes.tested("getLinkUrl()", lUrl.equals(linkUrl));
69 public void _link() {
70 oObj.link(linkUrl, linkSheetName, "", "", SheetLinkMode.VALUE);
71 tRes.tested("link()", true);
74 public void _setLinkMode() {
75 requiredMethod("getLinkMode()");
76 oObj.setLinkMode(SheetLinkMode.NONE);
77 slm = oObj.getLinkMode();
78 tRes.tested("setLinkMode()", slm == SheetLinkMode.NONE);
81 public void _setLinkSheetName() {
82 requiredMethod("getLinkSheetName()");
83 oObj.setLinkSheetName("Sheet2");
84 linkSheetName = oObj.getLinkSheetName();
85 tRes.tested("setLinkSheetName()", linkSheetName.equals("Sheet2"));
88 public void _setLinkUrl() {
89 requiredMethod("getLinkUrl()");
90 boolean result = false;
91 if (linkUrl2 == null) {
92 // set back to the original value
93 oObj.setLinkUrl(linkUrl);
94 result = true;
96 else {
97 oObj.setLinkUrl(linkUrl2);
98 linkUrl = oObj.getLinkUrl();
99 result = linkUrl.equals(linkUrl2);
101 tRes.tested("setLinkUrl()", result);