commonuisupport/uikon/test/tlibs/tloaddll/TLOADDLLV2.CPP
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // The following test case is used to test the loading of ECom plugin dll and print
       
    15 // a message on the screen if successfully loaded.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent - Internal Symbian test code
       
    22 */
       
    23 
       
    24 #include <eikenv.h>
       
    25 #include <ecom/implementationproxy.h>
       
    26 #include "contentmgr.h"
       
    27 #include "TLOADDLL.H"
       
    28 #include "TLoadDllV2.hrh"
       
    29 
       
    30 /**
       
    31    Constructor
       
    32  */
       
    33 CTestEikonEComDllLoading::CTestEikonEComDllLoading()
       
    34 	{
       
    35 	}
       
    36 
       
    37 /**
       
    38    Destructor
       
    39  */
       
    40 CTestEikonEComDllLoading::~CTestEikonEComDllLoading()
       
    41 	{
       
    42 	delete iContentManager;
       
    43 	}
       
    44 
       
    45 /**
       
    46    First phase constructor
       
    47  */
       
    48 EXPORT_C const CTestEikonEComDllLoading* CTestEikonEComDllLoading::NewL()
       
    49 	{
       
    50 	CTestEikonEComDllLoading* testDll=new(ELeave) CTestEikonEComDllLoading();
       
    51 
       
    52 	return testDll;
       
    53 	}
       
    54 
       
    55 /**
       
    56    Auxiliary function for all Test Cases
       
    57   
       
    58    The method is an override from CEikLibrary2 and 
       
    59    Sets up the variables needed by the eikenv.
       
    60    
       
    61  */
       
    62 void CTestEikonEComDllLoading::InitializeL()
       
    63 	{
       
    64 	CEikonEnv* env=CEikonEnv::Static();
       
    65 	iContentManager=CEikTestContentManager::NewL(env->FsSession());
       
    66 	env->AddPictureFactoryL(*iContentManager);
       
    67 	}
       
    68 
       
    69 /**
       
    70    Auxiliary function for all Test Cases
       
    71   
       
    72    The method is an override from CEikLibrary2 and 
       
    73    Returns the resource file used by this DLL.
       
    74    
       
    75  */
       
    76 CArrayFix<TFileName>* CTestEikonEComDllLoading::ResourceFileArrayL() const
       
    77 	{
       
    78 	CArrayFix<TFileName>* resFileArray = new(ELeave) CArrayFixFlat<TFileName>(1);
       
    79 	CleanupStack::PushL(resFileArray);
       
    80 	
       
    81 	resFileArray->AppendL(ResourceFile());
       
    82 	
       
    83 	CleanupStack::Pop(); // resFileArray
       
    84 	return resFileArray;
       
    85 	}
       
    86 
       
    87 /**
       
    88    Auxiliary function for all Test Cases
       
    89   
       
    90    The method is an override from CEikLibrary2 and 
       
    91    Returns DLL's control factory function.
       
    92    
       
    93  */
       
    94 CArrayFix<TCreateByTypeFunction>* CTestEikonEComDllLoading::ControlFactoryArrayL() const
       
    95 	{
       
    96 	CArrayFix<TCreateByTypeFunction>* ctrlFactoryArray = new(ELeave) CArrayFixFlat<TCreateByTypeFunction>(1);
       
    97 	CleanupStack::PushL(ctrlFactoryArray);
       
    98 
       
    99 	ctrlFactoryArray->AppendL(STATIC_CAST(TCreateByTypeFunction, CreateByTypeL));
       
   100 
       
   101 	CleanupStack::Pop(); // ctrlFactoryArray
       
   102 	return ctrlFactoryArray;
       
   103 	}
       
   104 
       
   105 /**
       
   106    Auxiliary function for all Test Cases
       
   107   
       
   108    Returns resource file name of the DLL.
       
   109    
       
   110  */
       
   111 TFileName CTestEikonEComDllLoading::ResourceFile() const
       
   112 	{
       
   113 	_LIT(KResFileName,"z:\\system\\test\\taddlib\\external.rsc");
       
   114 	TFileName resourceFile=KResFileName();
       
   115 	return resourceFile;
       
   116 	}
       
   117 
       
   118 /**
       
   119    Auxiliary function for CTestAutoContainer
       
   120   
       
   121    Creates a control specified by aControlType.
       
   122    
       
   123  */
       
   124 SEikControlInfo CTestEikonEComDllLoading::CreateByTypeL(TInt aControlType)
       
   125 	{	
       
   126 	SEikControlInfo controlInfo;
       
   127 	controlInfo.iControl = NULL;
       
   128 	controlInfo.iTrailerTextId = 0;
       
   129 	controlInfo.iFlags = 0;
       
   130 
       
   131     switch (aControlType)
       
   132         {
       
   133     case CTestEikDllLoadedLabel::ECtTestEikEComDllLoadedLabel:
       
   134 		controlInfo.iControl = new(ELeave) CTestEikDllLoadedLabel;
       
   135 		break;
       
   136 		}
       
   137 	return controlInfo;
       
   138 	}
       
   139 
       
   140 //Adding ECOM SUPPORT
       
   141 
       
   142 const TImplementationProxy ImplementationTable[] =
       
   143 	{
       
   144 	 IMPLEMENTATION_PROXY_ENTRY(KTLoadDllV2ImplUid,CTestEikonEComDllLoading::NewL)
       
   145 	};
       
   146 
       
   147 /**
       
   148    Returns a pointer to an array of TImplementationProxy objects containing a UID 
       
   149    and a funcion pointer.
       
   150   
       
   151    @param aTableCount number of items in the array.
       
   152    
       
   153    @return pointer to an array of TImplementationProxy objects.
       
   154  */
       
   155 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   156 	{
       
   157 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy) ;
       
   158 	return ImplementationTable;
       
   159 	}
       
   160 
       
   161 //
       
   162 // END OF FILE
       
   163 //