Kaydet (Commit) 6bf05f00 authored tarafından Jens Carl's avatar Jens Carl

tdf#45904 Move _XScenario Java tests to C++

Change-Id: Ic12eebe62de5132dce26ec46c62501f90200b909
Reviewed-on: https://gerrit.libreoffice.org/52180Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst 0cd7be18
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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_XSCENARIO_HXX
#define INCLUDED_TEST_SHEET_XSCENARIO_HXX
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <test/testdllapi.hxx>
namespace apitest
{
class OOO_DLLPUBLIC_TEST XScenario
{
public:
virtual css::uno::Reference<css::uno::XInterface> getScenarioSpreadsheet() = 0;
void testScenario();
protected:
~XScenario() {}
};
} // namespace apitest
#endif // INCLUDED_TEST_SHEET_XSCENARIO_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -571,7 +571,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_XEnhancedMouseClickBroadcaster \
qadevOOo/tests/java/ifc/sheet/_XFormulaQuery \
qadevOOo/tests/java/ifc/sheet/_XRangeSelection \
qadevOOo/tests/java/ifc/sheet/_XScenario \
qadevOOo/tests/java/ifc/sheet/_XSheetCellCursor \
qadevOOo/tests/java/ifc/style/_CharacterProperties \
qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \
......
......@@ -125,11 +125,6 @@
"ScTableSheetObj";"com::sun::star::sheet::XCellRangesQuery";"queryColumnDifferences()"
"ScTableSheetObj";"com::sun::star::sheet::XCellRangesQuery";"queryRowDifferences()"
"ScTableSheetObj";"com::sun::star::sheet::XCellRangesQuery";"queryIntersection()"
"ScTableSheetObj";"com::sun::star::sheet::XScenario";"getIsScenario()"
"ScTableSheetObj";"com::sun::star::sheet::XScenario";"getScenarioComment()"
"ScTableSheetObj";"com::sun::star::sheet::XScenario";"setScenarioComment()"
"ScTableSheetObj";"com::sun::star::sheet::XScenario";"addRanges()"
"ScTableSheetObj";"com::sun::star::sheet::XScenario";"apply()"
"ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellByPosition()"
"ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()"
"ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellRangeByName()"
......
/*
* 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 com.sun.star.sheet.XScenario;
import com.sun.star.table.CellRangeAddress;
import lib.MultiMethodTest;
import lib.Status;
/**
*
*/
public class _XScenario extends MultiMethodTest {
public XScenario oObj = null;
String comment = null;
boolean skipTest = false;
@Override
public void before() {
// testing a scenario containing the whole sheet does not make sense.
// test is skipped until this interface is implemented somewhere else
skipTest = true;
}
public void _addRanges() {
if (skipTest) {
tRes.tested("addRanges()",Status.skipped(true));
return;
}
oObj.addRanges(new CellRangeAddress[] {null});
tRes.tested("addRanges()", true);
}
public void _apply() {
requiredMethod("addRanges()");
if (skipTest) {
tRes.tested("apply()",Status.skipped(true));
return;
}
oObj.apply();
tRes.tested("apply()", true);
}
public void _getIsScenario() {
requiredMethod("apply()");
if (skipTest) {
tRes.tested("getIsScenario()",Status.skipped(true));
return;
}
boolean getIs = oObj.getIsScenario();
tRes.tested("getIsScenario()", getIs);
}
public void _getScenarioComment() {
if (skipTest) {
tRes.tested("getScenarioComment()",Status.skipped(true));
return;
}
comment = oObj.getScenarioComment();
tRes.tested("getScenarioComment()", true);
}
public void _setScenarioComment() {
requiredMethod("getScenarioComment()");
if (skipTest) {
tRes.tested("setScenarioComment()",Status.skipped(true));
return;
}
boolean res = false;
oObj.setScenarioComment("MyComment");
String c = oObj.getScenarioComment();
res = c.equals("MyComment");
oObj.setScenarioComment(comment);
tRes.tested("setScenarioComment()", res);
}
}
......@@ -20,6 +20,7 @@
#include <test/sheet/xdatapilottablessupplier.hxx>
#include <test/sheet/xmultipleoperation.hxx>
#include <test/sheet/xprintareas.hxx>
#include <test/sheet/xscenario.hxx>
#include <test/sheet/xscenarioenhanced.hxx>
#include <test/sheet/xscenariossupplier.hxx>
#include <test/sheet/xsheetannotationssupplier.hxx>
......@@ -60,6 +61,7 @@ class ScTableSheetObj : public CalcUnoApiTest, public apitest::Scenario,
public apitest::XMultipleOperation,
public apitest::XPrintAreas,
public apitest::XReplaceable,
public apitest::XScenario,
public apitest::XScenarioEnhanced,
public apitest::XScenariosSupplier,
public apitest::XSearchable,
......@@ -146,6 +148,10 @@ public:
CPPUNIT_TEST(testReplaceAll);
CPPUNIT_TEST(testCreateReplaceDescriptor);
// XScenario
// test was disabled in qadevOOo/tests/java/ifc/sheet/_XScenario.java
CPPUNIT_TEST(testScenario);
// XScenarioEnhanced
CPPUNIT_TEST(testGetRanges);
......@@ -218,8 +224,8 @@ uno::Reference< uno::XInterface > ScTableSheetObj::init()
CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), UNO_QUERY_THROW);
uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
uno::Reference<container::XIndexAccess> xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
uno::Reference<sheet::XSpreadsheet> xSheet(xIndex->getByIndex(0), UNO_QUERY_THROW);
xSheet->getCellByPosition(5 ,5)->setValue(15);
xSheet->getCellByPosition(2 ,0)->setValue(-5.15);
......@@ -232,6 +238,7 @@ uno::Reference< uno::XInterface > ScTableSheetObj::init()
uno::Sequence<table::CellRangeAddress> aCellRangeAddr(1);
aCellRangeAddr[0] = table::CellRangeAddress(0, 0, 0, 10, 10);
uno::Reference<sheet::XScenariosSupplier> xScence(xSheet, UNO_QUERY_THROW);
xScence->getScenarios()->addNewByName("Scenario", aCellRangeAddr, "Comment");
xSheets->getByName("Scenario");
......
......@@ -107,6 +107,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xmultipleoperation \
test/source/sheet/xprintareas \
test/source/sheet/xrecentfunctions \
test/source/sheet/xscenario \
test/source/sheet/xscenarioenhanced \
test/source/sheet/xscenarios \
test/source/sheet/xscenariossupplier \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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/xscenario.hxx>
#include <com/sun/star/sheet/XScenario.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <cppunit/extensions/HelperMacros.h>
using namespace css;
using namespace css::uno;
namespace apitest
{
void XScenario::testScenario()
{
uno::Reference<sheet::XScenario> xScenario(getScenarioSpreadsheet(), UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("Sheet is not a Scenario sheet", xScenario->getIsScenario());
uno::Sequence<table::CellRangeAddress> aCellRangeAddr(1);
xScenario->addRanges(aCellRangeAddr);
xScenario->apply();
CPPUNIT_ASSERT_MESSAGE("Unable add and apply ranges", xScenario->getIsScenario());
CPPUNIT_ASSERT_MESSAGE("Unable execute getScenarioComment()",
!xScenario->getScenarioComment().isEmpty());
xScenario->setScenarioComment("Test");
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable execute setScenarioComment()", OUString("Test"),
xScenario->getScenarioComment());
}
} // namespace apitest
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
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