photosgallery/viewframework/medialists/tsrc/ut_cglxmedialist/ut_cglxmedialist.h
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 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:    CGlxMediaList unit tests
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __UT_CGLXMEDIALIST_H__
       
    22 #define __UT_CGLXMEDIALIST_H__
       
    23 
       
    24 //  EXTERNAL INCLUDES
       
    25 #include <digia/eunit/ceunittestsuiteclass.h>
       
    26 
       
    27 //  INTERNAL INCLUDES
       
    28 #include "mglxmedialistobserver.h"
       
    29 
       
    30 //  FORWARD DECLARATIONS
       
    31 class MGlxMediaList;
       
    32 class CGlxMediaList;
       
    33 class CGlxDefaultAttributeContext;
       
    34 class CActiveSchedulerWait;
       
    35 
       
    36 #include <e32def.h>
       
    37 #ifndef NONSHARABLE_CLASS
       
    38     #define NONSHARABLE_CLASS(x) class x
       
    39 #endif
       
    40 
       
    41 //  CLASS DEFINITION
       
    42 /**
       
    43  *
       
    44  * EUnitWizard generated test class. 
       
    45  *
       
    46  */
       
    47 NONSHARABLE_CLASS( UT_CGlxMediaList )
       
    48      : public CEUnitTestSuiteClass, public MGlxMediaListObserver
       
    49     {
       
    50     public:     // Constructors and destructors
       
    51 
       
    52         /**
       
    53          * Two phase construction
       
    54          */
       
    55         static UT_CGlxMediaList* NewL();
       
    56         static UT_CGlxMediaList* NewLC();
       
    57         /**
       
    58          * Destructor
       
    59          */
       
    60         ~UT_CGlxMediaList();
       
    61 
       
    62     private:    // Constructors and destructors
       
    63 
       
    64         UT_CGlxMediaList();
       
    65         void ConstructL();
       
    66 
       
    67     public:     // From observer interface
       
    68 
       
    69 	// From MGlxMediaListObserver
       
    70 	virtual void HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/);
       
    71 	virtual void HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) {};
       
    72 	virtual void HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) {};
       
    73 	virtual void HandleItemModifiedL(const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/) {};
       
    74 	virtual void HandleAttributesAvailableL(TInt /*aItemIndex*/, const RArray<TMPXAttribute>& /*aAttributes*/, MGlxMediaList* /*aList*/);
       
    75 	virtual void HandleFocusChangedL(NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) {};
       
    76 	virtual void HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, MGlxMediaList* /*aList*/) {};
       
    77 	virtual void HandleMessageL(const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/) {};
       
    78 
       
    79     private:    // New methods
       
    80 
       
    81          void SetupL();
       
    82         
       
    83          void Teardown();
       
    84         
       
    85          void UT_CGlxMediaList_InstanceLL();
       
    86         
       
    87         
       
    88          void UT_CGlxMediaList_MediaListsL();
       
    89         
       
    90         
       
    91          void UT_CGlxMediaList_NewLCL();
       
    92         
       
    93         
       
    94          void UT_CGlxMediaList_OpenLL();
       
    95         
       
    96         
       
    97          void UT_CGlxMediaList_AddReferenceL();
       
    98         
       
    99         
       
   100          void UT_CGlxMediaList_RemoveReferenceL();
       
   101         
       
   102         
       
   103          void UT_CGlxMediaList_ReferenceCountL();
       
   104         
       
   105         
       
   106          void UT_CGlxMediaList_EqualsL();
       
   107         
       
   108         
       
   109          void UT_CGlxMediaList_OfferMediaL();
       
   110         
       
   111         
       
   112          void UT_CGlxMediaList_HandleAttributesAvailableLL();
       
   113         
       
   114         
       
   115          void UT_CGlxMediaList_AttributeRequestLL();
       
   116         
       
   117         
       
   118          void UT_CGlxMediaList_CloseL();
       
   119         
       
   120         
       
   121          void UT_CGlxMediaList_IdL();
       
   122         
       
   123         
       
   124          void UT_CGlxMediaList_CountL();
       
   125         
       
   126         
       
   127          void UT_CGlxMediaList_FocusIndexL();
       
   128         
       
   129         
       
   130          void UT_CGlxMediaList_SetFocusLL();
       
   131         
       
   132         
       
   133          void UT_CGlxMediaList_ItemL();
       
   134         
       
   135         
       
   136          void UT_CGlxMediaList_IndexL();
       
   137         
       
   138         
       
   139          void UT_CGlxMediaList_AddMediaListObserverLL();
       
   140         
       
   141         
       
   142          void UT_CGlxMediaList_RemoveMediaListObserverL();
       
   143         
       
   144         
       
   145          void UT_CGlxMediaList_AddContextLL();
       
   146         
       
   147         
       
   148          void UT_CGlxMediaList_RemoveContextL();
       
   149         
       
   150         
       
   151          void UT_CGlxMediaList_CollectionL();
       
   152         
       
   153         
       
   154          void UT_CGlxMediaList_PathLCL();
       
   155         
       
   156         
       
   157          void UT_CGlxMediaList_IsSelectedL();
       
   158         
       
   159         
       
   160          void UT_CGlxMediaList_SetSelectedLL();
       
   161         
       
   162         
       
   163          void UT_CGlxMediaList_SelectionCountL();
       
   164         
       
   165         
       
   166          void UT_CGlxMediaList_SelectedItemIndexL();
       
   167         
       
   168         
       
   169          void UT_CGlxMediaList_CommandLL();
       
   170         
       
   171         
       
   172          void UT_CGlxMediaList_CancelCommandL();
       
   173         
       
   174         
       
   175          void UT_CGlxMediaList_SetFilterLL();
       
   176         
       
   177         
       
   178          void UT_CGlxMediaList_FilterL();
       
   179         
       
   180         
       
   181          void UT_CGlxMediaList_HandleOpenLL();
       
   182         
       
   183         
       
   184          void UT_CGlxMediaList_HandleOpenL_1L();
       
   185         
       
   186         
       
   187          void UT_CGlxMediaList_HandleCollectionMediaLL();
       
   188         
       
   189         
       
   190          void UT_CGlxMediaList_HandleCollectionMessageL_1L();
       
   191         
       
   192 	void SetupFocusTestL();
       
   193 	void SetupPathTestL();
       
   194 	void SetupSelectionTestL();
       
   195 	void SetupFilterTestL();
       
   196 
       
   197 	void MoveFocusAbsoluteGreaterThanCurrentFocusL();
       
   198 	void MoveFocusAbsoluteLessThanCurrentFocusL();
       
   199 	void MoveFocusRelativeForwardL();
       
   200 	void MoveFocusRelativeBackwardL();
       
   201 	void MoveFocusRelativeForwardGreaterThanListCountL();
       
   202 	void MoveFocusRelativeBackwardLessThanZeroL();
       
   203 
       
   204 	void ReceiveMessageItemChangedItemModifiedL();
       
   205 
       
   206     private:    // Data
       
   207 	CGlxMediaList* iCGlxMediaList;
       
   208 	CGlxDefaultAttributeContext* iContext;
       
   209 
       
   210 	CActiveSchedulerWait* iSchedulerWait;
       
   211 
       
   212         EUNIT_DECLARE_TEST_TABLE; 
       
   213 
       
   214     private:
       
   215 
       
   216 	// Test media list observer
       
   217 	class CGlxMediaListObserverTest : public CBase, public MGlxMediaListObserver
       
   218 		{
       
   219 	public:
       
   220 		static CGlxMediaListObserverTest* NewL();
       
   221 
       
   222 		virtual ~CGlxMediaListObserverTest();
       
   223 
       
   224 		// From MGlxMediaListObserver
       
   225 		virtual void HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) {};
       
   226 		virtual void HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) {};
       
   227 		virtual void HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) {};
       
   228 		virtual void HandleItemModifiedL(const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/);
       
   229 		virtual void HandleAttributesAvailableL(TInt /*aItemIndex*/, const RArray<TMPXAttribute>& /*aAttributes*/, MGlxMediaList* /*aList*/) {};
       
   230 		virtual void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList);
       
   231 		virtual void HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, MGlxMediaList* /*aList*/) {};
       
   232 		virtual void HandleMessageL(const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/);
       
   233 
       
   234 		const MGlxMediaList* List() { return iList; };
       
   235 
       
   236 		// HandleFocusChangedL observations
       
   237 		NGlxListDefs::TFocusChangeType FocusChangeType() { return iFocusChangeType; };
       
   238 		TInt FocusNewIndex() { return iFocusNewIndex; };
       
   239 		TInt FocusOldIndex() { return iFocusOldIndex; };
       
   240 
       
   241 		// HandleItemModifiedL observations
       
   242 		const RArray<TInt>& ModifiedItemIndices() { return iModifiedItemIndices; };
       
   243 
       
   244 		// HandleMessageL observations
       
   245 		const CMPXMessage* Message() { return iMessage; };
       
   246 		TInt MessageCount() { return iMessageCount; };
       
   247 
       
   248 	private:
       
   249 		CGlxMediaListObserverTest();
       
   250 		void ConstructL();
       
   251 
       
   252 	private:
       
   253 		MGlxMediaList* iList;
       
   254 
       
   255 		// data from HandleFocusChangedL
       
   256 		NGlxListDefs::TFocusChangeType iFocusChangeType;
       
   257 		TInt iFocusNewIndex;
       
   258 		TInt iFocusOldIndex;
       
   259 
       
   260 		// data from HandleItemModifiedL
       
   261 		RArray<TInt> iModifiedItemIndices;
       
   262 
       
   263 		// data from HandleMessageL
       
   264 		CMPXMessage* iMessage;
       
   265 		TInt iMessageCount;
       
   266 		};
       
   267     };
       
   268 
       
   269 #endif      //  __UT_CGLXMEDIALIST_H__
       
   270 
       
   271 // End of file