localconnectivityservice/lcstylustap/tsrc/LcStylusTapTest/src/LcStylusTapTest.cpp
branchRCL_3
changeset 39 4096754ee773
parent 38 3dcb815346df
child 40 52a167391590
equal deleted inserted replaced
38:3dcb815346df 39:4096754ee773
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <Stiftestinterface.h>
       
    23 #include "LcStylusTapTest.h"
       
    24 #include <SettingServerClient.h>
       
    25 #include <ecom.h>
       
    26 //components headers
       
    27 #include <AknIndicatorPluginImplUIDs.hrh>
       
    28 
       
    29 
       
    30 // EXTERNAL DATA STRUCTURES
       
    31 //extern  ?external_data;
       
    32 
       
    33 // EXTERNAL FUNCTION PROTOTYPES  
       
    34 //extern ?external_function( ?arg_type,?arg_type );
       
    35 
       
    36 // CONSTANTS
       
    37 //const ?type ?constant_var = ?constant;
       
    38 
       
    39 // MACROS
       
    40 //#define ?macro ?macro_def
       
    41 
       
    42 // LOCAL CONSTANTS AND MACROS
       
    43 //const ?type ?constant_var = ?constant;
       
    44 //#define ?macro_name ?macro_def
       
    45 
       
    46 // MODULE DATA STRUCTURES
       
    47 //enum ?declaration
       
    48 //typedef ?declaration
       
    49 
       
    50 // LOCAL FUNCTION PROTOTYPES
       
    51 //?type ?function_name( ?arg_type, ?arg_type );
       
    52 
       
    53 // FORWARD DECLARATIONS
       
    54 //class ?FORWARD_CLASSNAME;
       
    55 
       
    56 // ============================= LOCAL FUNCTIONS ===============================
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // ?function_name ?description.
       
    60 // ?description
       
    61 // Returns: ?value_1: ?description
       
    62 //          ?value_n: ?description_line1
       
    63 //                    ?description_line2
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 /*
       
    67 ?type ?function_name(
       
    68     ?arg_type arg,  // ?description
       
    69     ?arg_type arg)  // ?description
       
    70     {
       
    71 
       
    72     ?code  // ?comment
       
    73 
       
    74     // ?comment
       
    75     ?code
       
    76     }
       
    77 */
       
    78 
       
    79 // ============================ MEMBER FUNCTIONS ===============================
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CLcStylusTapTest::CLcStylusTapTest
       
    83 // C++ default constructor can NOT contain any code, that
       
    84 // might leave.
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 CLcStylusTapTest::CLcStylusTapTest( 
       
    88     CTestModuleIf& aTestModuleIf ):
       
    89         CScriptBase( aTestModuleIf )
       
    90     {
       
    91     iTextType = 0;
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CLcStylusTapTest::ConstructL
       
    96 // Symbian 2nd phase constructor can leave.
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 void CLcStylusTapTest::ConstructL()
       
   100     {
       
   101     //Read logger settings to check whether test case name is to be
       
   102     //appended to log file name.
       
   103     RSettingServer settingServer;
       
   104     TInt ret = settingServer.Connect();
       
   105     if(ret != KErrNone)
       
   106         {
       
   107         User::Leave(ret);
       
   108         }
       
   109     // Struct to StifLogger settigs.
       
   110     TLoggerSettings loggerSettings; 
       
   111     // Parse StifLogger defaults from STIF initialization file.
       
   112     ret = settingServer.GetLoggerSettings(loggerSettings);
       
   113     if(ret != KErrNone)
       
   114         {
       
   115         User::Leave(ret);
       
   116         } 
       
   117     // Close Setting server session
       
   118     settingServer.Close();
       
   119 
       
   120     TFileName logFileName;
       
   121     
       
   122     if(loggerSettings.iAddTestCaseTitle)
       
   123         {
       
   124         TName title;
       
   125         TestModuleIf().GetTestCaseTitleL(title);
       
   126         logFileName.Format(KLcStylusTapTestLogFileWithTitle, &title);
       
   127         }
       
   128     else
       
   129         {
       
   130         logFileName.Copy(KLcStylusTapTestLogFile);
       
   131         }
       
   132 
       
   133     iLog = CStifLogger::NewL( KLcStylusTapTestLogPath, 
       
   134                           logFileName,
       
   135                           CStifLogger::ETxt,
       
   136                           CStifLogger::EFile,
       
   137                           EFalse );
       
   138     
       
   139     SendTestClassVersion();    
       
   140 		
       
   141     }
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // CLcStylusTapTest::NewL
       
   145 // Two-phased constructor.
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148 CLcStylusTapTest* CLcStylusTapTest::NewL( 
       
   149     CTestModuleIf& aTestModuleIf )
       
   150     {
       
   151     CLcStylusTapTest* self = new (ELeave) CLcStylusTapTest( aTestModuleIf );
       
   152 
       
   153     CleanupStack::PushL( self );
       
   154     self->ConstructL();
       
   155     CleanupStack::Pop();
       
   156 
       
   157     return self;
       
   158 
       
   159     }
       
   160 
       
   161 // Destructor
       
   162 CLcStylusTapTest::~CLcStylusTapTest()
       
   163     { 
       
   164     // Delete resources allocated from test methods
       
   165     Delete();
       
   166 
       
   167     if(iLcStylusTap)
       
   168     	delete iLcStylusTap;
       
   169 	iLcStylusTap = NULL;
       
   170 
       
   171     
       
   172     //if(REComSession::GetImplementationUidL(iDtor_Key) != TUid::Null())
       
   173     //	REComSession::DestroyedImplementation(iDtor_Key);
       
   174     
       
   175     REComSession::FinalClose();
       
   176     
       
   177     STIF_LOG("<<~CLcStylusTapTest");
       
   178     // Delete logger
       
   179     delete iLog; 
       
   180     }
       
   181 
       
   182 //-----------------------------------------------------------------------------
       
   183 // CLcStylusTapTest::SendTestClassVersion
       
   184 // Method used to send version of test class
       
   185 //-----------------------------------------------------------------------------
       
   186 //
       
   187 void CLcStylusTapTest::SendTestClassVersion()
       
   188 	{
       
   189 	TVersion moduleVersion;
       
   190 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   191 	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   192 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   193 	
       
   194 	TFileName moduleName;
       
   195 	moduleName = _L("LcStylusTapTest.dll");
       
   196 
       
   197 	TBool newVersionOfMethod = ETrue;
       
   198 	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   199 	}
       
   200 
       
   201 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   202 
       
   203 // -----------------------------------------------------------------------------
       
   204 // LibEntryL is a polymorphic Dll entry point.
       
   205 // Returns: CScriptBase: New CScriptBase derived object
       
   206 // -----------------------------------------------------------------------------
       
   207 //
       
   208 EXPORT_C CScriptBase* LibEntryL( 
       
   209     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   210     {
       
   211 
       
   212     return ( CScriptBase* ) CLcStylusTapTest::NewL( aTestModuleIf );
       
   213 
       
   214     }
       
   215 
       
   216 
       
   217 //  End of File