1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 package ifc.sheet;
24 
25 import com.sun.star.sheet.XScenario;
26 import com.sun.star.table.CellRangeAddress;
27 import lib.MultiMethodTest;
28 import lib.Status;
29 
30 /**
31  *
32  */
33 public class _XScenario extends MultiMethodTest {
34     public XScenario oObj = null;
35     CellRangeAddress address = null;
36     String comment = null;
37     boolean skipTest = false;
38 
before()39     public void before() {
40         // testing a scenario containing the whole sheet does not make sense.
41         // test is skipped until this interface is implemented somewhere else
42         skipTest = true;
43     }
44 
_addRanges()45     public void _addRanges() {
46         if (skipTest) {
47             tRes.tested("addRanges()",Status.skipped(true));
48             return;
49         }
50         oObj.addRanges(new CellRangeAddress[] {address});
51         tRes.tested("addRanges()", true);
52     }
53 
_apply()54     public void _apply() {
55         requiredMethod("addRanges()");
56         if (skipTest) {
57             tRes.tested("apply()",Status.skipped(true));
58             return;
59         }
60         oObj.apply();
61         tRes.tested("apply()", true);
62     }
63 
_getIsScenario()64     public void _getIsScenario() {
65         requiredMethod("apply()");
66         if (skipTest) {
67             tRes.tested("getIsScenario()",Status.skipped(true));
68             return;
69         }
70         boolean getIs = oObj.getIsScenario();
71         tRes.tested("getIsScenario()", getIs);
72     }
73 
_getScenarioComment()74     public void _getScenarioComment() {
75         if (skipTest) {
76             tRes.tested("getScenarioComment()",Status.skipped(true));
77             return;
78         }
79         comment = oObj.getScenarioComment();
80         tRes.tested("getScenarioComment()", true);
81     }
82 
_setScenarioComment()83     public void _setScenarioComment() {
84         requiredMethod("getScenarioComment()");
85         if (skipTest) {
86             tRes.tested("setScenarioComment()",Status.skipped(true));
87             return;
88         }
89         boolean res = false;
90         oObj.setScenarioComment("MyComment");
91         String c = oObj.getScenarioComment();
92         res = c.equals("MyComment");
93         oObj.setScenarioComment(comment);
94         tRes.tested("setScenarioComment()", res);
95     }
96 }
97