mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/src/ui_mpxViewUtilityTest.cpp
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     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:  ui_mpxViewUtilityTestimplemetation for STIF Test Framework TestScripter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <Stiftestinterface.h>
       
    22 #include "ui_mpxViewUtilityTest.h"
       
    23 #include <SettingServerClient.h>
       
    24 
       
    25 
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // Cui_mpxViewUtilityTest::Cui_mpxViewUtilityTest
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 Cui_mpxViewUtilityTest::Cui_mpxViewUtilityTest( 
       
    36     CTestModuleIf& aTestModuleIf ):
       
    37         CScriptBase( aTestModuleIf )
       
    38     {
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // Cui_mpxViewUtilityTest::ConstructL
       
    43 // Symbian 2nd phase constructor can leave.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 void Cui_mpxViewUtilityTest::ConstructL()
       
    47     {
       
    48     //Read logger settings to check whether test case name is to be
       
    49     //appended to log file name.
       
    50     RSettingServer settingServer;
       
    51     TInt ret = settingServer.Connect();
       
    52     if(ret != KErrNone)
       
    53         {
       
    54         User::Leave(ret);
       
    55         }
       
    56     // Struct to StifLogger settigs.
       
    57     TLoggerSettings loggerSettings; 
       
    58     // Parse StifLogger defaults from STIF initialization file.
       
    59     ret = settingServer.GetLoggerSettings(loggerSettings);
       
    60     if(ret != KErrNone)
       
    61         {
       
    62         User::Leave(ret);
       
    63         } 
       
    64     // Close Setting server session
       
    65     settingServer.Close();
       
    66 
       
    67     TFileName logFileName;
       
    68     
       
    69     if(loggerSettings.iAddTestCaseTitle)
       
    70         {
       
    71         TName title;
       
    72         TestModuleIf().GetTestCaseTitleL(title);
       
    73         logFileName.Format(Kui_mpxViewUtilityTestLogFileWithTitle, &title);
       
    74         }
       
    75     else
       
    76         {
       
    77         logFileName.Copy(Kui_mpxViewUtilityTestLogFile);
       
    78         }
       
    79 
       
    80     iLog = CStifLogger::NewL( Kui_mpxViewUtilityTestLogPath, 
       
    81                           logFileName,
       
    82                           CStifLogger::ETxt,
       
    83                           CStifLogger::EFile,
       
    84                           EFalse );
       
    85     
       
    86     SendTestClassVersion();
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // Cui_mpxViewUtilityTest::NewL
       
    91 // Two-phased constructor.
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 Cui_mpxViewUtilityTest* Cui_mpxViewUtilityTest::NewL( 
       
    95     CTestModuleIf& aTestModuleIf )
       
    96     {
       
    97     Cui_mpxViewUtilityTest* self = new (ELeave) Cui_mpxViewUtilityTest( aTestModuleIf );
       
    98 
       
    99     CleanupStack::PushL( self );
       
   100     self->ConstructL();
       
   101     CleanupStack::Pop();
       
   102 
       
   103     return self;
       
   104 
       
   105     }
       
   106 
       
   107 // Destructor
       
   108 Cui_mpxViewUtilityTest::~Cui_mpxViewUtilityTest()
       
   109     { 
       
   110 
       
   111     // Delete resources allocated from test methods
       
   112     Delete();
       
   113   /*  if( iMPXViewUtility != NULL )
       
   114     	{
       
   115     	 delete iMPXViewUtility;
       
   116     	 iMPXViewUtility = NULL;
       
   117     	}
       
   118 */
       
   119 //    iMPXViewUtility->Close();
       
   120     // Delete logger
       
   121     delete iLog; 
       
   122 
       
   123     }
       
   124 
       
   125 //-----------------------------------------------------------------------------
       
   126 // Cui_mpxViewUtilityTest::SendTestClassVersion
       
   127 // Method used to send version of test class
       
   128 //-----------------------------------------------------------------------------
       
   129 //
       
   130 void Cui_mpxViewUtilityTest::SendTestClassVersion()
       
   131 	{
       
   132 	TVersion moduleVersion;
       
   133 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   134 	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   135 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   136 	
       
   137 	TFileName moduleName;
       
   138 	moduleName = _L("ui_mpxViewUtilityTest.dll");
       
   139 
       
   140 	TBool newVersionOfMethod = ETrue;
       
   141 	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   142 	}
       
   143 
       
   144 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // LibEntryL is a polymorphic Dll entry point.
       
   148 // Returns: CScriptBase: New CScriptBase derived object
       
   149 // -----------------------------------------------------------------------------
       
   150 //
       
   151 EXPORT_C CScriptBase* LibEntryL( 
       
   152     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   153     {
       
   154 
       
   155     return ( CScriptBase* ) Cui_mpxViewUtilityTest::NewL( aTestModuleIf );
       
   156 
       
   157     }
       
   158 
       
   159 
       
   160 //  End of File