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