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