loc_pub/landmarks_ui_addedit_api/tsrc/bc/bcapplmkeditor/src/bcapplmkaddedit.cpp
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2002 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:    LandmarkUi Content File
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 // INCLUDE FILES
       
    26 #include <Stiftestinterface.h>
       
    27 #include "BCAppLmkAddEdit.h"
       
    28 #include <SettingServerClient.h>
       
    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 // CBCAppLmkAddEdit::CBCAppLmkAddEdit
       
    83 // C++ default constructor can NOT contain any code, that
       
    84 // might leave.
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 CBCAppLmkAddEdit::CBCAppLmkAddEdit(
       
    88     CTestModuleIf& aTestModuleIf ):
       
    89         CScriptBase( aTestModuleIf )
       
    90     {
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CBCAppLmkAddEdit::ConstructL
       
    95 // Symbian 2nd phase constructor can leave.
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 void CBCAppLmkAddEdit::ConstructL()
       
    99     {
       
   100     //Read logger settings to check whether test case name is to be
       
   101     //appended to log file name.
       
   102     RSettingServer settingServer;
       
   103     TInt ret = settingServer.Connect();
       
   104     if(ret != KErrNone)
       
   105         {
       
   106         User::Leave(ret);
       
   107         }
       
   108     // Struct to StifLogger settigs.
       
   109     TLoggerSettings loggerSettings;
       
   110     // Parse StifLogger defaults from STIF initialization file.
       
   111     ret = settingServer.GetLoggerSettings(loggerSettings);
       
   112     if(ret != KErrNone)
       
   113         {
       
   114         User::Leave(ret);
       
   115         }
       
   116     // Close Setting server session
       
   117     settingServer.Close();
       
   118 
       
   119     TFileName logFileName;
       
   120 
       
   121     if(loggerSettings.iAddTestCaseTitle)
       
   122         {
       
   123         TName title;
       
   124         TestModuleIf().GetTestCaseTitleL(title);
       
   125         logFileName.Format(KBCAppLmkAddEditLogFileWithTitle, &title);
       
   126         }
       
   127     else
       
   128         {
       
   129         logFileName.Copy(KBCAppLmkAddEditLogFile);
       
   130         }
       
   131 
       
   132     iLog = CStifLogger::NewL( KBCAppLmkAddEditLogPath,
       
   133                           logFileName,
       
   134                           CStifLogger::ETxt,
       
   135                           CStifLogger::EFile,
       
   136                           EFalse );
       
   137 
       
   138     SendTestClassVersion();
       
   139     }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CBCAppLmkAddEdit::NewL
       
   143 // Two-phased constructor.
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 CBCAppLmkAddEdit* CBCAppLmkAddEdit::NewL(
       
   147     CTestModuleIf& aTestModuleIf )
       
   148     {
       
   149     CBCAppLmkAddEdit* self = new (ELeave) CBCAppLmkAddEdit( aTestModuleIf );
       
   150 
       
   151     CleanupStack::PushL( self );
       
   152     self->ConstructL();
       
   153     CleanupStack::Pop();
       
   154 
       
   155     return self;
       
   156 
       
   157     }
       
   158 
       
   159 // Destructor
       
   160 CBCAppLmkAddEdit::~CBCAppLmkAddEdit()
       
   161     {
       
   162 
       
   163     // Delete resources allocated from test methods
       
   164     Delete();
       
   165 
       
   166     // Delete logger
       
   167     delete iLog;
       
   168 
       
   169     }
       
   170 
       
   171 //-----------------------------------------------------------------------------
       
   172 // CBCAppLmkAddEdit::SendTestClassVersion
       
   173 // Method used to send version of test class
       
   174 //-----------------------------------------------------------------------------
       
   175 //
       
   176 void CBCAppLmkAddEdit::SendTestClassVersion()
       
   177 	{
       
   178 	TVersion moduleVersion;
       
   179 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   180 	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   181 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   182 
       
   183 	TFileName moduleName;
       
   184 	moduleName = _L("BCAppLmkAddEdit.dll");
       
   185 
       
   186 	TBool newVersionOfMethod = ETrue;
       
   187 	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   188 	}
       
   189 
       
   190 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   191 
       
   192 // -----------------------------------------------------------------------------
       
   193 // LibEntryL is a polymorphic Dll entry point.
       
   194 // Returns: CScriptBase: New CScriptBase derived object
       
   195 // -----------------------------------------------------------------------------
       
   196 //
       
   197 EXPORT_C CScriptBase* LibEntryL(
       
   198     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   199     {
       
   200 
       
   201     return ( CScriptBase* ) CBCAppLmkAddEdit::NewL( aTestModuleIf );
       
   202 
       
   203     }
       
   204 
       
   205 
       
   206 //  End of File