tdf#45904 Move XPropertySet Java tests to C++
Move XPropertySet Java tests to C++ for ScSpreadsheetSettings.
Change-Id: Id969a566fcb4e544c26a4097e0f49a01bc967ad7
Reviewed-on: https://gerrit.libreoffice.org/66926
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 609e7d5..434ae00 100644
--- a/framework/qa/complex/api_internal/api.lst
+++ b/framework/qa/complex/api_internal/api.lst
@@ -84,7 +84,6 @@
job98=sc.ScHeaderFieldObj
job99=sc.ScHeaderFieldsObj
job126=sc.ScSheetLinkObj
job128=sc.ScSpreadsheetSettings
job129=sc.ScSpreadsheetSettingsObj
job131=sc.ScStyleFamilyObj
job132=sc.ScStyleObj
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 7188765..3f9f58a 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -982,7 +982,6 @@
qadevOOo/tests/java/mod/_sc/ScNamedRangesObj \
qadevOOo/tests/java/mod/_sc/ScShapeObj \
qadevOOo/tests/java/mod/_sc/ScSheetLinkObj \
qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings \
qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettingsObj \
qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj \
qadevOOo/tests/java/mod/_sc/ScStyleObj \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSpreadsheetSettings.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSpreadsheetSettings.csv
deleted file mode 100644
index 63db656..0000000
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSpreadsheetSettings.csv
+++ /dev/null
@@ -1,7 +0,0 @@
"ScSpreadsheetSettings";"com::sun::star::beans::XPropertySet";"getPropertySetInfo()"
"ScSpreadsheetSettings";"com::sun::star::beans::XPropertySet";"setPropertyValue()"
"ScSpreadsheetSettings";"com::sun::star::beans::XPropertySet";"getPropertyValue()"
"ScSpreadsheetSettings";"com::sun::star::beans::XPropertySet";"addPropertyChangeListener()"
"ScSpreadsheetSettings";"com::sun::star::beans::XPropertySet";"removePropertyChangeListener()"
"ScSpreadsheetSettings";"com::sun::star::beans::XPropertySet";"addVetoableChangeListener()"
"ScSpreadsheetSettings";"com::sun::star::beans::XPropertySet";"removeVetoableChangeListener()"
diff --git a/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings.java b/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings.java
deleted file mode 100644
index f98ad9f..0000000
--- a/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings.java
+++ /dev/null
@@ -1,69 +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 com.sun.star.uno.XInterface;
/**
* Test for object which is represented by service
* <code>com.sun.star.sheet.GlobalSheetSettings</code>. <p>
* Object implements the following interfaces :
* <ul>
* <li> <code>com::sun::star::sheet::GlobalSheetSettings</code></li>
* <li> <code>com::sun::star::beans::XPropertySet</code></li>
* </ul>
* @see com.sun.star.sheet.GlobalSheetSettings
* @see com.sun.star.beans.XPropertySet
* @see ifc.sheet._GlobalSheetSettings
* @see ifc.beans._XPropertySet
*/
public class ScSpreadsheetSettings extends TestCase {
/**
* Creating a TestEnvironment for the interfaces to be tested.
* Creates an instance of the service
* <code>com.sun.star.sheet.GlobalSheetSettings</code>.
*/
@Override
public TestEnvironment createTestEnvironment(
TestParameters tParam, 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" );
// create testobject here
oObj = (XInterface)tParam.getMSF().
createInstance("com.sun.star.sheet.GlobalSheetSettings");
TestEnvironment tEnv = new TestEnvironment(oObj);
return tEnv;
} // finish method getTestEnvironment
} // finish class ScSpreadsheetSettings
diff --git a/sc/qa/extras/scspreadsheetsettings.cxx b/sc/qa/extras/scspreadsheetsettings.cxx
index 4efd211..5835877 100644
--- a/sc/qa/extras/scspreadsheetsettings.cxx
+++ b/sc/qa/extras/scspreadsheetsettings.cxx
@@ -8,6 +8,7 @@
*/
#include <test/calc_unoapi_test.hxx>
#include <test/beans/xpropertyset.hxx>
#include <test/sheet/globalsheetsettings.hxx>
#include <com/sun/star/lang/XComponent.hpp>
@@ -23,7 +24,9 @@
namespace sc_apitest
{
class ScSpreadsheetSettings : public CalcUnoApiTest, public apitest::GlobalSheetSettings
class ScSpreadsheetSettings : public CalcUnoApiTest,
public apitest::GlobalSheetSettings,
public apitest::XPropertySet
{
public:
ScSpreadsheetSettings();
@@ -37,6 +40,13 @@
// GlobalSheetSettings
CPPUNIT_TEST(testGlobalSheetSettingsProperties);
// XPropertySet
CPPUNIT_TEST(testGetPropertySetInfo);
CPPUNIT_TEST(testGetPropertyValue);
CPPUNIT_TEST(testSetPropertyValue);
CPPUNIT_TEST(testPropertyChangeListener);
CPPUNIT_TEST(testVetoableChangeListener);
CPPUNIT_TEST_SUITE_END();
private:
@@ -45,6 +55,7 @@
ScSpreadsheetSettings::ScSpreadsheetSettings()
: CalcUnoApiTest("/sc/qa/extras/testdocuments")
, XPropertySet({ "LinkUpdateMode", "UsePrinterMetrics", "UserLists" })
{
}
@@ -70,7 +81,7 @@
CPPUNIT_TEST_SUITE_REGISTRATION(ScSpreadsheetSettings);
} // end namespace
} // namespace sc_apitest
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/qa/unoapi/sc_6.sce b/sc/qa/unoapi/sc_6.sce
index cb24d34..c842d05 100644
--- a/sc/qa/unoapi/sc_6.sce
+++ b/sc/qa/unoapi/sc_6.sce
@@ -19,6 +19,5 @@
-o sc.ScNamedRangesObj
# -o sc.ScShapeObj
# -o sc.ScSheetLinkObj
-o sc.ScSpreadsheetSettings
-o sc.ScSpreadsheetSettingsObj
-o sc.ScStyleFamilyObj
diff --git a/test/source/beans/xpropertyset.cxx b/test/source/beans/xpropertyset.cxx
index b67c485..993b609 100644
--- a/test/source/beans/xpropertyset.cxx
+++ b/test/source/beans/xpropertyset.cxx
@@ -171,6 +171,10 @@
bool XPropertySet::isPropertyValueChangeable(const OUString& rName)
{
bool bIgnore = isPropertyIgnored(rName);
if (bIgnore)
return false;
uno::Reference<beans::XPropertySet> xPropSet(init(), UNO_QUERY_THROW);
try
{
@@ -193,7 +197,7 @@
{
// 16-bit integer
sal_Int16 nOld = any.get<sal_Int16>();
sal_Int16 nNew = nOld + 2;
sal_Int16 nNew = nOld + 1;
xPropSet->setPropertyValue(rName, makeAny(nNew));
}
else if (type == cppu::UnoType<sal_Int32>::get())
@@ -240,14 +244,10 @@
}
else
{
bool bIgnore = isPropertyIgnored(rName);
if (bIgnore)
return false;
std::cout << type.getTypeName() << std::endl;
std::cout << rName << std::endl;
CPPUNIT_ASSERT_MESSAGE("XPropertySet::isChangeable: unknown type in Any tested.",
false);
CPPUNIT_ASSERT_MESSAGE(
"XPropertySet::isPropertyValueChangeable: unknown type in Any tested.", false);
}
uno::Any anyTest = xPropSet->getPropertyValue(rName);
@@ -255,9 +255,9 @@
}
catch (const uno::Exception&)
{
CPPUNIT_ASSERT_MESSAGE(
"XPropertySet::isChangeable: exception thrown while retrieving the property value.",
false);
CPPUNIT_ASSERT_MESSAGE("XPropertySet::isPropertyValueChangeable: exception thrown while "
"retrieving the property value.",
false);
}
return false;