summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2019-01-25 17:41:27 +0000
committerJens Carl <j.carl43@gmx.de>2019-01-25 21:52:05 +0100
commit7422d394812958a2014615b996df0378cc7d495f (patch)
tree5f24fc07bbc85dec75dc74f8c96b305ed12c8bca
parent79b04f8b02268399fd5388227e947d547366a4e5 (diff)
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>
-rw-r--r--framework/qa/complex/api_internal/api.lst1
-rw-r--r--qadevOOo/Jar_OOoRunner.mk1
-rw-r--r--qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSpreadsheetSettings.csv7
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings.java69
-rw-r--r--sc/qa/extras/scspreadsheetsettings.cxx15
-rw-r--r--sc/qa/unoapi/sc_6.sce1
-rw-r--r--test/source/beans/xpropertyset.cxx20
7 files changed, 23 insertions, 91 deletions
diff --git a/framework/qa/complex/api_internal/api.lst b/framework/qa/complex/api_internal/api.lst
index 609e7d5c323d..434ae00edc0d 100644
--- a/framework/qa/complex/api_internal/api.lst
+++ b/framework/qa/complex/api_internal/api.lst
@@ -84,7 +84,6 @@ job96=sc.ScFilterDescriptorBase
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 71887651aa48..3f9f58ac43d9 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -982,7 +982,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
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 63db656f8011..000000000000
--- 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 f98ad9f7f91b..000000000000
--- 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 4efd21102624..5835877e2dc0 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 @@ using namespace com::sun::star;
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 @@ public:
// 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 @@ private:
ScSpreadsheetSettings::ScSpreadsheetSettings()
: CalcUnoApiTest("/sc/qa/extras/testdocuments")
+ , XPropertySet({ "LinkUpdateMode", "UsePrinterMetrics", "UserLists" })
{
}
@@ -70,7 +81,7 @@ void ScSpreadsheetSettings::tearDown()
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 cb24d34d75c5..c842d055142c 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 b67c485a17a7..993b609ec4b4 100644
--- a/test/source/beans/xpropertyset.cxx
+++ b/test/source/beans/xpropertyset.cxx
@@ -171,6 +171,10 @@ void XPropertySet::testGetPropertyValue()
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 @@ bool XPropertySet::isPropertyValueChangeable(const OUString& rName)
{
// 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 @@ bool XPropertySet::isPropertyValueChangeable(const OUString& rName)
}
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 @@ bool XPropertySet::isPropertyValueChangeable(const OUString& rName)
}
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;