Kaydet (Commit) 41051536 authored tarafından Jens Carl's avatar Jens Carl Kaydeden (comit) Markus Mohrhard

tdf#45904 Move Java _XSpreadsheet tests to C++

Change-Id: Idb398c87c89aa9b5613b9952bffde5929c1bc76b
Reviewed-on: https://gerrit.libreoffice.org/43398Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 80003831
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/.
*/
#ifndef INCLUDED_TEST_SHEET_XSPREADSHEET_HXX
#define INCLUDED_TEST_SHEET_XSPREADSHEET_HXX
#include <test/testdllapi.hxx>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Reference.hxx>
using namespace css;
using namespace css::uno;
namespace apitest {
class OOO_DLLPUBLIC_TEST XSpreadsheet
{
public:
virtual uno::Reference< uno::XInterface > init() = 0;
void testCreateCursor();
void testCreateCursorByRange();
protected:
~XSpreadsheet(){}
};
}
#endif // INCLUDED_TEST_SHEET_XSPREADSHEET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -630,7 +630,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_XSheetLinkable \
qadevOOo/tests/java/ifc/sheet/_XSheetOperation \
qadevOOo/tests/java/ifc/sheet/_XSheetPageBreak \
qadevOOo/tests/java/ifc/sheet/_XSpreadsheet \
qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView \
qadevOOo/tests/java/ifc/style/_CharacterProperties \
qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \
......
......@@ -129,8 +129,6 @@
"ScTableSheetObj";"com::sun::star::sheet::XFormulaQuery";"queryDependents()"
"ScTableSheetObj";"com::sun::star::sheet::XFormulaQuery";"queryPrecedents()"
"ScTableSheetObj";"com::sun::star::sheet::XSheetFilterableEx";"createFilterDescriptorByObject()"
"ScTableSheetObj";"com::sun::star::sheet::XSpreadsheet";"createCursor()"
"ScTableSheetObj";"com::sun::star::sheet::XSpreadsheet";"createCursorByRange()"
"ScTableSheetObj";"com::sun::star::sheet::XArrayFormulaRange";"getArrayFormula()"
"ScTableSheetObj";"com::sun::star::sheet::XArrayFormulaRange";"setArrayFormula()"
"ScTableSheetObj";"com::sun::star::sheet::XCellRangeFormula#optional";"getFormulaArray()"
......
/*
* 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 lib.MultiMethodTest;
import com.sun.star.sheet.XSheetCellCursor;
import com.sun.star.sheet.XSheetCellRange;
import com.sun.star.sheet.XSpreadsheet;
import com.sun.star.table.XCellRange;
import com.sun.star.uno.UnoRuntime;
/**
* Testing <code>com.sun.star.sheet.XSpreadsheet</code>
* interface methods :
* <ul>
* <li><code> createCursor()</code></li>
* <li><code> createCursorByRange()</code></li>
* </ul> <p>
* @see com.sun.star.sheet.XSpreadsheet
*/
public class _XSpreadsheet extends MultiMethodTest {
// oObj filled by MultiMethodTest
public XSpreadsheet oObj = null;
/**
* Test calls the method and checks returned value. <p>
* Has <b> OK </b> status if returned value isn't null. <p>
*/
public void _createCursor() {
log.println("Testing createCursor");
XSheetCellCursor oCursor = oObj.createCursor() ;
tRes.tested("createCursor()", oCursor != null);
}
/**
* Test gets a cell range, call method using this cell range
* and checks returned value. <p>
* Has <b> OK </b> status if returned value isn't null
* and no exceptions were thrown. <p>
*/
public void _createCursorByRange() {
log.println("Testing createCursorByRange");
log.println("getting cellrange");
XCellRange oRange = null;
try {
oRange = oObj.getCellRangeByPosition (1, 1, 2, 3);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
log.println("Can't get cell range by address");
e.printStackTrace(log);
tRes.tested("createCursorByRange()", false);
}
XSheetCellRange oSheetRange = UnoRuntime.queryInterface(XSheetCellRange.class, oRange) ;
log.println("getting Cursor");
XSheetCellCursor oCursor = oObj.createCursorByRange(oSheetRange);
tRes.tested("createCursorByRange()", oCursor != null);
}
} // finish class _XSpreadsheet
......@@ -11,9 +11,10 @@
#include <test/sheet/xcellseries.hxx>
#include <test/sheet/xprintareas.hxx>
#include <test/sheet/xuniquecellformatrangessupplier.hxx>
#include <test/sheet/xspreadsheet.hxx>
#include <test/sheet/xsubtotalcalculatable.hxx>
#include <test/util/xreplaceable.hxx>
#include <test/util/xsearchable.hxx>
#include <test/sheet/xsubtotalcalculatable.hxx>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
......@@ -24,12 +25,15 @@ using namespace css::uno;
namespace sc_apitest
{
#define NUMBER_OF_TESTS 12
#define NUMBER_OF_TESTS 14
class ScTableSheetObj : public CalcUnoApiTest,
public apitest::XSearchable, public apitest::XReplaceable,
public apitest::XPrintAreas, public apitest::XCellSeries,
public apitest::XUniqueCellFormatRangesSupplier, public apitest::XSubTotalCalculatable
class ScTableSheetObj : public CalcUnoApiTest, public apitest::XSearchable,
public apitest::XReplaceable,
public apitest::XPrintAreas,
public apitest::XCellSeries,
public apitest::XUniqueCellFormatRangesSupplier,
public apitest::XSpreadsheet,
public apitest::XSubTotalCalculatable
{
public:
ScTableSheetObj();
......@@ -62,6 +66,10 @@ public:
// XUniqueCellFormatRangesSupplier
CPPUNIT_TEST(testGetUniqueCellFormatRanges);
// XSpreadsheet
CPPUNIT_TEST(testCreateCursor);
CPPUNIT_TEST(testCreateCursorByRange);
// XSubTotalCalculatable
CPPUNIT_TEST(testCreateSubTotalDescriptor);
CPPUNIT_TEST(testApplyRemoveSubTotals);
......
......@@ -64,6 +64,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xnamedranges \
test/source/sheet/xprintareas \
test/source/sheet/xspreadsheetdocument \
test/source/sheet/xspreadsheet \
test/source/sheet/xspreadsheets \
test/source/sheet/xspreadsheets2 \
test/source/sheet/xsheetannotation \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/.
*/
#include <test/sheet/xspreadsheet.hxx>
#include <com/sun/star/sheet/XSheetCellCursor.hpp>
#include <com/sun/star/sheet/XSheetCellRange.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <cppunit/extensions/HelperMacros.h>
using namespace com::sun::star;
using namespace com::sun::star::uno;
namespace apitest {
void XSpreadsheet::testCreateCursor()
{
uno::Reference< sheet::XSpreadsheet > xSheet(init(), UNO_QUERY_THROW);
uno::Reference< sheet::XSheetCellCursor > xCursor(xSheet->createCursor(), UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("Unable to create XSheetCellCursor", xCursor.is());
}
void XSpreadsheet::testCreateCursorByRange()
{
uno::Reference< sheet::XSpreadsheet > xSheet(init(), UNO_QUERY_THROW);
uno::Reference< sheet::XSheetCellRange > xCellRange(xSheet->getCellRangeByPosition(1, 1, 2, 3), UNO_QUERY_THROW);
uno::Reference< sheet::XSheetCellCursor > xCursor(xSheet->createCursorByRange(xCellRange), UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("Unable to create XSheetCellCursor", xCursor.is());
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment