diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-01-28 20:57:40 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-01-28 20:57:40 +0100 |
commit | 2716f7dce26f16a2b677c178aa7d01cea096ae47 (patch) | |
tree | 9e9f67205cd5b72f1031721273e1534a3a1e5b0f /cppuhelper/qa | |
parent | 10ac9e750447fd57e3cef7993b0ad6c6538d6269 (diff) |
replace obsolete "master" branch with README that points at new repoHEADmaster-deletedmaster
Diffstat (limited to 'cppuhelper/qa')
22 files changed, 0 insertions, 3192 deletions
diff --git a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx deleted file mode 100644 index 97c95a1e1..000000000 --- a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx +++ /dev/null @@ -1,288 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string.h> -#include <cppunit/TestFixture.h> -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/plugin/TestPlugIn.h> - -#include "com/sun/star/lang/XEventListener.hpp" -#include "cppuhelper/interfacecontainer.hxx" -#include "cppuhelper/queryinterface.hxx" -#include "cppuhelper/implbase1.hxx" -#include "cppuhelper/propshlp.hxx" - -using namespace com::sun::star; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; - - -struct equalStr -{ - bool operator()( - const char * const &rA, - const char * const &rB) const - { return !strcmp(rA, rB); } -}; -struct hashStr -{ - size_t operator()( const char * &rName ) const - { - return rtl::OString(rName).hashCode(); - } -}; - -class ContainerListener; - -struct ContainerStats { - int m_nAlive; - int m_nDisposed; - ContainerStats() : m_nAlive(0), m_nDisposed(0) {} -}; - -class ContainerListener : public ::cppu::WeakImplHelper1< XEventListener > -{ - ContainerStats *m_pStats; -public: - ContainerListener(ContainerStats *pStats) - : m_pStats(pStats) { m_pStats->m_nAlive++; } - virtual ~ContainerListener() { m_pStats->m_nAlive--; } - virtual void SAL_CALL disposing( const EventObject& ) - throw (RuntimeException) - { - m_pStats->m_nDisposed++; - } -}; - -namespace cppu_ifcontainer -{ - class IfTest : public CppUnit::TestFixture - { - osl::Mutex m_aGuard; - static const int nTests = 10; - public: - void testCreateDispose() - { - ContainerStats aStats; - cppu::OInterfaceContainerHelper *pContainer; - - pContainer = new cppu::OInterfaceContainerHelper(m_aGuard); - - CPPUNIT_ASSERT_MESSAGE("Empty container not empty", - pContainer->getLength() == 0); - - int i; - for (i = 0; i < nTests; i++) - { - Reference<XEventListener> xRef = new ContainerListener(&aStats); - int nNewLen = pContainer->addInterface(xRef); - - CPPUNIT_ASSERT_MESSAGE("addition length mismatch", - nNewLen == i + 1); - CPPUNIT_ASSERT_MESSAGE("addition length mismatch", - pContainer->getLength() == i + 1); - } - CPPUNIT_ASSERT_MESSAGE("alive count mismatch", - aStats.m_nAlive == nTests); - - EventObject aObj; - pContainer->disposeAndClear(aObj); - - CPPUNIT_ASSERT_MESSAGE("dispose count mismatch", - aStats.m_nDisposed == nTests); - CPPUNIT_ASSERT_MESSAGE("leaked container left alive", - aStats.m_nAlive == 0); - - delete pContainer; - } - - void testEnumerate() - { - int i; - ContainerStats aStats; - cppu::OInterfaceContainerHelper *pContainer; - pContainer = new cppu::OInterfaceContainerHelper(m_aGuard); - - std::vector< Reference< XEventListener > > aListeners; - for (i = 0; i < nTests; i++) - { - Reference<XEventListener> xRef = new ContainerListener(&aStats); - pContainer->addInterface(xRef); - aListeners.push_back(xRef); - } - Sequence< Reference< XInterface > > aElements; - aElements = pContainer->getElements(); - - CPPUNIT_ASSERT_MESSAGE("query contents", - (int)aElements.getLength() == nTests); - if ((int)aElements.getLength() == nTests) - { - for (i = 0; i < nTests; i++) - { - CPPUNIT_ASSERT_MESSAGE("mismatching elements", - aElements[i] == aListeners[i]); - } - } - pContainer->clear(); - - CPPUNIT_ASSERT_MESSAGE("non-empty container post clear", - pContainer->getLength() == 0); - delete pContainer; - } - - template < typename ContainerType, typename ContainedType > - void doContainerTest(const ContainedType *pTypes) - { - ContainerStats aStats; - ContainerType *pContainer; - pContainer = new ContainerType(m_aGuard); - - int i; - Reference<XEventListener> xRefs[nTests * 2]; - - // add these interfaces - for (i = 0; i < nTests * 2; i++) - { - xRefs[i] = new ContainerListener(&aStats); - pContainer->addInterface(pTypes[i / 2], xRefs[i]); - } - - // check it is all there - for (i = 0; i < nTests; i++) - { - cppu::OInterfaceContainerHelper *pHelper; - - pHelper = pContainer->getContainer(pTypes[i]); - - CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != NULL); - Sequence<Reference< XInterface > > aSeq = pHelper->getElements(); - CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 2); - CPPUNIT_ASSERT_MESSAGE("match", aSeq[0] == xRefs[i*2]); - CPPUNIT_ASSERT_MESSAGE("match", aSeq[1] == xRefs[i*2+1]); - } - - // remove every other interface - for (i = 0; i < nTests; i++) - pContainer->removeInterface(pTypes[i], xRefs[i*2+1]); - - // check it is half there - for (i = 0; i < nTests; i++) - { - cppu::OInterfaceContainerHelper *pHelper; - - pHelper = pContainer->getContainer(pTypes[i]); - - CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != NULL); - Sequence<Reference< XInterface > > aSeq = pHelper->getElements(); - CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 1); - CPPUNIT_ASSERT_MESSAGE("match", aSeq[0] == xRefs[i*2]); - } - - // remove the 1st half of the rest - for (i = 0; i < nTests / 2; i++) - pContainer->removeInterface(pTypes[i], xRefs[i*2]); - - // check it is half there - for (i = 0; i < nTests / 2; i++) - { - cppu::OInterfaceContainerHelper *pHelper; - - pHelper = pContainer->getContainer(pTypes[i]); - CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != NULL); - Sequence<Reference< XInterface > > aSeq = pHelper->getElements(); - CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 0); - } - - delete pContainer; - } - - void testOMultiTypeInterfaceContainerHelper() - { - uno::Type pTypes[nTests] = - { - ::cppu::UnoType< bool >::get(), - ::cppu::UnoType< float >::get(), - ::cppu::UnoType< double >::get(), - ::cppu::UnoType< ::sal_uInt64 >::get(), - ::cppu::UnoType< ::sal_Int64 >::get(), - ::cppu::UnoType< ::sal_uInt32 >::get(), - ::cppu::UnoType< ::sal_Int32 >::get(), - ::cppu::UnoType< ::sal_Int16 >::get(), - ::cppu::UnoType< ::rtl::OUString >::get(), - ::cppu::UnoType< ::sal_Int8 >::get() - }; - doContainerTest< cppu::OMultiTypeInterfaceContainerHelper, - uno::Type> (pTypes); - } - - void testOMultiTypeInterfaceContainerHelperInt32() - { - sal_Int32 pTypes[nTests] = - { - 0, - -1, - 1, - 256, - 1024, - 3, - 7, - 8, - 9, - 10 - }; - doContainerTest< cppu::OMultiTypeInterfaceContainerHelperInt32, sal_Int32> (pTypes); - } - - void testOMultiTypeInterfaceContainerHelperVar() - { - typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< - const char *,hashStr,equalStr> StrContainer; - - const char *pTypes[nTests] = - { - "this_is", "such", "fun", "writing", "unit", "tests", "when", "it", "works", "anyway" - }; - doContainerTest< StrContainer, const char *> (pTypes); - } - - // Automatic registration code - CPPUNIT_TEST_SUITE(IfTest); - CPPUNIT_TEST(testCreateDispose); - CPPUNIT_TEST(testEnumerate); - CPPUNIT_TEST(testOMultiTypeInterfaceContainerHelper); - CPPUNIT_TEST(testOMultiTypeInterfaceContainerHelperVar); - CPPUNIT_TEST(testOMultiTypeInterfaceContainerHelperInt32); - CPPUNIT_TEST_SUITE_END(); - }; -} // namespace cppu_ifcontainer - -CPPUNIT_TEST_SUITE_REGISTRATION(cppu_ifcontainer::IfTest); - -CPPUNIT_PLUGIN_IMPLEMENT(); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/qa/ifcontainer/export.map b/cppuhelper/qa/ifcontainer/export.map deleted file mode 100644 index 117caf43a..000000000 --- a/cppuhelper/qa/ifcontainer/export.map +++ /dev/null @@ -1,7 +0,0 @@ -UDK_3_0_0 { - global: - cppunitTestPlugIn; - - local: - *; -}; diff --git a/cppuhelper/qa/ifcontainer/makefile.mk b/cppuhelper/qa/ifcontainer/makefile.mk deleted file mode 100644 index d4d67a44e..000000000 --- a/cppuhelper/qa/ifcontainer/makefile.mk +++ /dev/null @@ -1,62 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=cppuhelper -TARGET=cppu_ifcontainer - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -CFLAGSCXX += $(CPPUNIT_CFLAGS) - -.IF "$(OS)" == "IOS" -CFLAGSCXX += -DCPPUNIT_PLUGIN_EXPORTED_NAME=cppunitTest_$(TARGET) -.ENDIF - -SHL1OBJS= \ - $(SLO)$/cppu_ifcontainer.obj -SHL1TARGET= cppu_ifcontainer -SHL1STDLIBS=\ - $(CPPUHELPERLIB) \ - $(SALLIB) \ - $(CPPULIB) \ - $(CPPUNITLIB) -SHL1IMPLIB= i$(SHL1TARGET) -DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP= export.map - -SLOFILES = $(SHL1OBJS) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk -.INCLUDE : _cppunit.mk - diff --git a/cppuhelper/qa/propertysetmixin/JavaSupplier.java b/cppuhelper/qa/propertysetmixin/JavaSupplier.java deleted file mode 100644 index 834e448c6..000000000 --- a/cppuhelper/qa/propertysetmixin/JavaSupplier.java +++ /dev/null @@ -1,317 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package test.cppuhelper.propertysetmixin.comp; - -import com.sun.star.beans.Ambiguous; -import com.sun.star.beans.Defaulted; -import com.sun.star.beans.Optional; -import com.sun.star.beans.UnknownPropertyException; -import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.PropertyVetoException; -import com.sun.star.beans.XFastPropertySet; -import com.sun.star.beans.XPropertyAccess; -import com.sun.star.beans.XPropertyChangeListener; -import com.sun.star.beans.XPropertySet; -import com.sun.star.beans.XPropertySetInfo; -import com.sun.star.beans.XVetoableChangeListener; -import com.sun.star.comp.loader.FactoryHelper; -import com.sun.star.lang.WrappedTargetException; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XEventListener; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XSingleServiceFactory; -import com.sun.star.lib.uno.helper.WeakBase; -import com.sun.star.lib.uno.helper.PropertySetMixin; -import com.sun.star.registry.XRegistryKey; -import com.sun.star.uno.Any; -import com.sun.star.uno.IQueryInterface; -import com.sun.star.uno.Type; -import com.sun.star.uno.XComponentContext; -import test.cppuhelper.propertysetmixin.XSupplier; -import test.cppuhelper.propertysetmixin.XTest3; - -public final class JavaSupplier extends WeakBase implements XSupplier { - public JavaSupplier(XComponentContext context) { - this.context = context; - } - - public XComponent getEmpty1() { return new Empty1(); } - - public XComponent getEmpty2() { return new Empty2(); } - - public XTest3 getFull() { return new Full(); } - - public static XSingleServiceFactory __getServiceFactory( - String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey) - { - return implName.equals(implementationName) - ? FactoryHelper.getServiceFactory( - JavaSupplier.class, serviceName, multiFactory, regKey) - : null; - } - - private static final String implementationName - = JavaSupplier.class.getName(); - private static final String serviceName - = "test.cppuhelper.propertysetmixin.JavaSupplier"; - - private final class Empty1 extends WeakBase implements XComponent { - public Empty1() {} - - public void dispose() { - prop.dispose(); - } - - public void addEventListener(XEventListener listener) {} - - public void removeEventListener(XEventListener listener) {} - - private final PropertySetMixin prop = new PropertySetMixin( - context, this, new Type(XComponent.class), null); - } - - private final class Empty2 extends WeakBase - implements XComponent, XPropertySet, XFastPropertySet, XPropertyAccess - { - public Empty2() {} - - public void dispose() { - prop.dispose(); - } - - public void addEventListener(XEventListener listener) {} - - public void removeEventListener(XEventListener listener) {} - - public com.sun.star.beans.XPropertySetInfo getPropertySetInfo() { - return prop.getPropertySetInfo(); - } - - public void setPropertyValue(String propertyName, Object value) - throws UnknownPropertyException, PropertyVetoException, - com.sun.star.lang.IllegalArgumentException, WrappedTargetException - { - prop.setPropertyValue(propertyName, value); - } - - public Object getPropertyValue(String propertyName) - throws UnknownPropertyException, WrappedTargetException - { - return prop.getPropertyValue(propertyName); - } - - public void addPropertyChangeListener( - String propertyName, XPropertyChangeListener listener) - throws UnknownPropertyException, WrappedTargetException - { - prop.addPropertyChangeListener(propertyName, listener); - } - - public void removePropertyChangeListener( - String propertyName, XPropertyChangeListener listener) - throws UnknownPropertyException, WrappedTargetException - { - prop.removePropertyChangeListener(propertyName, listener); - } - - public void addVetoableChangeListener( - String propertyName, XVetoableChangeListener listener) - throws UnknownPropertyException, WrappedTargetException - { - prop.addVetoableChangeListener(propertyName, listener); - } - - public void removeVetoableChangeListener( - String propertyName, XVetoableChangeListener listener) - throws UnknownPropertyException, WrappedTargetException - { - prop.removeVetoableChangeListener(propertyName, listener); - } - - public void setFastPropertyValue(int handle, Object value) - throws UnknownPropertyException, PropertyVetoException, - com.sun.star.lang.IllegalArgumentException, WrappedTargetException - { - prop.setFastPropertyValue(handle, value); - } - - public Object getFastPropertyValue(int handle) - throws UnknownPropertyException, WrappedTargetException - { - return prop.getFastPropertyValue(handle); - } - - public PropertyValue[] getPropertyValues() { - return prop.getPropertyValues(); - } - - public void setPropertyValues(PropertyValue[] props) - throws UnknownPropertyException, PropertyVetoException, - com.sun.star.lang.IllegalArgumentException, WrappedTargetException - { - prop.setPropertyValues(props); - } - - private final PropertySetMixin prop = new PropertySetMixin( - context, this, new Type(XComponent.class), null); - } - - private final class Full extends WeakBase - implements XTest3, XPropertySet, XFastPropertySet, XPropertyAccess - { - public Full() {} - - public synchronized int getFirst() { - return a1; - } - - public void setFirst(int value) { - prop.prepareSet("First", null); - synchronized (this) { - a1 = value; - } - } - - public synchronized Ambiguous getSecond() - throws UnknownPropertyException - { - return a2; - } - - public void setSecond(Ambiguous value) - throws PropertyVetoException, UnknownPropertyException - { - PropertySetMixin.BoundListeners l - = new PropertySetMixin.BoundListeners(); - prop.prepareSet( - "Second", Any.VOID, - (((Optional) ((Defaulted) value.Value).Value).IsPresent - ? ((Optional) ((Defaulted) value.Value).Value).Value - : Any.VOID), - l); - synchronized (this) { - a2 = value; - } - l.notifyListeners(); - } - - public int getThird() throws UnknownPropertyException { - throw new UnknownPropertyException("Third", this); - } - - public void setThird(int value) throws UnknownPropertyException { - throw new UnknownPropertyException("Third", this); - } - - public int getFourth() throws UnknownPropertyException { - throw new UnknownPropertyException("Fourth", this); - } - - public void setFourth(int value) throws UnknownPropertyException { - throw new UnknownPropertyException("Fourth", this); - } - - public com.sun.star.beans.XPropertySetInfo getPropertySetInfo() { - return prop.getPropertySetInfo(); - } - - public void setPropertyValue(String propertyName, Object value) - throws UnknownPropertyException, PropertyVetoException, - com.sun.star.lang.IllegalArgumentException, WrappedTargetException - { - prop.setPropertyValue(propertyName, value); - } - - public Object getPropertyValue(String propertyName) - throws UnknownPropertyException, WrappedTargetException - { - return prop.getPropertyValue(propertyName); - } - - public void addPropertyChangeListener( - String propertyName, XPropertyChangeListener listener) - throws UnknownPropertyException, WrappedTargetException - { - prop.addPropertyChangeListener(propertyName, listener); - } - - public void removePropertyChangeListener( - String propertyName, XPropertyChangeListener listener) - throws UnknownPropertyException, WrappedTargetException - { - prop.removePropertyChangeListener(propertyName, listener); - } - - public void addVetoableChangeListener( - String propertyName, XVetoableChangeListener listener) - throws UnknownPropertyException, WrappedTargetException - { - prop.addVetoableChangeListener(propertyName, listener); - } - - public void removeVetoableChangeListener( - String propertyName, XVetoableChangeListener listener) - throws UnknownPropertyException, WrappedTargetException - { - prop.removeVetoableChangeListener(propertyName, listener); - } - - public void setFastPropertyValue(int handle, Object value) - throws UnknownPropertyException, PropertyVetoException, - com.sun.star.lang.IllegalArgumentException, WrappedTargetException - { - prop.setFastPropertyValue(handle, value); - } - - public Object getFastPropertyValue(int handle) - throws UnknownPropertyException, WrappedTargetException - { - return prop.getFastPropertyValue(handle); - } - - public PropertyValue[] getPropertyValues() { - return prop.getPropertyValues(); - } - - public void setPropertyValues(PropertyValue[] props) - throws UnknownPropertyException, PropertyVetoException, - com.sun.star.lang.IllegalArgumentException, WrappedTargetException - { - prop.setPropertyValues(props); - } - - private final PropertySetMixin prop = new PropertySetMixin( - context, this, new Type(XTest3.class), new String[] { "Third" }); - - private int a1 = 0; - private Ambiguous a2 = new Ambiguous( - new Defaulted(new Optional(), true), false); - } - - private final XComponentContext context; -} diff --git a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx deleted file mode 100644 index 9f72fb181..000000000 --- a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx +++ /dev/null @@ -1,426 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppuhelper.hxx" - -#include "sal/config.h" - -#include "test/cppuhelper/propertysetmixin/XSupplier.hpp" -#include "test/cppuhelper/propertysetmixin/XTest3.hpp" - -#include "com/sun/star/beans/Ambiguous.hpp" -#include "com/sun/star/beans/Defaulted.hpp" -#include "com/sun/star/beans/Optional.hpp" -#include "com/sun/star/beans/PropertyVetoException.hpp" -#include "com/sun/star/beans/UnknownPropertyException.hpp" -#include "com/sun/star/lang/XComponent.hpp" -#include "cppuhelper/propertysetmixin.hxx" -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implbase1.hxx" -#include "cppuhelper/implementationentry.hxx" -#include "cppuhelper/queryinterface.hxx" -#include "cppuhelper/weak.hxx" -#include "com/sun/star/uno/Any.hxx" -#include "com/sun/star/uno/Exception.hpp" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/Type.hxx" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/uno/XInterface.hpp" -#include "osl/mutex.hxx" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" -#include "sal/types.h" -#include "uno/lbnames.h" - -namespace com { namespace sun { namespace star { - class XEventListener; -} } } - -namespace css = com::sun::star; - -namespace { - -class Empty1: - public cppu::OWeakObject, public css::lang::XComponent, - public cppu::PropertySetMixin< css::lang::XComponent > -{ -public: - explicit Empty1( - css::uno::Reference< css::uno::XComponentContext > const & context): - cppu::PropertySetMixin< css::lang::XComponent >( - context, static_cast< Implements >(0), - css::uno::Sequence< rtl::OUString >()) - {} - - virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) - throw (css::uno::RuntimeException); - - virtual void SAL_CALL acquire() throw () { OWeakObject::acquire(); } - - virtual void SAL_CALL release() throw () { OWeakObject::release(); } - - virtual void SAL_CALL dispose() throw (css::uno::RuntimeException) { - cppu::PropertySetMixin< css::lang::XComponent >::dispose(); - } - - virtual void SAL_CALL addEventListener( - css::uno::Reference< css::lang::XEventListener > const &) - throw (css::uno::RuntimeException) - {} - - virtual void SAL_CALL removeEventListener( - css::uno::Reference< css::lang::XEventListener > const &) - throw (css::uno::RuntimeException) - {} - -private: - Empty1(Empty1 &); // not defined - void operator =(Empty1 &); // not defined - - virtual ~Empty1() {} -}; - -css::uno::Any Empty1::queryInterface(css::uno::Type const & type) - throw (css::uno::RuntimeException) -{ - css::uno::Any a(OWeakObject::queryInterface(type)); - if (a.hasValue()) { - return a; - } - a = cppu::queryInterface( - type, static_cast< css::lang::XComponent * >(this)); - return a.hasValue() - ? a - : cppu::PropertySetMixin< css::lang::XComponent >::queryInterface( - type); -} - -class Empty2: - public cppu::OWeakObject, public css::lang::XComponent, - public cppu::PropertySetMixin< css::lang::XComponent > -{ -public: - explicit Empty2( - css::uno::Reference< css::uno::XComponentContext > const & context): - cppu::PropertySetMixin< css::lang::XComponent >( - context, - static_cast< Implements >( - IMPLEMENTS_PROPERTY_SET | IMPLEMENTS_FAST_PROPERTY_SET - | IMPLEMENTS_PROPERTY_ACCESS), - css::uno::Sequence< rtl::OUString >()) - {} - - virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) - throw (css::uno::RuntimeException); - - virtual void SAL_CALL acquire() throw () { OWeakObject::acquire(); } - - virtual void SAL_CALL release() throw () { OWeakObject::release(); } - - virtual void SAL_CALL dispose() throw (css::uno::RuntimeException) { - cppu::PropertySetMixin< css::lang::XComponent >::dispose(); - } - - virtual void SAL_CALL addEventListener( - css::uno::Reference< css::lang::XEventListener > const &) - throw (css::uno::RuntimeException) - {} - - virtual void SAL_CALL removeEventListener( - css::uno::Reference< css::lang::XEventListener > const &) - throw (css::uno::RuntimeException) - {} - -private: - Empty2(Empty2 &); // not defined - void operator =(Empty2 &); // not defined - - virtual ~Empty2() {} -}; - -css::uno::Any Empty2::queryInterface(css::uno::Type const & type) - throw (css::uno::RuntimeException) -{ - css::uno::Any a(OWeakObject::queryInterface(type)); - if (a.hasValue()) { - return a; - } - a = cppu::queryInterface( - type, static_cast< css::lang::XComponent * >(this)); - return a.hasValue() - ? a - : cppu::PropertySetMixin< css::lang::XComponent >::queryInterface( - type); -} - -css::uno::Sequence< rtl::OUString > sequenceThird() { - css::uno::Sequence< rtl::OUString > s(1); - s[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")); - return s; -} - -class Full: - public cppu::OWeakObject, public test::cppuhelper::propertysetmixin::XTest3, - public cppu::PropertySetMixin< - test::cppuhelper::propertysetmixin::XTest3 > -{ -public: - explicit Full( - css::uno::Reference< css::uno::XComponentContext > const & context): - cppu::PropertySetMixin< - test::cppuhelper::propertysetmixin::XTest3 >( - context, - static_cast< Implements >( - IMPLEMENTS_PROPERTY_SET | IMPLEMENTS_FAST_PROPERTY_SET - | IMPLEMENTS_PROPERTY_ACCESS), - sequenceThird()), - m_a1(0), - m_a2( - css::beans::Defaulted< css::beans::Optional< sal_Int32 > >( - css::beans::Optional< sal_Int32 >(), true), - false) - {} - - virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) - throw (css::uno::RuntimeException); - - virtual void SAL_CALL acquire() throw () { OWeakObject::acquire(); } - - virtual void SAL_CALL release() throw () { OWeakObject::release(); } - - virtual sal_Int32 SAL_CALL getFirst() throw (css::uno::RuntimeException); - - virtual void SAL_CALL setFirst(sal_Int32 value) - throw (css::uno::RuntimeException); - - virtual - css::beans::Ambiguous< - css::beans::Defaulted< css::beans::Optional< sal_Int32 > > > - SAL_CALL getSecond() - throw ( - css::beans::UnknownPropertyException, css::uno::RuntimeException); - - virtual void SAL_CALL setSecond( - css::beans::Ambiguous< - css::beans::Defaulted< css::beans::Optional< ::sal_Int32 > > > const & - value) - throw ( - css::beans::PropertyVetoException, - css::beans::UnknownPropertyException, css::uno::RuntimeException); - - virtual sal_Int32 SAL_CALL getThird() - throw ( - css::beans::UnknownPropertyException, css::uno::RuntimeException); - - virtual void SAL_CALL setThird(sal_Int32 value) - throw ( - css::beans::UnknownPropertyException, css::uno::RuntimeException); - - virtual sal_Int32 SAL_CALL getFourth() - throw ( - css::beans::UnknownPropertyException, css::uno::RuntimeException); - - virtual void SAL_CALL setFourth(sal_Int32 value) - throw ( - css::beans::UnknownPropertyException, css::uno::RuntimeException); - -private: - Full(Full &); // not defined - void operator =(Full &); // not defined - - virtual ~Full() {} - - osl::Mutex m_mutex; - sal_Int32 m_a1; - css::beans::Ambiguous< - css::beans::Defaulted< css::beans::Optional< sal_Int32 > > > m_a2; -}; - -css::uno::Any Full::queryInterface(css::uno::Type const & type) - throw (css::uno::RuntimeException) -{ - css::uno::Any a(OWeakObject::queryInterface(type)); - if (a.hasValue()) { - return a; - } - a = cppu::queryInterface( - type, - static_cast< test::cppuhelper::propertysetmixin::XTest3 * >(this)); - return a.hasValue() - ? a - : (cppu::PropertySetMixin< - test::cppuhelper::propertysetmixin::XTest3 >::queryInterface( - type)); -} - -sal_Int32 Full::getFirst() throw (css::uno::RuntimeException) { - osl::MutexGuard g(m_mutex); - return m_a1; -} - -void Full::setFirst(sal_Int32 value) throw (css::uno::RuntimeException) { - prepareSet( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), css::uno::Any(), - css::uno::Any(), 0); - osl::MutexGuard g(m_mutex); - m_a1 = value; -} - -css::beans::Ambiguous< - css::beans::Defaulted< css::beans::Optional< sal_Int32 > > > -Full::getSecond() - throw (css::beans::UnknownPropertyException, css::uno::RuntimeException) -{ - osl::MutexGuard g(m_mutex); - return m_a2; -} - -void Full::setSecond( - css::beans::Ambiguous< - css::beans::Defaulted< css::beans::Optional< ::sal_Int32 > > > const & - value) - throw ( - css::beans::PropertyVetoException, css::beans::UnknownPropertyException, - css::uno::RuntimeException) -{ - css::uno::Any v; - if (value.Value.Value.IsPresent) { - v <<= value.Value.Value.Value; - } - BoundListeners l; - prepareSet( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), css::uno::Any(), - v, &l); - { - osl::MutexGuard g(m_mutex); - m_a2 = value; - } - l.notify(); -} - -sal_Int32 Full::getThird() - throw (css::beans::UnknownPropertyException, css::uno::RuntimeException) -{ - throw css::beans::UnknownPropertyException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")), - static_cast< cppu::OWeakObject * >(this)); -} - -void Full::setThird(sal_Int32) - throw (css::beans::UnknownPropertyException, css::uno::RuntimeException) -{ - throw css::beans::UnknownPropertyException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")), - static_cast< cppu::OWeakObject * >(this)); -} - -sal_Int32 Full::getFourth() - throw (css::beans::UnknownPropertyException, css::uno::RuntimeException) -{ - throw css::beans::UnknownPropertyException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), - static_cast< cppu::OWeakObject * >(this)); -} - -void Full::setFourth(sal_Int32) - throw (css::beans::UnknownPropertyException, css::uno::RuntimeException) -{ - throw css::beans::UnknownPropertyException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), - static_cast< cppu::OWeakObject * >(this)); -} - -class Supplier: - public cppu::WeakImplHelper1< - test::cppuhelper::propertysetmixin::XSupplier > -{ -public: - explicit Supplier( - css::uno::Reference< css::uno::XComponentContext > const & context): - m_context(context) {} - - virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getEmpty1() - throw (css::uno::RuntimeException) - { return new Empty1(m_context); } - - virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getEmpty2() - throw (css::uno::RuntimeException) - { return new Empty2(m_context); } - - virtual css::uno::Reference< test::cppuhelper::propertysetmixin::XTest3 > - SAL_CALL getFull() throw (css::uno::RuntimeException) - { return new Full(m_context); } - -private: - Supplier(Supplier &); // not defined - void operator =(Supplier &); // not defined - - virtual ~Supplier() {} - - css::uno::Reference< css::uno::XComponentContext > m_context; -}; - -css::uno::Reference< css::uno::XInterface > SAL_CALL create( - css::uno::Reference< css::uno::XComponentContext > const & context) - SAL_THROW((css::uno::Exception)) -{ - return static_cast< cppu::OWeakObject * >(new Supplier(context)); -} - -rtl::OUString SAL_CALL getImplementationName() { - return rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "test.cppuhelper.propertysetmixin.comp.CppSupplier")); -} - -css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() { - css::uno::Sequence< rtl::OUString > s(1); - s[0] = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "test.cppuhelper.propertysetmixin.CppSupplier")); - return s; -} - -cppu::ImplementationEntry entries[] = { - { &create, &getImplementationName, &getSupportedServiceNames, - &cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } }; - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL mixin_component_getFactory( - char const * implName, void * serviceManager, void * registryKey) -{ - return cppu::component_getFactoryHelper( - implName, serviceManager, registryKey, entries); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/qa/propertysetmixin/makefile.mk b/cppuhelper/qa/propertysetmixin/makefile.mk deleted file mode 100644 index da794dbcc..000000000 --- a/cppuhelper/qa/propertysetmixin/makefile.mk +++ /dev/null @@ -1,139 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" -nothing .PHONY: -.ELSE - -PRJ := ../.. -PRJNAME := cppuhelper - -TARGET := qa_propertysetmixin -PACKAGE = test/cppuhelper/propertysetmixin/comp - -ENABLE_EXCEPTIONS := TRUE - -my_components = $(TARGET).cpp $(TARGET).java - -.INCLUDE: settings.mk - -.IF "$(OS)" == "WNT" -my_file = file:/// -.ELSE -my_file = file:// -.END - -DLLPRE = # no leading "lib" on .so files -INCPRE += -I$(MISC)/$(TARGET)/inc -CFLAGSCXX += $(CPPUNIT_CFLAGS) - -SHL1TARGET = $(TARGET) -SHL1OBJS = $(SLO)/test_propertysetmixin.obj -SHL1VERSIONMAP = test.map -SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(CPPUNITLIB) $(SALLIB) -SHL1IMPLIB = i$(SHL1TARGET) -SHL1RPATH = NONE -DEF1NAME = $(SHL1TARGET) - -SHL2TARGET = $(TARGET).uno -SHL2OBJS = $(SLO)/comp_propertysetmixin.obj -SHL2STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) -SHL2IMPLIB = i$(SHL2TARGET) -SH21RPATH = NONE -DEF2NAME = $(SHL2TARGET) - -SLOFILES = $(SHL1OBJS) $(SHL2OBJS) - -JAVAFILES = JavaSupplier.java -JARFILES = java_uno.jar juh.jar jurt.jar ridl.jar - -.INCLUDE: target.mk - -ALLTAR: test - -$(MISC)/$(TARGET)/types.urd: types.idl - $(MKDIRHIER) $(@:d) - $(IDLC) -O$(@:d) -I$(SOLARIDLDIR) -cid -we $< - -$(MISC)/$(TARGET)/types.rdb: $(MISC)/$(TARGET)/types.urd - - $(RM) $@ - $(REGMERGE) $@ /UCR $< - -$(MISC)/$(TARGET)/cppumaker.flag: $(MISC)/$(TARGET)/types.rdb - $(CPPUMAKER) -O$(MISC)/$(TARGET)/inc -BUCR -Gc \ - -X$(SOLARBINDIR)/udkapi.rdb $< - $(TOUCH) $@ - -$(SLOFILES): $(MISC)/$(TARGET)/cppumaker.flag - -$(MISC)/$(TARGET)/javamaker.flag: $(MISC)/$(TARGET)/types.rdb - $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)/udkapi.rdb $< - $(TOUCH) $@ - -.IF "$(SOLAR_JAVA)"!="" -$(JAVATARGET): $(MISC)/$(TARGET)/javamaker.flag -.ENDIF - -$(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \ - $(MISC)/$(TARGET)/services.input \ - $(my_components:^"$(MISC)/$(TARGET)/":+".component") - $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \ - $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input - -$(MISC)/$(TARGET)/services.input: - $(MKDIRHIER) $(@:d) - echo \ - '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \ - > $@ - -$(MISC)/$(TARGET)/$(TARGET).cpp.component .ERRREMOVE: \ - $(SOLARENV)/bin/createcomponent.xslt $(TARGET).cpp.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_INBUILD_NATIVE)$(SHL2TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt $(TARGET).cpp.component - -$(MISC)/$(TARGET)/$(TARGET).java.component .ERRREMOVE: \ - $(SOLARENV)/bin/createcomponent.xslt $(TARGET).java.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_INBUILD_JAVA)$(TARGET).uno.jar' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt $(TARGET).java.component - -$(MISC)/$(TARGET)/$(TARGET).uno.jar: $(JAVATARGET) \ - $(MISC)/$(TARGET)/javamaker.flag manifest - jar cfm $@ manifest -C $(CLASSDIR) test/cppuhelper/propertysetmixin - -test .PHONY: $(SHL1TARGETN) $(SHL2TARGETN) $(MISC)/$(TARGET)/$(TARGET).uno.jar \ - $(MISC)/$(TARGET)/types.rdb $(MISC)/$(TARGET)/services.rdb - $(CPPUNITTESTER) $(SHL1TARGETN) \ - '-env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/types.rdb' \ - '-env:UNO_SERVICES=$(my_file)$(SOLARXMLDIR)/ure/services.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb'\ - -env:URE_INTERNAL_LIB_DIR=$(my_file)$(SOLARSHAREDBIN) \ - -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) \ - -env:OOO_INBUILD_SHAREDLIB_DIR=$(my_file)$(PWD)/$(DLLDEST) \ - -env:OOO_INBUILD_JAR_DIR=$(my_file)$(PWD)/$(MISC)/$(TARGET) - -.END diff --git a/cppuhelper/qa/propertysetmixin/manifest b/cppuhelper/qa/propertysetmixin/manifest deleted file mode 100644 index 168f4bc19..000000000 --- a/cppuhelper/qa/propertysetmixin/manifest +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 -RegistrationClassName: test.cppuhelper.propertysetmixin.comp.JavaSupplier diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component deleted file mode 100644 index 1ae646e98..000000000 --- a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--********************************************************************** -* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2000, 2010 Oracle and/or its affiliates. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. -* -**********************************************************************--> - -<component loader="com.sun.star.loader.SharedLibrary" prefix="mixin" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="test.cppuhelper.propertysetmixin.comp.CppSupplier"> - <service name="test.cppuhelper.propertysetmixin.CppSupplier"/> - </implementation> -</component> diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component deleted file mode 100644 index 9711563b7..000000000 --- a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--********************************************************************** -* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2000, 2010 Oracle and/or its affiliates. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. -* -**********************************************************************--> - -<component loader="com.sun.star.loader.Java2" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="test.cppuhelper.propertysetmixin.comp.JavaSupplier"> - <service name="test.cppuhelper.propertysetmixin.JavaSupplier"/> - </implementation> -</component> diff --git a/cppuhelper/qa/propertysetmixin/test.map b/cppuhelper/qa/propertysetmixin/test.map deleted file mode 100644 index 0dbbcc5a7..000000000 --- a/cppuhelper/qa/propertysetmixin/test.map +++ /dev/null @@ -1,34 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -UDK_3_0_0 { - global: - cppunitTestPlugIn; - - local: - *; -}; diff --git a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx deleted file mode 100644 index b88efab8e..000000000 --- a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx +++ /dev/null @@ -1,659 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppuhelper.hxx" - -#ifdef IOS -#define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTest_cppuhelper_propertysetmixin -#endif - -#include "sal/config.h" - -#include "test/cppuhelper/propertysetmixin/CppSupplier.hpp" -#include "test/cppuhelper/propertysetmixin/JavaSupplier.hpp" -#include "test/cppuhelper/propertysetmixin/XSupplier.hpp" -#include "test/cppuhelper/propertysetmixin/XTest3.hpp" - -#include "com/sun/star/beans/Ambiguous.hpp" -#include "com/sun/star/beans/Defaulted.hpp" -#include "com/sun/star/beans/Optional.hpp" -#include "com/sun/star/beans/Property.hpp" -#include "com/sun/star/beans/PropertyAttribute.hpp" -#include "com/sun/star/beans/PropertyChangeEvent.hpp" -#include "com/sun/star/beans/PropertyState.hpp" -#include "com/sun/star/beans/PropertyValue.hpp" -#include "com/sun/star/beans/PropertyVetoException.hpp" -#include "com/sun/star/beans/UnknownPropertyException.hpp" -#include "com/sun/star/beans/XFastPropertySet.hpp" -#include "com/sun/star/beans/XPropertyAccess.hpp" -#include "com/sun/star/beans/XPropertyChangeListener.hpp" -#include "com/sun/star/beans/XPropertySet.hpp" -#include "com/sun/star/beans/XPropertySetInfo.hpp" -#include "com/sun/star/beans/XVetoableChangeListener.hpp" -#include "com/sun/star/lang/XComponent.hpp" -#include "com/sun/star/uno/Any.hxx" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/Type.hxx" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "cppuhelper/bootstrap.hxx" -#include "cppuhelper/implbase1.hxx" -#include "cppunit/TestAssert.h" -#include "cppunit/TestFixture.h" -#include "cppunit/extensions/HelperMacros.h" -#include "cppunit/plugin/TestPlugIn.h" -#include "osl/mutex.hxx" -#include "rtl/ref.hxx" -#include "rtl/string.h" -#include "rtl/textenc.h" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" -#include "sal/types.h" - -#include <limits> -#include <ostream> - -namespace com { namespace sun { namespace star { - struct EventObject; -} } } - -namespace css = com::sun::star; - -namespace { - -std::ostream & operator <<(std::ostream & out, rtl::OUString const & value) { - return out << rtl::OUStringToOString(value, RTL_TEXTENCODING_UTF8).getStr(); -} - -std::ostream & operator <<(std::ostream & out, css::uno::Type const & value) { - return out << "com::sun::star::uno::Type[" << value.getTypeName() << ']'; -} - -std::ostream & operator <<(std::ostream & out, css::uno::Any const & value) { - return - out << "com::sun::star::uno::Any[" << value.getValueType() << ", ...]"; -} - -class BoundListener: - public cppu::WeakImplHelper1< css::beans::XPropertyChangeListener > -{ -public: - BoundListener(): m_count(0) {} - - int count() const { - osl::MutexGuard g(m_mutex); - return m_count; - } - - virtual void SAL_CALL disposing(css::lang::EventObject const &) - throw (css::uno::RuntimeException) - { - osl::MutexGuard g(m_mutex); - CPPUNIT_ASSERT(m_count < std::numeric_limits< int >::max()); - ++m_count; - } - - virtual void SAL_CALL propertyChange( - css::beans::PropertyChangeEvent const &) - throw (css::uno::RuntimeException) - { CPPUNIT_FAIL("BoundListener::propertyChange called"); } - -private: - BoundListener(BoundListener &); // not defined - void operator =(BoundListener &); // not defined - - virtual ~BoundListener() {} - - mutable osl::Mutex m_mutex; - int m_count; -}; - -class VetoListener: - public cppu::WeakImplHelper1< css::beans::XVetoableChangeListener > -{ -public: - VetoListener(): m_count(0) {} - - int count() const { - osl::MutexGuard g(m_mutex); - return m_count; - } - - virtual void SAL_CALL disposing(css::lang::EventObject const &) - throw (css::uno::RuntimeException) - { - osl::MutexGuard g(m_mutex); - CPPUNIT_ASSERT(m_count < std::numeric_limits< int >::max()); - ++m_count; - } - - virtual void SAL_CALL vetoableChange( - css::beans::PropertyChangeEvent const &) - throw (css::beans::PropertyVetoException, css::uno::RuntimeException) - { CPPUNIT_FAIL("VetoListener::vetoableChange called"); } - -private: - VetoListener(VetoListener &); // not defined - void operator =(VetoListener &); // not defined - - virtual ~VetoListener() {} - - mutable osl::Mutex m_mutex; - int m_count; -}; - -class Test: public CppUnit::TestFixture { -public: - virtual void setUp(); - - virtual void tearDown(); - - void testCppEmpty1() { testEmpty1(getCppSupplier()); } - - void testCppEmpty2() { testEmpty2(getCppSupplier()); } - - void testCppFull() { testFull(getCppSupplier()); } - - void testJavaEmpty1() { testEmpty1(getJavaSupplier()); } - - void testJavaEmpty2() { testEmpty2(getJavaSupplier()); } - - void testJavaFull() { testFull(getJavaSupplier()); } - - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(testCppEmpty1); - CPPUNIT_TEST(testCppEmpty2); - CPPUNIT_TEST(testCppFull); - CPPUNIT_TEST(testJavaEmpty1); - CPPUNIT_TEST(testJavaEmpty2); - CPPUNIT_TEST(testJavaFull); - CPPUNIT_TEST_SUITE_END(); - -private: - css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > - getCppSupplier() const; - - css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > - getJavaSupplier() const; - - void testEmpty1( - css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > - const & supplier) const; - - void testEmpty2( - css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > - const & supplier) const; - - void testFull( - css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > - const & supplier) const; - - css::uno::Reference< css::uno::XComponentContext > m_context; -}; - -void Test::setUp() { - m_context = cppu::defaultBootstrap_InitialComponentContext(); - CPPUNIT_ASSERT(m_context.is()); -} - -void Test::tearDown() { - css::uno::Reference< css::lang::XComponent >( - m_context, css::uno::UNO_QUERY_THROW)->dispose(); -} - -css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > -Test::getCppSupplier() const -{ - return test::cppuhelper::propertysetmixin::CppSupplier::create(m_context); -} - -css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > -Test::getJavaSupplier() const -{ - return test::cppuhelper::propertysetmixin::JavaSupplier::create(m_context); -} - -void Test::testEmpty1( - css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > - const & supplier) const -{ - css::uno::Reference< css::lang::XComponent > empty1( - supplier->getEmpty1(), css::uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT( - !css::uno::Reference< css::beans::XPropertySet >( - empty1, css::uno::UNO_QUERY).is()); - CPPUNIT_ASSERT( - !css::uno::Reference< css::beans::XFastPropertySet >( - empty1, css::uno::UNO_QUERY).is()); - CPPUNIT_ASSERT( - !css::uno::Reference< css::beans::XPropertyAccess >( - empty1, css::uno::UNO_QUERY).is()); - empty1->dispose(); -} - -void Test::testEmpty2( - css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > - const & supplier) const -{ - css::uno::Reference< css::lang::XComponent > empty2( - supplier->getEmpty2(), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::beans::XPropertySet > empty2p( - empty2, css::uno::UNO_QUERY); - CPPUNIT_ASSERT(empty2p.is()); - css::uno::Reference< css::beans::XPropertySetInfo > info( - empty2p->getPropertySetInfo()); - CPPUNIT_ASSERT(info.is()); - CPPUNIT_ASSERT_EQUAL( - static_cast< sal_Int32 >(0), info->getProperties().getLength()); - try { - info->getPropertyByName( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any"))); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - CPPUNIT_ASSERT( - !info->hasPropertyByName( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")))); - try { - empty2p->setPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")), css::uno::Any()); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - empty2p->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any"))); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - rtl::Reference< BoundListener > boundListener1(new BoundListener); - empty2p->addPropertyChangeListener(rtl::OUString(), boundListener1.get()); - empty2p->addPropertyChangeListener(rtl::OUString(), boundListener1.get()); - rtl::Reference< BoundListener > boundListener2(new BoundListener); - empty2p->removePropertyChangeListener( - rtl::OUString(), boundListener2.get()); - rtl::Reference< VetoListener > vetoListener1(new VetoListener); - empty2p->addVetoableChangeListener(rtl::OUString(), vetoListener1.get()); - empty2p->addVetoableChangeListener(rtl::OUString(), vetoListener1.get()); - rtl::Reference< VetoListener > vetoListener2(new VetoListener); - empty2p->addVetoableChangeListener(rtl::OUString(), vetoListener2.get()); - empty2p->removeVetoableChangeListener(rtl::OUString(), vetoListener2.get()); - css::uno::Reference< css::beans::XFastPropertySet > empty2f( - empty2, css::uno::UNO_QUERY); - CPPUNIT_ASSERT(empty2f.is()); - try { - empty2f->setFastPropertyValue(-1, css::uno::Any()); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - empty2f->setFastPropertyValue(0, css::uno::Any()); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - empty2f->getFastPropertyValue(-1); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - empty2f->getFastPropertyValue(0); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - css::uno::Reference< css::beans::XPropertyAccess > empty2a( - empty2, css::uno::UNO_QUERY); - CPPUNIT_ASSERT(empty2a.is()); - CPPUNIT_ASSERT_EQUAL( - static_cast< sal_Int32 >(0), empty2a->getPropertyValues().getLength()); - empty2a->setPropertyValues( - css::uno::Sequence< css::beans::PropertyValue >()); - css::uno::Sequence< css::beans::PropertyValue > vs(2); - vs[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any1")); - vs[0].Handle = -1; - vs[0].State = css::beans::PropertyState_DIRECT_VALUE; - vs[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any2")); - vs[0].Handle = -1; - vs[0].State = css::beans::PropertyState_DIRECT_VALUE; - try { - empty2a->setPropertyValues(vs); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - CPPUNIT_ASSERT_EQUAL(0, boundListener1->count()); - CPPUNIT_ASSERT_EQUAL(0, boundListener2->count()); - CPPUNIT_ASSERT_EQUAL(0, vetoListener1->count()); - CPPUNIT_ASSERT_EQUAL(0, vetoListener2->count()); - empty2->dispose(); - CPPUNIT_ASSERT_EQUAL(2, boundListener1->count()); - CPPUNIT_ASSERT_EQUAL(0, boundListener2->count()); - CPPUNIT_ASSERT_EQUAL(2, vetoListener1->count()); - CPPUNIT_ASSERT_EQUAL(0, vetoListener2->count()); - empty2p->removePropertyChangeListener( - rtl::OUString(), boundListener1.get()); - empty2p->removePropertyChangeListener( - rtl::OUString(), boundListener2.get()); - empty2p->removeVetoableChangeListener(rtl::OUString(), vetoListener1.get()); - empty2p->removeVetoableChangeListener(rtl::OUString(), vetoListener2.get()); - empty2p->addPropertyChangeListener(rtl::OUString(), boundListener1.get()); - empty2p->addPropertyChangeListener(rtl::OUString(), boundListener2.get()); - empty2p->addVetoableChangeListener(rtl::OUString(), vetoListener1.get()); - empty2p->addVetoableChangeListener(rtl::OUString(), vetoListener2.get()); - try { - empty2p->addPropertyChangeListener( - rtl::OUString(), - css::uno::Reference< css::beans::XPropertyChangeListener >()); - } catch (css::uno::RuntimeException &) {} - try { - empty2p->addVetoableChangeListener( - rtl::OUString(), - css::uno::Reference< css::beans::XVetoableChangeListener >()); - } catch (css::uno::RuntimeException &) {} - CPPUNIT_ASSERT_EQUAL(3, boundListener1->count()); - CPPUNIT_ASSERT_EQUAL(1, boundListener2->count()); - CPPUNIT_ASSERT_EQUAL(3, vetoListener1->count()); - CPPUNIT_ASSERT_EQUAL(1, vetoListener2->count()); -} - -void Test::testFull( - css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > - const & supplier) const -{ - css::uno::Reference< test::cppuhelper::propertysetmixin::XTest3 > full( - supplier->getFull(), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::beans::XPropertySet > fullp( - full, css::uno::UNO_QUERY); - CPPUNIT_ASSERT(fullp.is()); - css::uno::Reference< css::beans::XPropertySetInfo > info( - fullp->getPropertySetInfo()); - CPPUNIT_ASSERT(info.is()); - CPPUNIT_ASSERT_EQUAL( - static_cast< sal_Int32 >(3), info->getProperties().getLength()); - css::beans::Property prop( - info->getPropertyByName( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")))); - CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), prop.Name); - CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), prop.Handle); - CPPUNIT_ASSERT_EQUAL(getCppuType(static_cast< sal_Int32 * >(0)), prop.Type); - CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int16 >(0), prop.Attributes); - prop = info->getPropertyByName( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second"))); - CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), prop.Name); - CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(1), prop.Handle); - CPPUNIT_ASSERT_EQUAL(getCppuType(static_cast< sal_Int32 * >(0)), prop.Type); - CPPUNIT_ASSERT_EQUAL( - static_cast< sal_Int16 >( - css::beans::PropertyAttribute::MAYBEVOID - | css::beans::PropertyAttribute::BOUND - | css::beans::PropertyAttribute::CONSTRAINED - | css::beans::PropertyAttribute::MAYBEAMBIGUOUS - | css::beans::PropertyAttribute::MAYBEDEFAULT - | css::beans::PropertyAttribute::OPTIONAL), - prop.Attributes); - try { - info->getPropertyByName( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third"))); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - prop = info->getPropertyByName( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth"))); - CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), prop.Name); - CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(3), prop.Handle); - CPPUNIT_ASSERT_EQUAL(getCppuType(static_cast< sal_Int32 * >(0)), prop.Type); - CPPUNIT_ASSERT_EQUAL( - static_cast< sal_Int16 >(css::beans::PropertyAttribute::OPTIONAL), - prop.Attributes); - try { - info->getPropertyByName( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("first"))); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - CPPUNIT_ASSERT( - info->hasPropertyByName( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")))); - CPPUNIT_ASSERT( - info->hasPropertyByName( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")))); - CPPUNIT_ASSERT( - !info->hasPropertyByName( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")))); - CPPUNIT_ASSERT( - info->hasPropertyByName( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")))); - CPPUNIT_ASSERT( - !info->hasPropertyByName( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("first")))); - CPPUNIT_ASSERT_EQUAL( - css::uno::makeAny(static_cast< sal_Int32 >(0)), - fullp->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")))); - fullp->setPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), - css::uno::makeAny(static_cast< sal_Int32 >(-100))); - CPPUNIT_ASSERT_EQUAL( - css::uno::makeAny(static_cast< sal_Int32 >(-100)), - fullp->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")))); - css::uno::Any voidAny; - CPPUNIT_ASSERT_EQUAL( - voidAny, - fullp->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")))); - fullp->setPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), - css::uno::makeAny(static_cast< sal_Int32 >(100))); - CPPUNIT_ASSERT_EQUAL( - css::uno::makeAny(static_cast< sal_Int32 >(100)), - fullp->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")))); - CPPUNIT_ASSERT(full->getSecond().Value.Value.IsPresent); - CPPUNIT_ASSERT_EQUAL( - static_cast< sal_Int32 >(100), full->getSecond().Value.Value.Value); - CPPUNIT_ASSERT(!full->getSecond().Value.IsDefaulted); - CPPUNIT_ASSERT(!full->getSecond().IsAmbiguous); - fullp->setPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), - css::uno::Any()); - CPPUNIT_ASSERT_EQUAL( - voidAny, - fullp->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")))); - CPPUNIT_ASSERT(!full->getSecond().Value.Value.IsPresent); - CPPUNIT_ASSERT(!full->getSecond().Value.IsDefaulted); - CPPUNIT_ASSERT(!full->getSecond().IsAmbiguous); - try { - fullp->setPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")), - css::uno::makeAny(static_cast< sal_Int32 >(100))); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - fullp->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third"))); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - fullp->setPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), - css::uno::makeAny(static_cast< sal_Int32 >(100))); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - fullp->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth"))); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - fullp->setPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("first")), - css::uno::Any()); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - fullp->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("first"))); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - css::uno::Reference< css::beans::XFastPropertySet > fullf( - full, css::uno::UNO_QUERY); - CPPUNIT_ASSERT(fullf.is()); - CPPUNIT_ASSERT_EQUAL( - css::uno::makeAny(static_cast< sal_Int32 >(-100)), - fullf->getFastPropertyValue(0)); - fullf->setFastPropertyValue( - 0, css::uno::makeAny(static_cast< sal_Int32 >(0))); - CPPUNIT_ASSERT_EQUAL( - css::uno::makeAny(static_cast< sal_Int32 >(0)), - fullf->getFastPropertyValue(0)); - try { - fullf->getFastPropertyValue(-1); - } catch (css::beans::UnknownPropertyException &) {} - try { - fullf->setFastPropertyValue(-1, css::uno::Any()); - } catch (css::beans::UnknownPropertyException &) {} - css::uno::Reference< css::beans::XPropertyAccess > fulla( - full, css::uno::UNO_QUERY); - CPPUNIT_ASSERT(fulla.is()); - css::uno::Sequence< css::beans::PropertyValue > vs( - fulla->getPropertyValues()); - CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(2), vs.getLength()); - CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), vs[0].Name); - CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), vs[0].Handle); - CPPUNIT_ASSERT_EQUAL( - css::uno::makeAny(static_cast< sal_Int32 >(0)), vs[0].Value); - CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DIRECT_VALUE, vs[0].State); - CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), vs[1].Name); - CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(1), vs[1].Handle); - CPPUNIT_ASSERT_EQUAL(voidAny, vs[1].Value); - CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DIRECT_VALUE, vs[1].State); - vs[0].Value <<= static_cast< sal_Int32 >(-100); - vs[1].Value <<= static_cast< sal_Int32 >(100); - vs[1].State = css::beans::PropertyState_AMBIGUOUS_VALUE; - fulla->setPropertyValues(vs); - vs = fulla->getPropertyValues(); - CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(2), vs.getLength()); - CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), vs[0].Name); - CPPUNIT_ASSERT_EQUAL( - css::uno::makeAny(static_cast< sal_Int32 >(-100)), vs[0].Value); - CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DIRECT_VALUE, vs[0].State); - CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), vs[1].Name); - CPPUNIT_ASSERT_EQUAL( - css::uno::makeAny(static_cast< sal_Int32 >(100)), vs[1].Value); - CPPUNIT_ASSERT_EQUAL( - css::beans::PropertyState_AMBIGUOUS_VALUE, vs[1].State); - CPPUNIT_ASSERT(full->getSecond().Value.Value.IsPresent); - CPPUNIT_ASSERT_EQUAL( - static_cast< sal_Int32 >(100), full->getSecond().Value.Value.Value); - CPPUNIT_ASSERT(!full->getSecond().Value.IsDefaulted); - CPPUNIT_ASSERT(full->getSecond().IsAmbiguous); - css::uno::Reference< css::beans::XPropertyChangeListener > boundListener( - new BoundListener); - fullp->addPropertyChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), boundListener); - fullp->removePropertyChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), boundListener); - fullp->addPropertyChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), boundListener); - fullp->removePropertyChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), boundListener); - try { - fullp->addPropertyChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")), - boundListener); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - fullp->removePropertyChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")), - boundListener); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - fullp->addPropertyChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), boundListener); - fullp->removePropertyChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), boundListener); - try { - fullp->addPropertyChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fifth")), - boundListener); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - fullp->removePropertyChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fifth")), - boundListener); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - css::uno::Reference< css::beans::XVetoableChangeListener > vetoListener( - new VetoListener); - fullp->addVetoableChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), vetoListener); - fullp->removeVetoableChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), vetoListener); - fullp->addVetoableChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), vetoListener); - fullp->removeVetoableChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), vetoListener); - try { - fullp->addVetoableChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")), - vetoListener); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - fullp->removeVetoableChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")), - vetoListener); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - fullp->addVetoableChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), vetoListener); - fullp->removeVetoableChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), vetoListener); - try { - fullp->addVetoableChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fifth")), - vetoListener); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} - try { - fullp->removeVetoableChangeListener( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fifth")), - vetoListener); - CPPUNIT_FAIL("exception expected"); - } catch (css::beans::UnknownPropertyException &) {} -} - -CPPUNIT_TEST_SUITE_REGISTRATION(Test); - -} - -CPPUNIT_PLUGIN_IMPLEMENT(); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/qa/propertysetmixin/types.idl b/cppuhelper/qa/propertysetmixin/types.idl deleted file mode 100644 index cd8659362..000000000 --- a/cppuhelper/qa/propertysetmixin/types.idl +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __testtools_servicetests_TestService1_idl__ -#define __testtools_servicetests_TestService1_idl__ - -#include <com/sun/star/beans/Ambiguous.idl> -#include <com/sun/star/beans/Defaulted.idl> -#include <com/sun/star/beans/Optional.idl> -#include <com/sun/star/beans/PropertyVetoException.idl> -#include <com/sun/star/beans/UnknownPropertyException.idl> -#include <com/sun/star/lang/XComponent.idl> -#include <com/sun/star/uno/XInterface.idl> - -module test { module cppuhelper { module propertysetmixin { - -interface XTest1 { - [attribute] long First; -}; - -interface XTest2 { - [attribute, bound] - com::sun::star::beans::Ambiguous< - com::sun::star::beans::Defaulted< - com::sun::star::beans::Optional< long > > > Second - { - get raises (com::sun::star::beans::UnknownPropertyException); - set raises ( - com::sun::star::beans::PropertyVetoException, - com::sun::star::beans::UnknownPropertyException); - }; -}; - -interface XTest3 { - interface XTest1; - interface XTest2; - [attribute] long Third { - get raises (com::sun::star::beans::UnknownPropertyException); - set raises (com::sun::star::beans::UnknownPropertyException); - }; - [attribute] long Fourth { - get raises (com::sun::star::beans::UnknownPropertyException); - set raises (com::sun::star::beans::UnknownPropertyException); - }; -}; - -interface XSupplier { - com::sun::star::lang::XComponent getEmpty1(); - - com::sun::star::lang::XComponent getEmpty2(); - - XTest3 getFull(); -}; - -service CppSupplier: XSupplier; - -service JavaSupplier: XSupplier; - -}; }; }; - -#endif diff --git a/cppuhelper/qa/sce/test_unourl.sce b/cppuhelper/qa/sce/test_unourl.sce deleted file mode 100644 index d937ca311..000000000 --- a/cppuhelper/qa/sce/test_unourl.sce +++ /dev/null @@ -1 +0,0 @@ -UnoUrl diff --git a/cppuhelper/qa/static/cppuhelper_cppunittester_all.cxx b/cppuhelper/qa/static/cppuhelper_cppunittester_all.cxx deleted file mode 100644 index a1085a6aa..000000000 --- a/cppuhelper/qa/static/cppuhelper_cppunittester_all.cxx +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* -* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2000, 2010 Oracle and/or its affiliates. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. -* -************************************************************************/ - -#include "sal/config.h" - -#include <cstdlib> -#include <iostream> -#include <limits> -#include <string> -#include "protectorfactory.hxx" -#include "osl/module.h" -#include "osl/module.hxx" -#include "osl/thread.h" -#include "rtl/process.h" -#include "rtl/string.h" -#include "rtl/string.hxx" -#include "rtl/textcvt.h" -#include "rtl/ustring.hxx" -#include "sal/main.h" -#include "sal/types.h" - -#include "cppunit/CompilerOutputter.h" -#include "cppunit/TestResult.h" -#include "cppunit/TestResultCollector.h" -#include "cppunit/TestRunner.h" -#include "cppunit/plugin/TestPlugIn.h" -#include "cppunit/plugin/PlugInParameters.h" -#include "cppunit/extensions/TestFactoryRegistry.h" -#include "cppunit/portability/Stream.h" - -#include "boost/noncopyable.hpp" - -namespace { - -void usageFailure() { - std::cerr - << ("Usage: cppunittester (--protector <shared-library-path>" - " <function-symbol>)* <shared-library-path>") - << std::endl; - std::exit(EXIT_FAILURE); -} - -rtl::OUString getArgument(sal_Int32 index) { - rtl::OUString arg; - rtl_getAppCommandArg(index, &arg.pData); - return arg; -} - -std::string convertLazy(rtl::OUString const & s16) { - rtl::OString s8(rtl::OUStringToOString(s16, osl_getThreadTextEncoding())); - return std::string( - s8.getStr(), - ((static_cast< sal_uInt32 >(s8.getLength()) - > (std::numeric_limits< std::string::size_type >::max)()) - ? (std::numeric_limits< std::string::size_type >::max)() - : static_cast< std::string::size_type >(s8.getLength()))); -} - -//Allow the whole uniting testing framework to be run inside a "Protector" -//which knows about uno exceptions, so it can print the content of the -//exception before falling over and dying -class CPPUNIT_API ProtectedFixtureFunctor : public CppUnit::Functor, private boost::noncopyable -{ -private: - const std::string &args; - CppUnit::TestResult &result; -public: - ProtectedFixtureFunctor(const std::string &args_, CppUnit::TestResult &result_) - : args(args_) - , result(result_) - { - } - bool run() const - { - CppUnit::TestRunner runner; - runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); - CppUnit::TestResultCollector collector; - result.addListener(&collector); - runner.run(result); - CppUnit::CompilerOutputter(&collector, CppUnit::stdCErr()).write(); - return collector.wasSuccessful(); - } - virtual bool operator()() const - { - return run(); - } -}; -} - -extern "C" CppUnitTestPlugIn - *cppunitTest_cppu_ifcontainer(void), - *cppunitTest_cppu_unourl(void); - -SAL_IMPLEMENT_MAIN() { - TestPlugInSignature plugs[] = { - cppunitTest_cppu_ifcontainer, - cppunitTest_cppu_unourl, - NULL - }; - CppUnit::TestResult result; - std::string args; - bool ok = false; - for (TestPlugInSignature *plug = plugs; *plug != NULL; plug++) { - CppUnitTestPlugIn *iface; - iface = (*plug)(); - iface->initialize(&CppUnit::TestFactoryRegistry::getRegistry(), CppUnit::PlugInParameters()); - } - ProtectedFixtureFunctor tests(args, result); - ok = tests.run(); - - return ok ? EXIT_SUCCESS : EXIT_FAILURE; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/qa/static/cppuhelper_cppunittester_subsequent.cxx b/cppuhelper/qa/static/cppuhelper_cppunittester_subsequent.cxx deleted file mode 100644 index 90d7f8b54..000000000 --- a/cppuhelper/qa/static/cppuhelper_cppunittester_subsequent.cxx +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* -* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2000, 2010 Oracle and/or its affiliates. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. -* -************************************************************************/ - -#include "sal/config.h" - -#include <cstdlib> -#include <iostream> -#include <limits> -#include <string> -#include "protectorfactory.hxx" -#include "osl/module.h" -#include "osl/module.hxx" -#include "osl/thread.h" -#include "rtl/process.h" -#include "rtl/string.h" -#include "rtl/string.hxx" -#include "rtl/textcvt.h" -#include "rtl/ustring.hxx" -#include "sal/main.h" -#include "sal/types.h" - -#include "cppunit/CompilerOutputter.h" -#include "cppunit/TestResult.h" -#include "cppunit/TestResultCollector.h" -#include "cppunit/TestRunner.h" -#include "cppunit/plugin/TestPlugIn.h" -#include "cppunit/plugin/PlugInParameters.h" -#include "cppunit/extensions/TestFactoryRegistry.h" -#include "cppunit/portability/Stream.h" - -#include "boost/noncopyable.hpp" - -namespace { - -void usageFailure() { - std::cerr - << ("Usage: cppunittester (--protector <shared-library-path>" - " <function-symbol>)* <shared-library-path>") - << std::endl; - std::exit(EXIT_FAILURE); -} - -rtl::OUString getArgument(sal_Int32 index) { - rtl::OUString arg; - rtl_getAppCommandArg(index, &arg.pData); - return arg; -} - -std::string convertLazy(rtl::OUString const & s16) { - rtl::OString s8(rtl::OUStringToOString(s16, osl_getThreadTextEncoding())); - return std::string( - s8.getStr(), - ((static_cast< sal_uInt32 >(s8.getLength()) - > (std::numeric_limits< std::string::size_type >::max)()) - ? (std::numeric_limits< std::string::size_type >::max)() - : static_cast< std::string::size_type >(s8.getLength()))); -} - -//Allow the whole uniting testing framework to be run inside a "Protector" -//which knows about uno exceptions, so it can print the content of the -//exception before falling over and dying -class CPPUNIT_API ProtectedFixtureFunctor : public CppUnit::Functor, private boost::noncopyable -{ -private: - const std::string &args; - CppUnit::TestResult &result; -public: - ProtectedFixtureFunctor(const std::string &args_, CppUnit::TestResult &result_) - : args(args_) - , result(result_) - { - } - bool run() const - { - CppUnit::TestRunner runner; - runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); - CppUnit::TestResultCollector collector; - result.addListener(&collector); - runner.run(result); - CppUnit::CompilerOutputter(&collector, CppUnit::stdCErr()).write(); - return collector.wasSuccessful(); - } - virtual bool operator()() const - { - return run(); - } -}; -} - -extern "C" CppUnitTestPlugIn - *cppunitTest_cppuhelper_propertysetmixin(void); - - -SAL_IMPLEMENT_MAIN() { - TestPlugInSignature plugs[] = { - cppunitTest_cppuhelper_propertysetmixin, - NULL - }; - CppUnit::TestResult result; - std::string args; - bool ok = false; - for (TestPlugInSignature *plug = plugs; *plug != NULL; plug++) { - CppUnitTestPlugIn *iface; - iface = (*plug)(); - iface->initialize(&CppUnit::TestFactoryRegistry::getRegistry(), CppUnit::PlugInParameters()); - } - ProtectedFixtureFunctor tests(args, result); - ok = tests.run(); - - return ok ? EXIT_SUCCESS : EXIT_FAILURE; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/qa/static/makefile.mk b/cppuhelper/qa/static/makefile.mk deleted file mode 100644 index b7a7d5c16..000000000 --- a/cppuhelper/qa/static/makefile.mk +++ /dev/null @@ -1,73 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#***********************************************************************/ - -PRJ = ../.. -PRJNAME = cppuhelper -TARGET = cppuhelper_cppunittester_all - -ENABLE_EXCEPTIONS = TRUE -LIBTARGET = NO - -.INCLUDE: settings.mk - -CFLAGSCXX += $(CPPUNIT_CFLAGS) - -.IF "$(OS)" != "IOS" - -ALL : - @echo This is only for iOS - -.ENDIF - -CFLAGSCXX += $(OBJCXXFLAGS) - -.IF "$(OOO_SUBSEQUENT_TESTS)" != "" - -APP1OBJS = $(OBJ)/cppuhelper_cppunittester_subsequent.obj -APP1RPATH = NONE -APP1LIBS += \ - $(SLB)/qa_propertysetmixin.lib \ - $(SLB)/cppuhelper.lib - -APP1STDLIBS = $(CPPUNITLIB) $(CPPULIB) $(SALLIB) $(SALHELPERLIB) -APP1TARGET = $(TARGET) - -.ELSE - -APP1OBJS = $(OBJ)/cppuhelper_cppunittester_all.obj -APP1RPATH = NONE -APP1LIBS += \ - $(SLB)/cppu_ifcontainer.lib \ - $(SLB)/cppu_unourl.lib \ - $(SLB)/cppuhelper.lib - -APP1STDLIBS = $(CPPUNITLIB) $(CPPULIB) $(SALLIB) $(SALHELPERLIB) -APP1TARGET = $(TARGET) - -.ENDIF - -.INCLUDE: target.mk diff --git a/cppuhelper/qa/unourl/cppu_unourl.cxx b/cppuhelper/qa/unourl/cppu_unourl.cxx deleted file mode 100644 index f025c2f30..000000000 --- a/cppuhelper/qa/unourl/cppu_unourl.cxx +++ /dev/null @@ -1,483 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <cppunit/TestFixture.h> -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/plugin/TestPlugIn.h> - -#include "cppuhelper/unourl.hxx" -#include "rtl/malformeduriexception.hxx" -#include "rtl/strbuf.hxx" -#include "rtl/string.h" -#include "rtl/textenc.h" -#include "rtl/ustring.hxx" -#include "sal/types.h" - -namespace cppu_unourl -{ - class UrlTest : public CppUnit::TestFixture - { - public: - void testDescriptorParsing() - { - struct Test - { - char const * pInput; - bool bValid; - }; - static Test const aTests[] - = { { "", false }, - { "abc", true }, - { "Abc", true }, - { "aBC", true }, - { "ABC", true }, - { "1abc", true }, - { "123", true }, - { "abc-1", false }, - { "ab%63", false }, - { "abc,", false }, - { "abc,def=", true }, - { "abc,Def=", true }, - { "abc,DEF=", true }, - { "abc,1def=", true }, - { "abc,123=", true }, - { "abc,def-1=", false }, - { "abc,def", false }, - { "abc,def=xxx,def=xxx", false }, - { "abc,def=xxx,ghi=xxx", true }, - { "abc,,def=xxx", false }, - { "abc,def=xxx,,ghi=xxx", false }, - { "abc,def=xxx,ghi=xxx,", false }, - { "abc,def=%", true }, - { "abc,def=%1", true }, - { "abc,def=%00", true }, - { "abc,def=%22", true }, - { "abc,def=\"", true }, - { "abc,def=%ed%a0%80", true } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) - { - bool bValid = false; - try - { - cppu::UnoUrlDescriptor aDescriptor(rtl::OUString::createFromAscii( - aTests[i].pInput)); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - - if (aTests[i].bValid) - { - CPPUNIT_ASSERT_MESSAGE("Valid uri parsed as invalid", bValid); - } - else - { - CPPUNIT_ASSERT_MESSAGE("Invalid uri parsed as valid", !bValid); - } - } - } - - void testDescriptorDescriptor() - { - struct Test - { - char const * pInput; - char const * pDescriptor; - }; - static Test const aTests[] - = {{ "abc", "abc" }, - { "Abc", "Abc" }, - { "aBC", "aBC" }, - { "ABC", "ABC" }, - { "1abc", "1abc" }, - { "123", "123" }, - { "abc,def=", "abc,def=" }, - { "abc,Def=", "abc,Def=" }, - { "abc,DEF=", "abc,DEF=" }, - { "abc,1def=", "abc,1def=" }, - { "abc,123=", "abc,123=" }, - { "abc,def=xxx,ghi=xxx", "abc,def=xxx,ghi=xxx" }, - { "abc,def=%", "abc,def=%" }, - { "abc,def=%1", "abc,def=%1" }, - { "abc,def=%00", "abc,def=%00" }, - { "abc,def=%22", "abc,def=%22" }, - { "abc,def=\"", "abc,def=\"" }, - { "abc,def=%ed%a0%80", "abc,def=%ed%a0%80" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) - { - bool bValid = false; - rtl::OUString aDescriptor; - try - { - aDescriptor = cppu::UnoUrlDescriptor(rtl::OUString::createFromAscii( - aTests[i].pInput)). - getDescriptor(); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI correctly", - aDescriptor.equalsAscii( - aTests[i].pDescriptor)); - } - } - - - void testDescriptorName() - { - struct Test - { - char const * pInput; - char const * pName; - }; - static Test const aTests[] - = { { "abc", "abc" }, - { "Abc", "abc" }, - { "aBC", "abc" }, - { "ABC", "abc" }, - { "1abc", "1abc" }, - { "123", "123" }, - { "abc,def=", "abc" }, - { "abc,Def=", "abc" }, - { "abc,DEF=", "abc" }, - { "abc,1def=", "abc" }, - { "abc,123=", "abc" }, - { "abc,def=xxx,ghi=xxx", "abc" }, - { "abc,def=%", "abc" }, - { "abc,def=%1", "abc" }, - { "abc,def=%00", "abc" }, - { "abc,def=%22", "abc" }, - { "abc,def=\"", "abc" }, - { "abc,def=%ed%a0%80", "abc" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) - { - bool bValid = false; - rtl::OUString aName; - try - { - aName = cppu::UnoUrlDescriptor(rtl::OUString::createFromAscii( - aTests[i].pInput)).getName(); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI correctly", - aName.equalsAscii(aTests[i].pName)); - } - } - - void testDescriptorKey(void) - { - struct Test - { - char const * pInput; - char const * pKey; - bool bPresent; - }; - static Test const aTests[] - = { { "abc", "abc", false }, - { "abc", "def", false }, - { "1abc", "def", false }, - { "123", "def", false }, - { "abc,def=", "abc", false }, - { "abc,def=", "def", true }, - { "abc,def=", "defg", false }, - { "abc,def=", "de", false }, - { "abc,def=", "ghi", false }, - { "abc,Def=", "def", true }, - { "abc,Def=", "Def", true }, - { "abc,Def=", "dEF", true }, - { "abc,Def=", "DEF", true }, - { "abc,def=xxx,ghi=xxx", "abc", false }, - { "abc,def=xxx,ghi=xxx", "def", true }, - { "abc,def=xxx,ghi=xxx", "ghi", true }, - { "abc,def=xxx,ghi=xxx", "jkl", false } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) - { - bool bValid = false; - bool bPresent = false; - try - { - bPresent = cppu::UnoUrlDescriptor(rtl::OUString::createFromAscii( - aTests[i].pInput)). - hasParameter(rtl::OUString::createFromAscii(aTests[i].pKey)); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to detect parameter correctly", - bPresent == aTests[i].bPresent); - } - } - - void testDescriptorValue() - { - struct Test - { - char const * pInput; - char const * pKey; - char const * pValue; - }; - static Test const aTests[] - = { { "abc", "abc", "" }, - { "abc", "def", "" }, - { "1abc", "def", "" }, - { "123", "def", "" }, - { "abc,def=", "abc", "" }, - { "abc,def=", "def", "" }, - { "abc,def=", "defg", "" }, - { "abc,def=", "de", "" }, - { "abc,def=", "ghi", "" }, - { "abc,Def=", "def", "" }, - { "abc,Def=", "Def", "" }, - { "abc,Def=", "dEF", "" }, - { "abc,Def=", "DEF", "" }, - { "abc,def=xxx,ghi=xxx", "abc", "" }, - { "abc,def=xxx,ghi=xxx", "def", "xxx" }, - { "abc,def=xxx,ghi=xxx", "ghi", "xxx" }, - { "abc,def=xxx,ghi=xxx", "jkl", "" }, - { "abc,def=%", "def", "%" }, - { "abc,def=%1", "def", "%1" }, - { "abc,def=%22", "def", "\"" }, - { "abc,def=\"", "def", "\"" }, - { "abc,def=abc", "def", "abc" }, - { "abc,def=Abc", "def", "Abc" }, - { "abc,def=aBC", "def", "aBC" }, - { "abc,def=ABC", "def", "ABC" }, - { "abc,def=%,ghi=", "def", "%" }, - { "abc,def=%1,ghi=", "def", "%1" }, - { "abc,def=%22,ghi=", "def", "\"" }, - { "abc,def=\",ghi=", "def", "\"" }, - { "abc,def=abc,ghi=", "def", "abc" }, - { "abc,def=Abc,ghi=", "def", "Abc" }, - { "abc,def=aBC,ghi=", "def", "aBC" }, - { "abc,def=ABC,ghi=", "def", "ABC" }, - { "abc,abc=,def=%", "def", "%" }, - { "abc,abc=,def=%1", "def", "%1" }, - { "abc,abc=,def=%22", "def", "\"" }, - { "abc,abc=,def=\"", "def", "\"" }, - { "abc,abc=,def=abc", "def", "abc" }, - { "abc,abc=,def=Abc", "def", "Abc" }, - { "abc,abc=,def=aBC", "def", "aBC" }, - { "abc,abc=,def=ABC", "def", "ABC" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) - { - bool bValid = false; - rtl::OUString aValue; - try - { - aValue = cppu::UnoUrlDescriptor(rtl::OUString::createFromAscii( - aTests[i].pInput)). - getParameter(rtl::OUString::createFromAscii(aTests[i].pKey)); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to get param correctly", - aValue.equalsAscii(aTests[i].pValue)); - } - } - - void testUrlParsing() - { - struct Test - { - char const * pInput; - bool bValid; - }; - static Test const aTests[] - = { { "", false }, - { "abc", false }, - { "uno", false }, - { "uno:", false }, - { "uno:abc;def;ghi", true }, - { "Uno:abc;def;ghi", true }, - { "uNO:abc;def;ghi", true }, - { "UNO:abc;def;ghi", true }, - { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", true }, - { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx,;ghi", false }, - { "uno:abc;def;", false }, - { "uno:abc;def;a", true }, - { "uno:abc;def;A", true }, - { "uno:abc;def;1", true }, - { "uno:abc;def;$&+,/:=?@", true }, - { "uno:abc;def;%24&+,/:=?@", false } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) - { - bool bValid = false; - try - { - cppu::UnoUrl aUrl(rtl::OUString::createFromAscii(aTests[i].pInput)); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - - if (aTests[i].bValid) - { - CPPUNIT_ASSERT_MESSAGE("Valid uri parsed as invalid", bValid); - } - else - { - CPPUNIT_ASSERT_MESSAGE("Invalid uri parsed as valid", !bValid); - } - - } - } - - void testUrlConnection() - { - struct Test - { - char const * pInput; - char const * pConnection; - }; - static Test const aTests[] - = { { "uno:abc;def;ghi", "abc" }, - { "uno:Abc;def;ghi", "Abc" }, - { "uno:aBC;def;ghi", "aBC" }, - { "uno:ABC;def;ghi", "ABC" }, - { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", - "abc,def=xxx,ghi=xxx" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) - { - bool bValid = false; - rtl::OUString aConnection; - try - { - aConnection = cppu::UnoUrl(rtl::OUString::createFromAscii( - aTests[i].pInput)). - getConnection().getDescriptor(); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to get param correctly", - aConnection.equalsAscii( - aTests[i].pConnection)); - } - } - - void testUrlProtocol() - { - struct Test - { - char const * pInput; - char const * pProtocol; - }; - static Test const aTests[] - = { { "uno:abc;def;ghi", "def" }, - { "uno:abc;Def;ghi", "Def" }, - { "uno:abc;dEF;ghi", "dEF" }, - { "uno:abc;DEF;ghi", "DEF" }, - { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", - "def,ghi=xxx,jkl=xxx" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) - { - bool bValid = false; - rtl::OUString aProtocol; - try - { - aProtocol = cppu::UnoUrl(rtl::OUString::createFromAscii( - aTests[i].pInput)). - getProtocol().getDescriptor(); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to get protocol correctly", - aProtocol.equalsAscii( - aTests[i].pProtocol)); - } - } - - void testUrlObjectName() - { - struct Test - { - char const * pInput; - char const * pObjectName; - }; - static Test const aTests[] - = { { "uno:abc;def;ghi", "ghi" }, - { "uno:abc;def;Ghi", "Ghi" }, - { "uno:abc;def;gHI", "gHI" }, - { "uno:abc;def;GHI", "GHI" }, - { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", "ghi" }, - { "uno:abc;def;a", "a" }, - { "uno:abc;def;A", "A" }, - { "uno:abc;def;1", "1" }, - { "uno:abc;def;$&+,/:=?@", "$&+,/:=?@" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) - { - bool bValid = false; - rtl::OUString aObjectName; - try - { - aObjectName = cppu::UnoUrl(rtl::OUString::createFromAscii( - aTests[i].pInput)).getObjectName(); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to get protocol correctly", - aObjectName.equalsAscii( - aTests[i].pObjectName)); - } - } - - // Automatic registration code - CPPUNIT_TEST_SUITE(UrlTest); - CPPUNIT_TEST(testDescriptorParsing); - CPPUNIT_TEST(testDescriptorDescriptor); - CPPUNIT_TEST(testDescriptorName); - CPPUNIT_TEST(testDescriptorKey); - CPPUNIT_TEST(testDescriptorValue); - CPPUNIT_TEST(testUrlParsing); - CPPUNIT_TEST(testUrlConnection); - CPPUNIT_TEST(testUrlProtocol); - CPPUNIT_TEST(testUrlObjectName); - CPPUNIT_TEST_SUITE_END(); - }; -} // namespace cppu_ifcontainer - -CPPUNIT_TEST_SUITE_REGISTRATION(cppu_unourl::UrlTest); - -CPPUNIT_PLUGIN_IMPLEMENT(); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/qa/unourl/export.map b/cppuhelper/qa/unourl/export.map deleted file mode 100644 index 117caf43a..000000000 --- a/cppuhelper/qa/unourl/export.map +++ /dev/null @@ -1,7 +0,0 @@ -UDK_3_0_0 { - global: - cppunitTestPlugIn; - - local: - *; -}; diff --git a/cppuhelper/qa/unourl/makefile.mk b/cppuhelper/qa/unourl/makefile.mk deleted file mode 100644 index 35d6e0bdf..000000000 --- a/cppuhelper/qa/unourl/makefile.mk +++ /dev/null @@ -1,62 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=cppuhelper -TARGET=cppu_unourl - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -CFLAGSCXX += $(CPPUNIT_CFLAGS) - -.IF "$(OS)" == "IOS" -CFLAGSCXX += -DCPPUNIT_PLUGIN_EXPORTED_NAME=cppunitTest_$(TARGET) -.ENDIF - -SHL1OBJS= \ - $(SLO)$/cppu_unourl.obj -SHL1TARGET= cppu_unourl -SHL1STDLIBS=\ - $(CPPUHELPERLIB) \ - $(SALLIB) \ - $(CPPULIB) \ - $(CPPUNITLIB) -SHL1IMPLIB= i$(SHL1TARGET) -DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP= export.map - -SLOFILES = $(SHL1OBJS) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk -.INCLUDE : _cppunit.mk - diff --git a/cppuhelper/qa/weak/makefile.mk b/cppuhelper/qa/weak/makefile.mk deleted file mode 100644 index 5116886b6..000000000 --- a/cppuhelper/qa/weak/makefile.mk +++ /dev/null @@ -1,53 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ := ..$/.. -PRJNAME := cppuhelper -TARGET := qa_weak - -ENABLE_EXCEPTIONS := TRUE - -.INCLUDE: settings.mk - -CFLAGSCXX += $(CPPUNIT_CFLAGS) -DLLPRE = # no leading "lib" on .so files - -SHL1TARGET = $(TARGET) -SHL1OBJS = $(SLO)$/test_weak.obj -SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(CPPUNITLIB) $(SALLIB) -SHL1VERSIONMAP = version.map -SHL1IMPLIB = i$(SHL1TARGET) -DEF1NAME = $(SHL1TARGET) - -SLOFILES = $(SHL1OBJS) - -.INCLUDE: target.mk - -ALLTAR: test - -test .PHONY: $(SHL1TARGETN) - $(TESTSHL2) $(SHL1TARGETN) diff --git a/cppuhelper/qa/weak/test_weak.cxx b/cppuhelper/qa/weak/test_weak.cxx deleted file mode 100644 index c45560c94..000000000 --- a/cppuhelper/qa/weak/test_weak.cxx +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppuhelper.hxx" - -#include <cppunit/TestFixture.h> -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/plugin/TestPlugIn.h> - -#include "sal/config.h" - -#include "com/sun/star/lang/DisposedException.hpp" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/XAdapter.hpp" -#include "com/sun/star/uno/XReference.hpp" -#include "com/sun/star/uno/XWeak.hpp" -#include "cppuhelper/implbase1.hxx" -#include "cppuhelper/weak.hxx" -#include "rtl/ref.hxx" -#include "sal/types.h" - -namespace { - -namespace css = com::sun::star; - -class Reference: public cppu::WeakImplHelper1< css::uno::XReference > { -public: - Reference(): m_disposed(false) {} - - virtual void SAL_CALL dispose() throw (css::uno::RuntimeException) { - m_disposed = true; - handleDispose(); - } - - bool isDisposed() const { return m_disposed; } - -protected: - virtual void handleDispose() {}; - -private: - bool m_disposed; -}; - -class RuntimeExceptionReference: public Reference { -protected: - virtual void handleDispose() { - throw css::uno::RuntimeException(); - } -}; - -class DisposedExceptionReference: public Reference { -protected: - virtual void handleDispose() { - throw css::lang::DisposedException(); - } -}; - -class Test: public ::CppUnit::TestFixture { -public: - void testReferenceDispose(); - - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(testReferenceDispose); - CPPUNIT_TEST_SUITE_END(); -}; - -void Test::testReferenceDispose() { - css::uno::Reference< css::uno::XWeak > w(new ::cppu::OWeakObject); - css::uno::Reference< css::uno::XAdapter > a(w->queryAdapter()); - ::rtl::Reference< Reference > r1(new RuntimeExceptionReference); - ::rtl::Reference< Reference > r2(new Reference); - ::rtl::Reference< Reference > r3(new DisposedExceptionReference); - a->addReference(r1.get()); - a->addReference(r2.get()); - a->addReference(r3.get()); - w.clear(); - CPPUNIT_ASSERT(r1->isDisposed()); - CPPUNIT_ASSERT(r2->isDisposed()); - CPPUNIT_ASSERT(r3->isDisposed()); -} - -CPPUNIT_TEST_SUITE_REGISTRATION(Test); - -} - -CPPUNIT_PLUGIN_IMPLEMENT(); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/qa/weak/version.map b/cppuhelper/qa/weak/version.map deleted file mode 100644 index 0dbbcc5a7..000000000 --- a/cppuhelper/qa/weak/version.map +++ /dev/null @@ -1,34 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -UDK_3_0_0 { - global: - cppunitTestPlugIn; - - local: - *; -}; |