classicui_plat/hotkeys_api/tsrc/src/testsdkeikhkeyt.cpp
changeset 45 667edd0b8678
equal deleted inserted replaced
37:89c890c70182 45:667edd0b8678
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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:  test eikhkeyt.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /*
       
    21  * INCLUDE FILES
       
    22  */
       
    23 #include <stiftestinterface.h>
       
    24 #include <settingserverclient.h>
       
    25 #include <coemain.h>
       
    26 #include <e32property.h>
       
    27 
       
    28 #include "testsdkeikhkeyt.h"
       
    29 
       
    30 _LIT( KModuleName, "testsdkeikhkeyt.dll" );
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CTestSDKEIKHKEYT::CTestSDKEIKHKEYT
       
    36 // C++ default constructor can NOT contain any code, that
       
    37 // might leave.
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 CTestSDKEIKHKEYT::CTestSDKEIKHKEYT( 
       
    41     CTestModuleIf& aTestModuleIf ):
       
    42         CScriptBase( aTestModuleIf )
       
    43     {
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CTestSDKEIKHKEYT::ConstructL
       
    48 // Symbian 2nd phase constructor can leave.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 void CTestSDKEIKHKEYT::ConstructL()
       
    52     {
       
    53     RSettingServer settingServer;
       
    54     CleanupClosePushL( settingServer );
       
    55     TInt ret = settingServer.Connect();
       
    56     if(ret != KErrNone)
       
    57         {
       
    58         User::Leave(ret);
       
    59         }
       
    60     TLoggerSettings loggerSettings; 
       
    61     ret = settingServer.GetLoggerSettings(loggerSettings);
       
    62     if(ret != KErrNone)
       
    63         {
       
    64         User::Leave(ret);
       
    65         } 
       
    66     settingServer.Close();
       
    67     CleanupStack::PopAndDestroy( &settingServer );
       
    68 
       
    69     TFileName logFileName;
       
    70     
       
    71     if(loggerSettings.iAddTestCaseTitle)
       
    72         {
       
    73         TName title;
       
    74         TestModuleIf().GetTestCaseTitleL(title);
       
    75         logFileName.Format(KtestsdkeikhkeytLogFileWithTitle, &title);
       
    76         }
       
    77     else
       
    78         {
       
    79         logFileName.Copy(KtestsdkeikhkeytLogFile);
       
    80         }
       
    81 
       
    82     iLog = CStifLogger::NewL( KtestsdkeikhkeytLogPath, 
       
    83                           logFileName,
       
    84                           CStifLogger::ETxt,
       
    85                           CStifLogger::EFile,
       
    86                           EFalse );
       
    87     iOffset = CCoeEnv::Static()->AddResourceFileL(_L("C:\\resource\\testsdkeikhkeyt.rsc"));
       
    88 
       
    89     SendTestClassVersion();
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CTestSDKEIKHKEYT::NewL
       
    94 // Two-phased constructor.
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 CTestSDKEIKHKEYT* CTestSDKEIKHKEYT::NewL( 
       
    98     CTestModuleIf& aTestModuleIf )
       
    99     {
       
   100     CTestSDKEIKHKEYT* self = new (ELeave) CTestSDKEIKHKEYT( aTestModuleIf );
       
   101 
       
   102     CleanupStack::PushL( self );
       
   103     self->ConstructL();
       
   104     CleanupStack::Pop( self );
       
   105 
       
   106     return self;
       
   107 
       
   108     }
       
   109 
       
   110 CTestSDKEIKHKEYT::~CTestSDKEIKHKEYT()
       
   111     { 
       
   112 
       
   113     Delete();
       
   114 
       
   115     delete iLog; 
       
   116 
       
   117     CCoeEnv::Static()->DeleteResourceFile( iOffset );
       
   118     }
       
   119 
       
   120 //-----------------------------------------------------------------------------
       
   121 // CTestSDKEIKHKEYT::SendTestClassVersion
       
   122 // Method used to send version of test class
       
   123 //-----------------------------------------------------------------------------
       
   124 //
       
   125 void CTestSDKEIKHKEYT::SendTestClassVersion()
       
   126     {
       
   127     TVersion moduleVersion;
       
   128     moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   129     moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   130     moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   131     
       
   132     TFileName moduleName;
       
   133     moduleName = KModuleName;
       
   134     
       
   135     TBool newVersionOfMethod = ETrue;
       
   136     TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   137     }
       
   138 
       
   139 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // LibEntryL is a polymorphic Dll entry point.
       
   143 // Returns: CScriptBase: New CScriptBase derived object
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 EXPORT_C CScriptBase* LibEntryL( 
       
   147     CTestModuleIf& aTestModuleIf )
       
   148     {
       
   149 
       
   150     return ( CScriptBase* ) CTestSDKEIKHKEYT::NewL( aTestModuleIf );
       
   151 
       
   152     }
       
   153 
       
   154 /*
       
   155  * End of File
       
   156  */