photosgallery/viewframework/medialists/tsrc/inc/tmglxmedialist_stub.h
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2007-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:    Medialist stub
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __TMGLXMEDIALIST_STUB_H__
       
    22 #define __TMGLXMEDIALIST_STUB_H__
       
    23 
       
    24 /**
       
    25  * @internal reviewed 08/02/2008 by Rhodri Byles
       
    26  */
       
    27 
       
    28 //  EXTERNAL INCLUDES
       
    29 #include <digia/eunit/eunitmacros.h>
       
    30 
       
    31 #include <mglxmedialist.h>
       
    32 #include <mglxmedialistobserver.h>
       
    33 
       
    34 //  INTERNAL INCLUDES
       
    35 namespace TMGlxMediaList_Stub_Config
       
    36     {
       
    37     const TBool KDefaultIsPopulated = ETrue;
       
    38     const TInt KDefaultSize = 3;
       
    39     const TInt KDefaultFocus = 1;
       
    40     }
       
    41 
       
    42 /**
       
    43  * Observer interface for medialist stub method calls
       
    44  * The test class is informed about any calls to the 
       
    45  * corresponding adapter using this interface. 
       
    46  */
       
    47 NONSHARABLE_CLASS( MGlxMediaList_Stub_Observer )
       
    48     {
       
    49     public:     // enums
       
    50 
       
    51         enum TMGlxMediaListMethodId
       
    52             {
       
    53             E_NotCalled,
       
    54             E_Close,
       
    55             E_TGlxMediaListId_Id_,
       
    56             E_TInt_Count_,
       
    57             E_TInt_FocusIndex_,
       
    58             E_void_SetFocusL_TInt_,
       
    59             E_const_TGlxMedia_r_Item_TInt_,
       
    60             E_TInt_Index_const_TGlxMediaId_r_,
       
    61             E_void_AddMediaListObserverL_MGlxMediaListObserver_p_,
       
    62             E_void_RemoveMediaListObserver_MGlxMediaListObserver_p_,
       
    63             E_void_AddContextL_const_MGlxFetchContext_p_TInt_,
       
    64             E_void_RemoveContext_const_MGlxFetchContext_p_,
       
    65             E_MMPXCollection_r_Collection_,
       
    66             E_CMPXCollectionPath_p_PathLC_,
       
    67             E_TBool_IsSelected_TInt_,
       
    68             E_void_SetSelectedL_TInt_TBool_,
       
    69             E_TInt_SelectionCount_,
       
    70             E_TInt_SelectedItemIndex_TInt_,
       
    71             E_void_CommandL_CMPXCommand_r_,
       
    72             E_void_CancelCommand_,
       
    73             E_void_SetFilterL_CMPXFilter_p_,
       
    74             E_CMPXFilter_p_Filter_,
       
    75             E_TGlxIdSpaceId_IdSpaceId_TInt_,
       
    76             E_TBool_IsPopulated
       
    77             };
       
    78 
       
    79     protected:     // Destructor
       
    80 
       
    81         /**
       
    82          * Destructor
       
    83          */
       
    84         virtual ~MGlxMediaList_Stub_Observer() {};
       
    85 
       
    86     public:     // Abstract methods
       
    87 
       
    88         /**
       
    89          * This method gets called when the media list stub is called
       
    90          * @param aMethodId the method id that was called
       
    91          */
       
    92         virtual void MGlxMediaList_MethodCalled(TMGlxMediaListMethodId aMethodId) = 0;
       
    93 
       
    94     };
       
    95 
       
    96 //  CLASS DEFINITION
       
    97 /**
       
    98  * Stub implementation of gallery medialist
       
    99  */
       
   100 NONSHARABLE_CLASS( TMGlxMediaList_Stub ) : public MGlxMediaList
       
   101     {
       
   102     public:     // Constructors and destructors
       
   103 
       
   104         /**
       
   105          * Constructor
       
   106          * @param aObserver, the observer for the medialist events
       
   107          */
       
   108         inline TMGlxMediaList_Stub( MGlxMediaList_Stub_Observer* aObserver );
       
   109 
       
   110         /**
       
   111          * Destructor
       
   112          */
       
   113         inline ~TMGlxMediaList_Stub();
       
   114 
       
   115     public:
       
   116 
       
   117         /**
       
   118          * This method can be used by test code to call 
       
   119          * HandleAttributesAvailableL of the 
       
   120          * observer of this media list.
       
   121          * @param aIndex the index for which the attributes are available
       
   122          */
       
   123         inline void NotifyAttributesAvailableL( TInt aIndex );
       
   124 
       
   125         /**
       
   126          * This method can be used by test code to call 
       
   127          * HandleError of the observer of this media list.
       
   128          * @param aError the error code
       
   129          */
       
   130         inline void NotifyError( TInt aError );
       
   131 
       
   132         /**
       
   133          * This method can be used by test code to call 
       
   134          * NotifyItemRemoved of the observer of this media list.
       
   135          * @param aStartIndex the first item index
       
   136          * @param aEndIndex the last item index
       
   137          */
       
   138         inline void NotifyItemRemoved( TInt aStartIndex, TInt aEndIndex );
       
   139         
       
   140         /**
       
   141          * This method can be used by test code to call 
       
   142          * HandlePopulatedL of the observer of this media list.
       
   143          */
       
   144         inline void NotifyHandlePopulatedL();
       
   145         
       
   146         /**
       
   147          * This method deletes the filter currently in use
       
   148          */
       
   149          inline void RemoveFilter();
       
   150 
       
   151     public: // from MGlxMediaList
       
   152 
       
   153         inline void Close();
       
   154         inline TGlxMediaListId Id() const;
       
   155         inline TInt Count( NGlxListDefs::TCountType aType ) const;
       
   156         inline TInt FocusIndex() const;
       
   157         inline void SetFocusL(NGlxListDefs::TFocusSetType aType, TInt aValue);
       
   158         inline const TGlxMedia& Item(TInt aIndex) const;
       
   159         inline TInt Index(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aId) const;
       
   160         inline void AddMediaListObserverL(MGlxMediaListObserver* aObserver);
       
   161         inline void RemoveMediaListObserver(MGlxMediaListObserver* aObserver);
       
   162         inline void AddContextL(const MGlxFetchContext* aContext, TInt aPriority);
       
   163         inline void RemoveContext(const MGlxFetchContext* aContext);
       
   164         inline MMPXCollection& Collection() const;
       
   165         inline CMPXCollectionPath* PathLC(NGlxListDefs::TPathType aType) const;
       
   166         inline TBool IsSelected(TInt aIndex) const;
       
   167         inline void SetSelectedL(TInt aIndex, TBool aSelected);
       
   168         inline TInt SelectionCount() const;
       
   169         inline TInt SelectedItemIndex(TInt aSelectionIndex) const;
       
   170         inline void CommandL(CMPXCommand& aCommand);
       
   171         inline void CancelCommand();
       
   172         inline void SetFilterL(CMPXFilter* aFilter);
       
   173         inline CMPXFilter* Filter() const;
       
   174         inline TGlxIdSpaceId IdSpaceId(TInt aIndex) const;
       
   175         inline TBool IsPopulated() const;
       
   176         
       
   177         ///@todo implement these methods
       
   178         void AddStaticItemL( CGlxMedia* /*aStaticItem*/,
       
   179             NGlxListDefs::TInsertionPosition /*aTargetPosition*/ ) {}
       
   180         void RemoveStaticItem(const TGlxMediaId& /*aItemId*/) {}
       
   181         void SetStaticItemsEnabled( TBool aEnabled ) { iStaticItemsEnabled = aEnabled; }
       
   182         TBool IsStaticItemsEnabled() const { return iStaticItemsEnabled; }
       
   183         
       
   184         virtual void SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition /*aFocusInitialPosition*/) { };
       
   185         virtual void ResetFocus(){ };
       
   186         virtual void SetVisibleWindowIndexL( TInt /*aIndex*/) { };
       
   187         virtual TInt VisibleWindowIndex() const { };
       
   188         virtual void CancelPreviousRequests() {};
       
   189         
       
   190     public: // Data, public so that the test can specify the values it needs to be returned
       
   191 
       
   192         /// Array that contains the attributes
       
   193         RArray<TMPXAttribute> iAttributesAvailable;
       
   194         /// The selection
       
   195         RArray<TInt> iSelection;
       
   196         /// media properties object
       
   197         CGlxMedia* iGlxMediaProperties;
       
   198         /// media
       
   199         TGlxMedia iGlxMedia;
       
   200         /// Whether the list is populated or not
       
   201         TBool iIsPopulated;
       
   202         /// The item count of the list
       
   203         TInt iCount;
       
   204         /// The focus index
       
   205         TInt iFocus;
       
   206         /// Collection path
       
   207         CMPXCollectionPath* iMPXCollectionPath;
       
   208         // Filter in use
       
   209         CMPXFilter* iMPXFilter;
       
   210 
       
   211     private: // Data, needed for functionality
       
   212 
       
   213         RArray<MGlxMediaListObserver*> iObservers;
       
   214         MGlxMediaList_Stub_Observer* iMGlxMediaList_Observer;
       
   215         TBool iStaticItemsEnabled;
       
   216     };
       
   217 
       
   218 // -----------------------------------------------------------------------------
       
   219 // Constructor
       
   220 // -----------------------------------------------------------------------------
       
   221 TMGlxMediaList_Stub::TMGlxMediaList_Stub(
       
   222     MGlxMediaList_Stub_Observer* aObserver )
       
   223     : iGlxMediaProperties( NULL ),
       
   224     iGlxMedia( TGlxMediaId( 0 ), iGlxMediaProperties ),
       
   225     iIsPopulated( TMGlxMediaList_Stub_Config::KDefaultIsPopulated ),
       
   226     iCount( TMGlxMediaList_Stub_Config::KDefaultSize ),
       
   227     iFocus( TMGlxMediaList_Stub_Config::KDefaultFocus ),
       
   228     iMPXCollectionPath( NULL ),
       
   229     iMGlxMediaList_Observer( aObserver ),
       
   230     iMPXFilter(0)
       
   231     {
       
   232     }
       
   233 
       
   234 // -----------------------------------------------------------------------------
       
   235 // Destructor
       
   236 // -----------------------------------------------------------------------------
       
   237 TMGlxMediaList_Stub::~TMGlxMediaList_Stub()
       
   238     {
       
   239     iSelection.Close();
       
   240     iObservers.Close();
       
   241     delete iMPXFilter;
       
   242     }
       
   243 
       
   244 // -----------------------------------------------------------------------------
       
   245 // NotifyAttributesAvailableL
       
   246 // -----------------------------------------------------------------------------
       
   247 void TMGlxMediaList_Stub::NotifyAttributesAvailableL( TInt aIndex )
       
   248     {
       
   249     EUNIT_PRINT( 
       
   250         _L( "TMGlxMediaList_Stub::Notifying attributes available %d" ),
       
   251             aIndex );
       
   252 
       
   253     // make the call to all registered observers
       
   254     for( TInt i=0; i<iObservers.Count(); i++ )
       
   255         {
       
   256         iObservers[ i ]->HandleAttributesAvailableL( 
       
   257             aIndex, iAttributesAvailable, this );
       
   258         }
       
   259     }
       
   260 
       
   261 // -----------------------------------------------------------------------------
       
   262 // NotifyError
       
   263 // -----------------------------------------------------------------------------
       
   264 void TMGlxMediaList_Stub::NotifyError( TInt aError )
       
   265     {
       
   266     EUNIT_PRINT( _L("TMGlxMediaList_Stub::Notifying error %d"), aError );
       
   267 
       
   268     // make the call to all registered observers
       
   269     for( TInt i=0; i<iObservers.Count(); i++ )
       
   270         {
       
   271         iObservers[ i ]->HandleError( aError );
       
   272         }
       
   273     }
       
   274 
       
   275 // -----------------------------------------------------------------------------
       
   276 // NotifyItemRemoved
       
   277 // -----------------------------------------------------------------------------
       
   278 void TMGlxMediaList_Stub::NotifyItemRemoved( 
       
   279     TInt aStartIndex, TInt aEndIndex )
       
   280     {
       
   281     EUNIT_PRINT( 
       
   282         _L("TMGlxMediaList_Stub::Notifying items removed %d->%d"), 
       
   283             aStartIndex, aEndIndex );
       
   284 
       
   285     // make the call to all registered observers
       
   286     for( TInt i=0; i<iObservers.Count(); i++ )
       
   287         {
       
   288         iObservers[ i ]->HandleItemRemovedL( 
       
   289             aStartIndex, aEndIndex, this );
       
   290         }
       
   291     }
       
   292 
       
   293 // -----------------------------------------------------------------------------
       
   294 // NotifyHandlePopulatedL
       
   295 // -----------------------------------------------------------------------------
       
   296 void TMGlxMediaList_Stub::NotifyHandlePopulatedL()
       
   297     {
       
   298     EUNIT_PRINT( 
       
   299         _L("TMGlxMediaList_Stub::Notifying handle populated") );
       
   300 
       
   301     // make the call to all registered observers
       
   302     for( TInt i=0; i<iObservers.Count(); i++ )
       
   303         {
       
   304         iObservers[ i ]->HandlePopulatedL( this );
       
   305         }
       
   306     }
       
   307 
       
   308 // -----------------------------------------------------------------------------
       
   309 // Close
       
   310 // -----------------------------------------------------------------------------
       
   311 void TMGlxMediaList_Stub::Close()
       
   312     {
       
   313     // inform the test case 
       
   314     if( iMGlxMediaList_Observer )
       
   315         {
       
   316         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( 
       
   317             MGlxMediaList_Stub_Observer::E_Close );
       
   318         }
       
   319     iObservers.Close();
       
   320     }
       
   321 
       
   322 // -----------------------------------------------------------------------------
       
   323 // Id
       
   324 // -----------------------------------------------------------------------------
       
   325 TGlxMediaListId TMGlxMediaList_Stub::Id() const
       
   326     {
       
   327     // inform the test case
       
   328     if( iMGlxMediaList_Observer )
       
   329         {
       
   330         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   331             MGlxMediaList_Stub_Observer::E_TGlxMediaListId_Id_ );
       
   332         }
       
   333     // just return this pointer as id
       
   334     return TGlxMediaListId((unsigned int)(void*)this);	
       
   335     }
       
   336 
       
   337 // -----------------------------------------------------------------------------
       
   338 // Count
       
   339 // -----------------------------------------------------------------------------
       
   340 TInt TMGlxMediaList_Stub::Count( NGlxListDefs::TCountType /*aType*/ ) const
       
   341     {
       
   342     // inform the test case
       
   343     if( iMGlxMediaList_Observer )
       
   344         {
       
   345         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   346             MGlxMediaList_Stub_Observer::E_TInt_Count_ );
       
   347         }
       
   348     // return the specified count
       
   349     return iCount;
       
   350     }
       
   351 
       
   352 // -----------------------------------------------------------------------------
       
   353 // FocusIndex
       
   354 // -----------------------------------------------------------------------------
       
   355 TInt TMGlxMediaList_Stub::FocusIndex() const
       
   356     {
       
   357     // inform the test case
       
   358     if( iMGlxMediaList_Observer )
       
   359         {
       
   360         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( 
       
   361             MGlxMediaList_Stub_Observer::E_TInt_FocusIndex_ );
       
   362         }
       
   363     // return given focus
       
   364     return iFocus;
       
   365     }
       
   366 
       
   367 // -----------------------------------------------------------------------------
       
   368 // SetFocusL
       
   369 // -----------------------------------------------------------------------------
       
   370 void TMGlxMediaList_Stub::SetFocusL( 
       
   371     NGlxListDefs::TFocusSetType /*aType*/, TInt /*aValue*/ )
       
   372     {
       
   373     // inform the test case
       
   374     if( iMGlxMediaList_Observer )
       
   375         {
       
   376         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   377             MGlxMediaList_Stub_Observer::E_void_SetFocusL_TInt_ );
       
   378         }
       
   379     // make an alloc to cause a leave in memory tests
       
   380     TInt* memAlloc = new (ELeave) TInt;
       
   381     delete memAlloc;
       
   382     }
       
   383 
       
   384 // -----------------------------------------------------------------------------
       
   385 // Item
       
   386 // -----------------------------------------------------------------------------
       
   387 const TGlxMedia& TMGlxMediaList_Stub::Item( TInt /*aIndex*/ ) const
       
   388     {
       
   389     // inform the test case
       
   390     if( iMGlxMediaList_Observer )
       
   391         {
       
   392         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   393             MGlxMediaList_Stub_Observer::E_const_TGlxMedia_r_Item_TInt_ );
       
   394         }
       
   395     // return the glxmedia object
       
   396     return iGlxMedia;
       
   397     }
       
   398 
       
   399 // -----------------------------------------------------------------------------
       
   400 // Index
       
   401 // -----------------------------------------------------------------------------
       
   402 TInt TMGlxMediaList_Stub::Index(
       
   403     const TGlxIdSpaceId& /*aIdSpaceId*/, const TGlxMediaId& /*aId*/ ) const
       
   404     {
       
   405     // inform the test case
       
   406     if( iMGlxMediaList_Observer )
       
   407         {
       
   408         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( 
       
   409             MGlxMediaList_Stub_Observer::E_TInt_Index_const_TGlxMediaId_r_ );
       
   410         }
       
   411     // Default return value generated by EUnit Wizard
       
   412     return 0;
       
   413     }
       
   414     
       
   415 // -----------------------------------------------------------------------------
       
   416 // AddMediaListObserverL
       
   417 // -----------------------------------------------------------------------------
       
   418 void TMGlxMediaList_Stub::AddMediaListObserverL(
       
   419     MGlxMediaListObserver* aObserver )
       
   420     {
       
   421     EUNIT_PRINT( _L("TMGlxMediaList_Stub::AddMediaListObserverL" ) );
       
   422     // inform the test case
       
   423     if( iMGlxMediaList_Observer )
       
   424         {
       
   425         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   426             MGlxMediaList_Stub_Observer::E_void_AddMediaListObserverL_MGlxMediaListObserver_p_ );
       
   427         }
       
   428     // add the observer to array
       
   429     iObservers.AppendL( aObserver );
       
   430 
       
   431     // make an alloc to cause a leave in memory tests
       
   432     TInt* memAlloc = new (ELeave) TInt;
       
   433     delete memAlloc;
       
   434     }
       
   435     
       
   436 // -----------------------------------------------------------------------------
       
   437 // RemoveMediaListObserver
       
   438 // -----------------------------------------------------------------------------
       
   439 void TMGlxMediaList_Stub::RemoveMediaListObserver(
       
   440     MGlxMediaListObserver* aObserver )
       
   441     {
       
   442     // inform the test case
       
   443     if( iMGlxMediaList_Observer )
       
   444         {
       
   445         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( 
       
   446             MGlxMediaList_Stub_Observer::E_void_RemoveMediaListObserver_MGlxMediaListObserver_p_ );
       
   447         }
       
   448 
       
   449     // find the observer
       
   450     TInt index = iObservers.Find( aObserver );
       
   451     // was it found
       
   452     if( index > KErrNotFound )
       
   453         {
       
   454         iObservers.Remove( index );
       
   455         }
       
   456     }
       
   457 
       
   458 // -----------------------------------------------------------------------------
       
   459 // AddContextL
       
   460 // -----------------------------------------------------------------------------
       
   461 void TMGlxMediaList_Stub::AddContextL(
       
   462     const MGlxFetchContext* /*aContext*/, TInt /*aPriority */)
       
   463     {
       
   464     // inform the test case
       
   465     if( iMGlxMediaList_Observer )
       
   466         {
       
   467         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( 
       
   468             MGlxMediaList_Stub_Observer::E_void_AddContextL_const_MGlxFetchContext_p_TInt_ );
       
   469         }
       
   470 
       
   471     // make an alloc to cause a leave in memory tests
       
   472     TInt* memAlloc = new (ELeave) TInt;
       
   473     delete memAlloc;
       
   474     }
       
   475     
       
   476 // -----------------------------------------------------------------------------
       
   477 // RemoveContext
       
   478 // -----------------------------------------------------------------------------
       
   479 void TMGlxMediaList_Stub::RemoveContext(
       
   480     const MGlxFetchContext* /*aContext */)
       
   481     {
       
   482     // inform the test case
       
   483     if( iMGlxMediaList_Observer )
       
   484         {
       
   485         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( 
       
   486             MGlxMediaList_Stub_Observer::E_void_RemoveContext_const_MGlxFetchContext_p_ );
       
   487         }
       
   488     }
       
   489 
       
   490 // -----------------------------------------------------------------------------
       
   491 // Collection
       
   492 // -----------------------------------------------------------------------------
       
   493 MMPXCollection& TMGlxMediaList_Stub::Collection() const
       
   494     {
       
   495     // inform the test case
       
   496     if( iMGlxMediaList_Observer )
       
   497         {
       
   498         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( 
       
   499             MGlxMediaList_Stub_Observer::E_MMPXCollection_r_Collection_ );
       
   500         }
       
   501 
       
   502     // this method is not called in current tests,
       
   503     // this is just to make the code compile
       
   504     MMPXCollection* empty = NULL;
       
   505     return *empty;
       
   506     }
       
   507 
       
   508 // -----------------------------------------------------------------------------
       
   509 // PathLC
       
   510 // -----------------------------------------------------------------------------
       
   511 CMPXCollectionPath* TMGlxMediaList_Stub::PathLC(NGlxListDefs::TPathType /*aType*/) const
       
   512     {
       
   513     // inform the test case
       
   514     if( iMGlxMediaList_Observer )
       
   515         {
       
   516         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( 
       
   517             MGlxMediaList_Stub_Observer::E_CMPXCollectionPath_p_PathLC_ );
       
   518         }
       
   519         
       
   520     // make an alloc to cause a leave in memory tests
       
   521     TInt* memAlloc = new (ELeave) TInt;
       
   522     delete memAlloc;
       
   523     // put the path to cleanupstack
       
   524     CleanupStack::PushL( iMPXCollectionPath );
       
   525     // so just make the code compile
       
   526     return iMPXCollectionPath;
       
   527     }
       
   528 
       
   529 // -----------------------------------------------------------------------------
       
   530 // IsSelected
       
   531 // -----------------------------------------------------------------------------
       
   532 TBool TMGlxMediaList_Stub::IsSelected( TInt /*aIndex */) const
       
   533     {
       
   534     // inform the test case
       
   535     if( iMGlxMediaList_Observer )
       
   536         {
       
   537         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   538             MGlxMediaList_Stub_Observer::E_TBool_IsSelected_TInt_ );
       
   539         }
       
   540         
       
   541     // Default return value generated by EUnit Wizard
       
   542     return EFalse;
       
   543     }
       
   544 
       
   545 // -----------------------------------------------------------------------------
       
   546 // SetSelectedL
       
   547 // -----------------------------------------------------------------------------
       
   548 void TMGlxMediaList_Stub::SetSelectedL( 
       
   549     TInt /*aIndex*/, TBool /*aSelected */)
       
   550     {
       
   551     // inform the test case
       
   552     if( iMGlxMediaList_Observer )
       
   553         {
       
   554         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   555             MGlxMediaList_Stub_Observer::E_void_SetSelectedL_TInt_TBool_ );
       
   556         }
       
   557 
       
   558     // make an alloc to cause a leave in memory tests
       
   559     TInt* memAlloc = new (ELeave) TInt;
       
   560     delete memAlloc;
       
   561     }
       
   562 
       
   563 // -----------------------------------------------------------------------------
       
   564 // SelectionCount
       
   565 // -----------------------------------------------------------------------------
       
   566 TInt TMGlxMediaList_Stub::SelectionCount() const
       
   567     {
       
   568     // inform the test case
       
   569     if( iMGlxMediaList_Observer )
       
   570         {
       
   571         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   572             MGlxMediaList_Stub_Observer::E_TInt_SelectionCount_ );
       
   573         }
       
   574         
       
   575     return 0;
       
   576     }
       
   577 
       
   578 // -----------------------------------------------------------------------------
       
   579 // SelectedItemIndex
       
   580 // -----------------------------------------------------------------------------
       
   581 TInt TMGlxMediaList_Stub::SelectedItemIndex(TInt /*aSelectionIndex*/) const
       
   582     {
       
   583     // inform the test case
       
   584     if( iMGlxMediaList_Observer )
       
   585         {
       
   586         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   587             MGlxMediaList_Stub_Observer::E_TInt_SelectedItemIndex_TInt_ );
       
   588         }
       
   589 
       
   590     return KErrNotFound;
       
   591     }
       
   592 
       
   593 // -----------------------------------------------------------------------------
       
   594 // CommandL
       
   595 // -----------------------------------------------------------------------------
       
   596 void TMGlxMediaList_Stub::CommandL( CMPXCommand& /*aCommand */)
       
   597     {
       
   598     // inform the test case
       
   599     if( iMGlxMediaList_Observer )
       
   600         {
       
   601         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   602             MGlxMediaList_Stub_Observer::E_void_CommandL_CMPXCommand_r_ );
       
   603         }
       
   604 
       
   605     // make an alloc to cause a leave in memory tests
       
   606     TInt* memAlloc = new (ELeave) TInt;
       
   607     delete memAlloc;
       
   608     }
       
   609 
       
   610 // -----------------------------------------------------------------------------
       
   611 // CancelCommand
       
   612 // -----------------------------------------------------------------------------
       
   613 void TMGlxMediaList_Stub::CancelCommand()
       
   614     {
       
   615     // inform the test case
       
   616     if( iMGlxMediaList_Observer )
       
   617         {
       
   618         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   619             MGlxMediaList_Stub_Observer::E_void_CancelCommand_ );
       
   620         }
       
   621     }
       
   622 
       
   623 // -----------------------------------------------------------------------------
       
   624 // SetFilterL
       
   625 // -----------------------------------------------------------------------------
       
   626 void TMGlxMediaList_Stub::SetFilterL(CMPXFilter* aFilter)
       
   627     {
       
   628     // inform the test case
       
   629     if( iMGlxMediaList_Observer )
       
   630         {
       
   631         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   632             MGlxMediaList_Stub_Observer::E_void_SetFilterL_CMPXFilter_p_ );
       
   633         }
       
   634 
       
   635     if (iMPXFilter)
       
   636         {
       
   637         delete iMPXFilter;
       
   638         iMPXFilter = NULL;
       
   639         }
       
   640     iMPXFilter = CMPXFilter::NewL(*aFilter);
       
   641 
       
   642     // make an alloc to cause a leave in memory tests
       
   643     TInt* memAlloc = new (ELeave) TInt;
       
   644     delete memAlloc;
       
   645     }
       
   646 
       
   647 // -----------------------------------------------------------------------------
       
   648 // Filter
       
   649 // -----------------------------------------------------------------------------
       
   650 CMPXFilter* TMGlxMediaList_Stub::Filter() const
       
   651     {
       
   652     // inform the test case
       
   653     if( iMGlxMediaList_Observer )
       
   654         {
       
   655         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   656             MGlxMediaList_Stub_Observer::E_CMPXFilter_p_Filter_ );
       
   657         }
       
   658     // return the filter (set by the test case)
       
   659     return iMPXFilter;
       
   660     }
       
   661 
       
   662 // -----------------------------------------------------------------------------
       
   663 // RemoveFilter
       
   664 // -----------------------------------------------------------------------------
       
   665 void TMGlxMediaList_Stub::RemoveFilter()
       
   666     {
       
   667     delete iMPXFilter;
       
   668     iMPXFilter = NULL;
       
   669     }
       
   670     
       
   671 // -----------------------------------------------------------------------------
       
   672 // IdSpaceId
       
   673 // -----------------------------------------------------------------------------
       
   674 TGlxIdSpaceId TMGlxMediaList_Stub::IdSpaceId(TInt /*aIndex*/) const
       
   675     {
       
   676     // inform the test case
       
   677     if( iMGlxMediaList_Observer )
       
   678         {
       
   679         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   680             MGlxMediaList_Stub_Observer::E_TGlxIdSpaceId_IdSpaceId_TInt_ );
       
   681         }
       
   682     return KGlxIdNone;
       
   683     }
       
   684 
       
   685 // -----------------------------------------------------------------------------
       
   686 // IsPopulated
       
   687 // -----------------------------------------------------------------------------
       
   688 TBool TMGlxMediaList_Stub::IsPopulated() const
       
   689     {
       
   690     // inform the test case
       
   691     if( iMGlxMediaList_Observer )
       
   692         {
       
   693         iMGlxMediaList_Observer->MGlxMediaList_MethodCalled(
       
   694             MGlxMediaList_Stub_Observer::E_TBool_IsPopulated );
       
   695         }
       
   696     // return the specified value
       
   697     return iIsPopulated;
       
   698     }
       
   699 
       
   700 #endif      //  __TMGLXMEDIALIST_STUB_H__
       
   701 
       
   702 // End of file