xref: /aoo42x/main/framework/test/test.cxx (revision 07a3d7f1)
16d739b60SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
36d739b60SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
46d739b60SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
56d739b60SAndrew Rist  * distributed with this work for additional information
66d739b60SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
76d739b60SAndrew Rist  * to you under the Apache License, Version 2.0 (the
86d739b60SAndrew Rist  * "License"); you may not use this file except in compliance
96d739b60SAndrew Rist  * with the License.  You may obtain a copy of the License at
106d739b60SAndrew Rist  *
116d739b60SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
126d739b60SAndrew Rist  *
136d739b60SAndrew Rist  * Unless required by applicable law or agreed to in writing,
146d739b60SAndrew Rist  * software distributed under the License is distributed on an
156d739b60SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
166d739b60SAndrew Rist  * KIND, either express or implied.  See the License for the
176d739b60SAndrew Rist  * specific language governing permissions and limitations
186d739b60SAndrew Rist  * under the License.
196d739b60SAndrew Rist  *
206d739b60SAndrew Rist  *************************************************************/
216d739b60SAndrew Rist 
226d739b60SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_framework.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_________________________________________________________________________________________________________________
28cdf0e10cSrcweir //	my own includes
29cdf0e10cSrcweir //_________________________________________________________________________________________________________________
30cdf0e10cSrcweir #include <classes/servicemanager.hxx>
31cdf0e10cSrcweir #include <classes/filtercache.hxx>
32cdf0e10cSrcweir #include <macros/generic.hxx>
33cdf0e10cSrcweir #include <macros/debug.hxx>
34cdf0e10cSrcweir #include <services.h>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir //_________________________________________________________________________________________________________________
37cdf0e10cSrcweir //	interface includes
38cdf0e10cSrcweir //_________________________________________________________________________________________________________________
39cdf0e10cSrcweir #include <com/sun/star/frame/XDesktop.hpp>
40cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
41cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
42cdf0e10cSrcweir #include <com/sun/star/frame/XFrameLoader.hpp>
43cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
44cdf0e10cSrcweir #include <com/sun/star/frame/XLoadEventListener.hpp>
45cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
46cdf0e10cSrcweir #include <com/sun/star/util/URL.hpp>
47cdf0e10cSrcweir #include <com/sun/star/frame/FrameSearchFlag.hpp>
48cdf0e10cSrcweir #include <com/sun/star/frame/XFrames.hpp>
49cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
50cdf0e10cSrcweir #include <com/sun/star/frame/XComponentLoader.hpp>
51cdf0e10cSrcweir #include <com/sun/star/frame/XTasksSupplier.hpp>
52cdf0e10cSrcweir #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
53cdf0e10cSrcweir #include <com/sun/star/beans/XMultiPropertySet.hpp>
54cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
55cdf0e10cSrcweir #include <com/sun/star/mozilla/XPluginInstancePeer.hpp>
56cdf0e10cSrcweir #include <com/sun/star/bridge/XInstanceProvider.hpp>
57cdf0e10cSrcweir #include <com/sun/star/document/XTypeDetection.hpp>
58cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
59cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
60cdf0e10cSrcweir #include <com/sun/star/container/XElementAccess.hpp>
61cdf0e10cSrcweir #include <com/sun/star/frame/XConfigManager.hpp>
62cdf0e10cSrcweir 
63cdf0e10cSrcweir //_________________________________________________________________________________________________________________
64cdf0e10cSrcweir //	other includes
65cdf0e10cSrcweir //_________________________________________________________________________________________________________________
66cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
67cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
68cdf0e10cSrcweir #include <rtl/ustring.hxx>
69cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
70cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
71cdf0e10cSrcweir #include <svtools/unoiface.hxx>
72cdf0e10cSrcweir #include <tools/urlobj.hxx>
73cdf0e10cSrcweir 
74cdf0e10cSrcweir #include <vcl/event.hxx>
75cdf0e10cSrcweir #include <vcl/svapp.hxx>
76cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
77cdf0e10cSrcweir #include <vcl/msgbox.hxx>
78cdf0e10cSrcweir #include <stdio.h>
79cdf0e10cSrcweir 
80cdf0e10cSrcweir //_________________________________________________________________________________________________________________
81cdf0e10cSrcweir //	const
82cdf0e10cSrcweir //_________________________________________________________________________________________________________________
83cdf0e10cSrcweir 
84cdf0e10cSrcweir #define	APPLICATIONNAME							"FrameWork - Testapplication"
85cdf0e10cSrcweir 
86cdf0e10cSrcweir //_________________________________________________________________________________________________________________
87cdf0e10cSrcweir //	namespace
88cdf0e10cSrcweir //_________________________________________________________________________________________________________________
89cdf0e10cSrcweir 
90cdf0e10cSrcweir using namespace ::rtl						;
91cdf0e10cSrcweir using namespace ::comphelper				;
92cdf0e10cSrcweir using namespace ::framework					;
93cdf0e10cSrcweir using namespace ::cppu						;
94cdf0e10cSrcweir using namespace ::com::sun::star::uno		;
95cdf0e10cSrcweir using namespace ::com::sun::star::lang		;
96cdf0e10cSrcweir using namespace ::com::sun::star::frame		;
97cdf0e10cSrcweir using namespace ::com::sun::star::awt		;
98cdf0e10cSrcweir using namespace ::com::sun::star::beans		;
99cdf0e10cSrcweir using namespace ::com::sun::star::util		;
100cdf0e10cSrcweir using namespace ::com::sun::star::task		;
101cdf0e10cSrcweir using namespace ::com::sun::star::mozilla	;
102cdf0e10cSrcweir using namespace ::com::sun::star::bridge	;
103cdf0e10cSrcweir using namespace ::com::sun::star::document	;
104cdf0e10cSrcweir using namespace ::com::sun::star::container	;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir //_________________________________________________________________________________________________________________
107cdf0e10cSrcweir //	defines
108cdf0e10cSrcweir //_________________________________________________________________________________________________________________
109cdf0e10cSrcweir 
110cdf0e10cSrcweir //_________________________________________________________________________________________________________________
111cdf0e10cSrcweir //	declarations
112cdf0e10cSrcweir //_________________________________________________________________________________________________________________
113cdf0e10cSrcweir 
114cdf0e10cSrcweir /*-***************************************************************************************************************/
115cdf0e10cSrcweir class TestApplication : public Application
116cdf0e10cSrcweir {
117cdf0e10cSrcweir 	//*************************************************************************************************************
118cdf0e10cSrcweir 	public:
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 		void Main();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	//*************************************************************************************************************
123cdf0e10cSrcweir 	private:
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 		#ifdef TEST_DESKTOP
126cdf0e10cSrcweir 		void impl_testDesktop	( const Reference< XDesktop >& xDesktop );
127cdf0e10cSrcweir 		void impl_buildTree		( const Reference< XDesktop >& xDesktop );
128cdf0e10cSrcweir 		void impl_logTree		( const Reference< XDesktop >& xDesktop );
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 		#endif
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 		#ifdef TEST_PLUGIN
133cdf0e10cSrcweir 		void impl_testPlugIn	( const Reference< XDesktop >& xDesktop, const Reference< XMultiServiceFactory >& xFactory	);
134cdf0e10cSrcweir 		#endif
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 		#ifdef TEST_LOGINDIALOG
137cdf0e10cSrcweir 		void impl_testLoginDialog();
138cdf0e10cSrcweir 		#endif
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 		#ifdef TEST_FILTERCACHE
141cdf0e10cSrcweir 		void impl_testFilterCache();
142cdf0e10cSrcweir 		#endif
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 		#ifdef TEST_TYPEDETECTION
145cdf0e10cSrcweir 		void impl_testTypeDetection();
146cdf0e10cSrcweir 		#endif
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 		#ifdef TEST_FILTERREGISTRATION
149cdf0e10cSrcweir 		void impl_testFilterRegistration();
150cdf0e10cSrcweir 		#endif
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 		#ifdef TEST_TREESEARCH
153cdf0e10cSrcweir 		sal_Bool impl_testTreeSearch();
154cdf0e10cSrcweir 		#endif
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	//*************************************************************************************************************
157cdf0e10cSrcweir 	private:
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	//*************************************************************************************************************
160cdf0e10cSrcweir 	private:
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 		Reference< XMultiServiceFactory >	m_xFactory;
163cdf0e10cSrcweir 
164cdf0e10cSrcweir };	//	class TestApplication
165cdf0e10cSrcweir 
166cdf0e10cSrcweir //_________________________________________________________________________________________________________________
167cdf0e10cSrcweir //	global variables
168cdf0e10cSrcweir //_________________________________________________________________________________________________________________
169cdf0e10cSrcweir 
170cdf0e10cSrcweir TestApplication	aTestApplication ;
171cdf0e10cSrcweir 
172cdf0e10cSrcweir //_________________________________________________________________________________________________________________
173cdf0e10cSrcweir //	main
174cdf0e10cSrcweir //_________________________________________________________________________________________________________________
175cdf0e10cSrcweir 
176cdf0e10cSrcweir void TestApplication::Main()
177cdf0e10cSrcweir {
178cdf0e10cSrcweir //	RegistryCache aCache;
179cdf0e10cSrcweir 
180cdf0e10cSrcweir 	/**-***********************************************************************************************************
181cdf0e10cSrcweir 		initialize program
182cdf0e10cSrcweir 	**************************************************************************************************************/
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 	// Init global servicemanager and set it.
185cdf0e10cSrcweir 	ServiceManager aManager;
186cdf0e10cSrcweir 	m_xFactory = aManager.getGlobalUNOServiceManager();
187cdf0e10cSrcweir 	setProcessServiceFactory( m_xFactory );
188cdf0e10cSrcweir 
189*07a3d7f1SPedro Giffuni 	// Control success of operation.
190cdf0e10cSrcweir 	LOG_ASSERT( !(m_xFactory.is()			==sal_False	), "TestApplication::Main()\nCan't create global service manager.\n\n"			)
191cdf0e10cSrcweir 	LOG_ASSERT( !(getProcessServiceFactory()!=m_xFactory), "TestApplication::Main()\nGlobal servicemanager not set in UNOTOOLS.\n\n"	)
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 	/**-***********************************************************************************************************
194cdf0e10cSrcweir 		test area
195cdf0e10cSrcweir 	**************************************************************************************************************/
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	sal_Bool bState = sal_True;
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
200cdf0e10cSrcweir 	#ifdef TEST_FILTERCACHE
201cdf0e10cSrcweir 	impl_testFilterCache();
202cdf0e10cSrcweir 	#endif
203cdf0e10cSrcweir 
204cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
205cdf0e10cSrcweir 	#ifdef TEST_TYPEDETECTION
206cdf0e10cSrcweir 	impl_testTypeDetection();
207cdf0e10cSrcweir 	#endif
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
210cdf0e10cSrcweir 	#ifdef TEST_LOGINDIALOG
211cdf0e10cSrcweir 	ResMgr* pRessourceManager = CREATEVERSIONRESMGR( lgd );
212cdf0e10cSrcweir 	Resource::SetResManager( pRessourceManager );
213cdf0e10cSrcweir 	impl_testLoginDialog();
214cdf0e10cSrcweir 	#endif
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
217cdf0e10cSrcweir 	#ifdef TEST_DESKTOP
218cdf0e10cSrcweir 	Reference< XDesktop > xDesktop( xGlobalServiceManager->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY );
219cdf0e10cSrcweir 	impl_testDesktop( xDesktop );
220cdf0e10cSrcweir 	#endif
221cdf0e10cSrcweir 
222cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
223cdf0e10cSrcweir 	#ifdef TEST_PLUGIN
224cdf0e10cSrcweir 	impl_testPlugIn( xDesktop, xGlobalServiceManager );
225cdf0e10cSrcweir 	#endif
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
228cdf0e10cSrcweir 	#ifdef TEST_FILTERREGISTRATION
229cdf0e10cSrcweir 	impl_testFilterRegistration();
230cdf0e10cSrcweir 	#endif
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
233cdf0e10cSrcweir 	#ifdef TEST_TREESEARCH
234cdf0e10cSrcweir 	bState = impl_testTreeSearch();
235cdf0e10cSrcweir 	#endif
236cdf0e10cSrcweir 
237cdf0e10cSrcweir //	Execute();
238cdf0e10cSrcweir //    xFrame->dispose();
239cdf0e10cSrcweir //    delete pMainWindow;
240cdf0e10cSrcweir 	if( bState = sal_True )
241cdf0e10cSrcweir 	{
242cdf0e10cSrcweir 		LOG_ERROR( "TestApplication::Main()", "Test successful ..." )
243cdf0e10cSrcweir 	}
244cdf0e10cSrcweir 	else
245cdf0e10cSrcweir 	{
246cdf0e10cSrcweir 		LOG_ERROR( "TestApplication::Main()", "Test failed ..." )
247cdf0e10cSrcweir 	}
248cdf0e10cSrcweir }
249cdf0e10cSrcweir 
250cdf0e10cSrcweir //_________________________________________________________________________________________________________________
251cdf0e10cSrcweir //	test method
252cdf0e10cSrcweir //_________________________________________________________________________________________________________________
253cdf0e10cSrcweir #ifdef TEST_TYPEDETECTION
254cdf0e10cSrcweir void TestApplication::impl_testTypeDetection()
255cdf0e10cSrcweir {
256cdf0e10cSrcweir 	// We use a string buffer to log important informations and search results.
257cdf0e10cSrcweir 	// Errors are shown directly by an assert!
258cdf0e10cSrcweir 	OUStringBuffer sBuffer( 100000 );
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 	// Create a new type detection service.
261cdf0e10cSrcweir 	Reference< XTypeDetection > xTypeDetection( getProcessServiceFactory()->createInstance( SERVICENAME_TYPEDETECTION ), UNO_QUERY );
262cdf0e10cSrcweir 	LOG_ASSERT( !(xTypeDetection.is()==sal_False), "TestApplication::impl_testTypeDetection()\nCouldn't create the type detection service.\n" );
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 	if( xTypeDetection.is() == sal_True )
265cdf0e10cSrcweir 	{
266cdf0e10cSrcweir 		// a) Check his implementation and his supported interfaces first.
267cdf0e10cSrcweir 		Reference< XInterface >		xInterface		( xTypeDetection, UNO_QUERY );
268cdf0e10cSrcweir 		Reference< XTypeProvider >	xTypeProvider	( xTypeDetection, UNO_QUERY );
269cdf0e10cSrcweir 		Reference< XServiceInfo >	xServiceInfo	( xTypeDetection, UNO_QUERY );
270cdf0e10cSrcweir 		Reference< XNameAccess >	xNameAccess		( xTypeDetection, UNO_QUERY );
271cdf0e10cSrcweir 		Reference< XElementAccess >	xElementAccess	( xTypeDetection, UNO_QUERY );
272cdf0e10cSrcweir 
273cdf0e10cSrcweir 		LOG_ASSERT( !(	xInterface.is()		==	sal_False	||
274cdf0e10cSrcweir 						xTypeProvider.is()	==	sal_False	||
275cdf0e10cSrcweir 						xServiceInfo.is()	==	sal_False	||
276cdf0e10cSrcweir 						xNameAccess.is()	==	sal_False	||
277cdf0e10cSrcweir 						xElementAccess.is()	==	sal_False	), "TestApplication::impl_testTypeDetection()\nMiss supported for searched interface!\n" )
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 		// b) Check OneInstance mode of service.
280cdf0e10cSrcweir 		Reference< XTypeDetection > xTypeDetection2( getProcessServiceFactory()->createInstance( SERVICENAME_TYPEDETECTION ), UNO_QUERY );
281cdf0e10cSrcweir 		LOG_ASSERT( !(xTypeDetection!=xTypeDetection2), "TestApplication::impl_testTypeDetection()\nService isn't \"OneInstance\" ...!\n" )
282cdf0e10cSrcweir 		xTypeDetection2 = Reference< XTypeDetection >();
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 		// c) Check "XTypeDetection" ... flat by URL
285cdf0e10cSrcweir 		// Define list of URLs for checking.
286cdf0e10cSrcweir 		OUString pURLs[] =
287cdf0e10cSrcweir 		{
288cdf0e10cSrcweir 			DECLARE_ASCII("file://c|/temp/test.sdw"	),
289cdf0e10cSrcweir 			DECLARE_ASCII("private:factory/scalc"	),
290cdf0e10cSrcweir 			DECLARE_ASCII("file://c|/temp/test.txt"	),
291cdf0e10cSrcweir 			DECLARE_ASCII("slot:5000"				),
292cdf0e10cSrcweir 		};
293cdf0e10cSrcweir 		sal_uInt32 nCount = 4;
294cdf0e10cSrcweir 		Sequence< OUString > seqURLs( pURLs, nCount );
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 		Reference< XMultiServiceFactory > xFilterFactory( getProcessServiceFactory()->createInstance( SERVICENAME_FILTERFACTORY		), UNO_QUERY );
297cdf0e10cSrcweir 		Reference< XMultiServiceFactory > xLoaderFactory( getProcessServiceFactory()->createInstance( SERVICENAME_FRAMELOADERFACTORY), UNO_QUERY );
298cdf0e10cSrcweir 		LOG_ASSERT( !(xFilterFactory.is()==sal_False), "TestApplication::impl_testTypeDetection()\nCouldn't create filter factory!\n" )
299cdf0e10cSrcweir 		LOG_ASSERT( !(xLoaderFactory.is()==sal_False), "TestApplication::impl_testTypeDetection()\nCouldn't create loader factory!\n" )
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 		// Step over these list.
302cdf0e10cSrcweir 		for( sal_uInt32 nURL=0; nURL<nCount; ++nURL )
303cdf0e10cSrcweir 		{
304cdf0e10cSrcweir 			// Try to get a type name for every URL from list and log search result.
305cdf0e10cSrcweir 			OUString sTypeName = xTypeDetection->queryTypeByURL( seqURLs[nURL] );
306cdf0e10cSrcweir 			sBuffer.appendAscii	( "queryTypeByURL( \""		);
307cdf0e10cSrcweir 			sBuffer.append		( seqURLs[nURL]				);
308cdf0e10cSrcweir 			sBuffer.appendAscii	( "\" ) returns type \""	);
309cdf0e10cSrcweir 			sBuffer.append		( sTypeName					);
310cdf0e10cSrcweir 			sBuffer.appendAscii	( "\"\n"					);
311cdf0e10cSrcweir 			// If a type was found - try to get a filter and a frame loader for it.
312cdf0e10cSrcweir 			if( sTypeName.getLength() > 0 )
313cdf0e10cSrcweir 			{
314cdf0e10cSrcweir 				Reference< XInterface > xFilter = xFilterFactory->createInstance( sTypeName );
315cdf0e10cSrcweir 				Reference< XInterface > xLoader = xLoaderFactory->createInstance( sTypeName );
316cdf0e10cSrcweir 				if( xFilter.is() == sal_False )
317cdf0e10cSrcweir 				{
318cdf0e10cSrcweir 					sBuffer.appendAscii( "Couldn't find an filter.\n" );
319cdf0e10cSrcweir 				}
320cdf0e10cSrcweir 				else
321cdf0e10cSrcweir 				{
322cdf0e10cSrcweir 					Reference< XPropertySet > xFilterProperties( xFilter, UNO_QUERY );
323cdf0e10cSrcweir 					LOG_ASSERT( !(xFilterProperties.is()==sal_False), "TestApplication::impl_testTypeDetection()\nFilter don't support XPropertySet!\n" )
324cdf0e10cSrcweir 					if( xFilterProperties.is() == sal_True )
325cdf0e10cSrcweir 					{
326cdf0e10cSrcweir 						OUString sUIName;
327cdf0e10cSrcweir 						xFilterProperties->getPropertyValue( DECLARE_ASCII("UIName") ) >>= sUIName;
328cdf0e10cSrcweir 						sBuffer.appendAscii	( "Found filter \""	);
329cdf0e10cSrcweir 						sBuffer.append		( sUIName			);
330cdf0e10cSrcweir 						sBuffer.appendAscii	( "\"\n"			);
331cdf0e10cSrcweir 					}
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 					Reference< XPropertySet > xLoaderProperties( xLoader, UNO_QUERY );
334cdf0e10cSrcweir 					LOG_ASSERT( !(xLoaderProperties.is()==sal_False), "TestApplication::impl_testTypeDetection()\nLoader don't support XPropertySet!\n" )
335cdf0e10cSrcweir 					if( xLoaderProperties.is() == sal_True )
336cdf0e10cSrcweir 					{
337cdf0e10cSrcweir 						OUString sUIName;
338cdf0e10cSrcweir 						xLoaderProperties->getPropertyValue( DECLARE_ASCII("UIName") ) >>= sUIName;
339cdf0e10cSrcweir 						sBuffer.appendAscii	( "Found loader \""	);
340cdf0e10cSrcweir 						sBuffer.append		( sUIName			);
341cdf0e10cSrcweir 						sBuffer.appendAscii	( "\"\n"			);
342cdf0e10cSrcweir 					}
343cdf0e10cSrcweir 				}
344cdf0e10cSrcweir 			}
345cdf0e10cSrcweir 		}
346cdf0e10cSrcweir 	}
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 	WRITE_LOGFILE( "testTypeDetection.log", U2B(sBuffer.makeStringAndClear()) )
349cdf0e10cSrcweir }
350cdf0e10cSrcweir #endif
351cdf0e10cSrcweir 
352cdf0e10cSrcweir //_________________________________________________________________________________________________________________
353cdf0e10cSrcweir //	test method
354cdf0e10cSrcweir //_________________________________________________________________________________________________________________
355cdf0e10cSrcweir #ifdef TEST_FILTERCACHE
356cdf0e10cSrcweir void TestApplication::impl_testFilterCache()
357cdf0e10cSrcweir {
358cdf0e10cSrcweir 	FilterCache aCache;
359cdf0e10cSrcweir 
360cdf0e10cSrcweir 	OUStringBuffer sBuffer( 100000 );
361cdf0e10cSrcweir 	if( aCache.isValid() == sal_False )
362cdf0e10cSrcweir 	{
363cdf0e10cSrcweir 		sBuffer.appendAscii( "Cache isn't valid!\n" );
364cdf0e10cSrcweir 	}
365cdf0e10cSrcweir 	else
366cdf0e10cSrcweir 	{
367cdf0e10cSrcweir /*
368cdf0e10cSrcweir 		// Step over all types and log his values.
369cdf0e10cSrcweir 		// These simulate a XNameAccess!
370cdf0e10cSrcweir 		const Sequence< OUString > seqAllTypeNames = aCache.getAllTypeNames();
371cdf0e10cSrcweir 		sal_uInt32 nCount = seqAllTypeNames.getLength();
372cdf0e10cSrcweir 		for( sal_uInt32 nPosition=0; nPosition<nCount; ++nPosition )
373cdf0e10cSrcweir 		{
374cdf0e10cSrcweir 			sBuffer.appendAscii( "--------------------------------------------------------------------------------\n" );
375cdf0e10cSrcweir 			const TType* pType = aCache.getTypeByName( seqAllTypeNames[nPosition] );
376cdf0e10cSrcweir 			if( pType == NULL )
377cdf0e10cSrcweir 			{
378cdf0e10cSrcweir 				sBuffer.appendAscii	( "Type ["					);
379cdf0e10cSrcweir 				sBuffer.append		( (sal_Int32)nPosition		);
380cdf0e10cSrcweir 				sBuffer.appendAscii	( "] \""					);
381cdf0e10cSrcweir 				sBuffer.append		( seqAllTypeNames[nPosition]);
382cdf0e10cSrcweir 				sBuffer.appendAscii	( "\" isn't valid!"			);
383cdf0e10cSrcweir 			}
384cdf0e10cSrcweir 			else
385cdf0e10cSrcweir 			{
386cdf0e10cSrcweir 				sBuffer.appendAscii	( "Type ["						);
387cdf0e10cSrcweir 				sBuffer.append		( (sal_Int32)nPosition			);
388cdf0e10cSrcweir 				sBuffer.appendAscii	( "] \""						);
389cdf0e10cSrcweir 				sBuffer.append		( seqAllTypeNames[nPosition]	);
390cdf0e10cSrcweir 				sBuffer.appendAscii	( "\"\n\t\tUIName\t=\t"			);
391cdf0e10cSrcweir 				sBuffer.append		( pType->sUIName				);
392cdf0e10cSrcweir 				sBuffer.appendAscii	( "\n\t\tMediaType\t=\t"		);
393cdf0e10cSrcweir 				sBuffer.append		( pType->sMediaType				);
394cdf0e10cSrcweir 				sBuffer.appendAscii	( "\n\t\tClipboardFormat\t=\t"	);
395cdf0e10cSrcweir 				sBuffer.append		( pType->sClipboardFormat		);
396cdf0e10cSrcweir 				sBuffer.appendAscii	( "\n\t\tURLPattern\t=\t{"		);
397cdf0e10cSrcweir 				for( TConstStringIterator aIterator=pType->lURLPattern.begin(); aIterator!=pType->lURLPattern.end(); ++aIterator )
398cdf0e10cSrcweir 				{
399cdf0e10cSrcweir 					sBuffer.append		( *aIterator	);
400cdf0e10cSrcweir 					sBuffer.appendAscii	( ";\n\t\t"		);
401cdf0e10cSrcweir 				}
402cdf0e10cSrcweir 				sBuffer.appendAscii( "}\nExtensions\t=\t" );
403cdf0e10cSrcweir 				for( aIterator=pType->lExtensions.begin(); aIterator!=pType->lExtensions.end(); ++aIterator )
404cdf0e10cSrcweir 				{
405cdf0e10cSrcweir 					sBuffer.append		( *aIterator	);
406cdf0e10cSrcweir 					sBuffer.appendAscii	( ";\n\t\t"		);
407cdf0e10cSrcweir 				}
408cdf0e10cSrcweir 				sBuffer.appendAscii	( "}\nDocumentIconID\t=\t" 			);
409cdf0e10cSrcweir 				sBuffer.append		( (sal_Int32)pType->nDocumentIconID	);
410cdf0e10cSrcweir 			}
411cdf0e10cSrcweir 		}
412cdf0e10cSrcweir */
413cdf0e10cSrcweir 		// searchFirstType( URL, MediaType, ClipboardFormat, startEntry )
414cdf0e10cSrcweir 		TCheckedTypeIterator aIterator;
415cdf0e10cSrcweir 		sBuffer.appendAscii( "search type for \"file://c|/temp/test.sdw\"; no media type; no clipboard format\n" );
416cdf0e10cSrcweir 		OUString sURL = DECLARE_ASCII("file://c|/temp/test.sdw");
417cdf0e10cSrcweir 		const OUString* pType = aCache.searchFirstType( &sURL, NULL, NULL, aIterator );
418cdf0e10cSrcweir 		while( pType != NULL )
419cdf0e10cSrcweir 		{
420cdf0e10cSrcweir 			sBuffer.appendAscii	( "\tfound \""	);
421cdf0e10cSrcweir 			sBuffer.append		( *pType		);
422cdf0e10cSrcweir 			sBuffer.appendAscii	( "\"\n"		);
423cdf0e10cSrcweir 			pType = aCache.searchType( &sURL, NULL, NULL, aIterator );
424cdf0e10cSrcweir 		}
425cdf0e10cSrcweir 	}
426cdf0e10cSrcweir 
427cdf0e10cSrcweir 	WRITE_LOGFILE( "test_FilterCache.log", U2B(sBuffer.makeStringAndClear()) )
428cdf0e10cSrcweir }
429cdf0e10cSrcweir #endif
430cdf0e10cSrcweir 
431cdf0e10cSrcweir //_________________________________________________________________________________________________________________
432cdf0e10cSrcweir //	test method
433cdf0e10cSrcweir //_________________________________________________________________________________________________________________
434cdf0e10cSrcweir #ifdef TEST_LOGINDIALOG
435cdf0e10cSrcweir void TestApplication::impl_testLoginDialog()
436cdf0e10cSrcweir {
437cdf0e10cSrcweir 	// Get global servicemanager to create service "LoginDialog".
438cdf0e10cSrcweir 	Reference< XMultiServiceFactory > xFactory = getProcessServiceFactory();
439cdf0e10cSrcweir 	LOG_ASSERT( !(xFactory.is()==sal_False), "TestApplication::impl_testLoginDialog()\nServicemanager not valid.\n" )
440cdf0e10cSrcweir 	// Create LoginDialog.
441cdf0e10cSrcweir 	Reference< XDialog > xDialog( xFactory->createInstance( DECLARE_ASCII("com.sun.star.framework.LoginDialog") ), UNO_QUERY );
442cdf0e10cSrcweir 	LOG_ASSERT( !(xDialog.is()==sal_False), "TestApplication::impl_testLoginDialog()\nCould not create login dialog.\n" )
443cdf0e10cSrcweir 	// Check set/getTitle()
444cdf0e10cSrcweir 	/* not implemented yet! */
445cdf0e10cSrcweir //	OUString sTitle = DECLARE_ASCII("Login Dialog Test");
446cdf0e10cSrcweir //	xDialog->setTitle( sTitle );
447cdf0e10cSrcweir //	LOG_ASSERT( !(xDialog->getTitle()!=sTitle), "TestApplication::impl_testLoginDialog()\nset/getTitle don't work correct.\n" )
448cdf0e10cSrcweir 
449cdf0e10cSrcweir 	UniString sInternalURL = DECLARE_ASCII("private:factory/scalc");
450cdf0e10cSrcweir 	UniString sExternalURL = OUString();
451cdf0e10cSrcweir 
452cdf0e10cSrcweir 	OString sOut = "internal: ";
453cdf0e10cSrcweir 	sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 );
454cdf0e10cSrcweir 	sOut += "\nexternal: ";
455cdf0e10cSrcweir 	sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 );
456cdf0e10cSrcweir 	sOut += "\n";
457cdf0e10cSrcweir 	LOG_ASSERT( sal_False, sOut )
458cdf0e10cSrcweir 
459cdf0e10cSrcweir 	INetURLObject::translateToExternal( sInternalURL, sExternalURL );
460cdf0e10cSrcweir 	sOut = "internal: ";
461cdf0e10cSrcweir 	sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 );
462cdf0e10cSrcweir 	sOut += "\nexternal: ";
463cdf0e10cSrcweir 	sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 );
464cdf0e10cSrcweir 	sOut += "\n";
465cdf0e10cSrcweir 	LOG_ASSERT( sal_False, sOut )
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 	INetURLObject::translateToInternal( sExternalURL, sInternalURL );
468cdf0e10cSrcweir 	sOut = "internal: ";
469cdf0e10cSrcweir 	sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 );
470cdf0e10cSrcweir 	sOut += "\nexternal: ";
471cdf0e10cSrcweir 	sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 );
472cdf0e10cSrcweir 	sOut += "\n";
473cdf0e10cSrcweir 	LOG_ASSERT( sal_False, sOut )
474cdf0e10cSrcweir 
475cdf0e10cSrcweir 	// Work with properties of dialog.
476cdf0e10cSrcweir 	Reference< XPropertySet > xPropertySet( xDialog, UNO_QUERY );
477cdf0e10cSrcweir 	LOG_ASSERT( !(xPropertySet.is()==sal_False), "TestApplication::impl_testLoginDialog()\nCan't cast dialog to XPropertySet interface.\n" )
478cdf0e10cSrcweir 	Any aUserName 		;
479cdf0e10cSrcweir 	Any aPassword 		;
480cdf0e10cSrcweir 	Any aServer   		;
481cdf0e10cSrcweir 	Any aConnectionType	;
482cdf0e10cSrcweir 	Any aPort			;
483cdf0e10cSrcweir 	aUserName 		<<= DECLARE_ASCII("Andreas");
484cdf0e10cSrcweir 	aPassword 		<<= DECLARE_ASCII("Test");
485cdf0e10cSrcweir 	aServer   		<<= DECLARE_ASCII("www.yahoo.de:7777");
486cdf0e10cSrcweir 	aConnectionType	<<= DECLARE_ASCII("Bla");
487cdf0e10cSrcweir 	sal_Int32 nPort = 8081;
488cdf0e10cSrcweir 	aPort			<<= nPort;
489cdf0e10cSrcweir 	try
490cdf0e10cSrcweir 	{
491cdf0e10cSrcweir 	xPropertySet->setPropertyValue( DECLARE_ASCII("UserName"			), aUserName 		);
492cdf0e10cSrcweir 	xPropertySet->setPropertyValue( DECLARE_ASCII("Password"			), aPassword 		);
493cdf0e10cSrcweir 	xPropertySet->setPropertyValue( DECLARE_ASCII("Server"  			), aServer   		);
494cdf0e10cSrcweir 	xPropertySet->setPropertyValue( DECLARE_ASCII("ConnectionType"	), aConnectionType	);
495cdf0e10cSrcweir 	xPropertySet->setPropertyValue( DECLARE_ASCII("Compressed"		), aPort			);
496cdf0e10cSrcweir 	}
497cdf0e10cSrcweir 	catch( ::com::sun::star::beans::UnknownPropertyException& )
498cdf0e10cSrcweir 	{
499cdf0e10cSrcweir 		LOG_ASSERT( sal_False, "UnkownPropertyException detected!\n" )
500cdf0e10cSrcweir 	}
501cdf0e10cSrcweir 	catch( ::com::sun::star::beans::PropertyVetoException& )
502cdf0e10cSrcweir 	{
503cdf0e10cSrcweir 		LOG_ASSERT( sal_False, "PropertyVetoException detected!\n" )
504cdf0e10cSrcweir 	}
505cdf0e10cSrcweir 	catch( ::com::sun::star::lang::IllegalArgumentException& )
506cdf0e10cSrcweir 	{
507cdf0e10cSrcweir 		LOG_ASSERT( sal_False, "IllegalArgumentException detected!\n" )
508cdf0e10cSrcweir 	}
509cdf0e10cSrcweir 	catch( ::com::sun::star::lang::WrappedTargetException& )
510cdf0e10cSrcweir 	{
511cdf0e10cSrcweir 		LOG_ASSERT( sal_False, "WrappedTargetException detected!\n" )
512cdf0e10cSrcweir 	}
513cdf0e10cSrcweir 	catch( ::com::sun::star::uno::RuntimeException& )
514cdf0e10cSrcweir 	{
515cdf0e10cSrcweir 		LOG_ASSERT( sal_False, "RuntimeException detected!\n" )
516cdf0e10cSrcweir 	}
517cdf0e10cSrcweir 
518cdf0e10cSrcweir 	xDialog->execute();
519cdf0e10cSrcweir 
520cdf0e10cSrcweir 	OUString sUserName			;
521cdf0e10cSrcweir 	OUString sPassword			;
522cdf0e10cSrcweir 	OUString sServer  			;
523cdf0e10cSrcweir 	OUString sConnectionType	;
524cdf0e10cSrcweir 	xPropertySet->getPropertyValue( DECLARE_ASCII("UserName"			) ) >>= sUserName 		;
525cdf0e10cSrcweir 	xPropertySet->getPropertyValue( DECLARE_ASCII("Password"			) ) >>= sPassword 		;
526cdf0e10cSrcweir 	xPropertySet->getPropertyValue( DECLARE_ASCII("Server"  			) ) >>= sServer   		;
527cdf0e10cSrcweir 	xPropertySet->getPropertyValue( DECLARE_ASCII("ConnectionType"	) ) >>= sConnectionType	;
528cdf0e10cSrcweir 	xPropertySet->getPropertyValue( sConnectionType ) >>= nPort	;
529cdf0e10cSrcweir 
530cdf0e10cSrcweir 	LOG_ASSERT( sal_False, OUStringToOString( sUserName, RTL_TEXTENCODING_UTF8 ) )
531cdf0e10cSrcweir 	LOG_ASSERT( sal_False, OUStringToOString( sPassword, RTL_TEXTENCODING_UTF8 ) )
532cdf0e10cSrcweir 	LOG_ASSERT( sal_False, OUStringToOString( sServer  , RTL_TEXTENCODING_UTF8 ) )
533cdf0e10cSrcweir 	LOG_ASSERT( sal_False, OUStringToOString( sConnectionType  , RTL_TEXTENCODING_UTF8 ) )
534cdf0e10cSrcweir 	LOG_ASSERT( sal_False, OString::valueOf( (sal_Int32)nPort ) )
535cdf0e10cSrcweir }
536cdf0e10cSrcweir #endif
537cdf0e10cSrcweir 
538cdf0e10cSrcweir //_________________________________________________________________________________________________________________
539cdf0e10cSrcweir //	test method
540cdf0e10cSrcweir //_________________________________________________________________________________________________________________
541cdf0e10cSrcweir #ifdef TEST_PLUGIN
542cdf0e10cSrcweir void TestApplication::impl_testPlugIn( const Reference< XDesktop >& xDesktop, const Reference< XMultiServiceFactory >& xFactory )
543cdf0e10cSrcweir {
544cdf0e10cSrcweir 	// create instance provider for creation of factories.
545cdf0e10cSrcweir 	Reference< XInstanceProvider > xInstanceProvider( (OWeakObject*)(new OInstanceProvider( xFactory )), UNO_QUERY );
546cdf0e10cSrcweir 	LOG_ASSERT( !(xInstanceProvider.is()==sal_False), "TestApplication::impl_testPlugIn()\nCan't create new instance provider!\n" )
547cdf0e10cSrcweir 
548cdf0e10cSrcweir 	// try to get factory for create a plugin
549cdf0e10cSrcweir 	Reference< XSingleServiceFactory > xPlugInFactory( xInstanceProvider->getInstance( INSTANCENAME_PLUGINFACTORY ), UNO_QUERY );
550cdf0e10cSrcweir 	LOG_ASSERT( !(xPlugInFactory.is()==sal_False), "TestApplication::impl_testPlugIn()\nCan't get PlugInFactory from instance provider!\n" )
551cdf0e10cSrcweir 
552cdf0e10cSrcweir 	// initialize parameter for creation of plugin
553cdf0e10cSrcweir 	Reference< XPluginInstancePeer > xPlugInDLL =Reference< XPluginInstancePeer >();
554cdf0e10cSrcweir 	Sequence< Any > seqArguments(1);
555cdf0e10cSrcweir 	seqArguments[0] <<= xPlugInDLL;
556cdf0e10cSrcweir 
557cdf0e10cSrcweir 	// create plugin
558cdf0e10cSrcweir 	Reference< XFrame > xPlugIn( xPlugInFactory->createInstanceWithArguments( seqArguments ), UNO_QUERY );
559cdf0e10cSrcweir 	LOG_ASSERT( !(xPlugIn.is()==sal_False), "TestApplication::impl_testPlugIn()\nFactory has created no valid plugin!\n" )
560cdf0e10cSrcweir 
561cdf0e10cSrcweir 	xPlugIn->setName( OUString(RTL_CONSTASCII_USTRINGPARAM("PlugIn")) );
562cdf0e10cSrcweir 	Reference< XFramesSupplier > xSupplier( xDesktop, UNO_QUERY );
563cdf0e10cSrcweir 	xPlugIn->setCreator( xSupplier );
564cdf0e10cSrcweir }
565cdf0e10cSrcweir #endif
566cdf0e10cSrcweir 
567cdf0e10cSrcweir //_________________________________________________________________________________________________________________
568cdf0e10cSrcweir //	test method
569cdf0e10cSrcweir //_________________________________________________________________________________________________________________
570cdf0e10cSrcweir #ifdef TEST_DESKTOP
571cdf0e10cSrcweir #define LOGFILE_TARGETING "targeting.log"
572cdf0e10cSrcweir void TestApplication::impl_testDesktop( const Reference< XDesktop >& xDesktop )
573cdf0e10cSrcweir {
574cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
575cdf0e10cSrcweir 	//	1) Test cast to all supported interfaces of Desktop.
576cdf0e10cSrcweir 
577cdf0e10cSrcweir 	Reference< XInterface >					xDesktopInterface				( xDesktop, UNO_QUERY );
578cdf0e10cSrcweir 	Reference< XTypeProvider >				xDesktopTypeProvider			( xDesktop, UNO_QUERY );
579cdf0e10cSrcweir 	Reference< XServiceInfo >				xDesktopServiceInfo				( xDesktop, UNO_QUERY );
580cdf0e10cSrcweir 	Reference< XComponentLoader >			xDesktopComponentLoader			( xDesktop, UNO_QUERY );
581cdf0e10cSrcweir 	Reference< XTasksSupplier >				xDesktopTasksSupplier			( xDesktop, UNO_QUERY );
582cdf0e10cSrcweir 	Reference< XDispatchProvider >			xDesktopDispatchProvider		( xDesktop, UNO_QUERY );
583cdf0e10cSrcweir 	Reference< XFramesSupplier >			xDesktopFramesSupplier			( xDesktop, UNO_QUERY );
584cdf0e10cSrcweir 	Reference< XFrame >						xDesktopFrame					( xDesktop, UNO_QUERY );
585cdf0e10cSrcweir 	Reference< XComponent >					xDesktopComponent				( xDesktop, UNO_QUERY );
586cdf0e10cSrcweir 	Reference< XStatusIndicatorFactory >	xDesktopStatusIndicatorFactory	( xDesktop, UNO_QUERY );
587cdf0e10cSrcweir 	Reference< XPropertySet >				xDesktopPropertySet				( xDesktop, UNO_QUERY );
588cdf0e10cSrcweir 	Reference< XFastPropertySet >			xDesktopFastPropertySet			( xDesktop, UNO_QUERY );
589cdf0e10cSrcweir 	Reference< XMultiPropertySet >			xDesktopMultiPropertySet		( xDesktop, UNO_QUERY );
590cdf0e10cSrcweir 
591cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopInterface.is()				==sal_False), "TestApplication::impl_testDesktop()\nXInterface not supported by Desktop.\n\n"				)
592cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopTypeProvider.is()				==sal_False), "TestApplication::impl_testDesktop()\nXTypeProvider not supported by Desktop.\n\n"			)
593cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopServiceInfo.is()				==sal_False), "TestApplication::impl_testDesktop()\nXServiceInfo not supported by Desktop.\n\n"				)
594cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktop.is()							==sal_False), "TestApplication::impl_testDesktop()\nXDesktop not supported by Desktop.\n\n"					)
595cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopComponentLoader.is()			==sal_False), "TestApplication::impl_testDesktop()\nXComponentLoader not supported by Desktop.\n\n"			)
596cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopTasksSupplier.is()			==sal_False), "TestApplication::impl_testDesktop()\nXTasksSupplier not supported by Desktop.\n\n"			)
597cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopDispatchProvider.is()			==sal_False), "TestApplication::impl_testDesktop()\nXDispatchProvider not supported by Desktop.\n\n"		)
598cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopFramesSupplier.is()			==sal_False), "TestApplication::impl_testDesktop()\nXFramesSupplier not supported by Desktop.\n\n"			)
599cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopFrame.is()					==sal_False), "TestApplication::impl_testDesktop()\nXFrame not supported by Desktop.\n\n"					)
600cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopComponent.is()				==sal_False), "TestApplication::impl_testDesktop()\nXComponent not supported by Desktop.\n\n"				)
601cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopStatusIndicatorFactory.is()	==sal_False), "TestApplication::impl_testDesktop()\nXStatusIndicatorFactory not supported by Desktop.\n\n"	)
602cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopPropertySet.is()				==sal_False), "TestApplication::impl_testDesktop()\nXPropertySet not supported by Desktop.\n\n"				)
603cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopFastPropertySet.is()			==sal_False), "TestApplication::impl_testDesktop()\nXFastPropertySet not supported by Desktop.\n\n"			)
604cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopMultiPropertySet.is()			==sal_False), "TestApplication::impl_testDesktop()\nXMultiPropertySet not supported by Desktop.\n\n"		)
605cdf0e10cSrcweir 
606cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
607cdf0e10cSrcweir 	//	2) Test set-/getName().
608cdf0e10cSrcweir 
609cdf0e10cSrcweir 	//	2a) Test default value "Desktop".
610cdf0e10cSrcweir 	OUString sName( RTL_CONSTASCII_USTRINGPARAM("Desktop") );
611cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopFrame->getName()!=sName), "TestApplication::impl_testDesktop()\nDefault value of desktop name is invalid.\n\n" )
612cdf0e10cSrcweir 
613cdf0e10cSrcweir 	//	2b) Set name and try to get the same name.
614cdf0e10cSrcweir 	sName = OUString( RTL_CONSTASCII_USTRINGPARAM("New Desktop") );
615cdf0e10cSrcweir 	xDesktopFrame->setName( sName );
616cdf0e10cSrcweir 	LOG_ASSERT( !(xDesktopFrame->getName()!=sName), "TestApplication::impl_testDesktop()\nSetting of name works not correct on desktop.\n\n" )
617cdf0e10cSrcweir 
618cdf0e10cSrcweir 	//	Reset name do default!
619*07a3d7f1SPedro Giffuni 	//	Its necessary for follow operations.
620cdf0e10cSrcweir 	sName = OUString( RTL_CONSTASCII_USTRINGPARAM("Desktop") );
621cdf0e10cSrcweir 	xDesktopFrame->setName( sName );
622cdf0e10cSrcweir 
623cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
624cdf0e10cSrcweir 	//	3) Test findFrame().
625cdf0e10cSrcweir 
626cdf0e10cSrcweir 	//	Build new example tree and log initial structure in file.
627cdf0e10cSrcweir 	impl_buildTree	( xDesktop );
628cdf0e10cSrcweir 	impl_logTree	( xDesktop );
629cdf0e10cSrcweir 
630cdf0e10cSrcweir 	OUString			sTargetFrameName;
631cdf0e10cSrcweir 	sal_uInt32			nSearchFlags	;
632cdf0e10cSrcweir 	Reference< XFrame >	xSearchFrame	;
633cdf0e10cSrcweir 	Reference< XFrame >	xTask_4			;
634cdf0e10cSrcweir 	Reference< XFrame >	xFrame_41		;
635cdf0e10cSrcweir 	Reference< XFrame >	xFrame_411		;
636cdf0e10cSrcweir 	Reference< XFrame >	xFrame_112		;
637cdf0e10cSrcweir 	Reference< XFrame >	xFrame_1123		;
638cdf0e10cSrcweir 	Reference< XFrame >	xFrame_11231	;
639cdf0e10cSrcweir 	Reference< XFrame >	xFrame_11221	;
640cdf0e10cSrcweir 
641cdf0e10cSrcweir 	//	3a) Search for Desktop
642cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
643cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Desktop\" on Desktop\n" )
644cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
645cdf0e10cSrcweir 	sTargetFrameName	= OUString(RTL_CONSTASCII_USTRINGPARAM("Desktop"));
646cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::SELF;
647cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
648cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3a)-1 invalid\n" );
649cdf0e10cSrcweir 
650cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
651cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Desktop\" on Desktop\n" )
652cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
653cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::ALL;
654cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
655cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3a)-2 invalid\n" );
656cdf0e10cSrcweir 
657cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
658cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Desktop\" on Desktop\n" )
659cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
660cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::CHILDREN;
661cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
662cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3a)-3 invalid\n" );
663cdf0e10cSrcweir 
664cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
665cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Desktop\" on Desktop\n" )
666cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
667cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::SIBLINGS;
668cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
669cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3a)-4 invalid\n" );
670cdf0e10cSrcweir 
671cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
672cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with AUTO for \"Desktop\" on Desktop\n" )
673cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
674cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::AUTO;
675cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
676cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3a)-5 invalid\n" );
677cdf0e10cSrcweir 
678cdf0e10cSrcweir 	//	3b) Search for Task_4
679cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
680cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Task_4\" on Desktop\n" )
681cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
682cdf0e10cSrcweir 	sTargetFrameName	= OUString(RTL_CONSTASCII_USTRINGPARAM("Task_4"));
683cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::SELF;
684cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
685cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3b)-1 invalid\n" );
686cdf0e10cSrcweir 
687cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
688cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Task_4\" on Desktop\n" )
689cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
690cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::SIBLINGS;
691cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
692cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3b)-2 invalid\n" );
693cdf0e10cSrcweir 
694cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
695cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Task_4\" on Desktop\n" )
696cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
697cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::CHILDREN;
698cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
699cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3b)-3 invalid\n" );
700cdf0e10cSrcweir 
701cdf0e10cSrcweir 	xTask_4 = xSearchFrame;
702cdf0e10cSrcweir 
703cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
704cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Task_4\" on Desktop\n" )
705cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
706cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::ALL;
707cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
708cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3b)-4 invalid\n" );
709cdf0e10cSrcweir 
710cdf0e10cSrcweir 	//	3c) Search for Frame_41
711cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
712cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Frame_41\" on Desktop\n" )
713cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
714cdf0e10cSrcweir 	sTargetFrameName	= OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_41"));
715cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::SELF;
716cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
717cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-1 invalid\n" );
718cdf0e10cSrcweir 
719cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
720cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Frame_41\" on Desktop\n" )
721cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
722cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::SIBLINGS;
723cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
724cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-2 invalid\n" );
725cdf0e10cSrcweir 
726cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
727cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Frame_41\" on Desktop\n" )
728cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
729cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::CHILDREN;
730cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
731cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-3 invalid\n" );
732cdf0e10cSrcweir 
733cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
734cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Frame_41\" on Desktop\n" )
735cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
736cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::ALL;
737cdf0e10cSrcweir 	xSearchFrame		= xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
738cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-4 invalid\n" );
739cdf0e10cSrcweir 
740cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
741cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Frame_41\" on Task_4\n" )
742cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
743cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::SELF;
744cdf0e10cSrcweir 	xSearchFrame		= xTask_4->findFrame(sTargetFrameName, nSearchFlags);
745cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-5 invalid\n" );
746cdf0e10cSrcweir 
747cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
748cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Frame_41\" on Task_4\n" )
749cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
750cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::SIBLINGS;
751cdf0e10cSrcweir 	xSearchFrame		= xTask_4->findFrame(sTargetFrameName, nSearchFlags);
752cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-6 invalid\n" );
753cdf0e10cSrcweir 
754cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
755cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Frame_41\" on Task_4\n" )
756cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
757cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::CHILDREN;
758cdf0e10cSrcweir 	xSearchFrame		= xTask_4->findFrame(sTargetFrameName, nSearchFlags);
759cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-7 invalid\n" );
760cdf0e10cSrcweir 
761cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
762cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Frame_41\" on Task_4\n" )
763cdf0e10cSrcweir 	WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
764cdf0e10cSrcweir 	nSearchFlags		= FrameSearchFlag::ALL;
765cdf0e10cSrcweir 	xSearchFrame		= xTask_4->findFrame(sTargetFrameName, nSearchFlags);
766cdf0e10cSrcweir 	LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-8 invalid\n" );
767cdf0e10cSrcweir 
768cdf0e10cSrcweir 	xFrame_41 = xSearchFrame;
769cdf0e10cSrcweir 
770cdf0e10cSrcweir 	//	3d) Search for Frame_411
771cdf0e10cSrcweir 	//	3e) Search for Frame_112
772cdf0e10cSrcweir 	//	3f) Search for Frame_1123
773cdf0e10cSrcweir 	//	3g) Search for Frame_11231
774cdf0e10cSrcweir 	//	3h) Search for Frame_11221
775cdf0e10cSrcweir }
776cdf0e10cSrcweir 
777cdf0e10cSrcweir //_________________________________________________________________________________________________________________
778cdf0e10cSrcweir //	helper method to build a new binaer-tree with desktop as top-frame
779cdf0e10cSrcweir //_________________________________________________________________________________________________________________
780cdf0e10cSrcweir void TestApplication::impl_buildTree( const Reference< XDesktop >& xDesktop )
781cdf0e10cSrcweir {
782cdf0e10cSrcweir 	// You can append and remove frames only on XFRames interface of desktop.
783cdf0e10cSrcweir 	// But the desktop support this interface not directly! Use getFrames() instantly.
784cdf0e10cSrcweir 	Reference< XFramesSupplier > xDesktopSupplier( xDesktop, UNO_QUERY );
785cdf0e10cSrcweir 	Reference< XFrames > xFrames = xDesktopSupplier->getFrames();
786cdf0e10cSrcweir 	LOG_ASSERT( !(xFrames.is()==sal_False), "TestApplication::impl_buildTree()\nCan't get framesaccess on desktop.\n\n" )
787cdf0e10cSrcweir 
788cdf0e10cSrcweir 	// Create some tasks and frames.
789cdf0e10cSrcweir 	Reference< XMultiServiceFactory > xServiceManager( getProcessServiceFactory() );
790cdf0e10cSrcweir 
791cdf0e10cSrcweir 	Reference< XTask >	xTask_1( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY );
792cdf0e10cSrcweir 	Reference< XTask >	xTask_2( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY );
793cdf0e10cSrcweir 	Reference< XTask >	xTask_3( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY );
794cdf0e10cSrcweir 	Reference< XTask >	xTask_4( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY );
795cdf0e10cSrcweir 	Reference< XTask >	xTask_5( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY );
796cdf0e10cSrcweir 	Reference< XFrame >	xFrame_11( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
797cdf0e10cSrcweir 	Reference< XFrame >	xFrame_12( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
798cdf0e10cSrcweir 	Reference< XFrame >	xFrame_21( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
799cdf0e10cSrcweir 	Reference< XFrame >	xFrame_22( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
800cdf0e10cSrcweir 	Reference< XFrame >	xFrame_31( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
801cdf0e10cSrcweir 	Reference< XFrame >	xFrame_32( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
802cdf0e10cSrcweir 	Reference< XFrame >	xFrame_41( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
803cdf0e10cSrcweir 	Reference< XFrame >	xFrame_42( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
804cdf0e10cSrcweir 	Reference< XFrame >	xFrame_51( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
805cdf0e10cSrcweir 	Reference< XFrame >	xFrame_52( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
806cdf0e10cSrcweir 	Reference< XFrame >	xFrame_111( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
807cdf0e10cSrcweir 	Reference< XFrame >	xFrame_112( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
808cdf0e10cSrcweir 	Reference< XFrame >	xFrame_121( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
809cdf0e10cSrcweir 	Reference< XFrame >	xFrame_411( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
810cdf0e10cSrcweir 	Reference< XFrame >	xFrame_1121( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
811cdf0e10cSrcweir 	Reference< XFrame >	xFrame_1122( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
812cdf0e10cSrcweir 	Reference< XFrame >	xFrame_1123( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
813cdf0e10cSrcweir 	Reference< XFrame >	xFrame_4111( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
814cdf0e10cSrcweir 	Reference< XFrame >	xFrame_4112( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
815cdf0e10cSrcweir 	Reference< XFrame >	xFrame_4113( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
816cdf0e10cSrcweir 	Reference< XFrame >	xFrame_11221( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
817cdf0e10cSrcweir 	Reference< XFrame >	xFrame_11231( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
818cdf0e10cSrcweir 
819cdf0e10cSrcweir 	// Initialize tasks and frames with names to support easy finding!
820cdf0e10cSrcweir 	Reference< XFrame > xTaskFrame_1( xTask_1, UNO_QUERY );
821cdf0e10cSrcweir 	Reference< XFrame > xTaskFrame_2( xTask_2, UNO_QUERY );
822cdf0e10cSrcweir 	Reference< XFrame > xTaskFrame_3( xTask_3, UNO_QUERY );
823cdf0e10cSrcweir 	Reference< XFrame > xTaskFrame_4( xTask_4, UNO_QUERY );
824cdf0e10cSrcweir 	Reference< XFrame > xTaskFrame_5( xTask_5, UNO_QUERY );
825cdf0e10cSrcweir 
826cdf0e10cSrcweir 	xTaskFrame_1->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_1")));
827cdf0e10cSrcweir 	xTaskFrame_2->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_2")));
828cdf0e10cSrcweir 	xTaskFrame_3->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_3")));
829cdf0e10cSrcweir 	xTaskFrame_4->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_4")));
830cdf0e10cSrcweir 	xTaskFrame_5->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_5")));
831cdf0e10cSrcweir 	xFrame_11->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11")));
832cdf0e10cSrcweir 	xFrame_12->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_12")));
833cdf0e10cSrcweir 	xFrame_21->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_21")));
834cdf0e10cSrcweir 	xFrame_22->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_22")));
835cdf0e10cSrcweir 	xFrame_31->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_31")));
836cdf0e10cSrcweir 	xFrame_32->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_32")));
837cdf0e10cSrcweir 	xFrame_41->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_41")));
838cdf0e10cSrcweir 	xFrame_42->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_42")));
839cdf0e10cSrcweir 	xFrame_51->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_51")));
840cdf0e10cSrcweir 	xFrame_52->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_52")));
841cdf0e10cSrcweir 	xFrame_111->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_111")));
842cdf0e10cSrcweir 	xFrame_112->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_112")));
843cdf0e10cSrcweir 	xFrame_121->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_121")));
844cdf0e10cSrcweir 	xFrame_411->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_411")));
845cdf0e10cSrcweir 	xFrame_1121->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1121")));
846cdf0e10cSrcweir 	xFrame_1122->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1122")));
847cdf0e10cSrcweir 	xFrame_1123->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1123")));
848cdf0e10cSrcweir 	xFrame_4111->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4111")));
849cdf0e10cSrcweir 	xFrame_4112->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4112")));
850cdf0e10cSrcweir 	xFrame_4113->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4113")));
851cdf0e10cSrcweir 	xFrame_11221->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11221")));
852cdf0e10cSrcweir 	xFrame_11231->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11231")));
853cdf0e10cSrcweir 
854cdf0e10cSrcweir 	// Build tree.
855cdf0e10cSrcweir 	// Append tasks as childs of desktop.
856cdf0e10cSrcweir 	xFrames->append( xTaskFrame_1 );
857cdf0e10cSrcweir 	xFrames->append( xTaskFrame_2 );
858cdf0e10cSrcweir 	xFrames->append( xTaskFrame_3 );
859cdf0e10cSrcweir 	xFrames->append( xTaskFrame_4 );
860cdf0e10cSrcweir 	xFrames->append( xTaskFrame_5 );
861cdf0e10cSrcweir 
862cdf0e10cSrcweir 	// Append frames as childs of tasks.
863cdf0e10cSrcweir 	Reference< XFramesSupplier > xTaskFramesSupplier_1( xTask_1, UNO_QUERY );
864cdf0e10cSrcweir 	Reference< XFramesSupplier > xTaskFramesSupplier_2( xTask_2, UNO_QUERY );
865cdf0e10cSrcweir 	Reference< XFramesSupplier > xTaskFramesSupplier_3( xTask_3, UNO_QUERY );
866cdf0e10cSrcweir 	Reference< XFramesSupplier > xTaskFramesSupplier_4( xTask_4, UNO_QUERY );
867cdf0e10cSrcweir 	Reference< XFramesSupplier > xTaskFramesSupplier_5( xTask_5, UNO_QUERY );
868cdf0e10cSrcweir 	Reference< XFramesSupplier > xFramesSupplier_11( xFrame_11, UNO_QUERY );
869cdf0e10cSrcweir 	Reference< XFramesSupplier > xFramesSupplier_12( xFrame_12, UNO_QUERY );
870cdf0e10cSrcweir 	Reference< XFramesSupplier > xFramesSupplier_112( xFrame_112, UNO_QUERY );
871cdf0e10cSrcweir 	Reference< XFramesSupplier > xFramesSupplier_1122( xFrame_1122, UNO_QUERY );
872cdf0e10cSrcweir 	Reference< XFramesSupplier > xFramesSupplier_1123( xFrame_1123, UNO_QUERY );
873cdf0e10cSrcweir 	Reference< XFramesSupplier > xFramesSupplier_41( xFrame_41, UNO_QUERY );
874cdf0e10cSrcweir 	Reference< XFramesSupplier > xFramesSupplier_411( xFrame_411, UNO_QUERY );
875cdf0e10cSrcweir 
876cdf0e10cSrcweir 	xFrames = xTaskFramesSupplier_1->getFrames();
877cdf0e10cSrcweir 	xFrames->append( xFrame_11 );
878cdf0e10cSrcweir 	xFrames->append( xFrame_12 );
879cdf0e10cSrcweir 	xFrames = xTaskFramesSupplier_2->getFrames();
880cdf0e10cSrcweir 	xFrames->append( xFrame_21 );
881cdf0e10cSrcweir 	xFrames->append( xFrame_22 );
882cdf0e10cSrcweir 	xFrames = xTaskFramesSupplier_3->getFrames();
883cdf0e10cSrcweir 	xFrames->append( xFrame_31 );
884cdf0e10cSrcweir 	xFrames->append( xFrame_32 );
885cdf0e10cSrcweir 	xFrames = xTaskFramesSupplier_4->getFrames();
886cdf0e10cSrcweir 	xFrames->append( xFrame_41 );
887cdf0e10cSrcweir 	xFrames->append( xFrame_42 );
888cdf0e10cSrcweir 	xFrames = xTaskFramesSupplier_5->getFrames();
889cdf0e10cSrcweir 	xFrames->append( xFrame_51 );
890cdf0e10cSrcweir 	xFrames->append( xFrame_52 );
891cdf0e10cSrcweir 	xFrames = xFramesSupplier_11->getFrames();
892cdf0e10cSrcweir 	xFrames->append( xFrame_111 );
893cdf0e10cSrcweir 	xFrames->append( xFrame_112 );
894cdf0e10cSrcweir 	xFrames = xFramesSupplier_12->getFrames();
895cdf0e10cSrcweir 	xFrames->append( xFrame_121 );
896cdf0e10cSrcweir 	xFrames = xFramesSupplier_112->getFrames();
897cdf0e10cSrcweir 	xFrames->append( xFrame_1121 );
898cdf0e10cSrcweir 	xFrames->append( xFrame_1122 );
899cdf0e10cSrcweir 	xFrames->append( xFrame_1123 );
900cdf0e10cSrcweir 	xFrames = xFramesSupplier_1122->getFrames();
901cdf0e10cSrcweir 	xFrames->append( xFrame_11221 );
902cdf0e10cSrcweir 	xFrames = xFramesSupplier_1123->getFrames();
903cdf0e10cSrcweir 	xFrames->append( xFrame_11231 );
904cdf0e10cSrcweir 	xFrames = xFramesSupplier_41->getFrames();
905cdf0e10cSrcweir 	xFrames->append( xFrame_411 );
906cdf0e10cSrcweir 	xFrames = xFramesSupplier_411->getFrames();
907cdf0e10cSrcweir 	xFrames->append( xFrame_4111 );
908cdf0e10cSrcweir 	xFrames->append( xFrame_4112 );
909cdf0e10cSrcweir 	xFrames->append( xFrame_4113 );
910cdf0e10cSrcweir 
911cdf0e10cSrcweir 	// Create some active paths.
912cdf0e10cSrcweir 	// desktop => task_1 => frame_11 => frame_112 => frame_1122
913cdf0e10cSrcweir //	xDesktopSupplier->setActiveFrame( xTaskFrame_1 );
914cdf0e10cSrcweir //	xTaskFramesSupplier_1->setActiveFrame( xFrame_11 );
915cdf0e10cSrcweir //	xFramesSupplier_11->setActiveFrame( xFrame_112 );
916cdf0e10cSrcweir //	xFramesSupplier_112->setActiveFrame( xFrame_1122 );
917cdf0e10cSrcweir 	// frame_41 => frame_411 => frame_4111
918cdf0e10cSrcweir //	xFramesSupplier_41->setActiveFrame( xFrame_411 );
919cdf0e10cSrcweir //	xFramesSupplier_411->setActiveFrame( xFrame_4111 );
920cdf0e10cSrcweir 	// task_3 => frame_31
921cdf0e10cSrcweir //	xTaskFramesSupplier_3->setActiveFrame( xFrame_31 );
922cdf0e10cSrcweir 	// frame_1123 => frame_11231
923cdf0e10cSrcweir //	xFramesSupplier_1123->setActiveFrame( xFrame_11231 );
924cdf0e10cSrcweir 
925cdf0e10cSrcweir //	xTask_1->activate();
926cdf0e10cSrcweir //	impl_logTree( xDesktop );
927cdf0e10cSrcweir //	xFrame_41->activate();
928cdf0e10cSrcweir //	impl_logTree( xDesktop );
929cdf0e10cSrcweir //	xFrame_52->activate();
930cdf0e10cSrcweir //	impl_logTree( xDesktop );
931cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_TREE, "initiale Hierarchy:" )
932cdf0e10cSrcweir 	impl_logTree( xDesktop );
933cdf0e10cSrcweir 
934cdf0e10cSrcweir //	xFrame_121->activate();
935cdf0e10cSrcweir //	impl_logTree( xDesktop );
936cdf0e10cSrcweir //	xFrame_41->activate();
937cdf0e10cSrcweir //	impl_logTree( xDesktop );
938cdf0e10cSrcweir //	xFrame_52->activate();
939cdf0e10cSrcweir //	impl_logTree( xDesktop );
940cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_411->activate():" )
941cdf0e10cSrcweir 	xFrame_411->activate();
942cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_411->activate():" )
943cdf0e10cSrcweir 	impl_logTree( xDesktop );
944cdf0e10cSrcweir //	xFrame_41->deactivate();
945cdf0e10cSrcweir //	impl_logTree( xDesktop );
946cdf0e10cSrcweir //	xFrame_4113->activate();
947cdf0e10cSrcweir //	impl_logTree( xDesktop );
948cdf0e10cSrcweir //	xFrame_21->activate();
949cdf0e10cSrcweir //	impl_logTree( xDesktop );
950cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_11231->activate():" )
951cdf0e10cSrcweir 	xFrame_11231->activate();
952cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_11231->activate():" )
953cdf0e10cSrcweir 	impl_logTree( xDesktop );
954cdf0e10cSrcweir 
955cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_11221->activate():" )
956cdf0e10cSrcweir 	xFrame_11221->activate();
957cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_11221->activate():" )
958cdf0e10cSrcweir 	impl_logTree( xDesktop );
959cdf0e10cSrcweir 
960cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_112->deactivate():" )
961cdf0e10cSrcweir //	xFrame_112->getCreator()->setActiveFrame( Reference< XFrame >() );
962cdf0e10cSrcweir 	xFrame_112->deactivate();
963cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_112->deactivate():" )
964cdf0e10cSrcweir 	impl_logTree( xDesktop );
965cdf0e10cSrcweir 
966cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_41->activate():" )
967cdf0e10cSrcweir 	xFrame_41->activate();
968cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_41->activate():" )
969cdf0e10cSrcweir 	impl_logTree( xDesktop );
970cdf0e10cSrcweir 
971cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xTask_4->activate():" )
972cdf0e10cSrcweir 	xTask_4->activate();
973cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_TREE, "nach xTask_4->activate():" )
974cdf0e10cSrcweir 	impl_logTree( xDesktop );
975cdf0e10cSrcweir 
976cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_1123->deactivate():" )
977cdf0e10cSrcweir 	xFrame_1123->deactivate();
978cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_1123->deactivate():" )
979cdf0e10cSrcweir 	impl_logTree( xDesktop );
980cdf0e10cSrcweir }
981cdf0e10cSrcweir 
982cdf0e10cSrcweir //_________________________________________________________________________________________________________________
983cdf0e10cSrcweir //	helper method to log current tree state
984cdf0e10cSrcweir //_________________________________________________________________________________________________________________
985cdf0e10cSrcweir void TestApplication::impl_logTree( const Reference< XDesktop >& xDesktop )
986cdf0e10cSrcweir {
987cdf0e10cSrcweir #ifdef ENABLE_SERVICEDEBUG
988cdf0e10cSrcweir 	// Use special feature of Desktop-implementation.
989cdf0e10cSrcweir 	// NEVER USE THIS IN RELEASE VERSIONS!!!
990cdf0e10cSrcweir 	Reference< XSPECIALDEBUGINTERFACE > xDebug( xDesktop, UNO_QUERY );
991cdf0e10cSrcweir 
992cdf0e10cSrcweir 	// Get a "stream" of all names of frames in tree.
993cdf0e10cSrcweir 	OUString sTreeNamesStream = xDebug->dumpVariable( DUMPVARIABLE_TREEINFO, 0 );
994cdf0e10cSrcweir 	// And write it to logfile.
995cdf0e10cSrcweir 	OString sOutPut = OUStringToOString( sTreeNamesStream, RTL_TEXTENCODING_UTF8 );
996cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_TREE, "\nNew tree log:\n\n"	);
997cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_TREE, sOutPut			);
998cdf0e10cSrcweir //	WRITE_LOGFILE( LOGFILENAME_TREE, "\n"						);
999cdf0e10cSrcweir #endif
1000cdf0e10cSrcweir }
1001cdf0e10cSrcweir #endif // TEST_DESKTOP
1002cdf0e10cSrcweir 
1003cdf0e10cSrcweir //_________________________________________________________________________________________________________________
1004cdf0e10cSrcweir //	test method for registration of new filters in configuration
1005cdf0e10cSrcweir //_________________________________________________________________________________________________________________
1006cdf0e10cSrcweir #ifdef TEST_FILTERREGISTRATION
1007cdf0e10cSrcweir void TestApplication::impl_testFilterRegistration()
1008cdf0e10cSrcweir {
1009cdf0e10cSrcweir 	Reference< XNameContainer > xContainer( m_xFactory->createInstance( SERVICENAME_FILTERFACTORY ), UNO_QUERY );
1010cdf0e10cSrcweir 	LOG_ASSERT( !(xContainer.is()==sal_False), "TestApplication::impl_testFilterRegistration()\nCould not create FilterFactory-service or cast it to XNameContainer.\n" )
1011cdf0e10cSrcweir 	if( xContainer.is() == sal_True )
1012cdf0e10cSrcweir 	{
1013cdf0e10cSrcweir 		Sequence< PropertyValue > lProperties( 8 );
1014cdf0e10cSrcweir 
1015cdf0e10cSrcweir 		lProperties[0].Name		=	DECLARE_ASCII("Type"					);
1016cdf0e10cSrcweir 		lProperties[0].Value	<<=	DECLARE_ASCII("component_DB"			);
1017cdf0e10cSrcweir 
1018cdf0e10cSrcweir 		lProperties[1].Name		=	DECLARE_ASCII("UIName"					);
1019cdf0e10cSrcweir 		lProperties[1].Value	<<=	DECLARE_ASCII("Ein neuer Filter-Eintrag");
1020cdf0e10cSrcweir 
1021cdf0e10cSrcweir 		lProperties[2].Name		=	DECLARE_ASCII("DocumentService"			);
1022cdf0e10cSrcweir 		lProperties[2].Value	<<=	DECLARE_ASCII("test.document.service"	);
1023cdf0e10cSrcweir 
1024cdf0e10cSrcweir 		lProperties[3].Name		=	DECLARE_ASCII("FilterService"			);
1025cdf0e10cSrcweir 		lProperties[3].Value	<<=	DECLARE_ASCII("test.filter.service"		);
1026cdf0e10cSrcweir 
1027cdf0e10cSrcweir 		lProperties[4].Name		=	DECLARE_ASCII("Flags"					);
1028cdf0e10cSrcweir 		lProperties[4].Value	<<=	(sal_Int32)100;
1029cdf0e10cSrcweir 
1030cdf0e10cSrcweir 		Sequence< OUString > lTempData(1);
1031cdf0e10cSrcweir 		lTempData[0] = DECLARE_ASCII("meine UserData");
1032cdf0e10cSrcweir 		lProperties[5].Name		=	DECLARE_ASCII("UserData"				);
1033cdf0e10cSrcweir 		lProperties[5].Value	<<=	lTempData;
1034cdf0e10cSrcweir 
1035cdf0e10cSrcweir 		lProperties[6].Name		=	DECLARE_ASCII("FileFormatVersion"		);
1036cdf0e10cSrcweir 		lProperties[6].Value	<<=	(sal_Int32)1;
1037cdf0e10cSrcweir 
1038cdf0e10cSrcweir 		lProperties[7].Name		=	DECLARE_ASCII("TemplateName"			);
1039cdf0e10cSrcweir 		lProperties[7].Value	<<=	DECLARE_ASCII("Mein Template Name"		);
1040cdf0e10cSrcweir 
1041cdf0e10cSrcweir 		Any aProperties;
1042cdf0e10cSrcweir 		aProperties <<= lProperties;
1043cdf0e10cSrcweir 		xContainer->insertByName( DECLARE_ASCII("mein_eigener_neuer_Filter"), aProperties );
1044cdf0e10cSrcweir 
1045cdf0e10cSrcweir 		lProperties[0].Name		=	DECLARE_ASCII("Type"					);
1046cdf0e10cSrcweir 		lProperties[0].Value	<<=	DECLARE_ASCII("component_DB"			);
1047cdf0e10cSrcweir 
1048cdf0e10cSrcweir 		lProperties[1].Name		=	DECLARE_ASCII("UIName"					);
1049cdf0e10cSrcweir 		lProperties[1].Value	<<=	DECLARE_ASCII("Ein neuer Filter-Eintrag 2");
1050cdf0e10cSrcweir 
1051cdf0e10cSrcweir 		lProperties[2].Name		=	DECLARE_ASCII("DocumentService"			);
1052cdf0e10cSrcweir 		lProperties[2].Value	<<=	DECLARE_ASCII("test.document.service 2"	);
1053cdf0e10cSrcweir 
1054cdf0e10cSrcweir 		lProperties[3].Name		=	DECLARE_ASCII("FilterService"			);
1055cdf0e10cSrcweir 		lProperties[3].Value	<<=	DECLARE_ASCII("test.filter.service 2"		);
1056cdf0e10cSrcweir 
1057cdf0e10cSrcweir 		lProperties[4].Name		=	DECLARE_ASCII("Flags"					);
1058cdf0e10cSrcweir 		lProperties[4].Value	<<=	(sal_Int32)200;
1059cdf0e10cSrcweir 
1060cdf0e10cSrcweir 		lTempData[0] = DECLARE_ASCII("meine UserData 2");
1061cdf0e10cSrcweir 		lProperties[5].Name		=	DECLARE_ASCII("UserData"				);
1062cdf0e10cSrcweir 		lProperties[5].Value	<<=	lTempData;
1063cdf0e10cSrcweir 
1064cdf0e10cSrcweir 		lProperties[6].Name		=	DECLARE_ASCII("FileFormatVersion"		);
1065cdf0e10cSrcweir 		lProperties[6].Value	<<=	(sal_Int32)2;
1066cdf0e10cSrcweir 
1067cdf0e10cSrcweir 		lProperties[7].Name		=	DECLARE_ASCII("TemplateName"			);
1068cdf0e10cSrcweir 		lProperties[7].Value	<<=	DECLARE_ASCII("Mein Template Name 2"		);
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir 		aProperties <<= lProperties;
1071cdf0e10cSrcweir 		xContainer->insertByName( DECLARE_ASCII("mein_eigener_neuer_Filter_2"), aProperties );
1072cdf0e10cSrcweir 
1073cdf0e10cSrcweir 		xContainer->removeByName( DECLARE_ASCII("mein_eigener_neuer_Filter") );
1074cdf0e10cSrcweir 	}
1075cdf0e10cSrcweir }
1076cdf0e10cSrcweir #endif
1077cdf0e10cSrcweir 
1078cdf0e10cSrcweir //_________________________________________________________________________________________________________________
1079cdf0e10cSrcweir //	test method for search mechanism in our frame tree
1080cdf0e10cSrcweir //_________________________________________________________________________________________________________________
1081cdf0e10cSrcweir #ifdef TEST_TREESEARCH
1082cdf0e10cSrcweir sal_Bool TestApplication::impl_testTreeSearch()
1083cdf0e10cSrcweir {
1084cdf0e10cSrcweir 	// Build an example tree.
1085cdf0e10cSrcweir 	Reference< XFrame > xD		( m_xFactory->createInstance( SERVICENAME_DESKTOP	), UNO_QUERY );
1086cdf0e10cSrcweir 	Reference< XFrame > xT1		( m_xFactory->createInstance( SERVICENAME_TASK		), UNO_QUERY );
1087cdf0e10cSrcweir 	Reference< XFrame > xT2		( m_xFactory->createInstance( SERVICENAME_TASK		), UNO_QUERY );
1088cdf0e10cSrcweir 	Reference< XFrame > xT3		( m_xFactory->createInstance( SERVICENAME_TASK		), UNO_QUERY );
1089cdf0e10cSrcweir 	Reference< XFrame > xF11	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1090cdf0e10cSrcweir 	Reference< XFrame > xF12	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1091cdf0e10cSrcweir 	Reference< XFrame > xF21	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1092cdf0e10cSrcweir 	Reference< XFrame > xF22	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1093cdf0e10cSrcweir 	Reference< XFrame > xF211	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1094cdf0e10cSrcweir 	Reference< XFrame > xF212	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1095cdf0e10cSrcweir 	Reference< XFrame > xF221	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1096cdf0e10cSrcweir 	Reference< XFrame > xF2111	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1097cdf0e10cSrcweir 	Reference< XFrame > xF2112	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1098cdf0e10cSrcweir 	Reference< XFrame > xF2121	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1099cdf0e10cSrcweir 	Reference< XFrame > xF2122	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1100cdf0e10cSrcweir 	Reference< XFrame > xF2211	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1101cdf0e10cSrcweir 	Reference< XFrame > xF21111	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1102cdf0e10cSrcweir 	Reference< XFrame > xF21112	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1103cdf0e10cSrcweir 	Reference< XFrame > xF21121	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1104cdf0e10cSrcweir 	Reference< XFrame > xF21122	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1105cdf0e10cSrcweir 	Reference< XFrame > xF21211	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1106cdf0e10cSrcweir 	Reference< XFrame > xF21212	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1107cdf0e10cSrcweir 	Reference< XFrame > xF21221	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1108cdf0e10cSrcweir 	Reference< XFrame > xF21222	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1109cdf0e10cSrcweir 	Reference< XFrame > xF22111	( m_xFactory->createInstance( SERVICENAME_FRAME		), UNO_QUERY );
1110cdf0e10cSrcweir 
1111cdf0e10cSrcweir 	xD->setName		( DECLARE_ASCII("D"		) );
1112cdf0e10cSrcweir 	xT1->setName	( DECLARE_ASCII("T1"	) );
1113cdf0e10cSrcweir 	xT2->setName	( DECLARE_ASCII("T2"	) );
1114cdf0e10cSrcweir 	xT3->setName	( DECLARE_ASCII("T3"	) );
1115cdf0e10cSrcweir 	xF11->setName	( DECLARE_ASCII("F11"	) );
1116cdf0e10cSrcweir 	xF12->setName	( DECLARE_ASCII("F12"	) );
1117cdf0e10cSrcweir 	xF21->setName	( DECLARE_ASCII("F21"	) );
1118cdf0e10cSrcweir 	xF22->setName	( DECLARE_ASCII("F22"	) );
1119cdf0e10cSrcweir 	xF211->setName	( DECLARE_ASCII("F211"	) );
1120cdf0e10cSrcweir 	xF212->setName	( DECLARE_ASCII("F212"	) );
1121cdf0e10cSrcweir 	xF221->setName	( DECLARE_ASCII("F221"	) );
1122cdf0e10cSrcweir 	xF2111->setName	( DECLARE_ASCII("F2111"	) );
1123cdf0e10cSrcweir 	xF2112->setName	( DECLARE_ASCII("F2112"	) );
1124cdf0e10cSrcweir 	xF2121->setName	( DECLARE_ASCII("F2121"	) );
1125cdf0e10cSrcweir 	xF2122->setName	( DECLARE_ASCII("F2122"	) );
1126cdf0e10cSrcweir 	xF2211->setName	( DECLARE_ASCII("F2211"	) );
1127cdf0e10cSrcweir 	xF21111->setName( DECLARE_ASCII("F21111") );
1128cdf0e10cSrcweir 	xF21112->setName( DECLARE_ASCII("F21112") );
1129cdf0e10cSrcweir 	xF21121->setName( DECLARE_ASCII("F21121") );
1130cdf0e10cSrcweir 	xF21122->setName( DECLARE_ASCII("F21122") );
1131cdf0e10cSrcweir 	xF21211->setName( DECLARE_ASCII("F21211") );
1132cdf0e10cSrcweir 	xF21212->setName( DECLARE_ASCII("F21212") );
1133cdf0e10cSrcweir 	xF21221->setName( DECLARE_ASCII("F21221") );
1134cdf0e10cSrcweir 	xF21222->setName( DECLARE_ASCII("F21222") );
1135cdf0e10cSrcweir 	xF22111->setName( DECLARE_ASCII("F22111") );
1136cdf0e10cSrcweir 
1137cdf0e10cSrcweir 	Reference< XFramesSupplier > xSD		( xD		, UNO_QUERY );
1138cdf0e10cSrcweir 	Reference< XFramesSupplier > xST1		( xT1		, UNO_QUERY );
1139cdf0e10cSrcweir 	Reference< XFramesSupplier > xST2		( xT2		, UNO_QUERY );
1140cdf0e10cSrcweir 	Reference< XFramesSupplier > xST3		( xT3		, UNO_QUERY );
1141cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF11		( xF11		, UNO_QUERY );
1142cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF12		( xF12		, UNO_QUERY );
1143cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF21		( xF21		, UNO_QUERY );
1144cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF22		( xF22		, UNO_QUERY );
1145cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF211		( xF211		, UNO_QUERY );
1146cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF212		( xF212		, UNO_QUERY );
1147cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF221		( xF221		, UNO_QUERY );
1148cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF2111	( xF2111	, UNO_QUERY );
1149cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF2112	( xF2112	, UNO_QUERY );
1150cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF2121	( xF2121	, UNO_QUERY );
1151cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF2122	( xF2122	, UNO_QUERY );
1152cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF2211	( xF2211	, UNO_QUERY );
1153cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF21111	( xF21111	, UNO_QUERY );
1154cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF21112	( xF21112	, UNO_QUERY );
1155cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF21121	( xF21121	, UNO_QUERY );
1156cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF21122	( xF21122	, UNO_QUERY );
1157cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF21211	( xF21211	, UNO_QUERY );
1158cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF21212	( xF21212	, UNO_QUERY );
1159cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF21221	( xF21221	, UNO_QUERY );
1160cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF21222	( xF21222	, UNO_QUERY );
1161cdf0e10cSrcweir 	Reference< XFramesSupplier > xSF22111	( xF22111	, UNO_QUERY );
1162cdf0e10cSrcweir 
1163cdf0e10cSrcweir 	xSD->getFrames()->append		( xT1		);
1164cdf0e10cSrcweir 	xSD->getFrames()->append		( xT2		);
1165cdf0e10cSrcweir 	xSD->getFrames()->append		( xT3		);
1166cdf0e10cSrcweir 	xST1->getFrames()->append		( xF11		);
1167cdf0e10cSrcweir 	xST1->getFrames()->append		( xF12		);
1168cdf0e10cSrcweir 	xST2->getFrames()->append		( xF21		);
1169cdf0e10cSrcweir 	xST2->getFrames()->append		( xF22		);
1170cdf0e10cSrcweir 	xSF21->getFrames()->append		( xF211		);
1171cdf0e10cSrcweir 	xSF21->getFrames()->append		( xF212		);
1172cdf0e10cSrcweir 	xSF211->getFrames()->append		( xF2111	);
1173cdf0e10cSrcweir 	xSF211->getFrames()->append		( xF2112	);
1174cdf0e10cSrcweir 	xSF212->getFrames()->append		( xF2121	);
1175cdf0e10cSrcweir 	xSF212->getFrames()->append		( xF2122	);
1176cdf0e10cSrcweir 	xSF2111->getFrames()->append	( xF21111	);
1177cdf0e10cSrcweir 	xSF2111->getFrames()->append	( xF21112	);
1178cdf0e10cSrcweir 	xSF2112->getFrames()->append	( xF21121	);
1179cdf0e10cSrcweir 	xSF2112->getFrames()->append	( xF21122	);
1180cdf0e10cSrcweir 	xSF2121->getFrames()->append	( xF21211	);
1181cdf0e10cSrcweir 	xSF2121->getFrames()->append	( xF21212	);
1182cdf0e10cSrcweir 	xSF2122->getFrames()->append	( xF21221	);
1183cdf0e10cSrcweir 	xSF2122->getFrames()->append	( xF21222	);
1184cdf0e10cSrcweir 	xSF22->getFrames()->append		( xF221		);
1185cdf0e10cSrcweir 	xSF221->getFrames()->append		( xF2211	);
1186cdf0e10cSrcweir 	xSF2211->getFrames()->append	( xF22111	);
1187cdf0e10cSrcweir 
1188cdf0e10cSrcweir 	sal_Int32 nFlags = 0;
1189cdf0e10cSrcweir 
1190cdf0e10cSrcweir 	// Test deep down search
1191cdf0e10cSrcweir 	nFlags = FrameSearchFlag::CHILDREN;
1192cdf0e10cSrcweir 	if	(
1193cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("T1"		), nFlags )	!=	xT1		)	||
1194cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("T2"		), nFlags )	!=	xT2		)	||
1195cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("T3"		), nFlags )	!=	xT3		)	||
1196cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F11"	), nFlags )	!=	xF11	)	||
1197cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F12"	), nFlags )	!=	xF12	)	||
1198cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21"	), nFlags )	!=	xF21	)	||
1199cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F22"	), nFlags )	!=	xF22	)	||
1200cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F211"	), nFlags )	!=	xF211	)	||
1201cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F212"	), nFlags )	!=	xF212	)	||
1202cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F2111"	), nFlags )	!=	xF2111	)	||
1203cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F2112"	), nFlags )	!=	xF2112	)	||
1204cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F2121"	), nFlags )	!=	xF2121	)	||
1205cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F2122"	), nFlags )	!=	xF2122	)	||
1206cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21111"	), nFlags )	!=	xF21111	)	||
1207cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21112"	), nFlags )	!=	xF21112	)	||
1208cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21121"	), nFlags )	!=	xF21121	)	||
1209cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21122"	), nFlags )	!=	xF21122	)	||
1210cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21211"	), nFlags )	!=	xF21211	)	||
1211cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21212"	), nFlags )	!=	xF21212	)	||
1212cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21221"	), nFlags )	!=	xF21221	)	||
1213cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21222"	), nFlags )	!=	xF21222	)	||
1214cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F221"	), nFlags )	!=	xF221	)	||
1215cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F2211"	), nFlags )	!=	xF2211	)	||
1216cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F22111"	), nFlags )	!=	xF22111	)
1217cdf0e10cSrcweir 		)
1218cdf0e10cSrcweir 	{
1219cdf0e10cSrcweir 		LOG_ERROR( "TestApplikation::impl_testTreeSearch()", "deep down search failed" )
1220cdf0e10cSrcweir 		return sal_False;
1221cdf0e10cSrcweir 	}
1222cdf0e10cSrcweir 
1223cdf0e10cSrcweir 	// Test flat down search
1224cdf0e10cSrcweir 	nFlags = FrameSearchFlag::CHILDREN | FrameSearchFlag::SIBLINGS;
1225cdf0e10cSrcweir 	if	(
1226cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("T1"		), nFlags )	!=	xT1		)	||
1227cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("T2"		), nFlags )	!=	xT2		)	||
1228cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("T3"		), nFlags )	!=	xT3		)	||
1229cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F11"	), nFlags )	!=	xF11	)	||
1230cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F12"	), nFlags )	!=	xF12	)	||
1231cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21"	), nFlags )	!=	xF21	)	||
1232cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F22"	), nFlags )	!=	xF22	)	||
1233cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F211"	), nFlags )	!=	xF211	)	||
1234cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F212"	), nFlags )	!=	xF212	)	||
1235cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F2111"	), nFlags )	!=	xF2111	)	||
1236cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F2112"	), nFlags )	!=	xF2112	)	||
1237cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F2121"	), nFlags )	!=	xF2121	)	||
1238cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F2122"	), nFlags )	!=	xF2122	)	||
1239cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21111"	), nFlags )	!=	xF21111	)	||
1240cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21112"	), nFlags )	!=	xF21112	)	||
1241cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21121"	), nFlags )	!=	xF21121	)	||
1242cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21122"	), nFlags )	!=	xF21122	)	||
1243cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21211"	), nFlags )	!=	xF21211	)	||
1244cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21212"	), nFlags )	!=	xF21212	)	||
1245cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21221"	), nFlags )	!=	xF21221	)	||
1246cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F21222"	), nFlags )	!=	xF21222	)	||
1247cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F221"	), nFlags )	!=	xF221	)	||
1248cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F2211"	), nFlags )	!=	xF2211	)	||
1249cdf0e10cSrcweir 			( xD->findFrame( DECLARE_ASCII("F22111"	), nFlags )	!=	xF22111	)
1250cdf0e10cSrcweir 		)
1251cdf0e10cSrcweir 	{
1252cdf0e10cSrcweir 		LOG_ERROR( "TestApplikation::impl_testTreeSearch()", "flat down search failed" )
1253cdf0e10cSrcweir 		return sal_False;
1254cdf0e10cSrcweir 	}
1255cdf0e10cSrcweir 
1256cdf0e10cSrcweir 	// Test deep up search
1257cdf0e10cSrcweir 	// All targets must be found. Control search steps in log files!
1258cdf0e10cSrcweir 	nFlags = FrameSearchFlag::PARENT;
1259cdf0e10cSrcweir 	if	(
1260cdf0e10cSrcweir 			( xF11->findFrame	( DECLARE_ASCII("T1"), nFlags )	!=	xT1	)	||	// search for valid targets
1261cdf0e10cSrcweir 			( xF12->findFrame	( DECLARE_ASCII("T1"), nFlags )	!=	xT1	)	||
1262cdf0e10cSrcweir 			( xF21->findFrame	( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1263cdf0e10cSrcweir 			( xF22->findFrame	( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1264cdf0e10cSrcweir 			( xF211->findFrame	( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1265cdf0e10cSrcweir 			( xF212->findFrame	( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1266cdf0e10cSrcweir 			( xF221->findFrame	( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1267cdf0e10cSrcweir 			( xF2111->findFrame	( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1268cdf0e10cSrcweir 			( xF2121->findFrame	( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1269cdf0e10cSrcweir 			( xF2122->findFrame	( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1270cdf0e10cSrcweir 			( xF2211->findFrame	( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1271cdf0e10cSrcweir 			( xF21111->findFrame( DECLARE_ASCII("T2"), nFlags )	!=	xT2 )	||
1272cdf0e10cSrcweir 			( xF21112->findFrame( DECLARE_ASCII("T2"), nFlags )	!=	xT2 )	||
1273cdf0e10cSrcweir 			( xF21121->findFrame( DECLARE_ASCII("T2"), nFlags )	!=	xT2 )	||
1274cdf0e10cSrcweir 			( xF21122->findFrame( DECLARE_ASCII("T2"), nFlags )	!=	xT2 )	||
1275cdf0e10cSrcweir 			( xF21211->findFrame( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1276cdf0e10cSrcweir 			( xF21212->findFrame( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1277cdf0e10cSrcweir 			( xF21221->findFrame( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1278cdf0e10cSrcweir 			( xF21222->findFrame( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1279cdf0e10cSrcweir 			( xF22111->findFrame( DECLARE_ASCII("T2"), nFlags )	!=	xT2	)	||
1280cdf0e10cSrcweir 			( xF11->findFrame	( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||	// search for existing but non valid targets
1281cdf0e10cSrcweir 			( xF12->findFrame	( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1282cdf0e10cSrcweir 			( xF21->findFrame	( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1283cdf0e10cSrcweir 			( xF22->findFrame	( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1284cdf0e10cSrcweir 			( xF211->findFrame	( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1285cdf0e10cSrcweir 			( xF212->findFrame	( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1286cdf0e10cSrcweir 			( xF221->findFrame	( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1287cdf0e10cSrcweir 			( xF2111->findFrame	( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1288cdf0e10cSrcweir 			( xF2121->findFrame	( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1289cdf0e10cSrcweir 			( xF2122->findFrame	( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1290cdf0e10cSrcweir 			( xF2211->findFrame	( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1291cdf0e10cSrcweir 			( xF21111->findFrame( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1292cdf0e10cSrcweir 			( xF21112->findFrame( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1293cdf0e10cSrcweir 			( xF21121->findFrame( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1294cdf0e10cSrcweir 			( xF21122->findFrame( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1295cdf0e10cSrcweir 			( xF21211->findFrame( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1296cdf0e10cSrcweir 			( xF21212->findFrame( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1297cdf0e10cSrcweir 			( xF21221->findFrame( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1298cdf0e10cSrcweir 			( xF21222->findFrame( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)	||
1299cdf0e10cSrcweir 			( xF22111->findFrame( DECLARE_ASCII("T3"), nFlags ).is()	==	sal_True	)
1300cdf0e10cSrcweir 		)
1301cdf0e10cSrcweir 	{
1302cdf0e10cSrcweir 		LOG_ERROR( "TestApplikation::impl_testTreeSearch()", "deep up search failed" )
1303cdf0e10cSrcweir 		return sal_False;
1304cdf0e10cSrcweir 	}
1305cdf0e10cSrcweir 
1306cdf0e10cSrcweir 	// Test inside/outside tasks search
1307*07a3d7f1SPedro Giffuni 	// No frames outside current task should be found if TASKS flag isn't set.
1308cdf0e10cSrcweir 	// Otherwise he must be found!
1309cdf0e10cSrcweir 	if	(
1310cdf0e10cSrcweir 			( xF21211->findFrame( DECLARE_ASCII("F12"	),	FrameSearchFlag::ALL								)		== xF12		)	||
1311cdf0e10cSrcweir 			( xF21211->findFrame( DECLARE_ASCII("F22111"),	FrameSearchFlag::GLOBAL 							)		!= xF22111	)	||
1312cdf0e10cSrcweir 			( xF21211->findFrame( DECLARE_ASCII("T4"	),	FrameSearchFlag::GLOBAL | FrameSearchFlag::CREATE	).is()	== sal_False)
1313cdf0e10cSrcweir 		)
1314cdf0e10cSrcweir 	{
1315cdf0e10cSrcweir 		LOG_ERROR( "TestApplikation::impl_testTreeSearch()", "inside/outside task search failed" )
1316cdf0e10cSrcweir 		return sal_False;
1317cdf0e10cSrcweir 	}
1318cdf0e10cSrcweir 
1319cdf0e10cSrcweir 	// Test SELF
1320cdf0e10cSrcweir 	// Use the desktop, one task and one frame node to do that.
1321cdf0e10cSrcweir 	// The desktop must ignore these question ... all other must return himself.
1322cdf0e10cSrcweir 	LOG_ASSERT2( (xD->findFrame 	(	DECLARE_ASCII(""),	FrameSearchFlag::SELF	)	== xD	), "TestApplication::impl_testTreeSearch()", "SELF search for D failed\n"	)
1323cdf0e10cSrcweir 	LOG_ASSERT2( (xT1->findFrame	(	DECLARE_ASCII(""),	FrameSearchFlag::SELF	)	!= xT1	), "TestApplication::impl_testTreeSearch()", "SELF search for T1 failed\n"	)
1324cdf0e10cSrcweir 	LOG_ASSERT2( (xF12->findFrame	(	DECLARE_ASCII(""),	FrameSearchFlag::SELF	)	!= xF12	), "TestApplication::impl_testTreeSearch()", "SELF search for F12 failed\n"	)
1325cdf0e10cSrcweir 
1326cdf0e10cSrcweir 	// Test special task search at desktop
1327cdf0e10cSrcweir 	// These search allow TASKS and CREATE flags only!
1328cdf0e10cSrcweir 	// We make no deep search - we work on direct children of desktop only.
1329cdf0e10cSrcweir 	// Supported for desktop only.
1330cdf0e10cSrcweir 	LOG_ASSERT2( (xD->findFrame		(	DECLARE_ASCII("T1"),	FrameSearchFlag::TASKS								)		!= xT1			), "TestApplication::impl_testTreeSearch()", "special TASKS search for T1 failed\n"				)
1331cdf0e10cSrcweir 	LOG_ASSERT2( (xD->findFrame		(	DECLARE_ASCII("T2"),	FrameSearchFlag::TASKS								)		!= xT2			), "TestApplication::impl_testTreeSearch()", "special TASKS search for T2 failed\n"				)
1332cdf0e10cSrcweir 	LOG_ASSERT2( (xD->findFrame		(	DECLARE_ASCII("T3"),	FrameSearchFlag::TASKS								)		!= xT3			), "TestApplication::impl_testTreeSearch()", "special TASKS search for T3 failed\n"				)
1333cdf0e10cSrcweir 	// Attention: T4 was created before!
1334cdf0e10cSrcweir 	LOG_ASSERT2( (xD->findFrame		(	DECLARE_ASCII("T5"),	FrameSearchFlag::TASKS								).is()	== sal_True		), "TestApplication::impl_testTreeSearch()", "special TASKS search for T5 failed\n"				)
1335cdf0e10cSrcweir 	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"		)
1336cdf0e10cSrcweir 	LOG_ASSERT2( (xD->findFrame		(	DECLARE_ASCII("F12"),	FrameSearchFlag::TASKS								).is()	== sal_True		), "TestApplication::impl_testTreeSearch()", "special TASKS search for F12 failed\n"			)
1337cdf0e10cSrcweir 	LOG_ASSERT2( (xF12->findFrame	(	DECLARE_ASCII("T1"),	FrameSearchFlag::TASKS								).is()	== sal_True		), "TestApplication::impl_testTreeSearch()", "special TASKS search for T1 from F12 failed\n"	)
1338cdf0e10cSrcweir 	LOG_ASSERT2( (xF22111->findFrame(	DECLARE_ASCII("T1"),	FrameSearchFlag::TASKS								).is()	== sal_True		), "TestApplication::impl_testTreeSearch()", "special TASKS search for T1 from F22111 failed\n"	)
1339cdf0e10cSrcweir 
1340cdf0e10cSrcweir 	return sal_True;
1341cdf0e10cSrcweir }
1342cdf0e10cSrcweir #endif
1343