Kaydet (Commit) 23a1c542 authored tarafından Jens Carl's avatar Jens Carl

tdf#45904 Move _Scenario Java tests to C++

Change-Id: I313f3a56fd99e7fb29e6f729cfe13e99adf1fed6
Reviewed-on: https://gerrit.libreoffice.org/47289Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst 6a29d733
/* -*- 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_SCENARIO_HXX
#define INCLUDED_TEST_SHEET_SCENARIO_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 Scenario
{
public:
virtual css::uno::Reference<css::uno::XInterface> getScenarioSpreadsheet() = 0;
void testScenarioProperties();
protected:
~Scenario() {}
};
}
#endif // INCLUDED_TEST_SHEET_SCENARIO_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -567,7 +567,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_DocumentSettings \
qadevOOo/tests/java/ifc/sheet/_FunctionDescription \
qadevOOo/tests/java/ifc/sheet/_GlobalSheetSettings \
qadevOOo/tests/java/ifc/sheet/_Scenario \
qadevOOo/tests/java/ifc/sheet/_Shape \
qadevOOo/tests/java/ifc/sheet/_SheetCell \
qadevOOo/tests/java/ifc/sheet/_SheetCellRange \
......
......@@ -109,14 +109,6 @@
"ScTableSheetObj";"com::sun::star::style::CharacterPropertiesComplex";"CharFontPitchComplex"
"ScTableSheetObj";"com::sun::star::style::CharacterPropertiesComplex";"CharPostureComplex"
"ScTableSheetObj";"com::sun::star::style::CharacterPropertiesComplex";"CharLocaleComplex"
"ScTableSheetObj";"com::sun::star::sheet::Scenario";"IsActive#optional"
"ScTableSheetObj";"com::sun::star::sheet::Scenario";"BorderColor#optional"
"ScTableSheetObj";"com::sun::star::sheet::Scenario";"Protected#optional"
"ScTableSheetObj";"com::sun::star::sheet::Scenario";"ShowBorder#optional"
"ScTableSheetObj";"com::sun::star::sheet::Scenario";"PrintBorder#optional"
"ScTableSheetObj";"com::sun::star::sheet::Scenario";"CopyBack#optional"
"ScTableSheetObj";"com::sun::star::sheet::Scenario";"CopyStyles#optional"
"ScTableSheetObj";"com::sun::star::sheet::Scenario";"CopyFormulas#optional"
"ScTableSheetObj";"com::sun::star::util::XProtectable";"protect()"
"ScTableSheetObj";"com::sun::star::util::XProtectable";"unprotect()"
"ScTableSheetObj";"com::sun::star::util::XProtectable";"isProtected()"
......
/*
* 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.beans.XPropertySet;
import com.sun.star.uno.UnoRuntime;
import lib.MultiPropertyTest;
public class _Scenario extends MultiPropertyTest {
@Override
public void before() {
oObj = UnoRuntime.queryInterface(XPropertySet.class,
tEnv.getObjRelation(
"ScenarioSheet"));
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@
*/
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/scenario.hxx>
#include <test/sheet/xcellformatrangessupplier.hxx>
#include <test/sheet/xcellrangeaddressable.hxx>
#include <test/sheet/xcellseries.hxx>
......@@ -41,9 +42,10 @@ using namespace css::uno;
namespace sc_apitest
{
#define NUMBER_OF_TESTS 34
#define NUMBER_OF_TESTS 35
class ScTableSheetObj : public CalcUnoApiTest, public apitest::XCellFormatRangesSupplier,
class ScTableSheetObj : public CalcUnoApiTest, public apitest::Scenario,
public apitest::XCellFormatRangesSupplier,
public apitest::XCellRangeAddressable,
public apitest::XCellSeries,
public apitest::XDataPilotTablesSupplier,
......@@ -79,6 +81,9 @@ public:
CPPUNIT_TEST_SUITE(ScTableSheetObj);
// Scenario
CPPUNIT_TEST(testScenarioProperties);
// XCellFormatRangesSupplier
CPPUNIT_TEST(testGetCellFormatRanges);
......
......@@ -47,6 +47,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/databaserange \
test/source/sheet/datapilotfield \
test/source/sheet/datapilotitem \
test/source/sheet/scenario \
test/source/sheet/xarealink \
test/source/sheet/xarealinks \
test/source/sheet/xcelladdressable \
......
/* -*- 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 <array>
#include <test/sheet/scenario.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/uno/Any.hxx>
#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 Scenario::testScenarioProperties()
{
uno::Reference<beans::XPropertySet> xScenario(getScenarioSpreadsheet(), UNO_QUERY_THROW);
OUString propName;
uno::Any aNewValue;
propName = "IsActive";
bool aIsActive = false;
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aIsActive);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value IsActive", aIsActive);
aNewValue <<= false;
xScenario->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aIsActive);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value IsActive", !aIsActive);
propName = "BorderColor";
sal_Int32 aBorderColor = 0;
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aBorderColor);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value BorderColor", sal_Int32(12632256),
aBorderColor);
aNewValue <<= sal_Int32(42);
xScenario->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aBorderColor);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set property value BorderColor", sal_Int32(42),
aBorderColor);
propName = "Protected";
bool aProtected = false;
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aProtected);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value Protected", aProtected);
aNewValue <<= false;
xScenario->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aProtected);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value Protected", !aProtected);
propName = "ShowBorder";
bool aShowBorder = false;
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aShowBorder);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value ShowBorder", aShowBorder);
aNewValue <<= false;
xScenario->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aShowBorder);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value ShowBorder", !aShowBorder);
propName = "PrintBorder";
bool aPrintBorder = false;
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aPrintBorder);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value PrintBorder", aPrintBorder);
aNewValue <<= false;
xScenario->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aPrintBorder);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value PrintBorder", !aPrintBorder);
propName = "CopyBack";
bool aCopyBack = false;
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyBack);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value CopyBack", aCopyBack);
aNewValue <<= false;
xScenario->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyBack);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value CopyBack", !aCopyBack);
propName = "CopyStyles";
bool aCopyStyles = true;
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyStyles);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value CopyStyles", !aCopyStyles);
aNewValue <<= true;
xScenario->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyStyles);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value CopyStyles", aCopyStyles);
propName = "CopyFormulas";
bool aCopyFormulas = false;
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyFormulas);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value CopyFormulas", aCopyFormulas);
aNewValue <<= false;
xScenario->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyFormulas);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value CopyFormulas", !aCopyFormulas);
}
}
/* 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