mpx/tsrc/public/basic/collectiontest/inc/testutility.h
changeset 62 b276843a15ba
equal deleted inserted replaced
58:c76ea6caa649 62:b276843a15ba
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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:  Provide common utility function for all test cases
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef TESTUTILITY_H
       
    19 #define TESTUTILITY_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32cmn.h>
       
    23 #include <mpxmediageneraldefs.h>
       
    24 #include <mpxmessagegeneraldefs.h>
       
    25 #include <mpxmediaarray.h>
       
    26 #include <mpxmediacontainerdefs.h>
       
    27 #include <mpxcollectionmessagedefs.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CMPXMedia;
       
    31 class CMPXMediaArray;
       
    32 class CMPXCollectionPath;
       
    33 class CStifLoggger;
       
    34 
       
    35 // CONSTANTS
       
    36 
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 * This static class contains utilities functions 
       
    42 */
       
    43 class TestUtility
       
    44     {
       
    45 public:
       
    46     /**
       
    47     * Test whether aTest descriptor attribute  contains in aContainer
       
    48     * @param aContainer: media 
       
    49     * @param aTest: media
       
    50     * @param aAttr: attribute type
       
    51     * @return ETrue aTest's aAttr is containing in aConatiner
       
    52     */        
       
    53     template<typename T> 
       
    54     static TBool ContainMediaObject(const CMPXMedia& aContainer, const CMPXMedia& aTest, 
       
    55                                     TMPXAttribute& aAttr, TIdentityRelation<T> anIdentity);
       
    56     
       
    57     /**
       
    58     * Test whether aTest and aContainer are contain media array and match specific content in order
       
    59     * @param aContainer: media 
       
    60     * @param aTest: media
       
    61     * @param aAttr: attribute type
       
    62     * @return ETrue aTest's aAttr is containing in aConatiner
       
    63     */
       
    64     template<typename T> 
       
    65     static TBool MatchMediaArrayObject(const CMPXMedia& aContainer, const CMPXMedia& aTest, 
       
    66                                        TMPXAttribute& aAttr, TIdentityRelation<T> anIdentity);
       
    67     
       
    68     /**
       
    69     * Test whether aContainer containing all the T object in aArray with aAttr attribues in order
       
    70     * @param aContainer: media 
       
    71     * @param aArray: array of T objects
       
    72     * @param aAttr: attribute type
       
    73     * @return ETrue aTest's aAttr is containing in aConatiner
       
    74     */
       
    75     template<typename T> 
       
    76     static TBool MatchMediaArrayObject(const CMPXMedia& aContainer, const RArray<T>& aArray, 
       
    77                                        TMPXAttribute& aAttr, TIdentityRelation<T> anIdentity);
       
    78 
       
    79     /**
       
    80     * Test whether aContainer containing all the text object in aArray with aAttr attribues in order
       
    81     * @param aContainer: media 
       
    82     * @param aArray: array of text objects
       
    83     * @param aAttr: attribute type
       
    84     * @return ETrue aTest's aAttr is containing in aConatiner
       
    85     */
       
    86     static TBool MatchMediaArrayTextObject(const CMPXMedia& aContainer, const MDesC16Array& aArray, 
       
    87                                            TMPXAttribute& aAttr);
       
    88                                            
       
    89     
       
    90     /**
       
    91     * Log the content of collection path. Only selection of each level and top level Ids are logged
       
    92     * @param aPath a path to log
       
    93     * @param aLogger a logger to log the message
       
    94     */
       
    95     //static void LogCollectionPath(CMPXCollectionPath& aPath, CStifLogger* aLogger);
       
    96     
       
    97 private:
       
    98     /**
       
    99     * Test whether aMedia1 and aMedia2 support same attribute
       
   100     * @param aMedia1: media 
       
   101     * @param aMedia2: media
       
   102     * @param aAttr: attribute type to match
       
   103     * @return ETrue aMedia1 and aMedia2 has same aAttr attribute
       
   104     */        
       
   105     static TBool ValidateMediaObject(const CMPXMedia& aMedia1, const CMPXMedia& aMedia2,
       
   106                                      TMPXAttribute& aAttr);
       
   107                                      
       
   108     /**
       
   109     * Test whether aMedia1 and aMedia2 support same array attribute
       
   110     * @param aMedia1: media 
       
   111     * @param aMedia2: media
       
   112     * @return ETrue aMedia1 and aMedia2 has same aAttr attribute
       
   113     */        
       
   114     static TBool ValidateMediaArrayObject(const CMPXMedia& aMedia1, const CMPXMedia& aMedia2);
       
   115     
       
   116     /**
       
   117     * Test whether aMedia is media array and same count as aArray
       
   118     * @param aMedia: media 
       
   119     * @param aArray: an array of items
       
   120     * @return ETrue aMedia is array object and same count as aArray
       
   121     */        
       
   122     static TBool ValidateMediaArrayObject(const CMPXMedia& aMedia, TInt aArrayCnt);
       
   123     };
       
   124 
       
   125 #include "testutility.inl"
       
   126 
       
   127 #endif  // TESTUTILITY_H