locsrv_plat/map_image_conversion_plugin_api/tsrc/src/testmapimgconpluginapi.cpp
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     1 /*
       
     2 * Copyright (c) 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:  Ctestmapimgconpluginapi class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <Stiftestinterface.h>
       
    22 #include "testmapimgconpluginapi.h"
       
    23 #include <SettingServerClient.h>
       
    24 
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // Ctestmapimgconpluginapi::Ctestmapimgconpluginapi
       
    30 // C++ default constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 Ctestmapimgconpluginapi::Ctestmapimgconpluginapi( 
       
    35     CTestModuleIf& aTestModuleIf ):
       
    36         CScriptBase( aTestModuleIf )
       
    37     {
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // Ctestmapimgconpluginapi::ConstructL
       
    42 // Symbian 2nd phase constructor can leave.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 void Ctestmapimgconpluginapi::ConstructL()
       
    46     {
       
    47     //Read logger settings to check whether test case name is to be
       
    48     //appended to log file name.
       
    49     RSettingServer settingServer;
       
    50     TInt ret = settingServer.Connect();
       
    51     if(ret != KErrNone)
       
    52         {
       
    53         User::Leave(ret);
       
    54         }
       
    55     // Struct to StifLogger settigs.
       
    56     TLoggerSettings loggerSettings; 
       
    57     // Parse StifLogger defaults from STIF initialization file.
       
    58     ret = settingServer.GetLoggerSettings(loggerSettings);
       
    59     if(ret != KErrNone)
       
    60         {
       
    61         User::Leave(ret);
       
    62         } 
       
    63     // Close Setting server session
       
    64     settingServer.Close();
       
    65 
       
    66     TFileName logFileName;
       
    67     
       
    68     if(loggerSettings.iAddTestCaseTitle)
       
    69         {
       
    70         TName title;
       
    71         TestModuleIf().GetTestCaseTitleL(title);
       
    72         logFileName.Format(KtestmapimgconpluginapiLogFileWithTitle, &title);
       
    73         }
       
    74     else
       
    75         {
       
    76         logFileName.Copy(KtestmapimgconpluginapiLogFile);
       
    77         }
       
    78 
       
    79     iLog = CStifLogger::NewL( KtestmapimgconpluginapiLogPath, 
       
    80                           logFileName,
       
    81                           CStifLogger::ETxt,
       
    82                           CStifLogger::EFile,
       
    83                           EFalse );
       
    84 
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // Ctestmapimgconpluginapi::NewL
       
    89 // Two-phased constructor.
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 Ctestmapimgconpluginapi* Ctestmapimgconpluginapi::NewL( 
       
    93     CTestModuleIf& aTestModuleIf )
       
    94     {
       
    95     Ctestmapimgconpluginapi* self = new (ELeave) Ctestmapimgconpluginapi( aTestModuleIf );
       
    96 
       
    97     CleanupStack::PushL( self );
       
    98     self->ConstructL();
       
    99     CleanupStack::Pop();
       
   100 
       
   101     return self;
       
   102 
       
   103     }
       
   104 
       
   105 // Destructor
       
   106 Ctestmapimgconpluginapi::~Ctestmapimgconpluginapi()
       
   107     { 
       
   108 
       
   109     // Delete resources allocated from test methods
       
   110     Delete();
       
   111 
       
   112     // Delete logger
       
   113     delete iLog; 
       
   114 
       
   115     }
       
   116     
       
   117 
       
   118 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // LibEntryL is a polymorphic Dll entry point.
       
   122 // Returns: CScriptBase: New CScriptBase derived object
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 EXPORT_C CScriptBase* LibEntryL( 
       
   126     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   127     {
       
   128 
       
   129     return ( CScriptBase* ) Ctestmapimgconpluginapi::NewL( aTestModuleIf );
       
   130 
       
   131     }
       
   132 
       
   133 
       
   134 //  End of File