startupservices/startupanimation/tsrc/TSanimctrl/src/TSanimctrl.cpp
changeset 77 b01c07dfcf84
equal deleted inserted replaced
74:1505405bc645 77:b01c07dfcf84
       
     1 /*
       
     2 * Copyright (c) 2009 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: This file contains testclass implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <StifTestInterface.h>
       
    20 #include "TSanimctrl.h"
       
    21 #include <SettingServerClient.h>
       
    22 
       
    23 const TInt KTestRepository( 0x0AA0151E ); // Repository to use for testing
       
    24 #include "sanimmockview.h"
       
    25 #include "sanimctrlrootsuite.h"
       
    26 
       
    27 
       
    28 // EXTERNAL DATA STRUCTURES
       
    29 //extern  ?external_data;
       
    30 
       
    31 // EXTERNAL FUNCTION PROTOTYPES  
       
    32 //extern ?external_function( ?arg_type,?arg_type );
       
    33 
       
    34 // CONSTANTS
       
    35 //const ?type ?constant_var = ?constant;
       
    36 
       
    37 // MACROS
       
    38 //#define ?macro ?macro_def
       
    39 
       
    40 // LOCAL CONSTANTS AND MACROS
       
    41 //const ?type ?constant_var = ?constant;
       
    42 //#define ?macro_name ?macro_def
       
    43 
       
    44 // MODULE DATA STRUCTURES
       
    45 //enum ?declaration
       
    46 //typedef ?declaration
       
    47 
       
    48 // LOCAL FUNCTION PROTOTYPES
       
    49 //?type ?function_name( ?arg_type, ?arg_type );
       
    50 
       
    51 // FORWARD DECLARATIONS
       
    52 //class ?FORWARD_CLASSNAME;
       
    53 
       
    54 // ============================= LOCAL FUNCTIONS ===============================
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // ?function_name ?description.
       
    58 // ?description
       
    59 // Returns: ?value_1: ?description
       
    60 //          ?value_n: ?description_line1
       
    61 //                    ?description_line2
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 /*
       
    65 ?type ?function_name(
       
    66     ?arg_type arg,  // ?description
       
    67     ?arg_type arg)  // ?description
       
    68     {
       
    69 
       
    70     ?code  // ?comment
       
    71 
       
    72     // ?comment
       
    73     ?code
       
    74     }
       
    75 */
       
    76 
       
    77 // ============================ MEMBER FUNCTIONS ===============================
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CTSanimctrl::CTSanimctrl
       
    81 // C++ default constructor can NOT contain any code, that
       
    82 // might leave.
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 CTSanimctrl::CTSanimctrl( 
       
    86     CTestModuleIf& aTestModuleIf,CSAnimMockView& view ):
       
    87         CScriptBase( aTestModuleIf ),
       
    88         iView(view)
       
    89     {
       
    90     
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CTSanimctrl::ConstructL
       
    95 // Symbian 2nd phase constructor can leave.
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 void CTSanimctrl::ConstructL()
       
    99     {
       
   100     //Read logger settings to check whether test case name is to be
       
   101     //appended to log file name.
       
   102    // iView = CSAnimMockView::NewL();
       
   103     RSettingServer settingServer;
       
   104     TInt ret = settingServer.Connect();
       
   105     if(ret != KErrNone)
       
   106         {
       
   107         User::Leave(ret);
       
   108         }
       
   109     // Struct to StifLogger settigs.
       
   110     TLoggerSettings loggerSettings; 
       
   111     // Parse StifLogger defaults from STIF initialization file.
       
   112     ret = settingServer.GetLoggerSettings(loggerSettings);
       
   113     if(ret != KErrNone)
       
   114         {
       
   115         User::Leave(ret);
       
   116         } 
       
   117     // Close Setting server session
       
   118     settingServer.Close();
       
   119 
       
   120     TFileName logFileName;
       
   121     
       
   122     if(loggerSettings.iAddTestCaseTitle)
       
   123         {
       
   124         TName title;
       
   125         TestModuleIf().GetTestCaseTitleL(title);
       
   126         logFileName.Format(KTSanimctrlLogFileWithTitle, &title);
       
   127         }
       
   128     else
       
   129         {
       
   130         logFileName.Copy(KTSanimctrlLogFile);
       
   131         }
       
   132 
       
   133     iLog = CStifLogger::NewL( KTSanimctrlLogPath, 
       
   134                           logFileName,
       
   135                           CStifLogger::ETxt,
       
   136                           CStifLogger::EFile,
       
   137                           EFalse );
       
   138     
       
   139     SendTestClassVersion();
       
   140     iParams.iRepositoryUid = TUid::Uid( KTestRepository );
       
   141           iParams.iAnimationPathKey = 1;
       
   142           iParams.iFrameDelayKey = 2;
       
   143           iParams.iTonePathKey = 3;
       
   144           iParams.iVolumeKey = 4;
       
   145        
       
   146     }
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // CTSanimctrl::NewL
       
   150 // Two-phased constructor.
       
   151 // -----------------------------------------------------------------------------
       
   152 //
       
   153 CTSanimctrl* CTSanimctrl::NewL( 
       
   154     CTestModuleIf& aTestModuleIf,CSAnimMockView& aview )
       
   155     {
       
   156     CTSanimctrl* self = new (ELeave) CTSanimctrl( aTestModuleIf,aview );
       
   157    // CSAnimMockView *iView = CSAnimMockView::NewL();
       
   158     CleanupStack::PushL( self );
       
   159     self->ConstructL();
       
   160     CleanupStack::Pop();
       
   161 
       
   162     return self;
       
   163 
       
   164     }
       
   165 
       
   166 // Destructor
       
   167 CTSanimctrl::~CTSanimctrl()
       
   168     { 
       
   169 
       
   170     // Delete resources allocated from test methods
       
   171     Delete();
       
   172 
       
   173     // Delete logger
       
   174     delete iLog; 
       
   175 
       
   176     }
       
   177 
       
   178 //-----------------------------------------------------------------------------
       
   179 // CTSanimctrl::SendTestClassVersion
       
   180 // Method used to send version of test class
       
   181 //-----------------------------------------------------------------------------
       
   182 //
       
   183 void CTSanimctrl::SendTestClassVersion()
       
   184 	{
       
   185 	TVersion moduleVersion;
       
   186 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   187 	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   188 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   189 	
       
   190 	TFileName moduleName;
       
   191 	moduleName = _L("TSanimctrl.dll");
       
   192 
       
   193 	TBool newVersionOfMethod = ETrue;
       
   194 	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   195 	}
       
   196 
       
   197 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   198 
       
   199 // -----------------------------------------------------------------------------
       
   200 // LibEntryL is a polymorphic Dll entry point.
       
   201 // Returns: CScriptBase: New CScriptBase derived object
       
   202 // -----------------------------------------------------------------------------
       
   203 //
       
   204 EXPORT_C CScriptBase* LibEntryL( 
       
   205     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   206     {
       
   207     CSAnimCtrlRootSuite* rootSuite = CSAnimCtrlRootSuite::NewL();
       
   208     return ( CScriptBase* ) CTSanimctrl::NewL( aTestModuleIf ,rootSuite->MainView());
       
   209 
       
   210     }
       
   211 
       
   212 // End of File