uiacceltk/hitchcock/CommonInc/alfmoduletest.h
changeset 19 f5bac0badc7e
parent 14 83d2d132aa58
child 25 f7f1ae431f74
child 27 70e659bb284f
equal deleted inserted replaced
14:83d2d132aa58 19:f5bac0badc7e
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description: 
    14 * Description: 
    15 *
    15 *
    16 */
    16 */
    17 #include "e32base.h"
       
    18 #include "e32debug.h"
       
    19 
       
    20 #ifndef ALFMODULETEST_H
    17 #ifndef ALFMODULETEST_H
    21 #define ALFMODULETEST_H
    18 #define ALFMODULETEST_H
    22 
    19 
    23 // Define this to build module testing enchanced version of ALF
    20 
    24 //#define USE_MODULE_TEST_HOOKS_FOR_ALF 
    21 #include <e32base.h>
    25 
    22 #include <graphics/surface.h>
    26 #if !defined(USE_MODULE_TEST_HOOKS_FOR_ALF) || !defined(AMT_CONTROL)
    23 #include <e32debug.h>
    27 
    24 
    28 #define AMT_DATA()
    25 // Informs if module test hooks have been set on.
    29 #define AMT_FUNC(func)                                
    26 #include "alfmoduletestconf.h"
    30 #define AMT_FUNC_EXC(func)
    27 
    31 #define AMT_FUNC_EXC_RET(ret, func)
    28 // Provides module test hooks defines.
    32 #define AMT_FUNC_EXC_IF(cond, func)
    29 #include "alfmoduletestdefines.h"
    33 #define AMT_FUNC_EXC_IF_RET(cond, ret, func)
    30 
    34 #define AMT_INC_COUNTER(member)
    31 
    35 #define AMT_DEC_COUNTER(member)
    32 #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
    36 #define AMT_SET_VALUE(member, val)
    33 
    37 #define AMT_GET_VALUE(x, member)
    34 // *** Test map classes
    38 #define AMT_INC_COUNTER_IF(cond, member)
    35 #include "alfmoduletesttype.h"
    39 #define AMT_DEC_COUNTER_IF(cond, member)
    36 #include "alfmoduletestitem.h"
    40 #define AMT_SET_VALUE_IF(cond, member, val)
    37 #include "alfmoduletestmap.h"
    41 #define AMT_GET_VALUE_IF(cond, x, member)
    38 
    42 
       
    43 #define AMT_MAP_APPEND(memberMap, key, type, defaultValue)          
       
    44 #define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type)     
       
    45 #define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type)            
       
    46 #define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type)            
       
    47 #define AMT_MAP_SET_VALUE(memberMap, key, value, type)              
       
    48 #define AMT_MAP_INC_VALUE(memberMap, key, type)                              
       
    49 #define AMT_MAP_DEC_VALUE(memberMap, key, type)                     
       
    50 #define AMT_MAP_RESET(memberMap)                                    
       
    51 
       
    52 #define AMT_PRINT_STATE()
       
    53 
       
    54 #ifndef AMT_CONTROL
       
    55 #error "Error: you need to define AMT_CONTROL macro in your code to be able to use ALF module test system!"
       
    56 // The user have to define AMT_CONTROL, e.g. like this:
       
    57 // #define AMT_CONTROL() static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
       
    58 // or
       
    59 // #define AMT_CONTROL() iMyModuleTestDataControl
       
    60 // etc.
       
    61 #endif
       
    62 
       
    63 #else
       
    64 
       
    65 
       
    66 //  *** Use these macros to access global memory chunk
       
    67 
       
    68 
       
    69 // Note: If you read/write a large block of data members, it is advisable not use the AMT_FUNC_EXC() based macros below. 
       
    70 //       Use Lock() and Unlock() around the block explicitely, and use AMT_FUNC() macro.
       
    71 //       That is to avoid unnecessary nested lock-unlock sequences (even if nested locks are working ok).
       
    72 
       
    73 // Note: Be careful not to lock the the mutex for a long time as it will halt other processes if they are using the lock during that time!
       
    74 
       
    75 // Generic macros
       
    76 #define AMT_DATA()                  AMT_CONTROL()->iModuleTestData
       
    77 #define AMT_FUNC(func)              if (AMT_DATA()->iIsEnabled) {func;}                                         
       
    78 #define AMT_FUNC_EXC(func)          {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {func;} AMT_CONTROL()->Unlock();}
       
    79 #define AMT_FUNC_EXC_RET(ret, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {ret = func;} AMT_CONTROL()->Unlock();}
       
    80 #define AMT_FUNC_EXC_IF(cond, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {func;} AMT_CONTROL()->Unlock();}        
       
    81 #define AMT_FUNC_EXC_IF_RET(cond, ret, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {ret = func;} AMT_CONTROL()->Unlock();}
       
    82 
       
    83 // Single operation macros, that will do lock/unlock.
       
    84 #define AMT_INC_COUNTER(member)     AMT_FUNC_EXC(AMT_DATA()->member++)
       
    85 #define AMT_DEC_COUNTER(member)     AMT_FUNC_EXC(AMT_DATA()->member--)
       
    86 #define AMT_SET_VALUE(member, val)  AMT_FUNC_EXC(AMT_DATA()->member=(val))
       
    87 #define AMT_GET_VALUE(x, member)    AMT_FUNC_EXC((x) = AMT_DATA()->member)
       
    88 #define AMT_PRINT_STATE()           AMT_FUNC_EXC(AMT_DATA()->PrintState())
       
    89 
       
    90 // Conditional single operation macros, that will do lock/unlock.
       
    91 #define AMT_INC_COUNTER_IF(cond, member)    AMT_FUNC_EXC_IF((cond), AMT_DATA()->member++)
       
    92 #define AMT_DEC_COUNTER_IF(cond, member)    AMT_FUNC_EXC_IF((cond), AMT_DATA()->member--)
       
    93 #define AMT_SET_VALUE_IF(cond, member, val) AMT_FUNC_EXC_IF((cond), AMT_DATA()->member=(val))
       
    94 #define AMT_GET_VALUE_IF(cond, x, member)   AMT_FUNC_EXC_IF((cond), (x) = AMT_DATA()->member)
       
    95 
       
    96 // Map operation macros, that will do lock/unlock
       
    97 #define AMT_MAP_APPEND(memberMap, key, type, defaultValue)          AMT_FUNC_EXC(AMT_DATA()->memberMap.Append(key, type, defaultValue))
       
    98 #define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type)     AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.SetValue(key, value, type))
       
    99 #define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type)            AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.Find(key, type)), AMT_DATA()->memberMap.SetValue(key, AMT_DATA()->memberMap.Find(key, type)->Value() + 1, type))
       
   100 #define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type)            AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.Find(key, type)), AMT_DATA()->memberMap.SetValue(key, AMT_DATA()->memberMap.Find(key, type)->Value() - 1, type))
       
   101 #define AMT_MAP_SET_VALUE(memberMap, key, value, type)              AMT_FUNC_EXC_IF(ETrue, AMT_DATA()->memberMap.SetValue(key, value, type))
       
   102 #define AMT_MAP_INC_VALUE(memberMap, key, type)                     AMT_MAP_INC_VALUE_IF(ETrue, memberMap, key, type)              
       
   103 #define AMT_MAP_DEC_VALUE(memberMap, key, type)                     AMT_MAP_DEC_VALUE_IF(ETrue, memberMap, key, type)
       
   104 #define AMT_MAP_RESET(memberMap)                                    AMT_FUNC_EXC(AMT_DATA()->memberMap.Reset())
       
   105 
    39 
   106 // *** Global object names
    40 // *** Global object names
   107 _LIT(KAlfModuleTestChunkName, "ALF_MODULE_TEST_CHUNK");
    41 _LIT(KAlfModuleTestChunkName, "ALF_MODULE_TEST_CHUNK");
   108 _LIT(KAlfModuleTestMutexName, "ALF_MODULE_TEST_MUTEX");
    42 _LIT(KAlfModuleTestMutexName, "ALF_MODULE_TEST_MUTEX");
   109 
    43 
   110 
    44 
   111 /**
       
   112  * TAlfModuleTestType specifies recognized test types.
       
   113  */
       
   114 enum TAlfModuleTestType
       
   115     {
       
   116     // Do not use this value when creating item.
       
   117     EAlfModuleTestTypeNone,
       
   118     
       
   119     // Render stage component specific tests
       
   120     EAlfModuleTestTypeRenderStageChangeSize,
       
   121     EAlfModuleTestTypeRenderStageChangePosition,
       
   122     EAlfModuleTestTypeRenderStageChangeFlag,
       
   123     
       
   124     // Streamer hierarchy model component specific tests
       
   125     EAlfModuleTestTypeHierarchyModelChangeSize,
       
   126     EAlfModuleTestTypeHierarchyModelChangePosition,
       
   127     EAlfModuleTestTypeHierarchyModelChangeFlag,    
       
   128     
       
   129     // Server bridge component specific tests
       
   130     EAlfModuleTestTypeBridgeChangeSize,
       
   131     EAlfModuleTestTypeBridgeChangePosition,
       
   132     EAlfModuleTestTypeBridgeChangeFlag,
       
   133     
       
   134     // Do not use this value when creating item.
       
   135     // This is just meant for Find operations when all tests are accepted.
       
   136     EAlfModuleTestTypeAll
       
   137     };
       
   138 
       
   139 
       
   140 /**
       
   141  * CAlfModuleTestItem
       
   142  * 
       
   143  * Provides key-value pair that is used in TAlfModuleTestMap.
       
   144  */
       
   145 template< class T >
       
   146 NONSHARABLE_CLASS( TAlfModuleTestItem )
       
   147     {
       
   148     
       
   149 public:
       
   150 
       
   151     /**
       
   152      * Constructor to initialize variables.
       
   153      * 
       
   154      * @param aKey Key that identifies the item.
       
   155      *             In test cases this could be for example handle.
       
   156      * @param aTestType Defines for what this test item is meant for.
       
   157      */
       
   158     TAlfModuleTestItem( TInt aKey, const TAlfModuleTestType& aTestType, const T& aDefaultValue ):
       
   159         iKey( aKey ),
       
   160         iTestType( aTestType ),
       
   161         iValue( aDefaultValue ),
       
   162         iValueSetCount( 0 )
       
   163         {
       
   164         }
       
   165 
       
   166     
       
   167     /**
       
   168      * @param aObject Value to be compared.
       
   169      * @return ETrue if given object equals the value of this item.
       
   170      *         Else EFalse.
       
   171      */
       
   172     TBool Equals( const T& aValue, const TAlfModuleTestType& aTestType ) const
       
   173         {
       
   174         // Also, check that value has been set. If it has not been set,
       
   175         // then think objects as unequals.
       
   176         return ( iValueSetCount > 0 
       
   177                  && iValue == aValue 
       
   178                  && TestTypeMatch( aTestType ) );
       
   179         }
       
   180 
       
   181     
       
   182     /**
       
   183      * @return TInt Key that should be set during creation of this object.
       
   184      */
       
   185     TInt Key() const
       
   186         {
       
   187         return iKey;
       
   188         }
       
   189 
       
   190     /**
       
   191      * @see ValueSet to check if the value has already been set.
       
   192      * 
       
   193      * @return const T& Value that corresonds the key.
       
   194      */
       
   195     const T& Value() const
       
   196         {
       
   197         return iValue;
       
   198         }
       
   199     
       
   200     
       
   201     /**
       
   202      * @param aValue Value to be set for the key
       
   203      */
       
   204     void SetValue( const T& aValue )
       
   205         {
       
   206         iValue = aValue;
       
   207         ++iValueSetCount;
       
   208         }
       
   209 
       
   210     
       
   211     /**
       
   212      * @return TInt Informs how many times the value has been set. 
       
   213      */
       
   214     TInt ValueSetCount() const
       
   215         {
       
   216         return iValueSetCount;
       
   217         }
       
   218     
       
   219     /**
       
   220      * @return const TAlfModuleTestType& Defines what the test is for
       
   221      */
       
   222     const TAlfModuleTestType& TestType() const
       
   223         {
       
   224         return iTestType;
       
   225         }
       
   226 
       
   227     
       
   228     /**
       
   229      * @param aTestType
       
   230      * @return TBool ETrue if flag matches this item. Else EFalse.
       
   231      */
       
   232     TBool TestTypeMatch( const TAlfModuleTestType& aTestType ) const
       
   233         {
       
   234         return ( EAlfModuleTestTypeAll == aTestType
       
   235                  || iTestType == aTestType );
       
   236         }
       
   237 
       
   238     
       
   239     /**
       
   240      * Resets the item info
       
   241      */
       
   242     void Reset()
       
   243         {
       
   244         iValueSetCount = 0;
       
   245         }
       
   246 
       
   247     
       
   248 private: // data    
       
   249     
       
   250     TInt iKey;
       
   251     TAlfModuleTestType iTestType;    
       
   252     T iValue;
       
   253     TInt iValueSetCount;
       
   254     
       
   255     };
       
   256 
       
   257 
       
   258 /**
       
   259  * Class CAlfModuleTestMap
       
   260  * 
       
   261  * Provides map functionality for the key-value-pairs.
       
   262  * In test cases, this should most likely be used so, that 
       
   263  * first test case classes create items with certain keys, for example with handle values.
       
   264  * Then, define hooks are used in the code to update values that corresond the correct handles.
       
   265  * In the end, test case classes can check that items have correct values set and if the test
       
   266  * is passed.
       
   267  */
       
   268 template< class T >
       
   269 NONSHARABLE_CLASS( TAlfModuleTestMap )
       
   270     {
       
   271 public:
       
   272 
       
   273     // Maximum item count in the map
       
   274     static const TInt KMaxArrayCount = 50;
       
   275 
       
   276     
       
   277     /**
       
   278      * Constructor to initialize variables.
       
   279      */
       
   280     TAlfModuleTestMap():
       
   281         iCount( 0 ),
       
   282         iSetValueCallCount( 0 )
       
   283         {            
       
   284         }
       
   285 
       
   286     
       
   287     /**
       
   288      * @param aKey
       
   289      * @param aTestType Informs what type of test is accepted. Others are skipped.
       
   290      * @return T* Ownership is not transferred.
       
   291      *            NULL if item is not found.
       
   292      */
       
   293     TAlfModuleTestItem< T >* Find( TInt aKey, const TAlfModuleTestType& aTestType )
       
   294         {
       
   295         // Try to find the item corresponding the given key.
       
   296         for ( TInt i = 0; i < iCount; ++i )
       
   297             {
       
   298             TAlfModuleTestItem< T >& testItem( iArray[ i ] );
       
   299             if ( testItem.Key() == aKey
       
   300                  && testItem.TestTypeMatch( aTestType ) )
       
   301                 {
       
   302                 return &( testItem );
       
   303                 }
       
   304             }
       
   305         // Item corresponding the given key was not found.
       
   306         return NULL;
       
   307         }    
       
   308     
       
   309     
       
   310     /**
       
   311      * Function to append new item into the map.
       
   312      * 
       
   313      * @param aKey
       
   314      * @param aTestType Describes for what case the appended test item is created for.
       
   315      * @return TInt System wide error code.
       
   316      */    
       
   317     TInt Append( TInt aKey, const TAlfModuleTestType& aTestType, const T& aDefaultValue )
       
   318         {
       
   319         if ( iCount == KMaxArrayCount )
       
   320             {
       
   321             // Array already full.
       
   322             return KErrOverflow;
       
   323             }
       
   324         else if ( Find( aKey, aTestType ) )
       
   325             {
       
   326             // Key has already been inserted.
       
   327             return KErrAlreadyExists;
       
   328             }
       
   329         
       
   330         // Append new key value set into the array.
       
   331         iArray[ iCount ] = TAlfModuleTestItem< T >( aKey, aTestType, aDefaultValue );
       
   332         ++iCount;
       
   333         return KErrNone;        
       
   334         }
       
   335 
       
   336     
       
   337     /**
       
   338      * Sets the value for the item.
       
   339      * Item itself should already exist in the array before
       
   340      * setting its value here. See, Append function.
       
   341      * 
       
   342      * @param aKey
       
   343      * @param aValue
       
   344      * @return TInt System wide error code.
       
   345      */
       
   346     TInt SetValue( TInt aKey, const T& aValue, const TAlfModuleTestType& aTestType )
       
   347         {
       
   348         // Increase counter, because this function is called.
       
   349         ++iSetValueCallCount;
       
   350         TAlfModuleTestItem< T >* item( Find( aKey, aTestType ) );        
       
   351         if ( !item )
       
   352             {
       
   353             // Item was not found from the array.        
       
   354             return KErrNotFound;
       
   355             }        
       
   356         // Item exists. So, set its values.
       
   357         item->SetValue( aValue );
       
   358         return KErrNone;
       
   359         }
       
   360 
       
   361     
       
   362     /**
       
   363      * Resets the map
       
   364      */
       
   365     void Reset()
       
   366         {
       
   367         // Just reset the counter.
       
   368         // We do not bother to reset map items, because when counter is reseted
       
   369         // already set items and their info is left out of the scope.
       
   370         iCount = 0;
       
   371         iSetValueCallCount = 0;
       
   372         }
       
   373     
       
   374     
       
   375     /**
       
   376      * Checks if all the values of items in the array match the given value.
       
   377      * 
       
   378      * @param aValue Reference to the value that items are compared to.
       
   379      * @param aTestType Informs the test type whose items should be compared.
       
   380      */
       
   381     TInt CountEquals( const T& aValue, const TAlfModuleTestType& aTestType ) const
       
   382         {
       
   383         TInt count( 0 );
       
   384         for ( TInt i = 0; i < iCount; ++i )
       
   385             {
       
   386             if ( iArray[ i ].Equals( aValue, aTestType ) )
       
   387                 {
       
   388                 // Item matches
       
   389                 ++count;            
       
   390                 }
       
   391             }
       
   392         return count;
       
   393         }
       
   394 
       
   395 
       
   396     /**
       
   397      * @return TInt Number of map items
       
   398      */
       
   399     TInt ItemCount() const
       
   400         {
       
   401         return iCount;
       
   402         }
       
   403 
       
   404 
       
   405     /**
       
   406      * @return const TAlfModuleTestItem< T >& Reference to the map item
       
   407      */
       
   408     const TAlfModuleTestItem< T >& Item( TInt aIndex ) const
       
   409         {
       
   410         return iArray[ aIndex ];
       
   411         }
       
   412 
       
   413     
       
   414     /**
       
   415      * @return TInt Number of times SetValue function has been called
       
   416      *              since last reset. This information can be used
       
   417      *              to check if hooks have been used correct times during
       
   418      *              a test case. Notice, that this informs the number of
       
   419      *              function calls, not the number of times a value has actually
       
   420      *              set for some item.
       
   421      */
       
   422     TInt SetValueCallCount() const
       
   423         {
       
   424         return iSetValueCallCount;
       
   425         }
       
   426     
       
   427     
       
   428 private: // data
       
   429     
       
   430     TAlfModuleTestItem< T > iArray[ KMaxArrayCount ];
       
   431     // Informs number of array items
       
   432     TInt iCount;
       
   433     // Informs how many times SetItem has been called since last reset.
       
   434     // Notice, that this informs the number of function calls, not the number
       
   435     // of times a value has actually set for some item.
       
   436     TInt iSetValueCallCount;
       
   437     
       
   438     };
       
   439 
       
   440     
       
   441 /*
    45 /*
   442  *  Class CAlfModuleTestData
    46  *  Class CAlfModuleTestData
   443  */
    47  */
   444 
    48 
   445 NONSHARABLE_CLASS(CAlfModuleTestData) : public CBase
    49 NONSHARABLE_CLASS(CAlfModuleTestData) : public CBase
   446     {
    50     {
   447 public:
    51 public:
   448     void PrintState()
    52     void PrintState() const
   449         {
    53         {
   450         RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
    54         RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
   451         RDebug::Print(_L("iTotalLayerCount[0]=%d"), iTotalLayerCount[0]);
    55         RDebug::Print(_L("iTotalLayerCount[0]=%d"), iTotalLayerCount[0]);
   452         RDebug::Print(_L("iTotalLayerCount[1]=%d"), iTotalLayerCount[1]);
    56         RDebug::Print(_L("iTotalLayerCount[1]=%d"), iTotalLayerCount[1]);
   453         RDebug::Print(_L("iCloneLayerCount=%d"), iCloneLayerCount);
    57         RDebug::Print(_L("iCloneLayerCount=%d"), iCloneLayerCount);
   485         RDebug::Print(_L("iLatestVisualExtentRect= x:%d, y:%d, width=%d, height=%d"), 
    89         RDebug::Print(_L("iLatestVisualExtentRect= x:%d, y:%d, width=%d, height=%d"), 
   486                          iLatestVisualExtentRect.iTl.iX, iLatestVisualExtentRect.iTl.iY, 
    90                          iLatestVisualExtentRect.iTl.iX, iLatestVisualExtentRect.iTl.iY, 
   487                          iLatestVisualExtentRect.Width(), iLatestVisualExtentRect.Height());
    91                          iLatestVisualExtentRect.Width(), iLatestVisualExtentRect.Height());
   488         RDebug::Print(_L("iTotalVisualFlagChangedCount=%d"), iTotalVisualFlagChangedCount);
    92         RDebug::Print(_L("iTotalVisualFlagChangedCount=%d"), iTotalVisualFlagChangedCount);
   489         RDebug::Print(_L("iTotalVisualAttributeChangedCount=%d"), iTotalVisualAttributeChangedCount);
    93         RDebug::Print(_L("iTotalVisualAttributeChangedCount=%d"), iTotalVisualAttributeChangedCount);
       
    94         RDebug::Print(_L("iBoolMap =>"));
       
    95         PrintBoolMapState( iBoolMap );        
       
    96         RDebug::Print(_L("iIntMap =>"));
       
    97         PrintIntMapState( iIntMap );
   490         RDebug::Print(_L("iSizeMap =>"));
    98         RDebug::Print(_L("iSizeMap =>"));
   491         PrintSizeMapState( iSizeMap );
    99         PrintSizeMapState( iSizeMap );
   492         RDebug::Print(_L("iPositionMap =>"));
   100         RDebug::Print(_L("iPositionMap =>"));
   493         PrintPositionMapState( iPositionMap );        
   101         PrintPositionMapState( iPositionMap );
       
   102         RDebug::Print(_L("iSurfaceMap =>"));
       
   103         PrintSurfaceMapState( iSurfaceMap );        
   494         RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
   104         RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
   495         }
   105         }
   496 
   106 
   497     
   107 
   498     void PrintSizeMapState( TAlfModuleTestMap< TSize > aMap )
   108     void PrintBoolMapState( const TAlfModuleTestMap< TBool >& aMap ) const
       
   109         {
       
   110         RDebug::Print(_L("*** ALF INTERNAL BOOL MAP STATE -->"));
       
   111         RDebug::Print(_L("Map item count=%d"), aMap.ItemCount());
       
   112         for ( TInt i = 0; i < aMap.ItemCount(); ++i )
       
   113             {
       
   114             const TAlfModuleTestItem< TBool >& item( aMap.Item( i ) );
       
   115             RDebug::Print(_L("Map item %d, iTestType=%d, iKey=%d, iValue=%d, iValueSetCount=%d, iLinkTargetKey=%d"),
       
   116                              i, item.TestType(), item.Key(), item.Value(), item.ValueSetCount(), item.LinkTargetKey());
       
   117             }
       
   118         RDebug::Print(_L("<-- ALF INTERNAL BOOL MAP STATE ***"));
       
   119         }
       
   120     
       
   121     
       
   122     void PrintIntMapState( const TAlfModuleTestMap< TInt >& aMap ) const
       
   123         {
       
   124         RDebug::Print(_L("*** ALF INTERNAL INT MAP STATE -->"));
       
   125         RDebug::Print(_L("Map item count=%d"), aMap.ItemCount());
       
   126         for ( TInt i = 0; i < aMap.ItemCount(); ++i )
       
   127             {
       
   128             const TAlfModuleTestItem< TInt >& item( aMap.Item( i ) );
       
   129             RDebug::Print(_L("Map item %d, iTestType=%d, iKey=%d, iValue=%d, iValueSetCount=%d, iLinkTargetKey=%d"),
       
   130                              i, item.TestType(), item.Key(), item.Value(), item.ValueSetCount(), item.LinkTargetKey());
       
   131             }
       
   132         RDebug::Print(_L("<-- ALF INTERNAL INT MAP STATE ***"));
       
   133         }
       
   134     
       
   135     
       
   136     void PrintSizeMapState( const TAlfModuleTestMap< TSize >& aMap ) const
   499         {
   137         {
   500         RDebug::Print(_L("*** ALF INTERNAL SIZE MAP STATE -->"));
   138         RDebug::Print(_L("*** ALF INTERNAL SIZE MAP STATE -->"));
   501         RDebug::Print(_L("Map item count=%d, SetValue call count=%d"), 
   139         RDebug::Print(_L("Map item count=%d"), aMap.ItemCount());
   502                          aMap.ItemCount(), aMap.SetValueCallCount());
       
   503         for ( TInt i = 0; i < aMap.ItemCount(); ++i )
   140         for ( TInt i = 0; i < aMap.ItemCount(); ++i )
   504             {
   141             {
   505             const TAlfModuleTestItem< TSize >& item( aMap.Item( i ) );
   142             const TAlfModuleTestItem< TSize >& item( aMap.Item( i ) );
   506             RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d"),
   143             RDebug::Print(_L("Map item %d, iTestType=%d, iKey=%d, iValueSetCount=%d, iLinkTargetKey=%d"),
   507                              i, item.Key(), item.TestType(), item.ValueSetCount());
   144                              i, item.TestType(), item.Key(), item.ValueSetCount(), item.LinkTargetKey());
   508             RDebug::Print(_L("Map item index=%d, width=%d, height=%d"),
   145             RDebug::Print(_L("Map item index=%d, width=%d, height=%d"),
   509                              i, item.Value().iWidth, item.Value().iHeight);
   146                              i, item.Value().iWidth, item.Value().iHeight);
   510             }
   147             }
   511         RDebug::Print(_L("<-- ALF INTERNAL SIZE MAP STATE ***"));
   148         RDebug::Print(_L("<-- ALF INTERNAL SIZE MAP STATE ***"));
   512         }
   149         }
   513 
   150 
   514     
   151     
   515     void PrintPositionMapState( TAlfModuleTestMap< TPoint > aMap )
   152     void PrintPositionMapState( const TAlfModuleTestMap< TPoint >& aMap ) const
   516         {
   153         {
   517         RDebug::Print(_L("*** ALF INTERNAL POSITION MAP STATE -->"));
   154         RDebug::Print(_L("*** ALF INTERNAL POSITION MAP STATE -->"));
   518         RDebug::Print(_L("Map item count=%d, SetValue call count=%d"), 
   155         RDebug::Print(_L("Map item count=%d"), aMap.ItemCount() );
   519                          aMap.ItemCount(), aMap.SetValueCallCount());
       
   520         for ( TInt i = 0; i < aMap.ItemCount(); ++i )
   156         for ( TInt i = 0; i < aMap.ItemCount(); ++i )
   521             {
   157             {
   522             const TAlfModuleTestItem< TPoint >& item( aMap.Item( i ) );
   158             const TAlfModuleTestItem< TPoint >& item( aMap.Item( i ) );
   523             RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d"),
   159             RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d, iLinkTargetKey=%d"),
   524                              i, item.Key(), item.TestType(), item.ValueSetCount());
   160                              i, item.Key(), item.TestType(), item.ValueSetCount(), item.LinkTargetKey());
   525             RDebug::Print(_L("Map item index=%d, x=%d, y=%d"),
   161             RDebug::Print(_L("Map item index=%d, x=%d, y=%d"),
   526                              i, item.Value().iX, item.Value().iY);
   162                              i, item.Value().iX, item.Value().iY);
   527             }
   163             }
   528         RDebug::Print(_L("<-- ALF INTERNAL POSITION MAP STATE ***"));
   164         RDebug::Print(_L("<-- ALF INTERNAL POSITION MAP STATE ***"));
   529         }    
   165         }
   530 
   166 
   531     
   167     
       
   168     void PrintSurfaceMapState( const TAlfModuleTestMap< TSurfaceId >& aMap ) const
       
   169         {
       
   170         RDebug::Print(_L("*** ALF INTERNAL SURFACE MAP STATE -->"));
       
   171         RDebug::Print(_L("Map item count=%d"), aMap.ItemCount() );
       
   172         for ( TInt i = 0; i < aMap.ItemCount(); ++i )
       
   173             {
       
   174             const TAlfModuleTestItem< TSurfaceId >& item( aMap.Item( i ) );
       
   175             RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d, iLinkTargetKey=%d"),
       
   176                              i, item.Key(), item.TestType(), item.ValueSetCount(), item.LinkTargetKey());
       
   177             RDebug::Print(_L("Map item index=%d, internal0=%d, internal1=%d, internal2=%d, internal3=%d"),
       
   178                              i, item.Value().iInternal[ 0 ], item.Value().iInternal[ 1 ],
       
   179                              item.Value().iInternal[ 2 ], item.Value().iInternal[ 3 ] );
       
   180             }
       
   181         RDebug::Print(_L("<-- ALF INTERNAL SURFACE MAP STATE ***"));
       
   182         }
       
   183 
       
   184 
   532 public:
   185 public:
   533     TBool iIsEnabled;           // *** not yet implemented. For run-time enabling/disabling of the test system.  
   186     TBool iIsEnabled;           // *** not yet implemented. For run-time enabling/disabling of the test system.  
   534     
   187     
   535     // Alf Render Stage
   188     // Alf Render Stage
   536     TInt iScreenCount;          // *** not yet implemented
   189     TInt iScreenCount;          // *** not yet implemented
   585     TInt iASE_Temp1;
   238     TInt iASE_Temp1;
   586     TInt iASE_Temp2;
   239     TInt iASE_Temp2;
   587     TInt iASE_Temp3;
   240     TInt iASE_Temp3;
   588     TInt iASE_Temp4;
   241     TInt iASE_Temp4;
   589 
   242 
   590     // Map that contains integer items that can be specified for certain test cases.
   243     // Map that contains boolean items for certain test cases.
       
   244     TAlfModuleTestMap< TBool > iBoolMap;        
       
   245     // Map that contains integer items for certain test cases.
   591     TAlfModuleTestMap< TInt > iIntMap;    
   246     TAlfModuleTestMap< TInt > iIntMap;    
   592     // Map that contains size items that can be specified for certain test cases.
   247     // Map that contains size items for certain test cases.
   593     TAlfModuleTestMap< TSize > iSizeMap;
   248     TAlfModuleTestMap< TSize > iSizeMap;
   594     // Map that contains position items that can be specified for certain test cases.
   249     // Map that contains position items for certain test cases.
   595     TAlfModuleTestMap< TPoint > iPositionMap;    
   250     TAlfModuleTestMap< TPoint > iPositionMap;
   596 
   251     // Map that contains rect items for certain test cases.
       
   252     TAlfModuleTestMap< TRect > iRectMap;
       
   253     // Map that contains surface id items for layer/surface test cases.
       
   254     TAlfModuleTestMap< TSurfaceId > iSurfaceMap;
       
   255     
   597     };
   256     };
   598 
   257 
   599 
   258 
   600 /*
   259 /*
   601  *  Class CAlfModuleTestDataControl
   260  *  Class CAlfModuleTestDataControl
   648     RChunk iModuleTestChunk;
   307     RChunk iModuleTestChunk;
   649     RMutex iModuleTestMutex;
   308     RMutex iModuleTestMutex;
   650     CAlfModuleTestData* iModuleTestData; // Not owned
   309     CAlfModuleTestData* iModuleTestData; // Not owned
   651     };
   310     };
   652 
   311 
   653 #endif
   312 #endif // USE_MODULE_TEST_HOOKS_FOR_ALF
       
   313 
   654 
   314 
   655 #endif // ALFMODULETEST_H
   315 #endif // ALFMODULETEST_H
   656 
   316 
   657 // End of File
   317 // End of File