uiacceltk/hitchcock/CommonInc/alfmoduletest.h
changeset 64 9f8c0686fb49
equal deleted inserted replaced
-1:000000000000 64:9f8c0686fb49
       
     1 #ifndef ALFMODULETEST_H
       
     2 #define ALFMODULETEST_H
       
     3 
       
     4 
       
     5 #include <e32base.h>
       
     6 #include <graphics/surface.h>
       
     7 #include <e32debug.h>
       
     8 
       
     9 // Informs if module test hooks have been set on.
       
    10 #include "alfmoduletestconf.h"
       
    11 
       
    12 // Provides module test hooks defines.
       
    13 #include "alfmoduletestdefines.h"
       
    14 
       
    15 
       
    16 #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
       
    17 
       
    18 // *** Test map classes
       
    19 #include "alfmoduletesttype.h"
       
    20 #include "alfmoduletestitem.h"
       
    21 #include "alfmoduletestmap.h"
       
    22 
       
    23 
       
    24 // *** Global object names
       
    25 _LIT(KAlfModuleTestChunkName, "ALF_MODULE_TEST_CHUNK");
       
    26 _LIT(KAlfModuleTestMutexName, "ALF_MODULE_TEST_MUTEX");
       
    27 
       
    28 const TInt KMaxSimultMeasurementCount = 10;
       
    29 /*
       
    30  *  Class CAlfModuleTestData
       
    31  */
       
    32 
       
    33 NONSHARABLE_CLASS(CAlfModuleTestData) : public CBase
       
    34     {
       
    35 public:
       
    36     void PrintState() const
       
    37         {
       
    38         RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
       
    39         RDebug::Print(_L("iTotalLayerCount[0]=%d"), iTotalLayerCount[0]);
       
    40         RDebug::Print(_L("iTotalLayerCount[1]=%d"), iTotalLayerCount[1]);
       
    41         RDebug::Print(_L("iCloneLayerCount=%d"), iCloneLayerCount);
       
    42         RDebug::Print(_L("iRsTotalNodeCount=%d"), iRsTotalNodeCount);
       
    43         RDebug::Print(_L("iRsWindowGroupNodeCount=%d"), iRsWindowGroupNodeCount);
       
    44         RDebug::Print(_L("iRsWindowNodeCount=%d"), iRsWindowNodeCount);
       
    45         RDebug::Print(_L("iRsAnimNodeCount=%d"), iRsAnimNodeCount);
       
    46         RDebug::Print(_L("iRsWindowNodeActivatedCount=%d"), iRsWindowNodeActivatedCount);
       
    47         RDebug::Print(_L("iRsNodeExtentChangedCount=%d"), iRsNodeExtentChangedCount);
       
    48         RDebug::Print(_L("iRsLatestNodeExtentRect= x:%d, y:%d, width=%d, height=%d"), 
       
    49                          iRsLatestNodeExtentRect.iTl.iX, iRsLatestNodeExtentRect.iTl.iY, 
       
    50                          iRsLatestNodeExtentRect.Width(), iRsLatestNodeExtentRect.Height());
       
    51         RDebug::Print(_L("iRsTotalNodeFlagChangedCount=%d"), iRsTotalNodeFlagChangedCount);
       
    52         RDebug::Print(_L("iRsTotalNodeAttributeChangedCount=%d"), iRsTotalNodeAttributeChangedCount);
       
    53         RDebug::Print(_L("iTotalNodeCount=%d"), iTotalNodeCount);
       
    54         RDebug::Print(_L("iWindowGroupNodeCount=%d"), iWindowGroupNodeCount);
       
    55         RDebug::Print(_L("iWindowNodeCount=%d"), iWindowNodeCount);
       
    56         RDebug::Print(_L("iAnimNodeCount=%d"), iAnimNodeCount);
       
    57         RDebug::Print(_L("iWindowNodeActivatedCount=%d"), iWindowNodeActivatedCount);
       
    58         RDebug::Print(_L("iNodeExtentChangedCount=%d"), iNodeExtentChangedCount);
       
    59         RDebug::Print(_L("iLatestNodeExtentRect= x:%d, y:%d, width=%d, height=%d"), 
       
    60                          iLatestNodeExtentRect.iTl.iX, iLatestNodeExtentRect.iTl.iY, 
       
    61                          iLatestNodeExtentRect.Width(), iLatestNodeExtentRect.Height());
       
    62         RDebug::Print(_L("iTotalNodeFlagChangedCount=%d"), iTotalNodeFlagChangedCount);
       
    63         RDebug::Print(_L("iTotalNodeAttributeChangedCount=%d"), iTotalNodeAttributeChangedCount);        
       
    64         RDebug::Print(_L("iTotalVisualCount=%d"), iTotalVisualCount);
       
    65         RDebug::Print(_L("iVisibleVisualCount=%d"), iVisibleVisualCount);
       
    66         RDebug::Print(_L("iActiveVisualCount=%d"), iActiveVisualCount);
       
    67         RDebug::Print(_L("iPassiveVisualCount=%d"), iPassiveVisualCount);
       
    68         RDebug::Print(_L("iTextureCount=%d"), iTextureCount);
       
    69         RDebug::Print(_L("iRenderBufferCount=%d"), iRenderBufferCount);
       
    70         RDebug::Print(_L("iTotalControlGroupCount=%d"), iTotalControlGroupCount);        
       
    71         RDebug::Print(_L("iVisualSizeChangedCount=%d"), iVisualSizeChangedCount);        
       
    72         RDebug::Print(_L("iVisualPositionChangedCount=%d"), iVisualPositionChangedCount);
       
    73         RDebug::Print(_L("iLatestVisualExtentRect= x:%d, y:%d, width=%d, height=%d"), 
       
    74                          iLatestVisualExtentRect.iTl.iX, iLatestVisualExtentRect.iTl.iY, 
       
    75                          iLatestVisualExtentRect.Width(), iLatestVisualExtentRect.Height());
       
    76         RDebug::Print(_L("iTotalVisualFlagChangedCount=%d"), iTotalVisualFlagChangedCount);
       
    77         RDebug::Print(_L("iTotalVisualAttributeChangedCount=%d"), iTotalVisualAttributeChangedCount);
       
    78         RDebug::Print(_L("iBoolMap =>"));
       
    79         PrintBoolMapState( iBoolMap );        
       
    80         RDebug::Print(_L("iIntMap =>"));
       
    81         PrintIntMapState( iIntMap );
       
    82         RDebug::Print(_L("iSizeMap =>"));
       
    83         PrintSizeMapState( iSizeMap );
       
    84         RDebug::Print(_L("iPositionMap =>"));
       
    85         PrintPositionMapState( iPositionMap );
       
    86         RDebug::Print(_L("iSurfaceMap =>"));
       
    87         PrintSurfaceMapState( iSurfaceMap );        
       
    88         RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
       
    89         }
       
    90 
       
    91 
       
    92     void PrintBoolMapState( const TAlfModuleTestMap< TBool >& aMap ) const
       
    93         {
       
    94         RDebug::Print(_L("*** ALF INTERNAL BOOL MAP STATE -->"));
       
    95         RDebug::Print(_L("Map item count=%d"), aMap.ItemCount());
       
    96         for ( TInt i = 0; i < aMap.ItemCount(); ++i )
       
    97             {
       
    98             const TAlfModuleTestItem< TBool >& item( aMap.Item( i ) );
       
    99             RDebug::Print(_L("Map item %d, iTestType=%d, iKey=%d, iValue=%d, iValueSetCount=%d, iLinkTargetKey=%d"),
       
   100                              i, item.TestType(), item.Key(), item.Value(), item.ValueSetCount(), item.LinkTargetKey());
       
   101             }
       
   102         RDebug::Print(_L("<-- ALF INTERNAL BOOL MAP STATE ***"));
       
   103         }
       
   104     
       
   105     
       
   106     void PrintIntMapState( const TAlfModuleTestMap< TInt >& aMap ) const
       
   107         {
       
   108         RDebug::Print(_L("*** ALF INTERNAL INT MAP STATE -->"));
       
   109         RDebug::Print(_L("Map item count=%d"), aMap.ItemCount());
       
   110         for ( TInt i = 0; i < aMap.ItemCount(); ++i )
       
   111             {
       
   112             const TAlfModuleTestItem< TInt >& item( aMap.Item( i ) );
       
   113             RDebug::Print(_L("Map item %d, iTestType=%d, iKey=%d, iValue=%d, iValueSetCount=%d, iLinkTargetKey=%d"),
       
   114                              i, item.TestType(), item.Key(), item.Value(), item.ValueSetCount(), item.LinkTargetKey());
       
   115             }
       
   116         RDebug::Print(_L("<-- ALF INTERNAL INT MAP STATE ***"));
       
   117         }
       
   118     
       
   119     
       
   120     void PrintSizeMapState( const TAlfModuleTestMap< TSize >& aMap ) const
       
   121         {
       
   122         RDebug::Print(_L("*** ALF INTERNAL SIZE MAP STATE -->"));
       
   123         RDebug::Print(_L("Map item count=%d"), aMap.ItemCount());
       
   124         for ( TInt i = 0; i < aMap.ItemCount(); ++i )
       
   125             {
       
   126             const TAlfModuleTestItem< TSize >& item( aMap.Item( i ) );
       
   127             RDebug::Print(_L("Map item %d, iTestType=%d, iKey=%d, iValueSetCount=%d, iLinkTargetKey=%d"),
       
   128                              i, item.TestType(), item.Key(), item.ValueSetCount(), item.LinkTargetKey());
       
   129             RDebug::Print(_L("Map item index=%d, width=%d, height=%d"),
       
   130                              i, item.Value().iWidth, item.Value().iHeight);
       
   131             }
       
   132         RDebug::Print(_L("<-- ALF INTERNAL SIZE MAP STATE ***"));
       
   133         }
       
   134 
       
   135     
       
   136     void PrintPositionMapState( const TAlfModuleTestMap< TPoint >& aMap ) const
       
   137         {
       
   138         RDebug::Print(_L("*** ALF INTERNAL POSITION MAP STATE -->"));
       
   139         RDebug::Print(_L("Map item count=%d"), aMap.ItemCount() );
       
   140         for ( TInt i = 0; i < aMap.ItemCount(); ++i )
       
   141             {
       
   142             const TAlfModuleTestItem< TPoint >& item( aMap.Item( i ) );
       
   143             RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d, iLinkTargetKey=%d"),
       
   144                              i, item.Key(), item.TestType(), item.ValueSetCount(), item.LinkTargetKey());
       
   145             RDebug::Print(_L("Map item index=%d, x=%d, y=%d"),
       
   146                              i, item.Value().iX, item.Value().iY);
       
   147             }
       
   148         RDebug::Print(_L("<-- ALF INTERNAL POSITION MAP STATE ***"));
       
   149         }
       
   150 
       
   151     
       
   152     void PrintSurfaceMapState( const TAlfModuleTestMap< TSurfaceId >& aMap ) const
       
   153         {
       
   154         RDebug::Print(_L("*** ALF INTERNAL SURFACE MAP STATE -->"));
       
   155         RDebug::Print(_L("Map item count=%d"), aMap.ItemCount() );
       
   156         for ( TInt i = 0; i < aMap.ItemCount(); ++i )
       
   157             {
       
   158             const TAlfModuleTestItem< TSurfaceId >& item( aMap.Item( i ) );
       
   159             RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d, iLinkTargetKey=%d"),
       
   160                              i, item.Key(), item.TestType(), item.ValueSetCount(), item.LinkTargetKey());
       
   161             RDebug::Print(_L("Map item index=%d, internal0=%d, internal1=%d, internal2=%d, internal3=%d"),
       
   162                              i, item.Value().iInternal[ 0 ], item.Value().iInternal[ 1 ],
       
   163                              item.Value().iInternal[ 2 ], item.Value().iInternal[ 3 ] );
       
   164             }
       
   165         RDebug::Print(_L("<-- ALF INTERNAL SURFACE MAP STATE ***"));
       
   166         }
       
   167 
       
   168 
       
   169 public:
       
   170     TBool iIsEnabled;           // *** not yet implemented. For run-time enabling/disabling of the test system.  
       
   171     
       
   172     // Alf Render Stage
       
   173     TInt iScreenCount;          // *** not yet implemented
       
   174     TInt iTotalLayerCount[10];  // For each screen
       
   175     TInt iCloneLayerCount;      // ** not yet implemented
       
   176     TInt iRsTotalNodeCount;
       
   177     TInt iRsWindowGroupNodeCount;
       
   178     TInt iRsWindowNodeCount;
       
   179     TInt iRsAnimNodeCount;
       
   180     TInt iRsWindowNodeActivatedCount;    
       
   181     TInt iRsNodeExtentChangedCount;
       
   182     TRect iRsLatestNodeExtentRect;
       
   183     TInt iRsTotalNodeFlagChangedCount;
       
   184     TInt iRsTotalNodeAttributeChangedCount;
       
   185     // These are temporary variables for Alf Render Stage thread internal use only!
       
   186     TInt iARS_Temp1;
       
   187     TInt iARS_Temp2;
       
   188     TInt iARS_Temp3;
       
   189     TInt iARS_Temp4;
       
   190    
       
   191     // Alf Streamer
       
   192     TInt iTotalNodeCount;
       
   193     TInt iWindowGroupNodeCount;
       
   194     TInt iWindowNodeCount;
       
   195     TInt iAnimNodeCount;
       
   196     TInt iWindowNodeActivatedCount;
       
   197     TInt iNodeExtentChangedCount;
       
   198     TRect iLatestNodeExtentRect;
       
   199     TInt iTotalNodeFlagChangedCount;
       
   200     TInt iTotalNodeAttributeChangedCount;
       
   201     // These are temporary variables for Alf Streamer thread internal use only!
       
   202     TInt iAST_Temp1;
       
   203     TInt iAST_Temp2;
       
   204     TInt iAST_Temp3;
       
   205     TInt iAST_Temp4;
       
   206    
       
   207     // Alf Server
       
   208     TInt iTotalVisualCount;
       
   209     TInt iVisibleVisualCount;
       
   210     TInt iActiveVisualCount;
       
   211     TInt iPassiveVisualCount;
       
   212     TInt iTextureCount;         // *** not yet implemented
       
   213     TInt iRenderBufferCount;    // *** not yet implemented
       
   214     TInt iTotalControlGroupCount;
       
   215     TInt iVisualSizeChangedCount;
       
   216     TInt iVisualPositionChangedCount;
       
   217     TRect iLatestVisualExtentRect;
       
   218     TInt iTotalVisualFlagChangedCount;
       
   219     TInt iTotalVisualAttributeChangedCount;
       
   220     TInt iOrdinalChange;
       
   221     // These are temporary variables for Alf Server thread internal use only!
       
   222     TInt iASE_Temp1;
       
   223     TInt iASE_Temp2;
       
   224     TInt iASE_Temp3;
       
   225     TInt iASE_Temp4;
       
   226 
       
   227     class TSpeedTest
       
   228     {
       
   229     public:
       
   230         TInt64 iHandle;
       
   231         TInt iCounter;
       
   232         TBool iEffects;
       
   233         TInt64 iTimeStamp[5];
       
   234     };
       
   235     
       
   236     TSpeedTest iTimeMap[10];
       
   237     TInt iNextFreeMap;
       
   238         
       
   239     // Map that contains boolean items for certain test cases.
       
   240     TAlfModuleTestMap< TBool > iBoolMap;        
       
   241     // Map that contains integer items for certain test cases.
       
   242     TAlfModuleTestMap< TInt > iIntMap;    
       
   243     // Map that contains size items for certain test cases.
       
   244     TAlfModuleTestMap< TSize > iSizeMap;
       
   245     // Map that contains position items for certain test cases.
       
   246     TAlfModuleTestMap< TPoint > iPositionMap;
       
   247     // Map that contains rect items for certain test cases.
       
   248     TAlfModuleTestMap< TRect > iRectMap;
       
   249     // Map that contains surface id items for layer/surface test cases.
       
   250     TAlfModuleTestMap< TSurfaceId > iSurfaceMap;
       
   251     
       
   252     };
       
   253 
       
   254 
       
   255 /*
       
   256  *  Class CAlfModuleTestDataControl
       
   257  */
       
   258 NONSHARABLE_CLASS(CAlfModuleTestDataControl) : public CBase
       
   259     {
       
   260 public:
       
   261     /*
       
   262      * Destructor
       
   263      */
       
   264     ~CAlfModuleTestDataControl()
       
   265         {
       
   266         iModuleTestMutex.Close();
       
   267         iModuleTestChunk.Close();
       
   268         }
       
   269 
       
   270     /*
       
   271      * Open global chunk and mutex created elsewhere
       
   272      */
       
   273     TInt OpenGlobalObjects()
       
   274         {
       
   275         RDebug::Print(_L("CAlfModuleTestDataControl::OpenGlobalObjects()."));
       
   276         // Open global module testing chunk
       
   277         TBool isReadOnly = EFalse;
       
   278         TInt err = iModuleTestChunk.OpenGlobal(KAlfModuleTestChunkName, isReadOnly);
       
   279         if (!err)
       
   280             {
       
   281             // Create global module testing mutex
       
   282             err = iModuleTestMutex.OpenGlobal(KAlfModuleTestMutexName);
       
   283             if (!err)
       
   284                 {
       
   285                 iModuleTestData = reinterpret_cast<CAlfModuleTestData*>(iModuleTestChunk.Base());
       
   286                 }
       
   287             }
       
   288         RDebug::Print(_L("CAlfModuleTestDataControl::OpenGlobalObjects. ret=%d"), err);
       
   289         return err;
       
   290         }
       
   291 
       
   292     /*
       
   293      * Lock access to global memory
       
   294      */
       
   295     void Lock() {iModuleTestMutex.Wait();}
       
   296  
       
   297     /*
       
   298      * Unlock access to global memory
       
   299      */
       
   300     void Unlock() {iModuleTestMutex.Signal();}
       
   301     
       
   302 public:
       
   303     RChunk iModuleTestChunk;
       
   304     RMutex iModuleTestMutex;
       
   305     CAlfModuleTestData* iModuleTestData; // Not owned
       
   306     };
       
   307 
       
   308 #endif // USE_MODULE_TEST_HOOKS_FOR_ALF
       
   309 
       
   310 
       
   311 #endif // ALFMODULETEST_H
       
   312 
       
   313 // End of File