bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / sheet / _XPrintAreas.java
blob720b120afbdaa2864d2d4c84e82e63a01097a389
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.XPrintAreas;
21 import com.sun.star.table.CellRangeAddress;
22 import lib.MultiMethodTest;
23 import lib.Status;
24 import lib.StatusException;
25 import util.ValueComparer;
27 /**
30 public class _XPrintAreas extends MultiMethodTest {
31 public XPrintAreas oObj = null;
32 CellRangeAddress address = null;
33 CellRangeAddress subaddress = null;
34 CellRangeAddress titleColumns;
35 CellRangeAddress titleRows;
37 public void before() {
38 address = (CellRangeAddress)tEnv.getObjRelation("CellRangeAddress");
39 subaddress = (CellRangeAddress)tEnv.getObjRelation("CellRangeSubAddress");
40 if (address == null)
41 throw new StatusException(Status.failed("Object relation CellRangeAddress not found"));
42 if (subaddress == null)
43 throw new StatusException(Status.failed("Object relation CellRangeSubAddress not found"));
46 public void _getPrintAreas() {
47 requiredMethod("getPrintTitleColumns()");
48 requiredMethod("getPrintTitleRows()");
49 executeMethod("getTitleColumns()");
50 executeMethod("getTitleRows()");
51 CellRangeAddress[] printAreas = oObj.getPrintAreas();
52 CellRangeAddress[] setValue = new CellRangeAddress[]{address};
53 boolean ret = ValueComparer.equalValue(printAreas, setValue);
54 // delete the print area
55 oObj.setPrintAreas(null);
56 printAreas = oObj.getPrintAreas();
57 ret &= printAreas.length == 0;
59 tRes.tested("getPrintAreas()", ret);
62 public void _getPrintTitleColumns() {
63 requiredMethod("setPrintTitleColumns()");
64 tRes.tested("getPrintTitleColumns()", !oObj.getPrintTitleColumns());
67 public void _getPrintTitleRows() {
68 requiredMethod("setPrintTitleRows()");
69 tRes.tested("getPrintTitleRows()", !oObj.getPrintTitleRows());
72 public void _getTitleColumns() {
73 requiredMethod("setTitleColumns()");
74 CellRangeAddress setValue = oObj.getTitleColumns();
75 tRes.tested("getTitleColumns()", ValueComparer.equalValue(setValue,titleColumns));
78 public void _getTitleRows() {
79 requiredMethod("setTitleRows()");
80 CellRangeAddress setValue = oObj.getTitleRows();
81 tRes.tested("getTitleRows()", ValueComparer.equalValue(setValue,titleRows));
84 public void _setPrintAreas() {
85 boolean ret = false;
86 CellRangeAddress[]setValue = new CellRangeAddress[]{subaddress};
87 oObj.setPrintAreas(setValue);
88 CellRangeAddress[]newVal = oObj.getPrintAreas();
89 ret = ValueComparer.equalValue(newVal, setValue);
90 setValue = new CellRangeAddress[]{address};
91 oObj.setPrintAreas(setValue);
92 newVal = oObj.getPrintAreas();
93 ret &= ValueComparer.equalValue(newVal, setValue);
94 tRes.tested("setPrintAreas()", ret);
97 public void _setPrintTitleColumns() {
98 requiredMethod("setTitleColumns()");
99 boolean ret = false;
100 boolean value = oObj.getPrintTitleColumns();
101 oObj.setPrintTitleColumns(!value);
102 ret = value != oObj.getPrintTitleColumns();
103 oObj.setPrintTitleColumns(false);
104 tRes.tested("setPrintTitleColumns()", ret);
107 public void _setPrintTitleRows() {
108 requiredMethod("setTitleRows()");
109 boolean ret = false;
110 boolean value = oObj.getPrintTitleRows();
111 oObj.setPrintTitleRows(!value);
112 ret = value != oObj.getPrintTitleRows();
113 oObj.setPrintTitleRows(false);
114 tRes.tested("setPrintTitleRows()", ret);
117 public void _setTitleColumns() {
118 requiredMethod("setPrintAreas()");
119 boolean ret = false;
120 CellRangeAddress newVal = oObj.getTitleColumns();
121 ret = ValueComparer.equalValue(newVal, new CellRangeAddress((short)0, 0, 0, 0, 0));
122 // use first row of range as title column
123 titleColumns = new CellRangeAddress();
124 titleColumns.Sheet = address.Sheet;
125 titleColumns.StartColumn = address.StartColumn;
126 titleColumns.StartRow = address.StartRow;
127 titleColumns.EndColumn = address.EndColumn;
128 titleColumns.EndRow = address.StartRow;
129 oObj.setTitleColumns(titleColumns);
130 tRes.tested("setTitleColumns()", ret);
133 public void _setTitleRows() {
134 requiredMethod("setPrintAreas()");
135 boolean ret = false;
136 CellRangeAddress newVal = oObj.getTitleRows();
137 ret = ValueComparer.equalValue(newVal, new CellRangeAddress((short)0, 0, 0, 0, 0));
138 // use first column of range as title row
139 titleRows = new CellRangeAddress();
140 titleRows.Sheet = address.Sheet;
141 titleRows.StartColumn = address.StartColumn;
142 titleRows.StartRow = address.StartRow;
143 titleRows.EndColumn = address.StartColumn;
144 titleRows.EndRow = address.EndRow;
145 oObj.setTitleColumns(titleRows);
146 tRes.tested("setTitleRows()", ret);