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