diff options
Diffstat (limited to 'dtrans/source/test/test_dtrans.cxx')
-rw-r--r-- | dtrans/source/test/test_dtrans.cxx | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/dtrans/source/test/test_dtrans.cxx b/dtrans/source/test/test_dtrans.cxx index 11ac2174915b..a8503a61811e 100644 --- a/dtrans/source/test/test_dtrans.cxx +++ b/dtrans/source/test/test_dtrans.cxx @@ -34,10 +34,8 @@ #include <stdio.h> #include <string.h> - // my defines - #ifdef UNX #define PATH_SEPARATOR '/' #else @@ -49,10 +47,8 @@ #define PERFORM( a, b ) fprintf( stderr, "Performing " a); b; fprintf( stderr, "done\n" ) #define TRACE( a ) fprintf( stderr, a ) - // namespaces - using namespace ::rtl; using namespace ::std; using namespace ::cppu; @@ -63,16 +59,12 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::io; using namespace ::com::sun::star::lang; - // globals - const char * app = NULL; - // ClipboardOwner - class ClipboardOwner : public WeakImplHelper1< XClipboardOwner > { Reference< XClipboard > m_xClipboard; @@ -83,10 +75,8 @@ class ClipboardOwner : public WeakImplHelper1< XClipboardOwner > public: ClipboardOwner(); - // XClipboardOwner - virtual void SAL_CALL lostOwnership( const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans ) throw(RuntimeException); sal_uInt32 receivedLostOwnerships() { return m_nReceivedLostOwnerships; }; @@ -94,19 +84,15 @@ public: Reference< XTransferable > lostOwnershipTransferableValue() { return m_xTransferable; }; }; - // ctor - ClipboardOwner::ClipboardOwner(): m_nReceivedLostOwnerships( 0 ) { } - // lostOwnership - void SAL_CALL ClipboardOwner::lostOwnership( const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans ) throw(RuntimeException) { @@ -115,10 +101,8 @@ void SAL_CALL ClipboardOwner::lostOwnership( const Reference< XClipboard >& xCli m_xTransferable = xTrans; } - // ClipboardListener - class ClipboardListener : public WeakImplHelper1< XClipboardListener > { Reference< XClipboard > m_xClipboard; @@ -129,16 +113,12 @@ class ClipboardListener : public WeakImplHelper1< XClipboardListener > public: ClipboardListener(); - // XClipboardOwner - virtual void SAL_CALL changedContents( const ClipboardEvent& event ) throw(RuntimeException); - // XEventListener - virtual void SAL_CALL disposing( const EventObject& event ) throw(RuntimeException); sal_uInt32 receivedChangedContentsEvents() { return m_nReceivedChangedContentsEvents; }; @@ -146,19 +126,15 @@ public: Reference< XTransferable > changedContentsEventTransferableValue() { return m_xTransferable; }; }; - // ctor - ClipboardListener::ClipboardListener(): m_nReceivedChangedContentsEvents( 0 ) { } - // changedContents - void SAL_CALL ClipboardListener::changedContents( const ClipboardEvent& event ) throw(RuntimeException) { @@ -167,36 +143,28 @@ void SAL_CALL ClipboardListener::changedContents( const ClipboardEvent& event ) m_xTransferable = event.Contents; } - // disposing - void SAL_CALL ClipboardListener::disposing( const EventObject& event ) throw(RuntimeException) { } - // StringTransferable - class StringTransferable : public WeakImplHelper2< XClipboardOwner, XTransferable > { public: StringTransferable( ); - // XTransferable - virtual Any SAL_CALL getTransferData( const DataFlavor& aFlavor ) throw(UnsupportedFlavorException, IOException, RuntimeException); virtual Sequence< DataFlavor > SAL_CALL getTransferDataFlavors( ) throw(RuntimeException); virtual sal_Bool SAL_CALL isDataFlavorSupported( const DataFlavor& aFlavor ) throw(RuntimeException); - // XClipboardOwner - virtual void SAL_CALL lostOwnership( const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans ) throw(RuntimeException); sal_Bool receivedLostOwnership() { return m_receivedLostOwnership; }; @@ -208,10 +176,8 @@ private: sal_Bool m_receivedLostOwnership; }; - // ctor - StringTransferable::StringTransferable( ) : m_seqDFlv( 1 ), m_receivedLostOwnership( sal_False ), @@ -233,10 +199,8 @@ StringTransferable::StringTransferable( ) : m_seqDFlv[0] = df; } - // getTransferData - Any SAL_CALL StringTransferable::getTransferData( const DataFlavor& aFlavor ) throw(UnsupportedFlavorException, IOException, RuntimeException) { @@ -250,20 +214,16 @@ Any SAL_CALL StringTransferable::getTransferData( const DataFlavor& aFlavor ) return anyData; } - // getTransferDataFlavors - Sequence< DataFlavor > SAL_CALL StringTransferable::getTransferDataFlavors( ) throw(RuntimeException) { return m_seqDFlv; } - // isDataFlavorSupported - sal_Bool SAL_CALL StringTransferable::isDataFlavorSupported( const DataFlavor& aFlavor ) throw(RuntimeException) { @@ -282,28 +242,22 @@ sal_Bool SAL_CALL StringTransferable::isDataFlavorSupported( const DataFlavor& a return bRet; } - // lostOwnership - void SAL_CALL StringTransferable::lostOwnership( const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans ) throw(RuntimeException) { m_receivedLostOwnership = sal_True; } - // main - int SAL_CALL main( int argc, const char* argv[] ) { OUString aRegistry; - // check command line parameters - if ( NULL == ( app = strrchr( argv[0], PATH_SEPARATOR ) ) ) app = argv[0]; else @@ -323,7 +277,6 @@ int SAL_CALL main( int argc, const char* argv[] ) if( aRegistry.isEmpty( ) ) fprintf( stderr, "Usage: %s -r full-path-to-applicat.rdb\n", app ); - // create service manager Reference< XMultiServiceFactory > xServiceManager; @@ -333,10 +286,8 @@ int SAL_CALL main( int argc, const char* argv[] ) xServiceManager = createRegistryServiceFactory( aRegistry, sal_True ); ENSURE( xServiceManager.is(), "*** ERROR *** service manager could not be created." ); - // create an instance of GenericClipboard service - Sequence< Any > arguments(1); arguments[0] = makeAny( OUString("generic") ); @@ -353,10 +304,8 @@ int SAL_CALL main( int argc, const char* argv[] ) if( xClipboardNotifier.is() ) xClipboardNotifier->addClipboardListener( xClipboardListener ); - // run various tests on clipboard implementation - TRACE( "\n*** testing generic clipboard service ***\n" ); Reference< XTransferable > xContents = new StringTransferable(); @@ -403,7 +352,6 @@ int SAL_CALL main( int argc, const char* argv[] ) TEST( "if received changedContents notification for correct transferable: ", pListener->changedContentsEventTransferableValue() == xContents ); } - PERFORM( "update on contents without data (clear): ", xClipboard->setContents( Reference< XTransferable >(), Reference< XClipboardOwner >() ) ); TEST( "that no further lostOwnership messages were received: ", pOwner->receivedLostOwnerships() == 1 ); TEST( "current clipboard contents (none): ", xClipboard->getContents().is() == sal_False ); @@ -416,19 +364,15 @@ int SAL_CALL main( int argc, const char* argv[] ) TEST( "if received changedContents notification for correct transferable: ", ! pListener->changedContentsEventTransferableValue().is() ); } - // create an instance of ClipboardManager service - Reference< XClipboardManager > xClipboardManager( xServiceManager->createInstance( OUString("com.sun.star.datatransfer.clipboard.ClipboardManager") ), UNO_QUERY ); ENSURE( xClipboardManager.is(), "*** ERROR *** clipboard manager service could not be created." ); - // run various tests on clipboard manager implementation - TRACE( "\n*** testing clipboard manager service ***\n" ); TEST( "initial number of clipboards (0): ", xClipboardManager->listClipboardNames().getLength() == 0 ); @@ -455,10 +399,8 @@ int SAL_CALL main( int argc, const char* argv[] ) ENSURE( sal_False, "*** ERROR *** exception caught." ); } - // shutdown the service manager - // query XComponent interface Reference< XComponent > xComponent( xServiceManager, UNO_QUERY ); @@ -472,5 +414,4 @@ int SAL_CALL main( int argc, const char* argv[] ) return 0; } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |