uiacceltk/hitchcock/CommonInc/alfmoduletest.h
branchRCL_3
changeset 7 433cbbb6a04b
parent 3 d8a3531bc6b8
child 8 10534483575f
equal deleted inserted replaced
3:d8a3531bc6b8 7:433cbbb6a04b
     3 
     3 
     4 #ifndef ALFMODULETEST_H
     4 #ifndef ALFMODULETEST_H
     5 #define ALFMODULETEST_H
     5 #define ALFMODULETEST_H
     6 
     6 
     7 // Define this to build module testing enchanced version of ALF
     7 // Define this to build module testing enchanced version of ALF
     8 //#define USE_MODULE_TEST_HOOKS_FOR_ALF
     8 // #define USE_MODULE_TEST_HOOKS_FOR_ALF 
     9 
     9 
    10 #if !defined(USE_MODULE_TEST_HOOKS_FOR_ALF) || !defined(AMT_CONTROL)
    10 #if !defined(USE_MODULE_TEST_HOOKS_FOR_ALF) || !defined(AMT_CONTROL)
    11 
    11 
    12 #define AMT_FUNC(func)                                
    12 #define AMT_FUNC(func)                                
    13 #define AMT_FUNC_EXC(func)    
    13 #define AMT_FUNC_EXC(func)    
       
    14 #define AMT_FUNC_EXC_IF(cond, func)    
    14 #define AMT_INC_COUNTER(member)
    15 #define AMT_INC_COUNTER(member)
    15 #define AMT_DEC_COUNTER(member)
    16 #define AMT_DEC_COUNTER(member)
    16 #define AMT_SET_VALUE(member, val)
    17 #define AMT_SET_VALUE(member, val)
    17 #define AMT_GET_VALUE(x, member)
    18 #define AMT_GET_VALUE(x, member)
       
    19 #define AMT_INC_COUNTER_IF(cond, member)
       
    20 #define AMT_DEC_COUNTER_IF(cond, member)
       
    21 #define AMT_SET_VALUE_IF(cond, member, val)
       
    22 #define AMT_GET_VALUE_IF(cond, x, member)
    18 #define AMT_PRINT_STATE()
    23 #define AMT_PRINT_STATE()
    19 
    24 
    20 #ifndef AMT_CONTROL
    25 #ifndef AMT_CONTROL
    21 #error "Error: you need to define AMT_CONTROL macro in your code to be able to use ALF module test system!"
    26 #error "Error: you need to define AMT_CONTROL macro in your code to be able to use ALF module test system!"
    22 // The user have to define AMT_CONTROL, e.g. like this:
    27 // The user have to define AMT_CONTROL, e.g. like this:
    23 // #define AMT_CONTROL()                static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
    28 // #define AMT_CONTROL() static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
    24 // or
    29 // or
    25 // #define AMT_CONTROL()                iMyModuleTestDataControl
    30 // #define AMT_CONTROL() iMyModuleTestDataControl
       
    31 // etc.
    26 #endif
    32 #endif
    27 
    33 
    28 #else
    34 #else
    29 
    35 
    30 
    36 
    39 
    45 
    40 // Generic macros
    46 // Generic macros
    41 #define AMT_DATA()                  AMT_CONTROL()->iModuleTestData
    47 #define AMT_DATA()                  AMT_CONTROL()->iModuleTestData
    42 #define AMT_FUNC(func)              if (AMT_DATA()->iIsEnabled) {func;}                                         
    48 #define AMT_FUNC(func)              if (AMT_DATA()->iIsEnabled) {func;}                                         
    43 #define AMT_FUNC_EXC(func)          {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {func;} AMT_CONTROL()->Unlock();}        
    49 #define AMT_FUNC_EXC(func)          {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {func;} AMT_CONTROL()->Unlock();}        
       
    50 #define AMT_FUNC_EXC_IF(cond, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {func;} AMT_CONTROL()->Unlock();}        
    44 
    51 
    45 // Single operation macros, that will do lock/unlock.
    52 // Single operation macros, that will do lock/unlock.
    46 #define AMT_INC_COUNTER(member)     AMT_FUNC_EXC(AMT_DATA()->member++)
    53 #define AMT_INC_COUNTER(member)     AMT_FUNC_EXC(AMT_DATA()->member++)
    47 #define AMT_DEC_COUNTER(member)     AMT_FUNC_EXC(AMT_DATA()->member--)
    54 #define AMT_DEC_COUNTER(member)     AMT_FUNC_EXC(AMT_DATA()->member--)
    48 #define AMT_SET_VALUE(member, val)  AMT_FUNC_EXC(AMT_DATA()->member=(val))
    55 #define AMT_SET_VALUE(member, val)  AMT_FUNC_EXC(AMT_DATA()->member=(val))
    49 #define AMT_GET_VALUE(x, member)    AMT_FUNC_EXC((x) = AMT_DATA()->member)
    56 #define AMT_GET_VALUE(x, member)    AMT_FUNC_EXC((x) = AMT_DATA()->member)
    50 #define AMT_PRINT_STATE()           AMT_FUNC_EXC(AMT_DATA()->PrintState())
    57 #define AMT_PRINT_STATE()           AMT_FUNC_EXC(AMT_DATA()->PrintState())
    51 
    58 
       
    59 // Conditional single operation macros, that will do lock/unlock.
       
    60 #define AMT_INC_COUNTER_IF(cond, member)    AMT_FUNC_EXC_IF((cond), AMT_DATA()->member++)
       
    61 #define AMT_DEC_COUNTER_IF(cond, member)    AMT_FUNC_EXC_IF((cond), AMT_DATA()->member--)
       
    62 #define AMT_SET_VALUE_IF(cond, member, val) AMT_FUNC_EXC_IF((cond), AMT_DATA()->member=(val))
       
    63 #define AMT_GET_VALUE_IF(cond, x, member)   AMT_FUNC_EXC_IF((cond), (x) = AMT_DATA()->member)
       
    64 
       
    65 
    52 // *** Global object names
    66 // *** Global object names
    53 _LIT(KAlfModuleTestChunkName, "ALF_MODULE_TEST_CHUNK");
    67 _LIT(KAlfModuleTestChunkName, "ALF_MODULE_TEST_CHUNK");
    54 _LIT(KAlfModuleTestMutexName, "ALF_MODULE_TEST_MUTEX");
    68 _LIT(KAlfModuleTestMutexName, "ALF_MODULE_TEST_MUTEX");
    55 
    69 
    56 /*
    70 /*
    64         {
    78         {
    65         RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
    79         RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
    66         RDebug::Print(_L("iTotalLayerCount[0]=%d"), iTotalLayerCount[0]);
    80         RDebug::Print(_L("iTotalLayerCount[0]=%d"), iTotalLayerCount[0]);
    67         RDebug::Print(_L("iTotalLayerCount[1]=%d"), iTotalLayerCount[1]);
    81         RDebug::Print(_L("iTotalLayerCount[1]=%d"), iTotalLayerCount[1]);
    68         RDebug::Print(_L("iCloneLayerCount=%d"), iCloneLayerCount);
    82         RDebug::Print(_L("iCloneLayerCount=%d"), iCloneLayerCount);
       
    83         RDebug::Print(_L("iRsTotalNodeCount=%d"), iRsTotalNodeCount);
       
    84         RDebug::Print(_L("iRsWindowGroupNodeCount=%d"), iRsWindowGroupNodeCount);
       
    85         RDebug::Print(_L("iRsWindowNodeCount=%d"), iRsWindowNodeCount);
       
    86         RDebug::Print(_L("iRsAnimNodeCount=%d"), iRsAnimNodeCount);
       
    87         RDebug::Print(_L("iRsWindowNodeActivatedCount=%d"), iRsWindowNodeActivatedCount);
       
    88         RDebug::Print(_L("iRsNodeExtentChangedCount=%d"), iRsNodeExtentChangedCount);
       
    89         RDebug::Print(_L("iRsLatestNodeExtentRect= x:%d, y:%d, width=%d, height=%d"), 
       
    90                          iRsLatestNodeExtentRect.iTl.iX, iRsLatestNodeExtentRect.iTl.iY, 
       
    91                          iRsLatestNodeExtentRect.Width(), iRsLatestNodeExtentRect.Height());
       
    92         RDebug::Print(_L("iRsTotalNodeFlagChangedCount=%d"), iRsTotalNodeFlagChangedCount);
       
    93         RDebug::Print(_L("iRsTotalNodeAttributeChangedCount=%d"), iRsTotalNodeAttributeChangedCount);
    69         RDebug::Print(_L("iTotalNodeCount=%d"), iTotalNodeCount);
    94         RDebug::Print(_L("iTotalNodeCount=%d"), iTotalNodeCount);
    70         RDebug::Print(_L("iWindowGroupNodeCount=%d"), iWindowGroupNodeCount);
    95         RDebug::Print(_L("iWindowGroupNodeCount=%d"), iWindowGroupNodeCount);
    71         RDebug::Print(_L("iWindowNodeCount=%d"), iWindowNodeCount);
    96         RDebug::Print(_L("iWindowNodeCount=%d"), iWindowNodeCount);
    72         RDebug::Print(_L("iAnimNodeCount=%d"), iAnimNodeCount);
    97         RDebug::Print(_L("iAnimNodeCount=%d"), iAnimNodeCount);
       
    98         RDebug::Print(_L("iWindowNodeActivatedCount=%d"), iWindowNodeActivatedCount);
       
    99         RDebug::Print(_L("iNodeExtentChangedCount=%d"), iNodeExtentChangedCount);
       
   100         RDebug::Print(_L("iLatestNodeExtentRect= x:%d, y:%d, width=%d, height=%d"), 
       
   101                          iLatestNodeExtentRect.iTl.iX, iLatestNodeExtentRect.iTl.iY, 
       
   102                          iLatestNodeExtentRect.Width(), iLatestNodeExtentRect.Height());
       
   103         RDebug::Print(_L("iTotalNodeFlagChangedCount=%d"), iTotalNodeFlagChangedCount);
       
   104         RDebug::Print(_L("iTotalNodeAttributeChangedCount=%d"), iTotalNodeAttributeChangedCount);        
    73         RDebug::Print(_L("iTotalVisualCount=%d"), iTotalVisualCount);
   105         RDebug::Print(_L("iTotalVisualCount=%d"), iTotalVisualCount);
    74         RDebug::Print(_L("iVisibleVisualCount=%d"), iVisibleVisualCount);
   106         RDebug::Print(_L("iVisibleVisualCount=%d"), iVisibleVisualCount);
    75         RDebug::Print(_L("iActiveVisualCount=%d"), iActiveVisualCount);
   107         RDebug::Print(_L("iActiveVisualCount=%d"), iActiveVisualCount);
    76         RDebug::Print(_L("iPassiveVisualCount=%d"), iPassiveVisualCount);
   108         RDebug::Print(_L("iPassiveVisualCount=%d"), iPassiveVisualCount);
    77         RDebug::Print(_L("iTextureCount=%d"), iTextureCount);
   109         RDebug::Print(_L("iTextureCount=%d"), iTextureCount);
    78         RDebug::Print(_L("iRenderBufferCount=%d"), iRenderBufferCount);
   110         RDebug::Print(_L("iRenderBufferCount=%d"), iRenderBufferCount);
       
   111         RDebug::Print(_L("iTotalControlGroupCount=%d"), iTotalControlGroupCount);        
       
   112         RDebug::Print(_L("iVisualSizeChangedCount=%d"), iVisualSizeChangedCount);        
       
   113         RDebug::Print(_L("iVisualPositionChangedCount=%d"), iVisualPositionChangedCount);
       
   114         RDebug::Print(_L("iLatestVisualExtentRect= x:%d, y:%d, width=%d, height=%d"), 
       
   115                          iLatestVisualExtentRect.iTl.iX, iLatestVisualExtentRect.iTl.iY, 
       
   116                          iLatestVisualExtentRect.Width(), iLatestVisualExtentRect.Height());
       
   117         RDebug::Print(_L("iTotalVisualFlagChangedCount=%d"), iTotalVisualFlagChangedCount);
       
   118         RDebug::Print(_L("iTotalVisualAttributeChangedCount=%d"), iTotalVisualAttributeChangedCount);        
    79         RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
   119         RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
    80         }
   120         }
    81     
   121     
    82     
   122     
    83 public:
   123 public:
    85     
   125     
    86     // Alf Render Stage
   126     // Alf Render Stage
    87     TInt iScreenCount;          // *** not yet implemented
   127     TInt iScreenCount;          // *** not yet implemented
    88     TInt iTotalLayerCount[10];  // For each screen
   128     TInt iTotalLayerCount[10];  // For each screen
    89     TInt iCloneLayerCount;      // ** not yet implemented
   129     TInt iCloneLayerCount;      // ** not yet implemented
    90     
   130     TInt iRsTotalNodeCount;
       
   131     TInt iRsWindowGroupNodeCount;
       
   132     TInt iRsWindowNodeCount;
       
   133     TInt iRsAnimNodeCount;
       
   134     TInt iRsWindowNodeActivatedCount;    
       
   135     TInt iRsNodeExtentChangedCount;
       
   136     TRect iRsLatestNodeExtentRect;
       
   137     TInt iRsTotalNodeFlagChangedCount;
       
   138     TInt iRsTotalNodeAttributeChangedCount;
       
   139     // These are temporary variables for Alf Render Stage thread internal use only!
       
   140     TInt iARS_Temp1;
       
   141     TInt iARS_Temp2;
       
   142     TInt iARS_Temp3;
       
   143     TInt iARS_Temp4;
       
   144    
    91     // Alf Streamer
   145     // Alf Streamer
    92     TInt iTotalNodeCount;       // *** not yet implemented
   146     TInt iTotalNodeCount;
    93     TInt iWindowGroupNodeCount; // *** not yet implemented
   147     TInt iWindowGroupNodeCount;
    94     TInt iWindowNodeCount;      // *** not yet implemented
   148     TInt iWindowNodeCount;
    95     TInt iAnimNodeCount;        // *** not yet implemented
   149     TInt iAnimNodeCount;
    96     
   150     TInt iWindowNodeActivatedCount;
       
   151     TInt iNodeExtentChangedCount;
       
   152     TRect iLatestNodeExtentRect;
       
   153     TInt iTotalNodeFlagChangedCount;
       
   154     TInt iTotalNodeAttributeChangedCount;
       
   155     // These are temporary variables for Alf Streamer thread internal use only!
       
   156     TInt iAST_Temp1;
       
   157     TInt iAST_Temp2;
       
   158     TInt iAST_Temp3;
       
   159     TInt iAST_Temp4;
       
   160    
    97     // Alf Server
   161     // Alf Server
    98     TInt iTotalVisualCount;     // *** not yet implemented
   162     TInt iTotalVisualCount;
    99     TInt iVisibleVisualCount;   // *** not yet implemented
   163     TInt iVisibleVisualCount;
   100     TInt iActiveVisualCount;    // Active visual count
   164     TInt iActiveVisualCount;
   101     TInt iPassiveVisualCount;   // Passive visual count
   165     TInt iPassiveVisualCount;
   102     TInt iTextureCount;         // *** not yet implemented
   166     TInt iTextureCount;         // *** not yet implemented
   103     TInt iRenderBufferCount;    // *** not yet implemented
   167     TInt iRenderBufferCount;    // *** not yet implemented
       
   168     TInt iTotalControlGroupCount;
       
   169     TInt iVisualSizeChangedCount;
       
   170     TInt iVisualPositionChangedCount;
       
   171     TRect iLatestVisualExtentRect;
       
   172     TInt iTotalVisualFlagChangedCount;
       
   173     TInt iTotalVisualAttributeChangedCount;
       
   174     TInt iOrdinalChange;
       
   175     // These are temporary variables for Alf Server thread internal use only!
       
   176     TInt iASE_Temp1;
       
   177     TInt iASE_Temp2;
       
   178     TInt iASE_Temp3;
       
   179     TInt iASE_Temp4;
   104     };
   180     };
   105 
   181 
   106 
   182 
   107 /*
   183 /*
   108  *  Class CAlfModuleTestDataControl
   184  *  Class CAlfModuleTestDataControl
   122     /*
   198     /*
   123      * Open global chunk and mutex created elsewhere
   199      * Open global chunk and mutex created elsewhere
   124      */
   200      */
   125     TInt OpenGlobalObjects()
   201     TInt OpenGlobalObjects()
   126         {
   202         {
       
   203         RDebug::Print(_L("CAlfModuleTestDataControl::OpenGlobalObjects()."));
   127         // Open global module testing chunk
   204         // Open global module testing chunk
   128         TBool isReadOnly = EFalse;
   205         TBool isReadOnly = EFalse;
   129         TInt err = iModuleTestChunk.OpenGlobal(KAlfModuleTestChunkName, isReadOnly);
   206         TInt err = iModuleTestChunk.OpenGlobal(KAlfModuleTestChunkName, isReadOnly);
   130         if (!err)
   207         if (!err)
   131             {
   208             {
   134             if (!err)
   211             if (!err)
   135                 {
   212                 {
   136                 iModuleTestData = reinterpret_cast<CAlfModuleTestData*>(iModuleTestChunk.Base());
   213                 iModuleTestData = reinterpret_cast<CAlfModuleTestData*>(iModuleTestChunk.Base());
   137                 }
   214                 }
   138             }
   215             }
   139         RDebug::Print(_L("CAlfModuleTestDataControl::OpenGlobalObjects. err=%d"), err);
   216         RDebug::Print(_L("CAlfModuleTestDataControl::OpenGlobalObjects. ret=%d"), err);
   140         return err;
   217         return err;
   141         }
   218         }
   142 
   219 
   143     /*
   220     /*
   144      * Lock access to global memory
   221      * Lock access to global memory