1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: test.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_framework.hxx"
34 //_________________________________________________________________________________________________________________
36 //_________________________________________________________________________________________________________________
37 #include <classes/servicemanager.hxx>
38 #include <classes/filtercache.hxx>
39 #include <macros/generic.hxx>
40 #include <macros/debug.hxx>
43 //_________________________________________________________________________________________________________________
45 //_________________________________________________________________________________________________________________
46 #include <com/sun/star/frame/XDesktop.hpp>
47 #include <com/sun/star/frame/XFrame.hpp>
48 #include <com/sun/star/awt/XWindow.hpp>
49 #include <com/sun/star/frame/XFrameLoader.hpp>
50 #include <com/sun/star/beans/PropertyValue.hpp>
51 #include <com/sun/star/frame/XLoadEventListener.hpp>
52 #include <com/sun/star/frame/XDispatchProvider.hpp>
53 #include <com/sun/star/util/URL.hpp>
54 #include <com/sun/star/frame/FrameSearchFlag.hpp>
55 #include <com/sun/star/frame/XFrames.hpp>
56 #include <com/sun/star/lang/XServiceInfo.hpp>
57 #include <com/sun/star/frame/XComponentLoader.hpp>
58 #include <com/sun/star/frame/XTasksSupplier.hpp>
59 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
60 #include <com/sun/star/beans/XMultiPropertySet.hpp>
61 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
62 #include <com/sun/star/mozilla/XPluginInstancePeer.hpp>
63 #include <com/sun/star/bridge/XInstanceProvider.hpp>
64 #include <com/sun/star/document/XTypeDetection.hpp>
65 #include <com/sun/star/container/XNameAccess.hpp>
66 #include <com/sun/star/container/XNameContainer.hpp>
67 #include <com/sun/star/container/XElementAccess.hpp>
68 #include <com/sun/star/frame/XConfigManager.hpp>
70 //_________________________________________________________________________________________________________________
72 //_________________________________________________________________________________________________________________
73 #include <comphelper/processfactory.hxx>
74 #include <com/sun/star/uno/Reference.h>
75 #include <rtl/ustring.hxx>
76 #include <rtl/ustrbuf.hxx>
77 #include <toolkit/helper/vclunohelper.hxx>
78 #include <svtools/unoiface.hxx>
79 #include <tools/urlobj.hxx>
81 #include <vcl/event.hxx>
82 #include <vcl/svapp.hxx>
83 #include <vcl/wrkwin.hxx>
84 #include <vcl/msgbox.hxx>
87 //_________________________________________________________________________________________________________________
89 //_________________________________________________________________________________________________________________
91 #define APPLICATIONNAME "FrameWork - Testapplication"
93 //_________________________________________________________________________________________________________________
95 //_________________________________________________________________________________________________________________
97 using namespace ::rtl
;
98 using namespace ::comphelper
;
99 using namespace ::framework
;
100 using namespace ::cppu
;
101 using namespace ::com::sun::star::uno
;
102 using namespace ::com::sun::star::lang
;
103 using namespace ::com::sun::star::frame
;
104 using namespace ::com::sun::star::awt
;
105 using namespace ::com::sun::star::beans
;
106 using namespace ::com::sun::star::util
;
107 using namespace ::com::sun::star::task
;
108 using namespace ::com::sun::star::mozilla
;
109 using namespace ::com::sun::star::bridge
;
110 using namespace ::com::sun::star::document
;
111 using namespace ::com::sun::star::container
;
113 //_________________________________________________________________________________________________________________
115 //_________________________________________________________________________________________________________________
117 //_________________________________________________________________________________________________________________
119 //_________________________________________________________________________________________________________________
121 /*-***************************************************************************************************************/
122 class TestApplication
: public Application
124 //*************************************************************************************************************
129 //*************************************************************************************************************
133 void impl_testDesktop ( const Reference
< XDesktop
>& xDesktop
);
134 void impl_buildTree ( const Reference
< XDesktop
>& xDesktop
);
135 void impl_logTree ( const Reference
< XDesktop
>& xDesktop
);
140 void impl_testPlugIn ( const Reference
< XDesktop
>& xDesktop
, const Reference
< XMultiServiceFactory
>& xFactory
);
143 #ifdef TEST_LOGINDIALOG
144 void impl_testLoginDialog();
147 #ifdef TEST_FILTERCACHE
148 void impl_testFilterCache();
151 #ifdef TEST_TYPEDETECTION
152 void impl_testTypeDetection();
155 #ifdef TEST_FILTERREGISTRATION
156 void impl_testFilterRegistration();
159 #ifdef TEST_TREESEARCH
160 sal_Bool
impl_testTreeSearch();
163 //*************************************************************************************************************
166 //*************************************************************************************************************
169 Reference
< XMultiServiceFactory
> m_xFactory
;
171 }; // class TestApplication
173 //_________________________________________________________________________________________________________________
175 //_________________________________________________________________________________________________________________
177 TestApplication aTestApplication
;
179 //_________________________________________________________________________________________________________________
181 //_________________________________________________________________________________________________________________
183 void TestApplication::Main()
185 // RegistryCache aCache;
187 /**-***********************************************************************************************************
189 **************************************************************************************************************/
191 // Init global servicemanager and set it.
192 ServiceManager aManager
;
193 m_xFactory
= aManager
.getGlobalUNOServiceManager();
194 setProcessServiceFactory( m_xFactory
);
196 // Control sucess of operation.
197 LOG_ASSERT( !(m_xFactory
.is() ==sal_False
), "TestApplication::Main()\nCan't create global service manager.\n\n" )
198 LOG_ASSERT( !(getProcessServiceFactory()!=m_xFactory
), "TestApplication::Main()\nGlobal servicemanager not set in UNOTOOLS.\n\n" )
200 /**-***********************************************************************************************************
202 **************************************************************************************************************/
204 sal_Bool bState
= sal_True
;
206 //-------------------------------------------------------------------------------------------------------------
207 #ifdef TEST_FILTERCACHE
208 impl_testFilterCache();
211 //-------------------------------------------------------------------------------------------------------------
212 #ifdef TEST_TYPEDETECTION
213 impl_testTypeDetection();
216 //-------------------------------------------------------------------------------------------------------------
217 #ifdef TEST_LOGINDIALOG
218 ResMgr
* pRessourceManager
= CREATEVERSIONRESMGR( lgd
);
219 Resource::SetResManager( pRessourceManager
);
220 impl_testLoginDialog();
223 //-------------------------------------------------------------------------------------------------------------
225 Reference
< XDesktop
> xDesktop( xGlobalServiceManager
->createInstance( SERVICENAME_DESKTOP
), UNO_QUERY
);
226 impl_testDesktop( xDesktop
);
229 //-------------------------------------------------------------------------------------------------------------
231 impl_testPlugIn( xDesktop
, xGlobalServiceManager
);
234 //-------------------------------------------------------------------------------------------------------------
235 #ifdef TEST_FILTERREGISTRATION
236 impl_testFilterRegistration();
239 //-------------------------------------------------------------------------------------------------------------
240 #ifdef TEST_TREESEARCH
241 bState
= impl_testTreeSearch();
245 // xFrame->dispose();
246 // delete pMainWindow;
247 if( bState
= sal_True
)
249 LOG_ERROR( "TestApplication::Main()", "Test successful ..." )
253 LOG_ERROR( "TestApplication::Main()", "Test failed ..." )
257 //_________________________________________________________________________________________________________________
259 //_________________________________________________________________________________________________________________
260 #ifdef TEST_TYPEDETECTION
261 void TestApplication::impl_testTypeDetection()
263 // We use a string buffer to log important informations and search results.
264 // Errors are shown directly by an assert!
265 OUStringBuffer
sBuffer( 100000 );
267 // Create a new type detection service.
268 Reference
< XTypeDetection
> xTypeDetection( getProcessServiceFactory()->createInstance( SERVICENAME_TYPEDETECTION
), UNO_QUERY
);
269 LOG_ASSERT( !(xTypeDetection
.is()==sal_False
), "TestApplication::impl_testTypeDetection()\nCouldn't create the type detection service.\n" );
271 if( xTypeDetection
.is() == sal_True
)
273 // a) Check his implementation and his supported interfaces first.
274 Reference
< XInterface
> xInterface ( xTypeDetection
, UNO_QUERY
);
275 Reference
< XTypeProvider
> xTypeProvider ( xTypeDetection
, UNO_QUERY
);
276 Reference
< XServiceInfo
> xServiceInfo ( xTypeDetection
, UNO_QUERY
);
277 Reference
< XNameAccess
> xNameAccess ( xTypeDetection
, UNO_QUERY
);
278 Reference
< XElementAccess
> xElementAccess ( xTypeDetection
, UNO_QUERY
);
280 LOG_ASSERT( !( xInterface
.is() == sal_False
||
281 xTypeProvider
.is() == sal_False
||
282 xServiceInfo
.is() == sal_False
||
283 xNameAccess
.is() == sal_False
||
284 xElementAccess
.is() == sal_False
), "TestApplication::impl_testTypeDetection()\nMiss supported for searched interface!\n" )
286 // b) Check OneInstance mode of service.
287 Reference
< XTypeDetection
> xTypeDetection2( getProcessServiceFactory()->createInstance( SERVICENAME_TYPEDETECTION
), UNO_QUERY
);
288 LOG_ASSERT( !(xTypeDetection
!=xTypeDetection2
), "TestApplication::impl_testTypeDetection()\nService isn't \"OneInstance\" ...!\n" )
289 xTypeDetection2
= Reference
< XTypeDetection
>();
291 // c) Check "XTypeDetection" ... flat by URL
292 // Define list of URLs for checking.
295 DECLARE_ASCII("file://c|/temp/test.sdw" ),
296 DECLARE_ASCII("private:factory/scalc" ),
297 DECLARE_ASCII("file://c|/temp/test.txt" ),
298 DECLARE_ASCII("slot:5000" ),
300 sal_uInt32 nCount
= 4;
301 Sequence
< OUString
> seqURLs( pURLs
, nCount
);
303 Reference
< XMultiServiceFactory
> xFilterFactory( getProcessServiceFactory()->createInstance( SERVICENAME_FILTERFACTORY
), UNO_QUERY
);
304 Reference
< XMultiServiceFactory
> xLoaderFactory( getProcessServiceFactory()->createInstance( SERVICENAME_FRAMELOADERFACTORY
), UNO_QUERY
);
305 LOG_ASSERT( !(xFilterFactory
.is()==sal_False
), "TestApplication::impl_testTypeDetection()\nCouldn't create filter factory!\n" )
306 LOG_ASSERT( !(xLoaderFactory
.is()==sal_False
), "TestApplication::impl_testTypeDetection()\nCouldn't create loader factory!\n" )
308 // Step over these list.
309 for( sal_uInt32 nURL
=0; nURL
<nCount
; ++nURL
)
311 // Try to get a type name for every URL from list and log search result.
312 OUString sTypeName
= xTypeDetection
->queryTypeByURL( seqURLs
[nURL
] );
313 sBuffer
.appendAscii ( "queryTypeByURL( \"" );
314 sBuffer
.append ( seqURLs
[nURL
] );
315 sBuffer
.appendAscii ( "\" ) returns type \"" );
316 sBuffer
.append ( sTypeName
);
317 sBuffer
.appendAscii ( "\"\n" );
318 // If a type was found - try to get a filter and a frame loader for it.
319 if( sTypeName
.getLength() > 0 )
321 Reference
< XInterface
> xFilter
= xFilterFactory
->createInstance( sTypeName
);
322 Reference
< XInterface
> xLoader
= xLoaderFactory
->createInstance( sTypeName
);
323 if( xFilter
.is() == sal_False
)
325 sBuffer
.appendAscii( "Couldn't find an filter.\n" );
329 Reference
< XPropertySet
> xFilterProperties( xFilter
, UNO_QUERY
);
330 LOG_ASSERT( !(xFilterProperties
.is()==sal_False
), "TestApplication::impl_testTypeDetection()\nFilter don't support XPropertySet!\n" )
331 if( xFilterProperties
.is() == sal_True
)
334 xFilterProperties
->getPropertyValue( DECLARE_ASCII("UIName") ) >>= sUIName
;
335 sBuffer
.appendAscii ( "Found filter \"" );
336 sBuffer
.append ( sUIName
);
337 sBuffer
.appendAscii ( "\"\n" );
340 Reference
< XPropertySet
> xLoaderProperties( xLoader
, UNO_QUERY
);
341 LOG_ASSERT( !(xLoaderProperties
.is()==sal_False
), "TestApplication::impl_testTypeDetection()\nLoader don't support XPropertySet!\n" )
342 if( xLoaderProperties
.is() == sal_True
)
345 xLoaderProperties
->getPropertyValue( DECLARE_ASCII("UIName") ) >>= sUIName
;
346 sBuffer
.appendAscii ( "Found loader \"" );
347 sBuffer
.append ( sUIName
);
348 sBuffer
.appendAscii ( "\"\n" );
355 WRITE_LOGFILE( "testTypeDetection.log", U2B(sBuffer
.makeStringAndClear()) )
359 //_________________________________________________________________________________________________________________
361 //_________________________________________________________________________________________________________________
362 #ifdef TEST_FILTERCACHE
363 void TestApplication::impl_testFilterCache()
367 OUStringBuffer
sBuffer( 100000 );
368 if( aCache
.isValid() == sal_False
)
370 sBuffer
.appendAscii( "Cache isn't valid!\n" );
375 // Step over all types and log his values.
376 // These simulate a XNameAccess!
377 const Sequence< OUString > seqAllTypeNames = aCache.getAllTypeNames();
378 sal_uInt32 nCount = seqAllTypeNames.getLength();
379 for( sal_uInt32 nPosition=0; nPosition<nCount; ++nPosition )
381 sBuffer.appendAscii( "--------------------------------------------------------------------------------\n" );
382 const TType* pType = aCache.getTypeByName( seqAllTypeNames[nPosition] );
385 sBuffer.appendAscii ( "Type [" );
386 sBuffer.append ( (sal_Int32)nPosition );
387 sBuffer.appendAscii ( "] \"" );
388 sBuffer.append ( seqAllTypeNames[nPosition]);
389 sBuffer.appendAscii ( "\" isn't valid!" );
393 sBuffer.appendAscii ( "Type [" );
394 sBuffer.append ( (sal_Int32)nPosition );
395 sBuffer.appendAscii ( "] \"" );
396 sBuffer.append ( seqAllTypeNames[nPosition] );
397 sBuffer.appendAscii ( "\"\n\t\tUIName\t=\t" );
398 sBuffer.append ( pType->sUIName );
399 sBuffer.appendAscii ( "\n\t\tMediaType\t=\t" );
400 sBuffer.append ( pType->sMediaType );
401 sBuffer.appendAscii ( "\n\t\tClipboardFormat\t=\t" );
402 sBuffer.append ( pType->sClipboardFormat );
403 sBuffer.appendAscii ( "\n\t\tURLPattern\t=\t{" );
404 for( TConstStringIterator aIterator=pType->lURLPattern.begin(); aIterator!=pType->lURLPattern.end(); ++aIterator )
406 sBuffer.append ( *aIterator );
407 sBuffer.appendAscii ( ";\n\t\t" );
409 sBuffer.appendAscii( "}\nExtensions\t=\t" );
410 for( aIterator=pType->lExtensions.begin(); aIterator!=pType->lExtensions.end(); ++aIterator )
412 sBuffer.append ( *aIterator );
413 sBuffer.appendAscii ( ";\n\t\t" );
415 sBuffer.appendAscii ( "}\nDocumentIconID\t=\t" );
416 sBuffer.append ( (sal_Int32)pType->nDocumentIconID );
420 // searchFirstType( URL, MediaType, ClipboardFormat, startEntry )
421 TCheckedTypeIterator aIterator
;
422 sBuffer
.appendAscii( "search type for \"file://c|/temp/test.sdw\"; no media type; no clipboard format\n" );
423 OUString sURL
= DECLARE_ASCII("file://c|/temp/test.sdw");
424 const OUString
* pType
= aCache
.searchFirstType( &sURL
, NULL
, NULL
, aIterator
);
425 while( pType
!= NULL
)
427 sBuffer
.appendAscii ( "\tfound \"" );
428 sBuffer
.append ( *pType
);
429 sBuffer
.appendAscii ( "\"\n" );
430 pType
= aCache
.searchType( &sURL
, NULL
, NULL
, aIterator
);
434 WRITE_LOGFILE( "test_FilterCache.log", U2B(sBuffer
.makeStringAndClear()) )
438 //_________________________________________________________________________________________________________________
440 //_________________________________________________________________________________________________________________
441 #ifdef TEST_LOGINDIALOG
442 void TestApplication::impl_testLoginDialog()
444 // Get global servicemanager to create service "LoginDialog".
445 Reference
< XMultiServiceFactory
> xFactory
= getProcessServiceFactory();
446 LOG_ASSERT( !(xFactory
.is()==sal_False
), "TestApplication::impl_testLoginDialog()\nServicemanager not valid.\n" )
447 // Create LoginDialog.
448 Reference
< XDialog
> xDialog( xFactory
->createInstance( DECLARE_ASCII("com.sun.star.framework.LoginDialog") ), UNO_QUERY
);
449 LOG_ASSERT( !(xDialog
.is()==sal_False
), "TestApplication::impl_testLoginDialog()\nCould not create login dialog.\n" )
450 // Check set/getTitle()
451 /* not implemented yet! */
452 // OUString sTitle = DECLARE_ASCII("Login Dialog Test");
453 // xDialog->setTitle( sTitle );
454 // LOG_ASSERT( !(xDialog->getTitle()!=sTitle), "TestApplication::impl_testLoginDialog()\nset/getTitle don't work correct.\n" )
456 UniString sInternalURL
= DECLARE_ASCII("private:factory/scalc");
457 UniString sExternalURL
= OUString();
459 OString sOut
= "internal: ";
460 sOut
+= OUStringToOString( sInternalURL
, RTL_TEXTENCODING_UTF8
);
461 sOut
+= "\nexternal: ";
462 sOut
+= OUStringToOString( sExternalURL
, RTL_TEXTENCODING_UTF8
);
464 LOG_ASSERT( sal_False
, sOut
)
466 INetURLObject::translateToExternal( sInternalURL
, sExternalURL
);
468 sOut
+= OUStringToOString( sInternalURL
, RTL_TEXTENCODING_UTF8
);
469 sOut
+= "\nexternal: ";
470 sOut
+= OUStringToOString( sExternalURL
, RTL_TEXTENCODING_UTF8
);
472 LOG_ASSERT( sal_False
, sOut
)
474 INetURLObject::translateToInternal( sExternalURL
, sInternalURL
);
476 sOut
+= OUStringToOString( sInternalURL
, RTL_TEXTENCODING_UTF8
);
477 sOut
+= "\nexternal: ";
478 sOut
+= OUStringToOString( sExternalURL
, RTL_TEXTENCODING_UTF8
);
480 LOG_ASSERT( sal_False
, sOut
)
482 // Work with properties of dialog.
483 Reference
< XPropertySet
> xPropertySet( xDialog
, UNO_QUERY
);
484 LOG_ASSERT( !(xPropertySet
.is()==sal_False
), "TestApplication::impl_testLoginDialog()\nCan't cast dialog to XPropertySet interface.\n" )
488 Any aConnectionType
;
490 aUserName
<<= DECLARE_ASCII("Andreas");
491 aPassword
<<= DECLARE_ASCII("Test");
492 aServer
<<= DECLARE_ASCII("www.yahoo.de:7777");
493 aConnectionType
<<= DECLARE_ASCII("Bla");
494 sal_Int32 nPort
= 8081;
498 xPropertySet
->setPropertyValue( DECLARE_ASCII("UserName" ), aUserName
);
499 xPropertySet
->setPropertyValue( DECLARE_ASCII("Password" ), aPassword
);
500 xPropertySet
->setPropertyValue( DECLARE_ASCII("Server" ), aServer
);
501 xPropertySet
->setPropertyValue( DECLARE_ASCII("ConnectionType" ), aConnectionType
);
502 xPropertySet
->setPropertyValue( DECLARE_ASCII("Compressed" ), aPort
);
504 catch( ::com::sun::star::beans::UnknownPropertyException
& )
506 LOG_ASSERT( sal_False
, "UnkownPropertyException detected!\n" )
508 catch( ::com::sun::star::beans::PropertyVetoException
& )
510 LOG_ASSERT( sal_False
, "PropertyVetoException detected!\n" )
512 catch( ::com::sun::star::lang::IllegalArgumentException
& )
514 LOG_ASSERT( sal_False
, "IllegalArgumentException detected!\n" )
516 catch( ::com::sun::star::lang::WrappedTargetException
& )
518 LOG_ASSERT( sal_False
, "WrappedTargetException detected!\n" )
520 catch( ::com::sun::star::uno::RuntimeException
& )
522 LOG_ASSERT( sal_False
, "RuntimeException detected!\n" )
530 OUString sConnectionType
;
531 xPropertySet
->getPropertyValue( DECLARE_ASCII("UserName" ) ) >>= sUserName
;
532 xPropertySet
->getPropertyValue( DECLARE_ASCII("Password" ) ) >>= sPassword
;
533 xPropertySet
->getPropertyValue( DECLARE_ASCII("Server" ) ) >>= sServer
;
534 xPropertySet
->getPropertyValue( DECLARE_ASCII("ConnectionType" ) ) >>= sConnectionType
;
535 xPropertySet
->getPropertyValue( sConnectionType
) >>= nPort
;
537 LOG_ASSERT( sal_False
, OUStringToOString( sUserName
, RTL_TEXTENCODING_UTF8
) )
538 LOG_ASSERT( sal_False
, OUStringToOString( sPassword
, RTL_TEXTENCODING_UTF8
) )
539 LOG_ASSERT( sal_False
, OUStringToOString( sServer
, RTL_TEXTENCODING_UTF8
) )
540 LOG_ASSERT( sal_False
, OUStringToOString( sConnectionType
, RTL_TEXTENCODING_UTF8
) )
541 LOG_ASSERT( sal_False
, OString::valueOf( (sal_Int32
)nPort
) )
545 //_________________________________________________________________________________________________________________
547 //_________________________________________________________________________________________________________________
549 void TestApplication::impl_testPlugIn( const Reference
< XDesktop
>& xDesktop
, const Reference
< XMultiServiceFactory
>& xFactory
)
551 // create instance provider for creation of factories.
552 Reference
< XInstanceProvider
> xInstanceProvider( (OWeakObject
*)(new OInstanceProvider( xFactory
)), UNO_QUERY
);
553 LOG_ASSERT( !(xInstanceProvider
.is()==sal_False
), "TestApplication::impl_testPlugIn()\nCan't create new instance provider!\n" )
555 // try to get factory for create a plugin
556 Reference
< XSingleServiceFactory
> xPlugInFactory( xInstanceProvider
->getInstance( INSTANCENAME_PLUGINFACTORY
), UNO_QUERY
);
557 LOG_ASSERT( !(xPlugInFactory
.is()==sal_False
), "TestApplication::impl_testPlugIn()\nCan't get PlugInFactory from instance provider!\n" )
559 // initialize parameter for creation of plugin
560 Reference
< XPluginInstancePeer
> xPlugInDLL
=Reference
< XPluginInstancePeer
>();
561 Sequence
< Any
> seqArguments(1);
562 seqArguments
[0] <<= xPlugInDLL
;
565 Reference
< XFrame
> xPlugIn( xPlugInFactory
->createInstanceWithArguments( seqArguments
), UNO_QUERY
);
566 LOG_ASSERT( !(xPlugIn
.is()==sal_False
), "TestApplication::impl_testPlugIn()\nFactory has created no valid plugin!\n" )
568 xPlugIn
->setName( OUString(RTL_CONSTASCII_USTRINGPARAM("PlugIn")) );
569 Reference
< XFramesSupplier
> xSupplier( xDesktop
, UNO_QUERY
);
570 xPlugIn
->setCreator( xSupplier
);
574 //_________________________________________________________________________________________________________________
576 //_________________________________________________________________________________________________________________
578 #define LOGFILE_TARGETING "targeting.log"
579 void TestApplication::impl_testDesktop( const Reference
< XDesktop
>& xDesktop
)
581 //-------------------------------------------------------------------------------------------------------------
582 // 1) Test cast to all supported interfaces of Desktop.
584 Reference
< XInterface
> xDesktopInterface ( xDesktop
, UNO_QUERY
);
585 Reference
< XTypeProvider
> xDesktopTypeProvider ( xDesktop
, UNO_QUERY
);
586 Reference
< XServiceInfo
> xDesktopServiceInfo ( xDesktop
, UNO_QUERY
);
587 Reference
< XComponentLoader
> xDesktopComponentLoader ( xDesktop
, UNO_QUERY
);
588 Reference
< XTasksSupplier
> xDesktopTasksSupplier ( xDesktop
, UNO_QUERY
);
589 Reference
< XDispatchProvider
> xDesktopDispatchProvider ( xDesktop
, UNO_QUERY
);
590 Reference
< XFramesSupplier
> xDesktopFramesSupplier ( xDesktop
, UNO_QUERY
);
591 Reference
< XFrame
> xDesktopFrame ( xDesktop
, UNO_QUERY
);
592 Reference
< XComponent
> xDesktopComponent ( xDesktop
, UNO_QUERY
);
593 Reference
< XStatusIndicatorFactory
> xDesktopStatusIndicatorFactory ( xDesktop
, UNO_QUERY
);
594 Reference
< XPropertySet
> xDesktopPropertySet ( xDesktop
, UNO_QUERY
);
595 Reference
< XFastPropertySet
> xDesktopFastPropertySet ( xDesktop
, UNO_QUERY
);
596 Reference
< XMultiPropertySet
> xDesktopMultiPropertySet ( xDesktop
, UNO_QUERY
);
598 LOG_ASSERT( !(xDesktopInterface
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXInterface not supported by Desktop.\n\n" )
599 LOG_ASSERT( !(xDesktopTypeProvider
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXTypeProvider not supported by Desktop.\n\n" )
600 LOG_ASSERT( !(xDesktopServiceInfo
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXServiceInfo not supported by Desktop.\n\n" )
601 LOG_ASSERT( !(xDesktop
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXDesktop not supported by Desktop.\n\n" )
602 LOG_ASSERT( !(xDesktopComponentLoader
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXComponentLoader not supported by Desktop.\n\n" )
603 LOG_ASSERT( !(xDesktopTasksSupplier
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXTasksSupplier not supported by Desktop.\n\n" )
604 LOG_ASSERT( !(xDesktopDispatchProvider
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXDispatchProvider not supported by Desktop.\n\n" )
605 LOG_ASSERT( !(xDesktopFramesSupplier
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXFramesSupplier not supported by Desktop.\n\n" )
606 LOG_ASSERT( !(xDesktopFrame
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXFrame not supported by Desktop.\n\n" )
607 LOG_ASSERT( !(xDesktopComponent
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXComponent not supported by Desktop.\n\n" )
608 LOG_ASSERT( !(xDesktopStatusIndicatorFactory
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXStatusIndicatorFactory not supported by Desktop.\n\n" )
609 LOG_ASSERT( !(xDesktopPropertySet
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXPropertySet not supported by Desktop.\n\n" )
610 LOG_ASSERT( !(xDesktopFastPropertySet
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXFastPropertySet not supported by Desktop.\n\n" )
611 LOG_ASSERT( !(xDesktopMultiPropertySet
.is() ==sal_False
), "TestApplication::impl_testDesktop()\nXMultiPropertySet not supported by Desktop.\n\n" )
613 //-------------------------------------------------------------------------------------------------------------
614 // 2) Test set-/getName().
616 // 2a) Test default value "Desktop".
617 OUString
sName( RTL_CONSTASCII_USTRINGPARAM("Desktop") );
618 LOG_ASSERT( !(xDesktopFrame
->getName()!=sName
), "TestApplication::impl_testDesktop()\nDefault value of desktop name is invalid.\n\n" )
620 // 2b) Set name and try to get the same name.
621 sName
= OUString( RTL_CONSTASCII_USTRINGPARAM("New Desktop") );
622 xDesktopFrame
->setName( sName
);
623 LOG_ASSERT( !(xDesktopFrame
->getName()!=sName
), "TestApplication::impl_testDesktop()\nSetting of name works not correct on desktop.\n\n" )
625 // Reset name do default!
626 // Its neccessary for follow operations.
627 sName
= OUString( RTL_CONSTASCII_USTRINGPARAM("Desktop") );
628 xDesktopFrame
->setName( sName
);
630 //-------------------------------------------------------------------------------------------------------------
631 // 3) Test findFrame().
633 // Build new example tree and log initial structure in file.
634 impl_buildTree ( xDesktop
);
635 impl_logTree ( xDesktop
);
637 OUString sTargetFrameName
;
638 sal_uInt32 nSearchFlags
;
639 Reference
< XFrame
> xSearchFrame
;
640 Reference
< XFrame
> xTask_4
;
641 Reference
< XFrame
> xFrame_41
;
642 Reference
< XFrame
> xFrame_411
;
643 Reference
< XFrame
> xFrame_112
;
644 Reference
< XFrame
> xFrame_1123
;
645 Reference
< XFrame
> xFrame_11231
;
646 Reference
< XFrame
> xFrame_11221
;
648 // 3a) Search for Desktop
649 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
650 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with SELF for \"Desktop\" on Desktop\n" )
651 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
652 sTargetFrameName
= OUString(RTL_CONSTASCII_USTRINGPARAM("Desktop"));
653 nSearchFlags
= FrameSearchFlag::SELF
;
654 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
655 LOG_ASSERT( !(xSearchFrame
.is()==sal_False
), "TestApplication::impl_testDesktop()\nSearch 3a)-1 invalid\n" );
657 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
658 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with ALL for \"Desktop\" on Desktop\n" )
659 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
660 nSearchFlags
= FrameSearchFlag::ALL
;
661 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
662 LOG_ASSERT( !(xSearchFrame
.is()==sal_False
), "TestApplication::impl_testDesktop()\nSearch 3a)-2 invalid\n" );
664 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
665 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with CHILDREN for \"Desktop\" on Desktop\n" )
666 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
667 nSearchFlags
= FrameSearchFlag::CHILDREN
;
668 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
669 LOG_ASSERT( !(xSearchFrame
.is()==sal_True
), "TestApplication::impl_testDesktop()\nSearch 3a)-3 invalid\n" );
671 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
672 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with SIBLINGS for \"Desktop\" on Desktop\n" )
673 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
674 nSearchFlags
= FrameSearchFlag::SIBLINGS
;
675 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
676 LOG_ASSERT( !(xSearchFrame
.is()==sal_True
), "TestApplication::impl_testDesktop()\nSearch 3a)-4 invalid\n" );
678 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
679 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with AUTO for \"Desktop\" on Desktop\n" )
680 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
681 nSearchFlags
= FrameSearchFlag::AUTO
;
682 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
683 LOG_ASSERT( !(xSearchFrame
.is()==sal_True
), "TestApplication::impl_testDesktop()\nSearch 3a)-5 invalid\n" );
685 // 3b) Search for Task_4
686 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
687 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with SELF for \"Task_4\" on Desktop\n" )
688 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
689 sTargetFrameName
= OUString(RTL_CONSTASCII_USTRINGPARAM("Task_4"));
690 nSearchFlags
= FrameSearchFlag::SELF
;
691 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
692 LOG_ASSERT( !(xSearchFrame
.is()==sal_True
), "TestApplication::impl_testDesktop()\nSearch 3b)-1 invalid\n" );
694 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
695 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with SIBLINGS for \"Task_4\" on Desktop\n" )
696 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
697 nSearchFlags
= FrameSearchFlag::SIBLINGS
;
698 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
699 LOG_ASSERT( !(xSearchFrame
.is()==sal_True
), "TestApplication::impl_testDesktop()\nSearch 3b)-2 invalid\n" );
701 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
702 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with CHILDREN for \"Task_4\" on Desktop\n" )
703 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
704 nSearchFlags
= FrameSearchFlag::CHILDREN
;
705 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
706 LOG_ASSERT( !(xSearchFrame
.is()==sal_False
), "TestApplication::impl_testDesktop()\nSearch 3b)-3 invalid\n" );
708 xTask_4
= xSearchFrame
;
710 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
711 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with ALL for \"Task_4\" on Desktop\n" )
712 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
713 nSearchFlags
= FrameSearchFlag::ALL
;
714 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
715 LOG_ASSERT( !(xSearchFrame
.is()==sal_False
), "TestApplication::impl_testDesktop()\nSearch 3b)-4 invalid\n" );
717 // 3c) Search for Frame_41
718 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
719 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with SELF for \"Frame_41\" on Desktop\n" )
720 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
721 sTargetFrameName
= OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_41"));
722 nSearchFlags
= FrameSearchFlag::SELF
;
723 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
724 LOG_ASSERT( !(xSearchFrame
.is()==sal_True
), "TestApplication::impl_testDesktop()\nSearch 3c)-1 invalid\n" );
726 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
727 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with SIBLINGS for \"Frame_41\" on Desktop\n" )
728 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
729 nSearchFlags
= FrameSearchFlag::SIBLINGS
;
730 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
731 LOG_ASSERT( !(xSearchFrame
.is()==sal_True
), "TestApplication::impl_testDesktop()\nSearch 3c)-2 invalid\n" );
733 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
734 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with CHILDREN for \"Frame_41\" on Desktop\n" )
735 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
736 nSearchFlags
= FrameSearchFlag::CHILDREN
;
737 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
738 LOG_ASSERT( !(xSearchFrame
.is()==sal_False
), "TestApplication::impl_testDesktop()\nSearch 3c)-3 invalid\n" );
740 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
741 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with ALL for \"Frame_41\" on Desktop\n" )
742 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
743 nSearchFlags
= FrameSearchFlag::ALL
;
744 xSearchFrame
= xDesktopFrame
->findFrame(sTargetFrameName
, nSearchFlags
);
745 LOG_ASSERT( !(xSearchFrame
.is()==sal_False
), "TestApplication::impl_testDesktop()\nSearch 3c)-4 invalid\n" );
747 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
748 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with SELF for \"Frame_41\" on Task_4\n" )
749 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
750 nSearchFlags
= FrameSearchFlag::SELF
;
751 xSearchFrame
= xTask_4
->findFrame(sTargetFrameName
, nSearchFlags
);
752 LOG_ASSERT( !(xSearchFrame
.is()==sal_True
), "TestApplication::impl_testDesktop()\nSearch 3c)-5 invalid\n" );
754 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
755 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with SIBLINGS for \"Frame_41\" on Task_4\n" )
756 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
757 nSearchFlags
= FrameSearchFlag::SIBLINGS
;
758 xSearchFrame
= xTask_4
->findFrame(sTargetFrameName
, nSearchFlags
);
759 LOG_ASSERT( !(xSearchFrame
.is()==sal_True
), "TestApplication::impl_testDesktop()\nSearch 3c)-6 invalid\n" );
761 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
762 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with CHILDREN for \"Frame_41\" on Task_4\n" )
763 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
764 nSearchFlags
= FrameSearchFlag::CHILDREN
;
765 xSearchFrame
= xTask_4
->findFrame(sTargetFrameName
, nSearchFlags
);
766 LOG_ASSERT( !(xSearchFrame
.is()==sal_False
), "TestApplication::impl_testDesktop()\nSearch 3c)-7 invalid\n" );
768 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
769 WRITE_LOGFILE( LOGFILE_TARGETING
, " Search with ALL for \"Frame_41\" on Task_4\n" )
770 WRITE_LOGFILE( LOGFILE_TARGETING
, "--------------------------------------------------------------------------------\n" )
771 nSearchFlags
= FrameSearchFlag::ALL
;
772 xSearchFrame
= xTask_4
->findFrame(sTargetFrameName
, nSearchFlags
);
773 LOG_ASSERT( !(xSearchFrame
.is()==sal_False
), "TestApplication::impl_testDesktop()\nSearch 3c)-8 invalid\n" );
775 xFrame_41
= xSearchFrame
;
777 // 3d) Search for Frame_411
778 // 3e) Search for Frame_112
779 // 3f) Search for Frame_1123
780 // 3g) Search for Frame_11231
781 // 3h) Search for Frame_11221
784 //_________________________________________________________________________________________________________________
785 // helper method to build a new binaer-tree with desktop as top-frame
786 //_________________________________________________________________________________________________________________
787 void TestApplication::impl_buildTree( const Reference
< XDesktop
>& xDesktop
)
789 // You can append and remove frames only on XFRames interface of desktop.
790 // But the desktop support this interface not directly! Use getFrames() instantly.
791 Reference
< XFramesSupplier
> xDesktopSupplier( xDesktop
, UNO_QUERY
);
792 Reference
< XFrames
> xFrames
= xDesktopSupplier
->getFrames();
793 LOG_ASSERT( !(xFrames
.is()==sal_False
), "TestApplication::impl_buildTree()\nCan't get framesaccess on desktop.\n\n" )
795 // Create some tasks and frames.
796 Reference
< XMultiServiceFactory
> xServiceManager( getProcessServiceFactory() );
798 Reference
< XTask
> xTask_1( xServiceManager
->createInstance(SERVICENAME_TASK
), UNO_QUERY
);
799 Reference
< XTask
> xTask_2( xServiceManager
->createInstance(SERVICENAME_TASK
), UNO_QUERY
);
800 Reference
< XTask
> xTask_3( xServiceManager
->createInstance(SERVICENAME_TASK
), UNO_QUERY
);
801 Reference
< XTask
> xTask_4( xServiceManager
->createInstance(SERVICENAME_TASK
), UNO_QUERY
);
802 Reference
< XTask
> xTask_5( xServiceManager
->createInstance(SERVICENAME_TASK
), UNO_QUERY
);
803 Reference
< XFrame
> xFrame_11( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
804 Reference
< XFrame
> xFrame_12( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
805 Reference
< XFrame
> xFrame_21( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
806 Reference
< XFrame
> xFrame_22( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
807 Reference
< XFrame
> xFrame_31( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
808 Reference
< XFrame
> xFrame_32( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
809 Reference
< XFrame
> xFrame_41( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
810 Reference
< XFrame
> xFrame_42( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
811 Reference
< XFrame
> xFrame_51( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
812 Reference
< XFrame
> xFrame_52( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
813 Reference
< XFrame
> xFrame_111( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
814 Reference
< XFrame
> xFrame_112( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
815 Reference
< XFrame
> xFrame_121( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
816 Reference
< XFrame
> xFrame_411( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
817 Reference
< XFrame
> xFrame_1121( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
818 Reference
< XFrame
> xFrame_1122( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
819 Reference
< XFrame
> xFrame_1123( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
820 Reference
< XFrame
> xFrame_4111( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
821 Reference
< XFrame
> xFrame_4112( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
822 Reference
< XFrame
> xFrame_4113( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
823 Reference
< XFrame
> xFrame_11221( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
824 Reference
< XFrame
> xFrame_11231( xServiceManager
->createInstance(SERVICENAME_FRAME
), UNO_QUERY
);
826 // Initialize tasks and frames with names to support easy finding!
827 Reference
< XFrame
> xTaskFrame_1( xTask_1
, UNO_QUERY
);
828 Reference
< XFrame
> xTaskFrame_2( xTask_2
, UNO_QUERY
);
829 Reference
< XFrame
> xTaskFrame_3( xTask_3
, UNO_QUERY
);
830 Reference
< XFrame
> xTaskFrame_4( xTask_4
, UNO_QUERY
);
831 Reference
< XFrame
> xTaskFrame_5( xTask_5
, UNO_QUERY
);
833 xTaskFrame_1
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_1")));
834 xTaskFrame_2
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_2")));
835 xTaskFrame_3
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_3")));
836 xTaskFrame_4
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_4")));
837 xTaskFrame_5
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_5")));
838 xFrame_11
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11")));
839 xFrame_12
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_12")));
840 xFrame_21
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_21")));
841 xFrame_22
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_22")));
842 xFrame_31
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_31")));
843 xFrame_32
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_32")));
844 xFrame_41
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_41")));
845 xFrame_42
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_42")));
846 xFrame_51
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_51")));
847 xFrame_52
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_52")));
848 xFrame_111
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_111")));
849 xFrame_112
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_112")));
850 xFrame_121
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_121")));
851 xFrame_411
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_411")));
852 xFrame_1121
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1121")));
853 xFrame_1122
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1122")));
854 xFrame_1123
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1123")));
855 xFrame_4111
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4111")));
856 xFrame_4112
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4112")));
857 xFrame_4113
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4113")));
858 xFrame_11221
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11221")));
859 xFrame_11231
->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11231")));
862 // Append tasks as childs of desktop.
863 xFrames
->append( xTaskFrame_1
);
864 xFrames
->append( xTaskFrame_2
);
865 xFrames
->append( xTaskFrame_3
);
866 xFrames
->append( xTaskFrame_4
);
867 xFrames
->append( xTaskFrame_5
);
869 // Append frames as childs of tasks.
870 Reference
< XFramesSupplier
> xTaskFramesSupplier_1( xTask_1
, UNO_QUERY
);
871 Reference
< XFramesSupplier
> xTaskFramesSupplier_2( xTask_2
, UNO_QUERY
);
872 Reference
< XFramesSupplier
> xTaskFramesSupplier_3( xTask_3
, UNO_QUERY
);
873 Reference
< XFramesSupplier
> xTaskFramesSupplier_4( xTask_4
, UNO_QUERY
);
874 Reference
< XFramesSupplier
> xTaskFramesSupplier_5( xTask_5
, UNO_QUERY
);
875 Reference
< XFramesSupplier
> xFramesSupplier_11( xFrame_11
, UNO_QUERY
);
876 Reference
< XFramesSupplier
> xFramesSupplier_12( xFrame_12
, UNO_QUERY
);
877 Reference
< XFramesSupplier
> xFramesSupplier_112( xFrame_112
, UNO_QUERY
);
878 Reference
< XFramesSupplier
> xFramesSupplier_1122( xFrame_1122
, UNO_QUERY
);
879 Reference
< XFramesSupplier
> xFramesSupplier_1123( xFrame_1123
, UNO_QUERY
);
880 Reference
< XFramesSupplier
> xFramesSupplier_41( xFrame_41
, UNO_QUERY
);
881 Reference
< XFramesSupplier
> xFramesSupplier_411( xFrame_411
, UNO_QUERY
);
883 xFrames
= xTaskFramesSupplier_1
->getFrames();
884 xFrames
->append( xFrame_11
);
885 xFrames
->append( xFrame_12
);
886 xFrames
= xTaskFramesSupplier_2
->getFrames();
887 xFrames
->append( xFrame_21
);
888 xFrames
->append( xFrame_22
);
889 xFrames
= xTaskFramesSupplier_3
->getFrames();
890 xFrames
->append( xFrame_31
);
891 xFrames
->append( xFrame_32
);
892 xFrames
= xTaskFramesSupplier_4
->getFrames();
893 xFrames
->append( xFrame_41
);
894 xFrames
->append( xFrame_42
);
895 xFrames
= xTaskFramesSupplier_5
->getFrames();
896 xFrames
->append( xFrame_51
);
897 xFrames
->append( xFrame_52
);
898 xFrames
= xFramesSupplier_11
->getFrames();
899 xFrames
->append( xFrame_111
);
900 xFrames
->append( xFrame_112
);
901 xFrames
= xFramesSupplier_12
->getFrames();
902 xFrames
->append( xFrame_121
);
903 xFrames
= xFramesSupplier_112
->getFrames();
904 xFrames
->append( xFrame_1121
);
905 xFrames
->append( xFrame_1122
);
906 xFrames
->append( xFrame_1123
);
907 xFrames
= xFramesSupplier_1122
->getFrames();
908 xFrames
->append( xFrame_11221
);
909 xFrames
= xFramesSupplier_1123
->getFrames();
910 xFrames
->append( xFrame_11231
);
911 xFrames
= xFramesSupplier_41
->getFrames();
912 xFrames
->append( xFrame_411
);
913 xFrames
= xFramesSupplier_411
->getFrames();
914 xFrames
->append( xFrame_4111
);
915 xFrames
->append( xFrame_4112
);
916 xFrames
->append( xFrame_4113
);
918 // Create some active paths.
919 // desktop => task_1 => frame_11 => frame_112 => frame_1122
920 // xDesktopSupplier->setActiveFrame( xTaskFrame_1 );
921 // xTaskFramesSupplier_1->setActiveFrame( xFrame_11 );
922 // xFramesSupplier_11->setActiveFrame( xFrame_112 );
923 // xFramesSupplier_112->setActiveFrame( xFrame_1122 );
924 // frame_41 => frame_411 => frame_4111
925 // xFramesSupplier_41->setActiveFrame( xFrame_411 );
926 // xFramesSupplier_411->setActiveFrame( xFrame_4111 );
927 // task_3 => frame_31
928 // xTaskFramesSupplier_3->setActiveFrame( xFrame_31 );
929 // frame_1123 => frame_11231
930 // xFramesSupplier_1123->setActiveFrame( xFrame_11231 );
932 // xTask_1->activate();
933 // impl_logTree( xDesktop );
934 // xFrame_41->activate();
935 // impl_logTree( xDesktop );
936 // xFrame_52->activate();
937 // impl_logTree( xDesktop );
938 // WRITE_LOGFILE( LOGFILENAME_TREE, "initiale Hierarchy:" )
939 impl_logTree( xDesktop
);
941 // xFrame_121->activate();
942 // impl_logTree( xDesktop );
943 // xFrame_41->activate();
944 // impl_logTree( xDesktop );
945 // xFrame_52->activate();
946 // impl_logTree( xDesktop );
947 // WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_411->activate():" )
948 xFrame_411
->activate();
949 // WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_411->activate():" )
950 impl_logTree( xDesktop
);
951 // xFrame_41->deactivate();
952 // impl_logTree( xDesktop );
953 // xFrame_4113->activate();
954 // impl_logTree( xDesktop );
955 // xFrame_21->activate();
956 // impl_logTree( xDesktop );
957 // WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_11231->activate():" )
958 xFrame_11231
->activate();
959 // WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_11231->activate():" )
960 impl_logTree( xDesktop
);
962 // WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_11221->activate():" )
963 xFrame_11221
->activate();
964 // WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_11221->activate():" )
965 impl_logTree( xDesktop
);
967 // WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_112->deactivate():" )
968 // xFrame_112->getCreator()->setActiveFrame( Reference< XFrame >() );
969 xFrame_112
->deactivate();
970 // WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_112->deactivate():" )
971 impl_logTree( xDesktop
);
973 // WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_41->activate():" )
974 xFrame_41
->activate();
975 // WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_41->activate():" )
976 impl_logTree( xDesktop
);
978 // WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xTask_4->activate():" )
980 // WRITE_LOGFILE( LOGFILENAME_TREE, "nach xTask_4->activate():" )
981 impl_logTree( xDesktop
);
983 // WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_1123->deactivate():" )
984 xFrame_1123
->deactivate();
985 // WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_1123->deactivate():" )
986 impl_logTree( xDesktop
);
989 //_________________________________________________________________________________________________________________
990 // helper method to log current tree state
991 //_________________________________________________________________________________________________________________
992 void TestApplication::impl_logTree( const Reference
< XDesktop
>& xDesktop
)
994 #ifdef ENABLE_SERVICEDEBUG
995 // Use special feature of Desktop-implementation.
996 // NEVER USE THIS IN RELEASE VERSIONS!!!
997 Reference
< XSPECIALDEBUGINTERFACE
> xDebug( xDesktop
, UNO_QUERY
);
999 // Get a "stream" of all names of frames in tree.
1000 OUString sTreeNamesStream
= xDebug
->dumpVariable( DUMPVARIABLE_TREEINFO
, 0 );
1001 // And write it to logfile.
1002 OString sOutPut
= OUStringToOString( sTreeNamesStream
, RTL_TEXTENCODING_UTF8
);
1003 // WRITE_LOGFILE( LOGFILENAME_TREE, "\nNew tree log:\n\n" );
1004 // WRITE_LOGFILE( LOGFILENAME_TREE, sOutPut );
1005 // WRITE_LOGFILE( LOGFILENAME_TREE, "\n" );
1008 #endif // TEST_DESKTOP
1010 //_________________________________________________________________________________________________________________
1011 // test method for registration of new filters in configuration
1012 //_________________________________________________________________________________________________________________
1013 #ifdef TEST_FILTERREGISTRATION
1014 void TestApplication::impl_testFilterRegistration()
1016 Reference
< XNameContainer
> xContainer( m_xFactory
->createInstance( SERVICENAME_FILTERFACTORY
), UNO_QUERY
);
1017 LOG_ASSERT( !(xContainer
.is()==sal_False
), "TestApplication::impl_testFilterRegistration()\nCould not create FilterFactory-service or cast it to XNameContainer.\n" )
1018 if( xContainer
.is() == sal_True
)
1020 Sequence
< PropertyValue
> lProperties( 8 );
1022 lProperties
[0].Name
= DECLARE_ASCII("Type" );
1023 lProperties
[0].Value
<<= DECLARE_ASCII("component_DB" );
1025 lProperties
[1].Name
= DECLARE_ASCII("UIName" );
1026 lProperties
[1].Value
<<= DECLARE_ASCII("Ein neuer Filter-Eintrag");
1028 lProperties
[2].Name
= DECLARE_ASCII("DocumentService" );
1029 lProperties
[2].Value
<<= DECLARE_ASCII("test.document.service" );
1031 lProperties
[3].Name
= DECLARE_ASCII("FilterService" );
1032 lProperties
[3].Value
<<= DECLARE_ASCII("test.filter.service" );
1034 lProperties
[4].Name
= DECLARE_ASCII("Flags" );
1035 lProperties
[4].Value
<<= (sal_Int32
)100;
1037 Sequence
< OUString
> lTempData(1);
1038 lTempData
[0] = DECLARE_ASCII("meine UserData");
1039 lProperties
[5].Name
= DECLARE_ASCII("UserData" );
1040 lProperties
[5].Value
<<= lTempData
;
1042 lProperties
[6].Name
= DECLARE_ASCII("FileFormatVersion" );
1043 lProperties
[6].Value
<<= (sal_Int32
)1;
1045 lProperties
[7].Name
= DECLARE_ASCII("TemplateName" );
1046 lProperties
[7].Value
<<= DECLARE_ASCII("Mein Template Name" );
1049 aProperties
<<= lProperties
;
1050 xContainer
->insertByName( DECLARE_ASCII("mein_eigener_neuer_Filter"), aProperties
);
1052 lProperties
[0].Name
= DECLARE_ASCII("Type" );
1053 lProperties
[0].Value
<<= DECLARE_ASCII("component_DB" );
1055 lProperties
[1].Name
= DECLARE_ASCII("UIName" );
1056 lProperties
[1].Value
<<= DECLARE_ASCII("Ein neuer Filter-Eintrag 2");
1058 lProperties
[2].Name
= DECLARE_ASCII("DocumentService" );
1059 lProperties
[2].Value
<<= DECLARE_ASCII("test.document.service 2" );
1061 lProperties
[3].Name
= DECLARE_ASCII("FilterService" );
1062 lProperties
[3].Value
<<= DECLARE_ASCII("test.filter.service 2" );
1064 lProperties
[4].Name
= DECLARE_ASCII("Flags" );
1065 lProperties
[4].Value
<<= (sal_Int32
)200;
1067 lTempData
[0] = DECLARE_ASCII("meine UserData 2");
1068 lProperties
[5].Name
= DECLARE_ASCII("UserData" );
1069 lProperties
[5].Value
<<= lTempData
;
1071 lProperties
[6].Name
= DECLARE_ASCII("FileFormatVersion" );
1072 lProperties
[6].Value
<<= (sal_Int32
)2;
1074 lProperties
[7].Name
= DECLARE_ASCII("TemplateName" );
1075 lProperties
[7].Value
<<= DECLARE_ASCII("Mein Template Name 2" );
1077 aProperties
<<= lProperties
;
1078 xContainer
->insertByName( DECLARE_ASCII("mein_eigener_neuer_Filter_2"), aProperties
);
1080 xContainer
->removeByName( DECLARE_ASCII("mein_eigener_neuer_Filter") );
1085 //_________________________________________________________________________________________________________________
1086 // test method for search mechanism in our frame tree
1087 //_________________________________________________________________________________________________________________
1088 #ifdef TEST_TREESEARCH
1089 sal_Bool
TestApplication::impl_testTreeSearch()
1091 // Build an example tree.
1092 Reference
< XFrame
> xD ( m_xFactory
->createInstance( SERVICENAME_DESKTOP
), UNO_QUERY
);
1093 Reference
< XFrame
> xT1 ( m_xFactory
->createInstance( SERVICENAME_TASK
), UNO_QUERY
);
1094 Reference
< XFrame
> xT2 ( m_xFactory
->createInstance( SERVICENAME_TASK
), UNO_QUERY
);
1095 Reference
< XFrame
> xT3 ( m_xFactory
->createInstance( SERVICENAME_TASK
), UNO_QUERY
);
1096 Reference
< XFrame
> xF11 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1097 Reference
< XFrame
> xF12 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1098 Reference
< XFrame
> xF21 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1099 Reference
< XFrame
> xF22 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1100 Reference
< XFrame
> xF211 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1101 Reference
< XFrame
> xF212 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1102 Reference
< XFrame
> xF221 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1103 Reference
< XFrame
> xF2111 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1104 Reference
< XFrame
> xF2112 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1105 Reference
< XFrame
> xF2121 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1106 Reference
< XFrame
> xF2122 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1107 Reference
< XFrame
> xF2211 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1108 Reference
< XFrame
> xF21111 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1109 Reference
< XFrame
> xF21112 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1110 Reference
< XFrame
> xF21121 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1111 Reference
< XFrame
> xF21122 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1112 Reference
< XFrame
> xF21211 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1113 Reference
< XFrame
> xF21212 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1114 Reference
< XFrame
> xF21221 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1115 Reference
< XFrame
> xF21222 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1116 Reference
< XFrame
> xF22111 ( m_xFactory
->createInstance( SERVICENAME_FRAME
), UNO_QUERY
);
1118 xD
->setName ( DECLARE_ASCII("D" ) );
1119 xT1
->setName ( DECLARE_ASCII("T1" ) );
1120 xT2
->setName ( DECLARE_ASCII("T2" ) );
1121 xT3
->setName ( DECLARE_ASCII("T3" ) );
1122 xF11
->setName ( DECLARE_ASCII("F11" ) );
1123 xF12
->setName ( DECLARE_ASCII("F12" ) );
1124 xF21
->setName ( DECLARE_ASCII("F21" ) );
1125 xF22
->setName ( DECLARE_ASCII("F22" ) );
1126 xF211
->setName ( DECLARE_ASCII("F211" ) );
1127 xF212
->setName ( DECLARE_ASCII("F212" ) );
1128 xF221
->setName ( DECLARE_ASCII("F221" ) );
1129 xF2111
->setName ( DECLARE_ASCII("F2111" ) );
1130 xF2112
->setName ( DECLARE_ASCII("F2112" ) );
1131 xF2121
->setName ( DECLARE_ASCII("F2121" ) );
1132 xF2122
->setName ( DECLARE_ASCII("F2122" ) );
1133 xF2211
->setName ( DECLARE_ASCII("F2211" ) );
1134 xF21111
->setName( DECLARE_ASCII("F21111") );
1135 xF21112
->setName( DECLARE_ASCII("F21112") );
1136 xF21121
->setName( DECLARE_ASCII("F21121") );
1137 xF21122
->setName( DECLARE_ASCII("F21122") );
1138 xF21211
->setName( DECLARE_ASCII("F21211") );
1139 xF21212
->setName( DECLARE_ASCII("F21212") );
1140 xF21221
->setName( DECLARE_ASCII("F21221") );
1141 xF21222
->setName( DECLARE_ASCII("F21222") );
1142 xF22111
->setName( DECLARE_ASCII("F22111") );
1144 Reference
< XFramesSupplier
> xSD ( xD
, UNO_QUERY
);
1145 Reference
< XFramesSupplier
> xST1 ( xT1
, UNO_QUERY
);
1146 Reference
< XFramesSupplier
> xST2 ( xT2
, UNO_QUERY
);
1147 Reference
< XFramesSupplier
> xST3 ( xT3
, UNO_QUERY
);
1148 Reference
< XFramesSupplier
> xSF11 ( xF11
, UNO_QUERY
);
1149 Reference
< XFramesSupplier
> xSF12 ( xF12
, UNO_QUERY
);
1150 Reference
< XFramesSupplier
> xSF21 ( xF21
, UNO_QUERY
);
1151 Reference
< XFramesSupplier
> xSF22 ( xF22
, UNO_QUERY
);
1152 Reference
< XFramesSupplier
> xSF211 ( xF211
, UNO_QUERY
);
1153 Reference
< XFramesSupplier
> xSF212 ( xF212
, UNO_QUERY
);
1154 Reference
< XFramesSupplier
> xSF221 ( xF221
, UNO_QUERY
);
1155 Reference
< XFramesSupplier
> xSF2111 ( xF2111
, UNO_QUERY
);
1156 Reference
< XFramesSupplier
> xSF2112 ( xF2112
, UNO_QUERY
);
1157 Reference
< XFramesSupplier
> xSF2121 ( xF2121
, UNO_QUERY
);
1158 Reference
< XFramesSupplier
> xSF2122 ( xF2122
, UNO_QUERY
);
1159 Reference
< XFramesSupplier
> xSF2211 ( xF2211
, UNO_QUERY
);
1160 Reference
< XFramesSupplier
> xSF21111 ( xF21111
, UNO_QUERY
);
1161 Reference
< XFramesSupplier
> xSF21112 ( xF21112
, UNO_QUERY
);
1162 Reference
< XFramesSupplier
> xSF21121 ( xF21121
, UNO_QUERY
);
1163 Reference
< XFramesSupplier
> xSF21122 ( xF21122
, UNO_QUERY
);
1164 Reference
< XFramesSupplier
> xSF21211 ( xF21211
, UNO_QUERY
);
1165 Reference
< XFramesSupplier
> xSF21212 ( xF21212
, UNO_QUERY
);
1166 Reference
< XFramesSupplier
> xSF21221 ( xF21221
, UNO_QUERY
);
1167 Reference
< XFramesSupplier
> xSF21222 ( xF21222
, UNO_QUERY
);
1168 Reference
< XFramesSupplier
> xSF22111 ( xF22111
, UNO_QUERY
);
1170 xSD
->getFrames()->append ( xT1
);
1171 xSD
->getFrames()->append ( xT2
);
1172 xSD
->getFrames()->append ( xT3
);
1173 xST1
->getFrames()->append ( xF11
);
1174 xST1
->getFrames()->append ( xF12
);
1175 xST2
->getFrames()->append ( xF21
);
1176 xST2
->getFrames()->append ( xF22
);
1177 xSF21
->getFrames()->append ( xF211
);
1178 xSF21
->getFrames()->append ( xF212
);
1179 xSF211
->getFrames()->append ( xF2111
);
1180 xSF211
->getFrames()->append ( xF2112
);
1181 xSF212
->getFrames()->append ( xF2121
);
1182 xSF212
->getFrames()->append ( xF2122
);
1183 xSF2111
->getFrames()->append ( xF21111
);
1184 xSF2111
->getFrames()->append ( xF21112
);
1185 xSF2112
->getFrames()->append ( xF21121
);
1186 xSF2112
->getFrames()->append ( xF21122
);
1187 xSF2121
->getFrames()->append ( xF21211
);
1188 xSF2121
->getFrames()->append ( xF21212
);
1189 xSF2122
->getFrames()->append ( xF21221
);
1190 xSF2122
->getFrames()->append ( xF21222
);
1191 xSF22
->getFrames()->append ( xF221
);
1192 xSF221
->getFrames()->append ( xF2211
);
1193 xSF2211
->getFrames()->append ( xF22111
);
1195 sal_Int32 nFlags
= 0;
1197 // Test deep down search
1198 nFlags
= FrameSearchFlag::CHILDREN
;
1200 ( xD
->findFrame( DECLARE_ASCII("T1" ), nFlags
) != xT1
) ||
1201 ( xD
->findFrame( DECLARE_ASCII("T2" ), nFlags
) != xT2
) ||
1202 ( xD
->findFrame( DECLARE_ASCII("T3" ), nFlags
) != xT3
) ||
1203 ( xD
->findFrame( DECLARE_ASCII("F11" ), nFlags
) != xF11
) ||
1204 ( xD
->findFrame( DECLARE_ASCII("F12" ), nFlags
) != xF12
) ||
1205 ( xD
->findFrame( DECLARE_ASCII("F21" ), nFlags
) != xF21
) ||
1206 ( xD
->findFrame( DECLARE_ASCII("F22" ), nFlags
) != xF22
) ||
1207 ( xD
->findFrame( DECLARE_ASCII("F211" ), nFlags
) != xF211
) ||
1208 ( xD
->findFrame( DECLARE_ASCII("F212" ), nFlags
) != xF212
) ||
1209 ( xD
->findFrame( DECLARE_ASCII("F2111" ), nFlags
) != xF2111
) ||
1210 ( xD
->findFrame( DECLARE_ASCII("F2112" ), nFlags
) != xF2112
) ||
1211 ( xD
->findFrame( DECLARE_ASCII("F2121" ), nFlags
) != xF2121
) ||
1212 ( xD
->findFrame( DECLARE_ASCII("F2122" ), nFlags
) != xF2122
) ||
1213 ( xD
->findFrame( DECLARE_ASCII("F21111" ), nFlags
) != xF21111
) ||
1214 ( xD
->findFrame( DECLARE_ASCII("F21112" ), nFlags
) != xF21112
) ||
1215 ( xD
->findFrame( DECLARE_ASCII("F21121" ), nFlags
) != xF21121
) ||
1216 ( xD
->findFrame( DECLARE_ASCII("F21122" ), nFlags
) != xF21122
) ||
1217 ( xD
->findFrame( DECLARE_ASCII("F21211" ), nFlags
) != xF21211
) ||
1218 ( xD
->findFrame( DECLARE_ASCII("F21212" ), nFlags
) != xF21212
) ||
1219 ( xD
->findFrame( DECLARE_ASCII("F21221" ), nFlags
) != xF21221
) ||
1220 ( xD
->findFrame( DECLARE_ASCII("F21222" ), nFlags
) != xF21222
) ||
1221 ( xD
->findFrame( DECLARE_ASCII("F221" ), nFlags
) != xF221
) ||
1222 ( xD
->findFrame( DECLARE_ASCII("F2211" ), nFlags
) != xF2211
) ||
1223 ( xD
->findFrame( DECLARE_ASCII("F22111" ), nFlags
) != xF22111
)
1226 LOG_ERROR( "TestApplikation::impl_testTreeSearch()", "deep down search failed" )
1230 // Test flat down search
1231 nFlags
= FrameSearchFlag::CHILDREN
| FrameSearchFlag::SIBLINGS
;
1233 ( xD
->findFrame( DECLARE_ASCII("T1" ), nFlags
) != xT1
) ||
1234 ( xD
->findFrame( DECLARE_ASCII("T2" ), nFlags
) != xT2
) ||
1235 ( xD
->findFrame( DECLARE_ASCII("T3" ), nFlags
) != xT3
) ||
1236 ( xD
->findFrame( DECLARE_ASCII("F11" ), nFlags
) != xF11
) ||
1237 ( xD
->findFrame( DECLARE_ASCII("F12" ), nFlags
) != xF12
) ||
1238 ( xD
->findFrame( DECLARE_ASCII("F21" ), nFlags
) != xF21
) ||
1239 ( xD
->findFrame( DECLARE_ASCII("F22" ), nFlags
) != xF22
) ||
1240 ( xD
->findFrame( DECLARE_ASCII("F211" ), nFlags
) != xF211
) ||
1241 ( xD
->findFrame( DECLARE_ASCII("F212" ), nFlags
) != xF212
) ||
1242 ( xD
->findFrame( DECLARE_ASCII("F2111" ), nFlags
) != xF2111
) ||
1243 ( xD
->findFrame( DECLARE_ASCII("F2112" ), nFlags
) != xF2112
) ||
1244 ( xD
->findFrame( DECLARE_ASCII("F2121" ), nFlags
) != xF2121
) ||
1245 ( xD
->findFrame( DECLARE_ASCII("F2122" ), nFlags
) != xF2122
) ||
1246 ( xD
->findFrame( DECLARE_ASCII("F21111" ), nFlags
) != xF21111
) ||
1247 ( xD
->findFrame( DECLARE_ASCII("F21112" ), nFlags
) != xF21112
) ||
1248 ( xD
->findFrame( DECLARE_ASCII("F21121" ), nFlags
) != xF21121
) ||
1249 ( xD
->findFrame( DECLARE_ASCII("F21122" ), nFlags
) != xF21122
) ||
1250 ( xD
->findFrame( DECLARE_ASCII("F21211" ), nFlags
) != xF21211
) ||
1251 ( xD
->findFrame( DECLARE_ASCII("F21212" ), nFlags
) != xF21212
) ||
1252 ( xD
->findFrame( DECLARE_ASCII("F21221" ), nFlags
) != xF21221
) ||
1253 ( xD
->findFrame( DECLARE_ASCII("F21222" ), nFlags
) != xF21222
) ||
1254 ( xD
->findFrame( DECLARE_ASCII("F221" ), nFlags
) != xF221
) ||
1255 ( xD
->findFrame( DECLARE_ASCII("F2211" ), nFlags
) != xF2211
) ||
1256 ( xD
->findFrame( DECLARE_ASCII("F22111" ), nFlags
) != xF22111
)
1259 LOG_ERROR( "TestApplikation::impl_testTreeSearch()", "flat down search failed" )
1263 // Test deep up search
1264 // All targets must be found. Control search steps in log files!
1265 nFlags
= FrameSearchFlag::PARENT
;
1267 ( xF11
->findFrame ( DECLARE_ASCII("T1"), nFlags
) != xT1
) || // search for valid targets
1268 ( xF12
->findFrame ( DECLARE_ASCII("T1"), nFlags
) != xT1
) ||
1269 ( xF21
->findFrame ( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1270 ( xF22
->findFrame ( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1271 ( xF211
->findFrame ( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1272 ( xF212
->findFrame ( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1273 ( xF221
->findFrame ( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1274 ( xF2111
->findFrame ( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1275 ( xF2121
->findFrame ( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1276 ( xF2122
->findFrame ( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1277 ( xF2211
->findFrame ( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1278 ( xF21111
->findFrame( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1279 ( xF21112
->findFrame( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1280 ( xF21121
->findFrame( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1281 ( xF21122
->findFrame( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1282 ( xF21211
->findFrame( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1283 ( xF21212
->findFrame( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1284 ( xF21221
->findFrame( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1285 ( xF21222
->findFrame( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1286 ( xF22111
->findFrame( DECLARE_ASCII("T2"), nFlags
) != xT2
) ||
1287 ( xF11
->findFrame ( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) || // search for existing but non valid targets
1288 ( xF12
->findFrame ( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1289 ( xF21
->findFrame ( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1290 ( xF22
->findFrame ( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1291 ( xF211
->findFrame ( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1292 ( xF212
->findFrame ( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1293 ( xF221
->findFrame ( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1294 ( xF2111
->findFrame ( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1295 ( xF2121
->findFrame ( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1296 ( xF2122
->findFrame ( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1297 ( xF2211
->findFrame ( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1298 ( xF21111
->findFrame( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1299 ( xF21112
->findFrame( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1300 ( xF21121
->findFrame( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1301 ( xF21122
->findFrame( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1302 ( xF21211
->findFrame( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1303 ( xF21212
->findFrame( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1304 ( xF21221
->findFrame( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1305 ( xF21222
->findFrame( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
) ||
1306 ( xF22111
->findFrame( DECLARE_ASCII("T3"), nFlags
).is() == sal_True
)
1309 LOG_ERROR( "TestApplikation::impl_testTreeSearch()", "deep up search failed" )
1313 // Test inside/outside tasks search
1314 // No frames outside current task should be found if TASKS flag isnt set.
1315 // Otherwise he must be found!
1317 ( xF21211
->findFrame( DECLARE_ASCII("F12" ), FrameSearchFlag::ALL
) == xF12
) ||
1318 ( xF21211
->findFrame( DECLARE_ASCII("F22111"), FrameSearchFlag::GLOBAL
) != xF22111
) ||
1319 ( xF21211
->findFrame( DECLARE_ASCII("T4" ), FrameSearchFlag::GLOBAL
| FrameSearchFlag::CREATE
).is() == sal_False
)
1322 LOG_ERROR( "TestApplikation::impl_testTreeSearch()", "inside/outside task search failed" )
1327 // Use the desktop, one task and one frame node to do that.
1328 // The desktop must ignore these question ... all other must return himself.
1329 LOG_ASSERT2( (xD
->findFrame ( DECLARE_ASCII(""), FrameSearchFlag::SELF
) == xD
), "TestApplication::impl_testTreeSearch()", "SELF search for D failed\n" )
1330 LOG_ASSERT2( (xT1
->findFrame ( DECLARE_ASCII(""), FrameSearchFlag::SELF
) != xT1
), "TestApplication::impl_testTreeSearch()", "SELF search for T1 failed\n" )
1331 LOG_ASSERT2( (xF12
->findFrame ( DECLARE_ASCII(""), FrameSearchFlag::SELF
) != xF12
), "TestApplication::impl_testTreeSearch()", "SELF search for F12 failed\n" )
1333 // Test special task search at desktop
1334 // These search allow TASKS and CREATE flags only!
1335 // We make no deep search - we work on direct children of desktop only.
1336 // Supported for desktop only.
1337 LOG_ASSERT2( (xD
->findFrame ( DECLARE_ASCII("T1"), FrameSearchFlag::TASKS
) != xT1
), "TestApplication::impl_testTreeSearch()", "special TASKS search for T1 failed\n" )
1338 LOG_ASSERT2( (xD
->findFrame ( DECLARE_ASCII("T2"), FrameSearchFlag::TASKS
) != xT2
), "TestApplication::impl_testTreeSearch()", "special TASKS search for T2 failed\n" )
1339 LOG_ASSERT2( (xD
->findFrame ( DECLARE_ASCII("T3"), FrameSearchFlag::TASKS
) != xT3
), "TestApplication::impl_testTreeSearch()", "special TASKS search for T3 failed\n" )
1340 // Attention: T4 was created before!
1341 LOG_ASSERT2( (xD
->findFrame ( DECLARE_ASCII("T5"), FrameSearchFlag::TASKS
).is() == sal_True
), "TestApplication::impl_testTreeSearch()", "special TASKS search for T5 failed\n" )
1342 LOG_ASSERT2( (xD
->findFrame ( DECLARE_ASCII("T5"), FrameSearchFlag::TASKS
| FrameSearchFlag::CREATE
).is() == sal_False
), "TestApplication::impl_testTreeSearch()", "special TASKS+CREATE search for T5 failed\n" )
1343 LOG_ASSERT2( (xD
->findFrame ( DECLARE_ASCII("F12"), FrameSearchFlag::TASKS
).is() == sal_True
), "TestApplication::impl_testTreeSearch()", "special TASKS search for F12 failed\n" )
1344 LOG_ASSERT2( (xF12
->findFrame ( DECLARE_ASCII("T1"), FrameSearchFlag::TASKS
).is() == sal_True
), "TestApplication::impl_testTreeSearch()", "special TASKS search for T1 from F12 failed\n" )
1345 LOG_ASSERT2( (xF22111
->findFrame( DECLARE_ASCII("T1"), FrameSearchFlag::TASKS
).is() == sal_True
), "TestApplication::impl_testTreeSearch()", "special TASKS search for T1 from F22111 failed\n" )