summaryrefslogtreecommitdiff
path: root/qadevOOo
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2017-08-20 06:42:33 +0000
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-08-23 23:38:32 +0200
commitda25c627f71eede6256b629336bf3fe30d89ace5 (patch)
tree62453cc143ed9e67af4ea3ade90d56f87f8209d3 /qadevOOo
parentfcbabad4e760a9fda8bbb5069e5dc45ab390b78d (diff)
tdf#45905 Remove/disable obsolete _XNamedRanges Java tests
The _XNamedRanges test are already written in C++ since commit b9337e22ce1dbf2eba0e8c8db294ae99f4111f91. Change-Id: I8610cc50ce23de7183efb5d9b6b436f1b9dceae1 Reviewed-on: https://gerrit.libreoffice.org/41349 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'qadevOOo')
-rw-r--r--qadevOOo/Jar_OOoRunner.mk1
-rw-r--r--qadevOOo/objdsc/sc/com.sun.star.comp.office.ScNamedRangesObj.csv4
-rw-r--r--qadevOOo/tests/java/ifc/sheet/_XNamedRanges.java316
3 files changed, 0 insertions, 321 deletions
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 82ba7bbc8bf7..a1ed436b45ff 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -612,7 +612,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_XLabelRange \
qadevOOo/tests/java/ifc/sheet/_XLabelRanges \
qadevOOo/tests/java/ifc/sheet/_XMultipleOperation \
- qadevOOo/tests/java/ifc/sheet/_XNamedRanges \
qadevOOo/tests/java/ifc/sheet/_XRangeSelection \
qadevOOo/tests/java/ifc/sheet/_XRecentFunctions \
qadevOOo/tests/java/ifc/sheet/_XScenario \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScNamedRangesObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScNamedRangesObj.csv
index f3e5cdbf502e..815f57b9b10e 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScNamedRangesObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScNamedRangesObj.csv
@@ -5,8 +5,4 @@
"ScNamedRangesObj";"com::sun::star::container::XIndexAccess";"getByIndex()"
"ScNamedRangesObj";"com::sun::star::container::XElementAccess";"getElementType()"
"ScNamedRangesObj";"com::sun::star::container::XElementAccess";"hasElements()"
-"ScNamedRangesObj";"com::sun::star::sheet::XNamedRanges";"addNewByName()"
-"ScNamedRangesObj";"com::sun::star::sheet::XNamedRanges";"addNewFromTitles()"
-"ScNamedRangesObj";"com::sun::star::sheet::XNamedRanges";"removeByName()"
-"ScNamedRangesObj";"com::sun::star::sheet::XNamedRanges";"outputList()"
"ScNamedRangesObj";"com::sun::star::container::XEnumerationAccess";"createEnumeration()"
diff --git a/qadevOOo/tests/java/ifc/sheet/_XNamedRanges.java b/qadevOOo/tests/java/ifc/sheet/_XNamedRanges.java
deleted file mode 100644
index 78c867d69d04..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_XNamedRanges.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package ifc.sheet;
-
-import java.util.Random;
-import java.util.StringTokenizer;
-
-import lib.MultiMethodTest;
-import lib.Status;
-import lib.StatusException;
-
-import com.sun.star.container.XIndexAccess;
-import com.sun.star.sheet.Border;
-import com.sun.star.sheet.NamedRangeFlag;
-import com.sun.star.sheet.XCellRangeAddressable;
-import com.sun.star.sheet.XCellRangeReferrer;
-import com.sun.star.sheet.XNamedRanges;
-import com.sun.star.sheet.XSpreadsheet;
-import com.sun.star.table.CellAddress;
-import com.sun.star.table.CellRangeAddress;
-import com.sun.star.table.XCell;
-import com.sun.star.table.XCellRange;
-import com.sun.star.text.XTextRange;
-import com.sun.star.uno.UnoRuntime;
-
-/**
-* Testing <code>com.sun.star.sheet.XNamedRanges</code>
-* interface methods :
-* <ul>
-* <li><code> addNewByName()</code></li>
-* <li><code> addNewFromTitles()</code></li>
-* <li><code> removeByName()</code></li>
-* <li><code> outputList()</code></li>
-* </ul> <p>
-* This test needs the following object relations :
-* <ul>
-* <li> <code>'SHEET'</code> (of type <code>XSpreadsheet</code>):
-* to have a spreadsheet </li>
-* <ul> <p>
-* @see com.sun.star.sheet.XNamedRanges
-* @see com.sun.star.sheet.XSpreadsheet
-*/
-public class _XNamedRanges extends MultiMethodTest {
-
- public XNamedRanges oObj = null;
- String name = "_XNamedRanges";
- XSpreadsheet oSheet = null;
-
- /**
- * Retrieves object relations.
- * @throws StatusException If one of relations not found.
- */
- @Override
- protected void before() {
- oSheet = (XSpreadsheet)tEnv.getObjRelation("SHEET");
- if (oSheet == null) throw new StatusException(Status.failed
- ("Relation 'SHEET' not found"));
- }
-
- /**
- * Test creates and stores random content and random type, calls the method
- * and checks that new range exists in collection using method
- * <code>hasByName()</code>. <p>
- * Has <b> OK </b> status if new range exists in collection
- * and no exceptions were thrown. <p>
- */
- public void _addNewByName() {
- boolean bResult = true;
- CellAddress aPosition = new CellAddress((short)0, 2, 2);
- int nType = getRandomType();
- String sContent = getRandomContent("D3;A6:B9;=F12");
- name += sContent;
- log.println("Adding new range with name=\"" + name +
- "\", sContent = \"" + sContent +
- "\", aPosition = (" + aPosition.Sheet + ", "
- + aPosition.Column + ", "
- + aPosition.Row +
- "), Type = " + nType + ".");
-
- oObj.addNewByName(name, sContent, aPosition, nType);
-
- //inserted for a bug
- CellAddress listOutputPosition = new CellAddress((short)0, 1, 1);
- oObj.outputList(listOutputPosition);
- String s = null;
- String s1 = null;
- try {
- s = oSheet.getCellByPosition(1, 1).getFormula();
- s1 = oSheet.getCellByPosition(2, 1).getFormula();
- } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
- log.println("Can't get cell by position: " + e);
- bResult = false;
- }
- log.println("Outputlist returns: " + s + " " + s1);
- //end of insertion
-
- bResult &= oObj.hasByName(name);
-
- tRes.tested("addNewByName()", bResult);
- }
-
- /**
- * Test creates a table with left and top titles, creates new ranges from
- * top titles and left titles, checks all new title ranges. <p>
- * Has <b> OK </b> status if all required title ranges are present
- * in collection, if each of them have valid size and position and
- * no exceptions were thrown. <p>
- */
- public void _addNewFromTitles() {
- boolean bResult = true;
-
- // First, create a small table.
- log.println("Creating a small table.");
- try {
- XCell cell = null;
- XTextRange textrange = null;
-
- for (int i = 1; i < 4; i++) {
- cell = oSheet.getCellByPosition(0, i);
- textrange = UnoRuntime.
- queryInterface(XTextRange.class, cell);
- textrange.setString("Row" + i);
-
- cell = oSheet.getCellByPosition(i, 0);
- textrange = UnoRuntime.
- queryInterface(XTextRange.class, cell);
- textrange.setString("Column" + i);
- }
-
- for (int i = 1; i < 4; i++)
- for (int j = 1; j < 4; j++) {
- cell = oSheet.getCellByPosition(i, j);
- textrange = UnoRuntime.
- queryInterface(XTextRange.class, cell);
- textrange.setString("Val" + ((j - 1) * 3 + i));
- }
- log.println("Finished creating table.");
- log.println("Creating new ranges from titles");
-
- CellRangeAddress CRA = new CellRangeAddress((short)0, 0, 0, 3, 3);
- Border border = Border.TOP;
- oObj.addNewFromTitles(CRA, border);
- for (int i = 1; i < 4; i++) {
- bResult &= oObj.hasByName("Column" + i);
-
- Object range = oObj.getByName("Column" + i);
- XCellRangeReferrer CRR = UnoRuntime.
- queryInterface(XCellRangeReferrer.class,range);
-
- XCellRange CR = CRR.getReferredCells();
- XCellRangeAddressable xCRA = UnoRuntime.queryInterface(XCellRangeAddressable.class, CR);
-
- CellRangeAddress objCRA = xCRA.getRangeAddress();
-
- bResult &= (objCRA.EndColumn == i && objCRA.StartColumn == i);
- bResult &= objCRA.StartRow == 1;
- bResult &= objCRA.EndRow == 3;
- bResult &= objCRA.Sheet == 0;
- }
-
- border = Border.LEFT;
- oObj.addNewFromTitles(CRA, border);
- for (int i = 1; i < 4; i++) {
- bResult &= oObj.hasByName("Row" + i);
-
- Object range = oObj.getByName("Row" + i);
- XCellRangeReferrer CRR = UnoRuntime.
- queryInterface(XCellRangeReferrer.class,range);
-
- XCellRange CR = CRR.getReferredCells();
- XCellRangeAddressable xCRA = UnoRuntime.queryInterface(XCellRangeAddressable.class, CR);
-
- CellRangeAddress objCRA = xCRA.getRangeAddress();
-
- bResult &= (objCRA.EndRow == i && objCRA.StartRow == i);
- bResult &= objCRA.StartColumn == 1;
- bResult &= objCRA.EndColumn == 3;
- bResult &= objCRA.Sheet == 0;
- }
-
- oObj.outputList(new CellAddress((short)0, 5, 5));
-
- } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
- e.printStackTrace(log);
- bResult = false;
- } catch (com.sun.star.lang.WrappedTargetException e) {
- e.printStackTrace(log);
- bResult = false;
- } catch (com.sun.star.container.NoSuchElementException e) {
- e.printStackTrace(log);
- bResult = false;
- }
-
- tRes.tested("addNewFromTitles()", bResult);
- }
-
- /**
- * Test calls the method and checks existing of named ranges obtained
- * by relation <code>'SHEET'</code>. <p>
- * Has <b> OK </b> status if all output named ranges exist
- * and no exceptions were thrown. <p>
- */
- public void _outputList() {
- boolean bResult = true;
- CellAddress CA = new CellAddress((short)0, 0, 0);
-
- XIndexAccess IA = UnoRuntime.
- queryInterface(XIndexAccess.class, oObj);
-
- int elementsCount = IA.getCount();
-
- oObj.outputList(CA);
-
- try {
- for (int i = 0; i < elementsCount; i++) {
- XCell cell = oSheet.getCellByPosition(0, i);
- XTextRange textrange = UnoRuntime.queryInterface(XTextRange.class, cell);
- String str = textrange.getString();
- bResult &= oObj.hasByName(str);
- }
- } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
- e.printStackTrace(log);
- bResult = false;
- }
-
- tRes.tested("outputList()", bResult);
- }
-
- /**
- * Test calls the method for existing range, checks number of ranges in
- * collection after method call, calls method for non-existent named range.
- * <p>Has <b> OK </b> status if number of named ranges is less by one than
- * before method call and exception was thrown during second call. <p>
- * The following method tests are to be completed successfully before :
- * <ul>
- * <li> <code> addNewByName() </code> : to have name of existent
- * named range </li>
- * </ul>
- */
- public void _removeByName() {
- requiredMethod("addNewByName()");
- boolean bResult = true;
- XIndexAccess IA = UnoRuntime.
- queryInterface(XIndexAccess.class, oObj);
-
- int elementsCount = IA.getCount();
-
- // Removing existent element
- oObj.removeByName(name);
- bResult = elementsCount == IA.getCount() + 1;
-
- try {
- // Removing unexistent element.
- oObj.removeByName(name);
- log.println("Exception expected when removed unexistent element!");
- bResult = false;
- } catch (com.sun.star.uno.RuntimeException e) {
- log.println("Expected exception occurred while testing" +
- "removeByName() when removed unexistent element.");
-
- }
-
- tRes.tested("removeByName()", bResult);
- }
-
- /**
- * Method make string of random content.
- * @return string of random content
- */
- String getRandomContent(String str) {
- String gRS = "none";
- Random rnd = new Random();
-
- StringTokenizer ST = new StringTokenizer(str, ";");
- int nr = rnd.nextInt(ST.countTokens());
- if (nr < 1)
- nr++;
-
- for (int i=1; i < nr + 1; i++)
- gRS = ST.nextToken();
-
- return gRS;
- }
-
- /**
- * Returns random value of named range flag.
- */
- int getRandomType(){
- int types[] = { 0,
- NamedRangeFlag.COLUMN_HEADER,
- NamedRangeFlag.FILTER_CRITERIA,
- NamedRangeFlag.PRINT_AREA,
- NamedRangeFlag.ROW_HEADER
- };
-
- Random rnd = new Random();
- return types[rnd.nextInt(5)];
- }
-}
-