stif/stif_plat/inc/UIStoreContainer.h
branchRCL_3
changeset 59 8ad140f3dd41
parent 0 a03f92240627
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     1 /*
       
     2 * Copyright (c) 2009 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: This file contains the header file of the 
       
    15 * CTestCaseRunnner, CTestCasePrinter and CStartedTestCase
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef UISTORECASECONTAINER_H
       
    20 #define UISTORECASECONTAINER_H
       
    21 
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 
       
    27 #include <StifTestInterface.h>
       
    28 
       
    29 #include <stifinternal/RRefArray.h>
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 // MACROS
       
    34 
       
    35 // DATA TYPES
       
    36 
       
    37 // FUNCTION PROTOTYPES
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 class CUIEngineContainer;
       
    41 class CTestInfo;
       
    42 class CUIStore;
       
    43 class CTestSetInfo;
       
    44 
       
    45 // DESCRIPTION
       
    46 // CTestProgress defines the progress information from Test Module.
       
    47 class CTestProgress
       
    48     :public CBase 
       
    49     {
       
    50     public:
       
    51         static CTestProgress* NewL( const TTestProgress& aProgress );
       
    52 
       
    53         ~CTestProgress();
       
    54         
       
    55         void ReplaceTextL( const TTestProgress& aProgress );
       
    56     
       
    57     private:
       
    58         void ConstructL( const TTestProgress& aProgress );
       
    59 
       
    60     public:
       
    61         // "Priority" of the progress information.
       
    62         TInt iPosition;
       
    63         // Description of the data to be printed.
       
    64         TPtrC iDescription;
       
    65         // The actual progress information.
       
    66         TPtrC iText;
       
    67     
       
    68     private:
       
    69         // Description of the data to be printed.
       
    70         HBufC* iDescriptionBuf;
       
    71         // The actual progress information.
       
    72         HBufC* iTextBuf;
       
    73 
       
    74     };
       
    75 
       
    76 // DESCRIPTION
       
    77 // CStartedTestCase contains active objects that handles one test case
       
    78 class CStartedTestCase 
       
    79     :public CBase  
       
    80     {
       
    81     public: // Enumerations
       
    82 
       
    83     private: // Enumerations
       
    84 
       
    85     public:  // Constructors and destructor
       
    86 
       
    87         /**
       
    88         * NewL is first phase of two-phased constructor.
       
    89         */
       
    90         static CStartedTestCase* NewL( const CTestInfo& aTestInfo, 
       
    91                                        CUIEngineContainer& aContainer );
       
    92 
       
    93         /**
       
    94         * Destructor of CStartedTestCase.
       
    95         */
       
    96         virtual ~CStartedTestCase();
       
    97 
       
    98     public: // New functions
       
    99     
       
   100         /**
       
   101         * Get Engine container handle.
       
   102         */
       
   103         IMPORT_C CUIEngineContainer& UIEngineContainer() const;
       
   104             
       
   105         /**
       
   106         * Set case result
       
   107         */
       
   108         void SetResult( const TFullTestResult& aResult );
       
   109 
       
   110         /**
       
   111         * Get test case info.
       
   112         */    
       
   113         inline CTestInfo const& TestInfo() const
       
   114             { return *iTestInfo; }; 
       
   115                
       
   116         /**
       
   117         * Return the result
       
   118         */
       
   119         inline const TFullTestResult& Result() const
       
   120             { return iResult; };
       
   121 
       
   122         /**
       
   123         * Return the print array
       
   124         */
       
   125         inline RPointerArray<CTestProgress>& PrintArray()
       
   126             { return iPrints; };
       
   127         inline const RPointerArray<CTestProgress>& PrintArray() const
       
   128             { return iPrints; };
       
   129         
       
   130         /**
       
   131         * Get status.
       
   132         */
       
   133         inline TInt Status() const { return iStatus; }
       
   134 
       
   135     public: // Functions from base classes
       
   136 
       
   137     protected:  // New functions
       
   138 
       
   139     protected:  // Functions from base classes
       
   140 
       
   141     private:   // Functions from base classes
       
   142         
       
   143         /** 
       
   144         * C++ default constructor.
       
   145         */
       
   146         CStartedTestCase( CUIEngineContainer& aContainer );
       
   147        
       
   148         /**
       
   149         * By default Symbian OS constructor is private.
       
   150         */
       
   151         void ConstructL( const CTestInfo& aTestInfo );
       
   152         
       
   153         /**
       
   154         * Private constructor for internal use.
       
   155         */
       
   156         CStartedTestCase( CTestInfo* aTestInfo, 
       
   157                           TFullTestResult aResult, 
       
   158                           TInt aStatus  );
       
   159         
       
   160     public:      //Data
       
   161         /**
       
   162         * Backpointer that can be utilized by UI, not used from UI Engine.
       
   163         */
       
   164         TAny*       iBackPtr;
       
   165     
       
   166     protected:  // Data
       
   167         // None
       
   168 
       
   169     private:    // Data
       
   170         CUIEngineContainer*             iContainer;
       
   171         CTestInfo*                      iTestInfo;
       
   172         TFullTestResult                 iResult;   // Test case result
       
   173         
       
   174         RPointerArray<CTestProgress>    iPrints;   // Prints from case
       
   175 
       
   176         // Execution status (flags from CUIStoreIf::TUpdateFlags)
       
   177         TInt                            iStatus;
       
   178         
       
   179     public:     // Friend classes
       
   180         // None
       
   181 
       
   182     protected:  // Friend classes
       
   183         // None
       
   184 
       
   185     private:    // Friend classes
       
   186         friend class CUIStore;
       
   187 
       
   188     };
       
   189 
       
   190 // DESCRIPTION
       
   191 // CStartedTestSet contains test set information
       
   192 class CStartedTestSet 
       
   193     :public CBase  
       
   194     {
       
   195     public: // Enumerations
       
   196         enum TSetType
       
   197             {
       
   198             ESetSequential,
       
   199             ESetParallel,
       
   200             };
       
   201 
       
   202     private: // Enumerations
       
   203 
       
   204     public:  // Constructors and destructor
       
   205 
       
   206         /**
       
   207         * NewL is first phase of two-phased constructor.
       
   208         */
       
   209         static CStartedTestSet* NewL( CUIStore* aUIStore, 
       
   210                                       const CTestSetInfo& aTestSetInfo,
       
   211                                       TSetType aType );
       
   212 
       
   213         /**
       
   214         * Destructor of CStartedTestCase.
       
   215         */
       
   216         virtual ~CStartedTestSet();
       
   217 
       
   218     public: // New functions
       
   219     
       
   220         /**
       
   221         * Get test case info.
       
   222         */    
       
   223         inline CTestSetInfo const& TestSetInfo() const
       
   224             { return *iTestSetInfo; }; 
       
   225                
       
   226         /**
       
   227         * Return the result
       
   228         */
       
   229         inline const TFullTestResult& Result() const
       
   230             { return iResult; };
       
   231 
       
   232         /**
       
   233         * Get status.
       
   234         */
       
   235         inline TInt Status() const { return iStatus; }
       
   236         
       
   237         /**
       
   238         * Get test cases runned/running in test set.
       
   239         */
       
   240         inline const RRefArray<CStartedTestCase>& TestCases() const
       
   241             { return iTestCases; };
       
   242         
       
   243         /**
       
   244         * Get type.
       
   245         */ 
       
   246         inline TSetType Type(){ return iType; };        
       
   247         
       
   248         /**
       
   249         * Start next testcase. Returns KErrNotFound if does not exits.
       
   250         */ 
       
   251         TInt StartNext();
       
   252         
       
   253         /**
       
   254         * Abort running testcases.
       
   255         */ 
       
   256         TInt Abort();
       
   257         
       
   258         /**
       
   259         * Check if test case running in this test set.
       
   260         */
       
   261         TBool IsRunning( const CStartedTestCase* aTestCase ); 
       
   262         
       
   263         /**
       
   264         * Test from this set completed.
       
   265         */
       
   266         TInt TestCompleted( const CStartedTestCase* aTestCase, 
       
   267                             TFullTestResult aResult );
       
   268                             
       
   269         /**
       
   270         * Sets mode in which only not executed tests will be run.
       
   271         */
       
   272         void SetNotStartedCasesMode(TBool aNotStartedCasesMode);
       
   273         
       
   274         /**
       
   275         * Returns pointer to original test set.
       
   276         */
       
   277         CTestSetInfo* GetOriginalTestSet();
       
   278 
       
   279         /**
       
   280         * Sets pointer to original test set to NULL.
       
   281         */
       
   282         void NullOriginalTestSet();
       
   283 
       
   284     public: // Functions from base classes
       
   285 
       
   286     protected:  // New functions
       
   287 
       
   288     protected:  // Functions from base classes
       
   289 
       
   290     private:   // Functions from base classes
       
   291         /** 
       
   292         * C++ default constructor.
       
   293         */
       
   294         CStartedTestSet( CUIStore* aUIStore, TSetType aType );
       
   295 
       
   296         /**
       
   297         * By default Symbian OS constructor is private.
       
   298         */
       
   299         void ConstructL( const CTestSetInfo& aTestSetInfo );
       
   300 
       
   301     public:      //Data
       
   302         /**
       
   303         * Backpointer that can be utilized by UI, not used from UI Engine.
       
   304         */
       
   305         TAny*       iBackPtr;
       
   306     
       
   307     protected:  // Data
       
   308         // None
       
   309 
       
   310     private:    // Data
       
   311         // Backpointer
       
   312         CUIStore*                       iUIStore;
       
   313         
       
   314         CTestSetInfo*                   iTestSetInfo;
       
   315         TFullTestResult                 iResult;   // Test case result
       
   316         TBool                           iResultSet;
       
   317         
       
   318         RRefArray<CStartedTestCase>     iTestCases;
       
   319         
       
   320         TSetType                        iType;
       
   321 
       
   322         // Execution status (flags from CUIStoreIf::TUpdateFlags)
       
   323         TInt                            iStatus;
       
   324         
       
   325         // Next case to start        
       
   326         TInt                            iNext;
       
   327         // Number of running cases
       
   328         TInt                            iRunningCases;
       
   329         
       
   330         // In this mode only not executed tests will be run
       
   331         TBool                           iNotStartedCasesMode;
       
   332         
       
   333         // Original test set
       
   334         CTestSetInfo*                   iOriginalTestSet;
       
   335         
       
   336     public:     // Friend classes
       
   337         // None
       
   338 
       
   339     protected:  // Friend classes
       
   340         // None
       
   341 
       
   342     private:    // Friend classes
       
   343         // None
       
   344 
       
   345     };
       
   346 
       
   347 #endif // UISTORECASECONTAINER_H
       
   348 
       
   349 // End of File