tdf#45904 Move XNameAccess Java tests to C++
Move XNameAccess Java tests to C++ for ScDatabaseRangesObj.
Change-Id: Id54f9bc1a9215a4524be4a1f52800049ce438c8a
Reviewed-on: https://gerrit.libreoffice.org/66250
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43@gmx.de>
diff --git a/framework/qa/complex/api_internal/api.lst b/framework/qa/complex/api_internal/api.lst
index c56c6f5..113755a 100644
--- a/framework/qa/complex/api_internal/api.lst
+++ b/framework/qa/complex/api_internal/api.lst
@@ -78,7 +78,6 @@
job81=sc.ScCellFieldObj
job85=sc.ScCellSearchObj
job88=sc.ScDatabaseRangeObj
job89=sc.ScDatabaseRangesObj
job90=sc.ScDataPilotFieldObj
job91=sc.ScDataPilotFieldsObj
job92=sc.ScDataPilotTablesObj
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index e170d9e..12bd022 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -967,7 +967,6 @@
qadevOOo/tests/java/mod/_sc/ScChartObj \
qadevOOo/tests/java/mod/_sc/ScChartsObj \
qadevOOo/tests/java/mod/_sc/ScDatabaseRangeObj \
qadevOOo/tests/java/mod/_sc/ScDatabaseRangesObj \
qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupItemObj \
qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupObj \
qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupsObj \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDatabaseRangesObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDatabaseRangesObj.csv
deleted file mode 100644
index 704ef56..0000000
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDatabaseRangesObj.csv
+++ /dev/null
@@ -1,3 +0,0 @@
"ScDatabaseRangesObj";"com::sun::star::container::XNameAccess";"getByName()"
"ScDatabaseRangesObj";"com::sun::star::container::XNameAccess";"getElementNames()"
"ScDatabaseRangesObj";"com::sun::star::container::XNameAccess";"hasByName()"
diff --git a/qadevOOo/tests/java/mod/_sc/ScDatabaseRangesObj.java b/qadevOOo/tests/java/mod/_sc/ScDatabaseRangesObj.java
deleted file mode 100644
index fd8900b..0000000
--- a/qadevOOo/tests/java/mod/_sc/ScDatabaseRangesObj.java
+++ /dev/null
@@ -1,122 +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 mod._sc;
import java.io.PrintWriter;
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
import util.SOfficeFactory;
import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.XComponent;
import com.sun.star.sheet.XDatabaseRanges;
import com.sun.star.sheet.XSpreadsheetDocument;
import com.sun.star.table.CellRangeAddress;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Type;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
/**
* Test for object which is represented by service
* <code>com.sun.star.sheet.DatabaseRanges</code>. <p>
* Object implements the following interfaces :
* <ul>
* <li> <code>com::sun::star::sheet::XDatabaseRanges</code></li>
* <li> <code>com::sun::star::container::XNameAccess</code></li>
* <li> <code>com::sun::star::container::XElementAccess</code></li>
* </ul>
* @see com.sun.star.sheet.DatabaseRanges
* @see com.sun.star.sheet.XDatabaseRanges
* @see com.sun.star.container.XNameAccess
* @see com.sun.star.container.XElementAccess
* @see ifc.sheet._XDatabaseRanges
* @see ifc.container._XNameAccess
* @see ifc.container._XElementAccess
*/
public class ScDatabaseRangesObj extends TestCase {
private XSpreadsheetDocument xSheetDoc = null;
/**
* Creates Spreadsheet document.
*/
@Override
protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception {
SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() );
log.println( "creating a Spreadsheet document" );
xSheetDoc = SOF.createCalcDoc(null);
}
/**
* Disposes Spreadsheet document.
*/
@Override
protected void cleanup( TestParameters tParam, PrintWriter log ) {
log.println( " disposing xSheetDoc " );
XComponent oComp = UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
util.DesktopTools.closeDoc(oComp);
}
/**
* Creating a TestEnvironment for the interfaces to be tested.
* Retrieves the collection of database ranges in the document.
* If the database range with name <code>'dbRange'</code> doesn't exist
* in the collection then creates new database range and adds it to the
* collection with the name <code>'dbRange'</code> to have one element
* for the test of the interface <code>ElementAccess</code> at least.
* The collection of database ranges is the instance of the service
* <code>com.sun.star.sheet.DatabaseRanges</code>.
* @see com.sun.star.sheet.DatabaseRanges
* @see com.sun.star.container.XElementAccess
*/
@Override
protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
XInterface oObj = null;
// creation of testobject here
// first we write what we are intend to do to log file
log.println( "Creating a test environment" );
log.println("Getting test object ") ;
XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
XDatabaseRanges dbRanges = null;
dbRanges = (XDatabaseRanges) AnyConverter.toObject(
new Type(XDatabaseRanges.class),
docProps.getPropertyValue("DatabaseRanges"));
log.println("Adding at least one element for ElementAccess interface");
CellRangeAddress aRange = new CellRangeAddress((short)0, 2, 4, 5, 6);
if (!dbRanges.hasByName("dbRange")) {
dbRanges.addNewByName("dbRange", aRange);
}
oObj = dbRanges;
TestEnvironment tEnv = new TestEnvironment( oObj );
// Other parameters required for interface tests
return tEnv;
}
}
diff --git a/sc/qa/extras/scdatabaserangesobj.cxx b/sc/qa/extras/scdatabaserangesobj.cxx
index a4c3b69..21abd61 100644
--- a/sc/qa/extras/scdatabaserangesobj.cxx
+++ b/sc/qa/extras/scdatabaserangesobj.cxx
@@ -11,6 +11,7 @@
#include <test/container/xelementaccess.hxx>
#include <test/container/xenumerationaccess.hxx>
#include <test/container/xindexaccess.hxx>
#include <test/container/xnameaccess.hxx>
#include <test/sheet/xdatabaseranges.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -35,7 +36,8 @@
public apitest::XDatabaseRanges,
public apitest::XElementAccess,
public apitest::XEnumerationAccess,
public apitest::XIndexAccess
public apitest::XIndexAccess,
public apitest::XNameAccess
{
public:
ScDatabaseRangesObj();
@@ -60,6 +62,11 @@
CPPUNIT_TEST(testGetByIndex);
CPPUNIT_TEST(testGetCount);
// XNameAccess
CPPUNIT_TEST(testGetByName);
CPPUNIT_TEST(testGetElementNames);
CPPUNIT_TEST(testHasByName);
CPPUNIT_TEST_SUITE_END();
private:
@@ -70,6 +77,7 @@
: CalcUnoApiTest("/sc/qa/extras/testdocuments")
, XElementAccess(cppu::UnoType<sheet::XDatabaseRange>::get())
, XIndexAccess(1)
, XNameAccess("DbRange")
{
}
diff --git a/sc/qa/unoapi/sc_4.sce b/sc/qa/unoapi/sc_4.sce
index 21807ee..5d3b0dd 100644
--- a/sc/qa/unoapi/sc_4.sce
+++ b/sc/qa/unoapi/sc_4.sce
@@ -19,7 +19,6 @@
-o sc.ScDataPilotItemsObj
-o sc.ScDataPilotTablesObj
-o sc.ScDatabaseRangeObj
# -o sc.ScDatabaseRangesObj
-o sc.ScDocumentConfiguration
-o sc.ScDrawPageObj
-o sc.ScDrawPagesObj