summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/qa/complex/api_internal/api.lst1
-rw-r--r--include/test/container/xnamereplace.hxx36
-rw-r--r--qadevOOo/Jar_OOoRunner.mk1
-rw-r--r--qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamilyObj.csv1
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj.java171
-rw-r--r--sc/qa/extras/scstylefamilyobj.cxx10
-rw-r--r--sc/qa/unoapi/sc_6.sce1
-rw-r--r--test/source/container/xnamereplace.cxx28
8 files changed, 50 insertions, 199 deletions
diff --git a/framework/qa/complex/api_internal/api.lst b/framework/qa/complex/api_internal/api.lst
index 2340ff4fc6bb..406fbb8bebdc 100644
--- a/framework/qa/complex/api_internal/api.lst
+++ b/framework/qa/complex/api_internal/api.lst
@@ -80,7 +80,6 @@ job88=sc.ScDatabaseRangeObj
job98=sc.ScHeaderFieldObj
job99=sc.ScHeaderFieldsObj
job126=sc.ScSheetLinkObj
-job131=sc.ScStyleFamilyObj
job132=sc.ScStyleObj
job134=sc.ScTableColumnObj
job135=sc.ScTableColumnsObj
diff --git a/include/test/container/xnamereplace.hxx b/include/test/container/xnamereplace.hxx
index 2d52fc2037eb..e10d198794ff 100644
--- a/include/test/container/xnamereplace.hxx
+++ b/include/test/container/xnamereplace.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -11,32 +11,42 @@
#define INCLUDED_TEST_CONTAINER_XNAMEREPLACE_HXX
#include <rtl/ustring.hxx>
-#include <com/sun/star/uno/Reference.hxx>
#include <test/testdllapi.hxx>
-#include <com/sun/star/uno/Any.hxx>
-namespace apitest {
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Any.hxx>
+namespace apitest
+{
class OOO_DLLPUBLIC_TEST XNameReplace
{
public:
- XNameReplace(const OUString& rName): maTestReplacementName(rName) {}
-
- virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+ XNameReplace(const OUString& rName)
+ : m_aReplacementName(rName)
+ {
+ }
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
void testReplaceByName();
- virtual css::uno::Any getAnyElementForNameReplace() = 0;
+ void setReplacmentElement(const css::uno::Any& rElement)
+ {
+ m_aReplacementElement = rElement;
+ }
- virtual ~XNameReplace() {}
-private:
- OUString const maTestReplacementName;
+protected:
+ ~XNameReplace() {}
+private:
+ OUString const m_aReplacementName;
+ css::uno::Any m_aReplacementElement;
};
-}
+} // namespace apitest
#endif // INCLUDED_TEST_CONTAINER_XNAMEREPLACE_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 9e5265f3e632..805ddeca0e38 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -970,7 +970,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/mod/_sc/ScModelObj \
qadevOOo/tests/java/mod/_sc/ScShapeObj \
qadevOOo/tests/java/mod/_sc/ScSheetLinkObj \
- qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj \
qadevOOo/tests/java/mod/_sc/ScStyleObj \
qadevOOo/tests/java/mod/_sc/ScSubTotalDescriptorBase \
qadevOOo/tests/java/mod/_sc/ScTableColumnObj \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamilyObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamilyObj.csv
deleted file mode 100644
index 10e3d65acd85..000000000000
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamilyObj.csv
+++ /dev/null
@@ -1 +0,0 @@
-"ScStyleFamilyObj";"com::sun::star::container::XNameReplace#optional";"replaceByName()"
diff --git a/qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj.java b/qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj.java
deleted file mode 100644
index ea8b06aabc3a..000000000000
--- a/qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj.java
+++ /dev/null
@@ -1,171 +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 util.SOfficeFactory;
-
-import com.sun.star.container.XIndexAccess;
-import com.sun.star.container.XNameAccess;
-import com.sun.star.container.XNameContainer;
-import com.sun.star.lang.XComponent;
-import com.sun.star.sheet.XSpreadsheetDocument;
-import com.sun.star.style.XStyleFamiliesSupplier;
-import com.sun.star.uno.AnyConverter;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XInterface;
-
-/**
-* Test for object which is represented by service
-* <code>com.sun.star.style.StyleFamily</code>. <p>
-* Object implements the following interfaces :
-* <ul>
-* <li> <code>com::sun::star::container::XNameContainer</code></li>
-* <li> <code>com::sun::star::container::XNameAccess</code></li>
-* <li> <code>com::sun::star::container::XElementAccess</code></li>
-* <li> <code>com::sun::star::container::XIndexAccess</code></li>
-* <li> <code>com::sun::star::container::XNameReplace</code></li>
-* </ul>
-* @see com.sun.star.style.StyleFamily
-* @see com.sun.star.container.XNameContainer
-* @see com.sun.star.container.XNameAccess
-* @see com.sun.star.container.XElementAccess
-* @see com.sun.star.container.XIndexAccess
-* @see com.sun.star.container.XNameReplace
-* @see ifc.container._XNameContainer
-* @see ifc.container._XNameAccess
-* @see ifc.container._XElementAccess
-* @see ifc.container._XIndexAccess
-* @see ifc.container._XNameReplace
-*/
-public class ScStyleFamilyObj extends TestCase {
- private XSpreadsheetDocument xSpreadsheetDoc = null;
-
- /**
- * Creates Spreadsheet document.
- */
- @Override
- protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception {
- SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() );
- log.println( "creating a Spreadsheet document" );
- xSpreadsheetDoc = SOF.createCalcDoc(null);
- }
-
- /**
- * Disposes Spreadsheet document.
- */
- @Override
- protected void cleanup( TestParameters tParam, PrintWriter log ) {
- log.println( " disposing xSheetDoc " );
- XComponent oComp = UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
- util.DesktopTools.closeDoc(oComp);
- }
-
- /**
- * Creating a TestEnvironment for the interfaces to be tested.
- * Retrieves the collection of style families from the document
- * using the interface <code>XStyleFamiliesSupplier</code>.
- * Obtains style family with index 0 from the collection.
- * Creates the two instance of the service <code>com.sun.star.style.CellStyle</code>.
- * One of the instance uses for inserting of new style to the obtained style
- * family that is the instance of the service
- * <code>com.sun.star.style.StyleFamily</code>.
- * Object relations created :
- * <ul>
- * <li> <code>'SecondInstance'</code> for
- * {@link ifc.container._XNameContainer}(the second created instance of
- * the service <code>com.sun.star.style.CellStyle</code>)</li>
- * <li> <code>'XNameReplaceINDEX'</code> for
- * {@link ifc.container._XNameContainer}(the number of the current
- * running threads multiplied by two)</li>
- * <li> <code>'INSTANCE1', ..., 'INSTANCEN'</code> for
- * {@link ifc.container._XNameContainer}(the created instances of
- * the service <code>com.sun.star.style.CellStyle</code>)</li>
- * </ul>
- * @see com.sun.star.style.CellStyle
- */
- @Override
- protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception {
-
- // creation of testobject here
- // first we write what we are intend to do to log file
- log.println( "creating a test environment" );
-
- XNameAccess oStyleFamilyNameAccess = null;
- // create testobject here
- log.println("getting style");
- XStyleFamiliesSupplier oStyleFamiliesSupplier = UnoRuntime.queryInterface(
- XStyleFamiliesSupplier.class, xSpreadsheetDoc);
-
- XNameAccess oStyleFamilies = oStyleFamiliesSupplier.getStyleFamilies();
- XIndexAccess oStyleFamiliesIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, oStyleFamilies);
- oStyleFamilyNameAccess = (XNameAccess) AnyConverter.toObject(
- new Type(XNameAccess.class),
- oStyleFamiliesIndexAccess.getByIndex(0));
-
- SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF());
- XComponent xComp = UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc);
-
- XInterface oInstance = (XInterface)
- SOF.createInstance(xComp,"com.sun.star.style.CellStyle");
-
- // insert a Style which can be replaced by name
- XNameContainer oContainer = UnoRuntime.queryInterface(
- XNameContainer.class, oStyleFamilyNameAccess);
- oContainer.insertByName("ScStyleFamilyObj", oInstance);
-
- TestEnvironment tEnv = new TestEnvironment(oStyleFamilyNameAccess);
-
- oInstance = (XInterface)
- SOF.createInstance(xComp, "com.sun.star.style.CellStyle");
-
- //second instance for insertByName in XNameContainer
- tEnv.addObjRelation("SecondInstance", oInstance);
-
- int THRCNT = 1;
- if ((String)tParam.get("THRCNT") != null) {
- THRCNT = Integer.parseInt((String)tParam.get("THRCNT"));
- }
-
- log.println( "adding XNameReplaceINDEX as mod relation to environment" );
- tEnv.addObjRelation("XNameReplaceINDEX", Integer.toString(2*THRCNT));
-
- // INSTANCEn : _XNameContainer; _XNameReplace
- log.println( "adding INSTANCEn as mod relation to environment" );
- for (int n = 1; n < 2*(THRCNT+1) ;n++ ) {
- log.println( "adding INSTANCE" + n +
- " as mod relation to environment" );
- tEnv.addObjRelation("INSTANCE" + n, SOF.createInstance(
- xComp,"com.sun.star.style.CellStyle"));
- }
- // NAMEREPLACE : _XNameReplace
- log.println("adding NAMEREPLACE as mod relation to environment");
- String cName = "ScStyleFamilyObj";
- tEnv.addObjRelation("NAMEREPLACE", cName);
-
- return tEnv;
- } // finish method getTestEnvironment
-
-} // finish class ScStyleFamilyObj
-
diff --git a/sc/qa/extras/scstylefamilyobj.cxx b/sc/qa/extras/scstylefamilyobj.cxx
index bbe8b7d6457b..fc0e75ccf3df 100644
--- a/sc/qa/extras/scstylefamilyobj.cxx
+++ b/sc/qa/extras/scstylefamilyobj.cxx
@@ -12,6 +12,7 @@
#include <test/container/xindexaccess.hxx>
#include <test/container/xnameaccess.hxx>
#include <test/container/xnamecontainer.hxx>
+#include <test/container/xnamereplace.hxx>
#include <cppu/unotype.hxx>
#include <com/sun/star/container/XIndexAccess.hpp>
@@ -34,7 +35,8 @@ class ScStyleFamilyObj : public CalcUnoApiTest,
public apitest::XElementAccess,
public apitest::XIndexAccess,
public apitest::XNameAccess,
- public apitest::XNameContainer
+ public apitest::XNameContainer,
+ public apitest::XNameReplace
{
public:
ScStyleFamilyObj();
@@ -65,6 +67,9 @@ public:
CPPUNIT_TEST(testRemoveByName);
CPPUNIT_TEST(testRemoveByNameNoneExistingElement);
+ // XNameReplace
+ CPPUNIT_TEST(testReplaceByName);
+
CPPUNIT_TEST_SUITE_END();
private:
@@ -77,6 +82,7 @@ ScStyleFamilyObj::ScStyleFamilyObj()
, XIndexAccess(19)
, XNameAccess("Default")
, XNameContainer("Default")
+ , XNameReplace("Default")
{
}
@@ -94,6 +100,8 @@ uno::Reference<uno::XInterface> ScStyleFamilyObj::init()
uno::UNO_QUERY_THROW);
// XNameContainer
setElement(uno::makeAny(xMSF->createInstance("com.sun.star.style.CellStyle")));
+ // XNameReplace
+ setReplacmentElement(uno::makeAny(xMSF->createInstance("com.sun.star.style.CellStyle")));
uno::Reference<container::XNameContainer> xNC(xNA_SF, uno::UNO_QUERY_THROW);
xNC->insertByName("ScStyleFamilyObj", uno::makeAny(xCS));
diff --git a/sc/qa/unoapi/sc_6.sce b/sc/qa/unoapi/sc_6.sce
index 1077a053ef63..c8bae6e3df39 100644
--- a/sc/qa/unoapi/sc_6.sce
+++ b/sc/qa/unoapi/sc_6.sce
@@ -18,4 +18,3 @@
-o sc.ScModelObj
# -o sc.ScShapeObj
# -o sc.ScSheetLinkObj
--o sc.ScStyleFamilyObj
diff --git a/test/source/container/xnamereplace.cxx b/test/source/container/xnamereplace.cxx
index cd2a05ae8f9a..b1fdc9ec8cf0 100644
--- a/test/source/container/xnamereplace.cxx
+++ b/test/source/container/xnamereplace.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -8,22 +8,30 @@
*/
#include <test/container/xnamereplace.hxx>
+
#include <com/sun/star/container/XNameReplace.hpp>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
#include <cppunit/extensions/HelperMacros.h>
using namespace css;
-using namespace css::uno;
-
-namespace apitest {
+namespace apitest
+{
void XNameReplace::testReplaceByName()
{
- uno::Reference< container::XNameReplace > xNameReplace(init(), UNO_QUERY_THROW);
- xNameReplace->replaceByName(maTestReplacementName, getAnyElementForNameReplace());
- Any aAny = xNameReplace->getByName( maTestReplacementName );
- uno::Reference< uno::XInterface > xElement(aAny, UNO_QUERY_THROW);
-}
+ uno::Reference<container::XNameReplace> xNameReplace(init(), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_NO_THROW(xNameReplace->replaceByName(m_aReplacementName, m_aReplacementElement));
+ uno::Any aAny = xNameReplace->getByName(m_aReplacementName);
+
+ // we deliberately avoid uno::UNO_QUERY_THROW, so a test on .is() can be made
+ uno::Reference<uno::XInterface> xElement(aAny, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xElement.is());
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */