localconnectivityservice/lcstylustap/tsrc/LcStylusTapTest/inc/LcStylusTapTest.h
branchRCL_3
changeset 39 4096754ee773
parent 38 3dcb815346df
child 40 52a167391590
equal deleted inserted replaced
38:3dcb815346df 39:4096754ee773
     1 /*
       
     2 * Copyright (c) 2006 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:  Header file for LcStylusTapTest
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef LcStylusTapTest_H
       
    22 #define LcStylusTapTest_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <StifLogger.h>
       
    26 #include <TestScripterInternal.h>
       
    27 #include <StifTestModule.h>
       
    28 #include <TestclassAssert.h>
       
    29 #include <ecom.h>
       
    30 #include <AknIndicatorPlugin.h>
       
    31 #include "lcstylustap.h"
       
    32 
       
    33 // CONSTANTS
       
    34 //const ?type ?constant_var = ?constant;
       
    35 
       
    36 // MACROS
       
    37 //#define ?macro ?macro_def
       
    38 #define TEST_CLASS_VERSION_MAJOR 0
       
    39 #define TEST_CLASS_VERSION_MINOR 0
       
    40 #define TEST_CLASS_VERSION_BUILD 0
       
    41 
       
    42 #ifdef STIF_LOG
       
    43 #undef STIF_LOG
       
    44 #endif
       
    45 
       
    46 #define STIF_LOG( s )\
       
    47     {\
       
    48     TBuf<KMaxLogData> traceBuf;\
       
    49     traceBuf.Append( _L( "[STIF_LOG] " ) );\
       
    50     traceBuf.Append( _L( s ) );\
       
    51     iLog->Log( _L( s ) );\
       
    52     RDebug::Print( traceBuf );\
       
    53     }
       
    54 
       
    55 #define STIF_LOG1( s, v ) \
       
    56     {\
       
    57     TBuf<KMaxLogData> traceBuf;\
       
    58     traceBuf.Append( _L( "[STIF_LOG] " ) );\
       
    59     traceBuf.Append( _L( s ) );\
       
    60     iLog->Log( _L( s ), v );\
       
    61     RDebug::Print( traceBuf, v );\
       
    62     }
       
    63 
       
    64 #define STIF_LOG2( s, v1, v2 ) \
       
    65     {\
       
    66     TBuf<KMaxLogData> traceBuf;\
       
    67     traceBuf.Append( _L( "[STIF_LOG] " ) );\
       
    68     traceBuf.Append( _L( s ) );\
       
    69     iLog->Log( _L( s ), v1, v2 );\
       
    70     RDebug::Print( traceBuf, v1, v2 );\
       
    71     }
       
    72 
       
    73 #define STIF_LOG3( s, v1, v2, v3 ) \
       
    74     {\
       
    75     TBuf<KMaxLogData> traceBuf;\
       
    76     traceBuf.Append( _L( "[STIF_LOG] " ) );\
       
    77     traceBuf.Append( _L( s ) );\
       
    78     iLog->Log( _L( s ), v1, v2, v3 );\
       
    79     RDebug::Print( traceBuf, v1, v2, v3 );\
       
    80     }
       
    81 
       
    82 // Logging path
       
    83 _LIT( KLcStylusTapTestLogPath, "\\logs\\testframework\\LcStylusTapTest\\" );
       
    84 
       
    85 // Logging path for ATS - for phone builds comment this line
       
    86 //_LIT( KLcStylusTapTestLogPath, "e:\\testing\\stiflogs\\" ); 
       
    87 
       
    88 // Log file
       
    89 _LIT( KLcStylusTapTestLogFile, "LcStylusTapTest.txt" ); 
       
    90 _LIT( KLcStylusTapTestLogFileWithTitle, "LcStylusTapTest_[%S].txt" );
       
    91 
       
    92 // FUNCTION PROTOTYPES
       
    93 //?type ?function_name(?arg_list);
       
    94 
       
    95 // FORWARD DECLARATIONS
       
    96 //class ?FORWARD_CLASSNAME;
       
    97 class CLcStylusTapTest;
       
    98 class CLcStylusTap;
       
    99 
       
   100 // DATA TYPES
       
   101 //enum ?declaration
       
   102 
       
   103 enum TLcStylusTapTestResult
       
   104     {
       
   105     ETestCasePassed,
       
   106     ETestCaseFailed
       
   107     };
       
   108 
       
   109 //typedef ?declaration
       
   110 //extern ?data_type;
       
   111 
       
   112 // CLASS DECLARATION
       
   113 
       
   114 NONSHARABLE_CLASS( TLcStylusTapTestBlockParams )
       
   115     {
       
   116     public:
       
   117         TPtrC iTestBlockName;
       
   118         
       
   119         TPtrC iTestOption1;
       
   120         TPtrC iTestOption2;
       
   121         TPtrC iTestOption3;
       
   122         
       
   123         TInt iTestIntOption1;
       
   124         TInt iTestIntOption2;
       
   125         
       
   126         TChar iTestCharOption1;
       
   127         TChar iTestCharOption2;
       
   128     };
       
   129 
       
   130 /**
       
   131 *  CLcStylusTapTest test class for STIF Test Framework TestScripter.
       
   132 *  ?other_description_lines
       
   133 *
       
   134 *  @lib ?library
       
   135 *  @since ?Series60_version
       
   136 */
       
   137 NONSHARABLE_CLASS( CLcStylusTapTest ) : public CScriptBase
       
   138     {
       
   139     public:  // Constructors and destructor
       
   140 
       
   141         /**
       
   142         * Two-phased constructor.
       
   143         */
       
   144         static CLcStylusTapTest* NewL( CTestModuleIf& aTestModuleIf );
       
   145 
       
   146         /**
       
   147         * Destructor.
       
   148         */
       
   149         virtual ~CLcStylusTapTest();
       
   150 
       
   151     public: // New functions
       
   152 
       
   153         /**
       
   154         * ?member_description.
       
   155         * @since ?Series60_version
       
   156         * @param ?arg1 ?description
       
   157         * @return ?description
       
   158         */
       
   159         //?type ?member_function( ?type ?arg1 );
       
   160 
       
   161     public: // Functions from base classes
       
   162 
       
   163         /**
       
   164         * From CScriptBase Runs a script line.
       
   165         * @since ?Series60_version
       
   166         * @param aItem Script line containing method name and parameters
       
   167         * @return Symbian OS error code
       
   168         */
       
   169         virtual TInt RunMethodL( CStifItemParser& aItem );
       
   170 
       
   171     protected:  // New functions
       
   172 
       
   173         /**
       
   174         * ?member_description.
       
   175         * @since ?Series60_version
       
   176         * @param ?arg1 ?description
       
   177         * @return ?description
       
   178         */
       
   179         //?type ?member_function( ?type ?arg1 );
       
   180 
       
   181     protected:  // Functions from base classes
       
   182 
       
   183         /**
       
   184         * From ?base_class ?member_description
       
   185         */
       
   186         //?type ?member_function();
       
   187 
       
   188     private:
       
   189 
       
   190         /**
       
   191         * C++ default constructor.
       
   192         */
       
   193         CLcStylusTapTest( CTestModuleIf& aTestModuleIf );
       
   194 
       
   195         /**
       
   196         * By default Symbian 2nd phase constructor is private.
       
   197         */
       
   198         void ConstructL();
       
   199 
       
   200         // Prohibit copy constructor if not deriving from CBase.
       
   201         // ?classname( const ?classname& );
       
   202         // Prohibit assigment operator if not deriving from CBase.
       
   203         // ?classname& operator=( const ?classname& );
       
   204 
       
   205         /**
       
   206         * Frees all resources allocated from test methods.
       
   207         * @since ?Series60_version
       
   208         */
       
   209         void Delete();
       
   210 
       
   211         /**
       
   212         * Test methods are listed below. 
       
   213         */
       
   214 
       
   215         virtual TInt ExecuteApiTestBlock( CStifItemParser& aItem );
       
   216         virtual TInt ExecuteModuleTestBlock( CStifItemParser& aItem );
       
   217         virtual TInt ExecuteBranchTestBlock( CStifItemParser& aItem );
       
   218         
       
   219         /**
       
   220          * Method used to log version of test class
       
   221          */
       
   222         void SendTestClassVersion();
       
   223 
       
   224         //ADD NEW METHOD DEC HERE
       
   225         //[TestMethods] - Do not remove
       
   226 
       
   227         void GetTestBlockParamsL( CStifItemParser& aItem );
       
   228         
       
   229     	void DoExecuteApiTestBlockL( CStifItemParser& aItem, TLcStylusTapTestResult& aTestResult );    	
       
   230     	void DoExecuteModuleTestBlockL( CStifItemParser& aItem, TLcStylusTapTestResult& aTestResult );    
       
   231     	void DoExecuteBranchTestBlockL( CStifItemParser& aItem, TLcStylusTapTestResult& aTestResult );
       
   232     	
       
   233         void ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption, 
       
   234                  TInt aTestIntOption, TInt aTestCharOption, TLcStylusTapTestResult& aTestResult );
       
   235         
       
   236         //tests method
       
   237         void CreateLcStylusTapTestL( TPtrC aTestOption, TPtrC aTestSubOption, TLcStylusTapTestResult& aTestResult );
       
   238         
       
   239         void TextTapTestL( TPtrC aTestOption, TPtrC aTestSubOption, TLcStylusTapTestResult& aTestResult );
       
   240         
       
   241         void CallHandleIndicatorTapTestL( TPtrC aTestOption, TPtrC aTestSubOption, TLcStylusTapTestResult& aTestResult );
       
   242         
       
   243         //other methods
       
   244         TBool GetPluginImplementation(TInt aValue);        
       
   245         void DestroyImplementation();
       
   246         //cheks if TextL method of lcstylustap returns correct values 
       
   247         TInt CheckTextResult(TInt aValue, HBufC* &aMedia); 
       
   248 	
       
   249     public:     // Data
       
   250         // ?one_line_short_description_of_data
       
   251         //?data_declaration;
       
   252 
       
   253     protected:  // Data
       
   254         // ?one_line_short_description_of_data
       
   255         //?data_declaration;
       
   256 
       
   257     private:    // Data
       
   258         TLcStylusTapTestBlockParams iTestBlockParams;
       
   259         
       
   260         CLcStylusTap* iLcStylusTap;        
       
   261 
       
   262     	RImplInfoPtrArray   iPluginImpArray;
       
   263         TUid iDtor_Key;
       
   264 		TInt iTextType;		
       
   265         RImplInfoPtrArray iImplementations;
       
   266         
       
   267         // Reserved pointer for future extension
       
   268         //TAny* iReserved;
       
   269 
       
   270     public:     // Friend classes
       
   271         //?friend_class_declaration;
       
   272     protected:  // Friend classes
       
   273         //?friend_class_declaration;
       
   274     private:    // Friend classes
       
   275         //?friend_class_declaration;
       
   276         
       
   277     };
       
   278 
       
   279 #endif      // LcStylusTapTest_H
       
   280 
       
   281 // End of File