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