videocollection/mpxmyvideoscollection/tsrc/ut_vcxmyvideoscollectionutiltest/src/VcxMyVideosCollectionUtilTestBlocks.cpp
branchRCL_3
changeset 26 67eb01668b0e
parent 23 8f0df5c82986
equal deleted inserted replaced
23:8f0df5c82986 26:67eb01668b0e
    20 #include <StifParser.h>
    20 #include <StifParser.h>
    21 #include <StifTestInterface.h>
    21 #include <StifTestInterface.h>
    22 #include <vcxmyvideosdefs.h>
    22 #include <vcxmyvideosdefs.h>
    23 #include <mpxmedia.h>
    23 #include <mpxmedia.h>
    24 #include <mpxattribute.h>
    24 #include <mpxattribute.h>
       
    25 #include <mpxmediaarray.h>
       
    26 #include <mpxmediacontainerdefs.h>
    25 #include <mpxmediageneraldefs.h>
    27 #include <mpxmediageneraldefs.h>
    26 #include <mpxmediavideodefs.h>
    28 #include <mpxmediavideodefs.h>
    27 #include "VcxMyVideosCollectionUtilTest.h"
    29 #include "VcxMyVideosCollectionUtilTest.h"
    28 #include "vcxmyvideoscollectionutil.h"
    30 #include "vcxmyvideoscollectionutil.h"
    29 
    31 
    51 //?type ?function_name( ?arg_type, ?arg_type );
    53 //?type ?function_name( ?arg_type, ?arg_type );
    52 
    54 
    53 // FORWARD DECLARATIONS
    55 // FORWARD DECLARATIONS
    54 //class ?FORWARD_CLASSNAME;
    56 //class ?FORWARD_CLASSNAME;
    55 
    57 
    56 // ============================= LOCAL FUNCTIONS ===============================
    58 const TMPXAttributeData KMPXMediaFail={0xC0FFEE,0xBADBEEF};
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // ?function_name ?description.
       
    60 // ?description
       
    61 // Returns: ?value_1: ?description
       
    62 //          ?value_n: ?description_line1
       
    63 //                    ?description_line2
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 /*
       
    67 ?type ?function_name(
       
    68     ?arg_type arg,  // ?description
       
    69     ?arg_type arg)  // ?description
       
    70     {
       
    71 
       
    72     ?code  // ?comment
       
    73 
       
    74     // ?comment
       
    75     ?code
       
    76     }
       
    77 */
       
    78 
    59 
    79 // ============================ MEMBER FUNCTIONS ===============================
    60 // ============================ MEMBER FUNCTIONS ===============================
    80 
    61 
    81 // -----------------------------------------------------------------------------
    62 // -----------------------------------------------------------------------------
    82 // CVcxMyVideosCollectionUtilTest::Delete
    63 // CVcxMyVideosCollectionUtilTest::Delete
   104         // First string is the function name used in TestScripter script file.
    85         // First string is the function name used in TestScripter script file.
   105         // Second is the actual implementation member function.        
    86         // Second is the actual implementation member function.        
   106         ENTRY( "CreateEmptyMediaList", CVcxMyVideosCollectionUtilTest::CreateEmptyMediaListL ),
    87         ENTRY( "CreateEmptyMediaList", CVcxMyVideosCollectionUtilTest::CreateEmptyMediaListL ),
   107         ENTRY( "CreateEmptyMessageList", CVcxMyVideosCollectionUtilTest::CreateEmptyMessageListL ),
    88         ENTRY( "CreateEmptyMessageList", CVcxMyVideosCollectionUtilTest::CreateEmptyMessageListL ),
   108         ENTRY( "CopyFromListToList", CVcxMyVideosCollectionUtilTest::CopyFromListToListL ),
    89         ENTRY( "CopyFromListToList", CVcxMyVideosCollectionUtilTest::CopyFromListToListL ),
       
    90         ENTRY( "CopyFromListToList2", CVcxMyVideosCollectionUtilTest::CopyFromListToListL2 ),
   109         ENTRY( "DriveLetter2DriveNumber", CVcxMyVideosCollectionUtilTest::DriveLetter2DriveNumberL ),
    91         ENTRY( "DriveLetter2DriveNumber", CVcxMyVideosCollectionUtilTest::DriveLetter2DriveNumberL ),
   110         ENTRY( "MakeUniqueFileName", CVcxMyVideosCollectionUtilTest::MakeUniqueFileNameL ),
    92         ENTRY( "MakeUniqueFileName", CVcxMyVideosCollectionUtilTest::MakeUniqueFileNameL ),
   111         ENTRY( "Origin", CVcxMyVideosCollectionUtilTest::OriginL ),
    93         ENTRY( "Origin", CVcxMyVideosCollectionUtilTest::OriginL ),
   112         ENTRY( "Flags", CVcxMyVideosCollectionUtilTest::FlagsL ),
    94         ENTRY( "Flags", CVcxMyVideosCollectionUtilTest::FlagsL ),
   113         ENTRY( "DownloadId", CVcxMyVideosCollectionUtilTest::DownloadIdL ),
    95         ENTRY( "DownloadId", CVcxMyVideosCollectionUtilTest::DownloadIdL ),
   140 //
   122 //
   141 TInt CVcxMyVideosCollectionUtilTest::CreateEmptyMediaListL( CStifItemParser& /*aItem*/ )
   123 TInt CVcxMyVideosCollectionUtilTest::CreateEmptyMediaListL( CStifItemParser& /*aItem*/ )
   142     {
   124     {
   143     CMPXMedia* media = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
   125     CMPXMedia* media = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
   144     delete media;
   126     delete media;
       
   127     
       
   128     // Only thing that can fail here is method call leaves. If we reach the end
       
   129     // everyting has worked fine and we can return ok.
   145     return KErrNone;
   130     return KErrNone;
   146     }
   131     }
   147 
   132 
   148 // ----------------------------------------------------------------------------
   133 // ----------------------------------------------------------------------------
   149 // CVcxMyVideosCollectionUtilTest::CreateEmptyMessageListL
   134 // CVcxMyVideosCollectionUtilTest::CreateEmptyMessageListL
   151 //
   136 //
   152 TInt CVcxMyVideosCollectionUtilTest::CreateEmptyMessageListL( CStifItemParser& /*aItem*/ )
   137 TInt CVcxMyVideosCollectionUtilTest::CreateEmptyMessageListL( CStifItemParser& /*aItem*/ )
   153     {
   138     {
   154     CMPXMedia* media = TVcxMyVideosCollectionUtil::CreateEmptyMessageListL();
   139     CMPXMedia* media = TVcxMyVideosCollectionUtil::CreateEmptyMessageListL();
   155     delete media;
   140     delete media;
       
   141     
       
   142     // Only thing that can fail here is method call leaves. If we reach the end
       
   143     // everyting has worked fine and we can return ok.    
   156     return KErrNone;
   144     return KErrNone;
   157     }
   145     }
   158 
   146 
   159 // ---------------------------------------------------------------------------
   147 // ---------------------------------------------------------------------------
   160 // CVcxMyVideosCollectionUtilTest::CopyFromListToListL
   148 // CVcxMyVideosCollectionUtilTest::CopyFromListToListL
   162 //
   150 //
   163 TInt CVcxMyVideosCollectionUtilTest::CopyFromListToListL( CStifItemParser& aItem )
   151 TInt CVcxMyVideosCollectionUtilTest::CopyFromListToListL( CStifItemParser& aItem )
   164     {
   152     {
   165     CMPXMedia* from = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
   153     CMPXMedia* from = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
   166     CMPXMedia* to = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
   154     CMPXMedia* to = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
       
   155     CMPXMedia* failList = CMPXMedia::NewL();
       
   156     CMPXMedia* media( NULL );
       
   157     TInt itemsToCopy( 0 );
       
   158     TInt itemsCopied( 0 );
   167     RArray<TUint32> ids;
   159     RArray<TUint32> ids;
       
   160     TMPXItemId idGet;
       
   161     TInt retVal( KErrGeneral );
   168     
   162     
   169     TInt numberOfMedia;
   163     TInt numberOfMedia;
   170     TInt wantedId;
   164     TInt wantedId;
   171     
   165     
   172     aItem.GetNextInt( numberOfMedia );
   166     aItem.GetNextInt( numberOfMedia );
   173     aItem.GetNextInt( wantedId );
   167     aItem.GetNextInt( wantedId );
   174     
   168     
   175     ids.Append( wantedId );
   169     ids.Append( wantedId );
   176     
   170     
   177     // add stuff to be copied to "from" -list
   171     // add stuff to be copied to "from" -list
   178     
   172     CleanupStack::PushL( from );
       
   173     CleanupStack::PushL( to );
       
   174     CMPXMediaArray* fromMessageArray = from->Value<CMPXMediaArray>(
       
   175             KMPXMediaArrayContents );
       
   176     CleanupStack::PushL( fromMessageArray );
   179     
   177     
   180     TVcxMyVideosCollectionUtil::CopyFromListToListL( *from, *to, ids );
   178     TVcxMyVideosCollectionUtil::CopyFromListToListL( *from, *to, ids );
   181     
   179     
       
   180     for(TInt i = 0; i < numberOfMedia; i++ )
       
   181         {
       
   182         media = CMPXMedia::NewL();
       
   183         CleanupStack::PushL( media );
       
   184         media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId,
       
   185                 TMPXItemId( i, i) );
       
   186         media->SetTObjectValueL<TInt32>( KVcxMediaMyVideosInt32Value,
       
   187                 42 );        
       
   188         fromMessageArray->AppendL( media );
       
   189         if( i == wantedId )
       
   190             {
       
   191             itemsToCopy++;
       
   192             }
       
   193         CleanupStack::Pop( media );
       
   194         }
       
   195     
       
   196     TRAPD( err, TVcxMyVideosCollectionUtil::CopyFromListToListL( *from, *failList, ids ) );    
       
   197     if( err != KErrArgument )    
       
   198         {
       
   199         CleanupStack::Pop( fromMessageArray );
       
   200         CleanupStack::Pop( to );
       
   201         CleanupStack::Pop( from );        
       
   202         fromMessageArray->Reset();
       
   203         delete failList;
       
   204         delete from;
       
   205         delete to; 
       
   206         return retVal;
       
   207         }
       
   208     
       
   209     TVcxMyVideosCollectionUtil::CopyFromListToListL( *from, *to, ids );
       
   210     
   182     // check that the "to" -list have the items it should have
   211     // check that the "to" -list have the items it should have
   183     
   212     CMPXMediaArray* toMessageArray = to->Value<CMPXMediaArray>(
       
   213                 KMPXMediaArrayContents );
       
   214     CleanupStack::PushL( toMessageArray );
       
   215     
       
   216     for( TInt i = 0; i < toMessageArray->Count(); i++ )
       
   217         {        
       
   218         idGet = TVcxMyVideosCollectionUtil::IdL( *(toMessageArray->operator[](i)) );
       
   219         if( idGet.iId1 == wantedId )
       
   220             {
       
   221             itemsCopied++;
       
   222             }
       
   223         }    
       
   224     
       
   225     if( itemsCopied == itemsToCopy )
       
   226         {
       
   227         retVal = KErrNone;  
       
   228         }
       
   229     
       
   230     CleanupStack::Pop( toMessageArray );
       
   231     CleanupStack::Pop( fromMessageArray );
       
   232     CleanupStack::Pop( to );
       
   233     CleanupStack::Pop( from );
       
   234     
       
   235     toMessageArray->Reset();
       
   236     fromMessageArray->Reset();
       
   237     
       
   238     delete failList;
   184     delete from;
   239     delete from;
   185     delete to;
   240     delete to;    
   186     
   241     return retVal;
   187     return KErrNone;
   242     }
       
   243 
       
   244 // ---------------------------------------------------------------------------
       
   245 // CVcxMyVideosCollectionUtilTest::CopyFromListToListL2
       
   246 // ---------------------------------------------------------------------------
       
   247 //
       
   248 TInt CVcxMyVideosCollectionUtilTest::CopyFromListToListL2( CStifItemParser& aItem )
       
   249     {
       
   250     RArray<CMPXMedia*> fromArray;
       
   251     CMPXMedia* to = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
       
   252     CMPXMedia* failList = CMPXMedia::NewL();
       
   253     CMPXMedia* media( NULL );        
       
   254     TInt itemsToCopy( 0 );
       
   255     TInt itemsCopied( 0 );
       
   256     RArray<TUint32> ids;
       
   257     TMPXItemId idGet;
       
   258     TInt retVal( KErrGeneral );
       
   259     
       
   260     TInt numberOfMedia;
       
   261     TInt wantedId;
       
   262     
       
   263     aItem.GetNextInt( numberOfMedia );
       
   264     aItem.GetNextInt( wantedId );
       
   265     
       
   266     ids.Append( wantedId );
       
   267     
       
   268     // add stuff to be copied to "from" -list    
       
   269     CleanupStack::PushL( to );    
       
   270     
       
   271     TVcxMyVideosCollectionUtil::CopyFromListToListL( fromArray, *to, ids );
       
   272     
       
   273     for(TInt i = 0; i < numberOfMedia; i++ )
       
   274         {
       
   275         media = CMPXMedia::NewL();
       
   276         CleanupStack::PushL( media );
       
   277         media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId,
       
   278                 TMPXItemId( i, i) );
       
   279         media->SetTObjectValueL<TInt32>( KVcxMediaMyVideosInt32Value,
       
   280                 42 );        
       
   281         fromArray.AppendL( media );
       
   282         if( i == wantedId )
       
   283             {
       
   284             itemsToCopy++;
       
   285             }
       
   286         CleanupStack::Pop( media );
       
   287         }    
       
   288     
       
   289     TRAPD(err, TVcxMyVideosCollectionUtil::CopyFromListToListL( fromArray, *failList, ids ));
       
   290     if( err != KErrArgument )    
       
   291         {        
       
   292         CleanupStack::Pop( to );
       
   293         fromArray.Reset();
       
   294         delete failList;
       
   295         delete to; 
       
   296         return retVal;
       
   297         }
       
   298     
       
   299     TVcxMyVideosCollectionUtil::CopyFromListToListL( fromArray, *to, ids );
       
   300     
       
   301     // check that the "to" -list have the items it should have
       
   302     CMPXMediaArray* toMessageArray = to->Value<CMPXMediaArray>(
       
   303                 KMPXMediaArrayContents );
       
   304     CleanupStack::PushL( toMessageArray );
       
   305     
       
   306     for( TInt i = 0; i < toMessageArray->Count(); i++ )
       
   307         {        
       
   308         idGet = TVcxMyVideosCollectionUtil::IdL( *(toMessageArray->operator[](i)) );
       
   309         if( idGet.iId1 == wantedId )
       
   310             {
       
   311             itemsCopied++;
       
   312             }
       
   313         }    
       
   314     
       
   315     if( itemsCopied == itemsToCopy )
       
   316         {
       
   317         retVal = KErrNone;  
       
   318         }
       
   319     
       
   320     CleanupStack::Pop( toMessageArray );    
       
   321     CleanupStack::Pop( to );
       
   322         
       
   323     toMessageArray->Reset();
       
   324     
       
   325     for( TInt i = 0; i < fromArray.Count(); i++ )
       
   326         {
       
   327         CMPXMedia* arrayMedia = fromArray[i];
       
   328         delete arrayMedia;        
       
   329         }
       
   330     fromArray.Reset();    
       
   331     delete failList;
       
   332     delete to;    
       
   333     return retVal;
   188     }
   334     }
   189     
   335     
   190 // ---------------------------------------------------------------------------
   336 // ---------------------------------------------------------------------------
   191 // This helper function converts drive letter to drive number
   337 // This helper function converts drive letter to drive number
   192 // ---------------------------------------------------------------------------
   338 // ---------------------------------------------------------------------------
   193 //
   339 //
   194 TInt CVcxMyVideosCollectionUtilTest::DriveLetter2DriveNumberL( CStifItemParser& /*aItem*/ )
   340 TInt CVcxMyVideosCollectionUtilTest::DriveLetter2DriveNumberL( CStifItemParser& aItem )
   195     {
   341     {
   196     TVcxMyVideosCollectionUtil::DriveLetter2DriveNumber( _L("E:") );
   342     TInt retVal( KErrNone ); 
   197     return KErrNone;
   343     TPtrC string;
       
   344     TInt expectedValue( -1 );
       
   345     
       
   346     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
       
   347     
       
   348     User::LeaveIfError( aItem.GetNextString( string ) );
       
   349     User::LeaveIfError( aItem.GetNextInt( expectedValue ) );
       
   350     
       
   351     _LIT( KNullDescString, "KNullDesC" );
       
   352     if ( string.Compare( KNullDescString ) == 0 )
       
   353         {
       
   354         string.Set( KNullDesC );
       
   355         }
       
   356   
       
   357     TInt driveNumber = TVcxMyVideosCollectionUtil::DriveLetter2DriveNumber( string );
       
   358     if (  driveNumber != expectedValue )
       
   359         {
       
   360         retVal = KErrGeneral;
       
   361         }
       
   362 
       
   363     return retVal;
   198     }
   364     }
   199 
   365 
   200 // ---------------------------------------------------------------------------
   366 // ---------------------------------------------------------------------------
   201 // CVcxMyVideosCollectionUtilTest::MakeUniqueFileNameL
   367 // CVcxMyVideosCollectionUtilTest::MakeUniqueFileNameL
   202 // ---------------------------------------------------------------------------
   368 // ---------------------------------------------------------------------------
   203 //
   369 //
   204 TInt CVcxMyVideosCollectionUtilTest::MakeUniqueFileNameL( CStifItemParser& /*aItem*/ )
   370 TInt CVcxMyVideosCollectionUtilTest::MakeUniqueFileNameL( CStifItemParser& /*aItem*/ )
   205     {
   371     {
       
   372     TInt retVal( KErrNone );
   206     RFs fs;
   373     RFs fs;
   207     fs.Connect();
   374     fs.Connect();
   208     TBuf<KMaxPath> path;
   375     TBuf<KMaxPath> path;
   209     TVcxMyVideosCollectionUtil::MakeUniqueFileNameL( fs, _L("c://testframework//testframework.ini"), path );
   376     _LIT( KFileName1,   "c:\\data\\vcxmyvideoscollectionutiltest_file.txt" );
       
   377     _LIT( KFileName2,   "c:\\data\\vcxmyvideoscollectionutiltest_file2" );
       
   378     _LIT( KInvalidFile, "c:\\data\\vcxmyvideoscollectionutiltest_DoesNotExist" );
       
   379     
       
   380     // File with filename extension 
       
   381     TVcxMyVideosCollectionUtil::MakeUniqueFileNameL( fs, KFileName1, path );
       
   382     if ( path.Length() <= KFileName1().Length() )
       
   383         {
       
   384         retVal = KErrGeneral;
       
   385         }    
       
   386     
       
   387     // File without filename extension
       
   388     TVcxMyVideosCollectionUtil::MakeUniqueFileNameL( fs, KFileName2, path );
       
   389     if ( ( path.Find( KFileName2 ) == KErrNotFound ) ||
       
   390          ( path.Length() <= KFileName2().Length() ) ) 
       
   391         {
       
   392         retVal = KErrGeneral;
       
   393         }  
       
   394     
       
   395     // Non-existent file
       
   396     TVcxMyVideosCollectionUtil::MakeUniqueFileNameL( fs, KInvalidFile, path );
       
   397     if ( path.Compare( KInvalidFile ) != 0 )
       
   398         {
       
   399         retVal = KErrGeneral;
       
   400         }
       
   401 
       
   402     // Null descriptor
       
   403     TVcxMyVideosCollectionUtil::MakeUniqueFileNameL( fs, KNullDesC, path );
       
   404     
   210     fs.Close();
   405     fs.Close();
   211     return KErrNone;
   406     return retVal;
   212     }
   407     }
   213 
   408 
   214 // ----------------------------------------------------------------------------
   409 // ----------------------------------------------------------------------------
   215 // CVcxMyVideosCollectionUtilTest::OriginL
   410 // CVcxMyVideosCollectionUtilTest::OriginL
   216 // ----------------------------------------------------------------------------
   411 // ----------------------------------------------------------------------------
   217 //
   412 //
   218 TInt CVcxMyVideosCollectionUtilTest::OriginL( CStifItemParser& /*aItem*/ )
   413 TInt CVcxMyVideosCollectionUtilTest::OriginL( CStifItemParser& /*aItem*/ )
   219     {
   414     {
   220     CMPXMedia* media = CMPXMedia::NewL();
   415     CMPXMedia* media = CMPXMedia::NewL();
   221     TInt retVal( KErrNone );
   416     TInt retVal( KErrNone );
       
   417     TUint8 valueGet = TVcxMyVideosCollectionUtil::OriginL( *media );
       
   418     valueGet = TVcxMyVideosCollectionUtil::OriginL( *media );
       
   419     if( EVcxMyVideosOriginOther != valueGet )
       
   420         {
       
   421         retVal = KErrGeneral;
       
   422         delete media;
       
   423         return retVal;
       
   424         }
   222     TUint8 valueSet = EVcxMyVideosOriginCapturedWithCamera;
   425     TUint8 valueSet = EVcxMyVideosOriginCapturedWithCamera;
   223     media->SetTObjectValueL<TUint8>( KVcxMediaMyVideosOrigin, valueSet );
   426     media->SetTObjectValueL<TUint8>( KVcxMediaMyVideosOrigin, valueSet );
   224     TUint8 valueGet = TVcxMyVideosCollectionUtil::OriginL( *media );
   427     valueGet = TVcxMyVideosCollectionUtil::OriginL( *media );
   225     if( valueSet != valueGet )
   428     if( valueSet != valueGet )
   226         {
   429         {
   227         retVal = KErrGeneral;
   430         retVal = KErrGeneral;
   228         delete media;
   431         delete media;
   229         return retVal;
   432         return retVal;
   244 // ----------------------------------------------------------------------------
   447 // ----------------------------------------------------------------------------
   245 //
   448 //
   246 TInt CVcxMyVideosCollectionUtilTest::FlagsL( CStifItemParser& /*aItem*/ )
   449 TInt CVcxMyVideosCollectionUtilTest::FlagsL( CStifItemParser& /*aItem*/ )
   247     {
   450     {
   248     CMPXMedia* media = CMPXMedia::NewL();
   451     CMPXMedia* media = CMPXMedia::NewL();
   249     TInt retVal( KErrNone );
   452     TInt retVal( KErrNone );    
   250     TUint32 flagsSet( 0xBEEF );
   453     TUint32 flagsSet( 0xBEEF );
       
   454     TUint32 flagsGet( TVcxMyVideosCollectionUtil::FlagsL( *media ) );
       
   455     if( flagsGet != 0 )
       
   456         {
       
   457         delete media;
       
   458         retVal = KErrGeneral;
       
   459         return retVal;
       
   460         }
   251     media->SetTObjectValueL<TUint32>( KMPXMediaGeneralFlags, flagsSet );
   461     media->SetTObjectValueL<TUint32>( KMPXMediaGeneralFlags, flagsSet );
   252     TUint32 flagsGet( TVcxMyVideosCollectionUtil::FlagsL( *media ) );
   462     flagsGet= TVcxMyVideosCollectionUtil::FlagsL( *media );
   253     if( flagsSet != flagsGet )
   463     if( flagsSet != flagsGet )
   254         {
   464         {
   255         retVal = KErrGeneral;
   465         retVal = KErrGeneral;
   256         }
   466         }
   257     delete media;
   467     delete media;
   265 TInt CVcxMyVideosCollectionUtilTest::DownloadIdL( CStifItemParser& /*aItem*/ )
   475 TInt CVcxMyVideosCollectionUtilTest::DownloadIdL( CStifItemParser& /*aItem*/ )
   266     {
   476     {
   267     CMPXMedia* media = CMPXMedia::NewL();
   477     CMPXMedia* media = CMPXMedia::NewL();
   268     TInt retVal( KErrNone );
   478     TInt retVal( KErrNone );
   269     TUint32 idSet( 0xBEEF );
   479     TUint32 idSet( 0xBEEF );
       
   480     TUint32 idGet( TVcxMyVideosCollectionUtil::DownloadIdL( *media ) );
       
   481     if( 0 != idGet )
       
   482         {
       
   483         delete media;
       
   484         retVal = KErrGeneral;
       
   485         return retVal;
       
   486         }
   270     media->SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadId, idSet );
   487     media->SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadId, idSet );
   271     TUint32 idGet( TVcxMyVideosCollectionUtil::DownloadIdL( *media ) );
   488     idGet = TVcxMyVideosCollectionUtil::DownloadIdL( *media );
   272     if( idSet != idGet )
   489     if( idSet != idGet )
   273         {
   490         {
   274         retVal = KErrGeneral;
   491         retVal = KErrGeneral;
   275         }
   492         }
   276     delete media;
   493     delete media;
   284 TInt CVcxMyVideosCollectionUtilTest::DownloadStateL( CStifItemParser& /*aItem*/ )
   501 TInt CVcxMyVideosCollectionUtilTest::DownloadStateL( CStifItemParser& /*aItem*/ )
   285     {
   502     {
   286     CMPXMedia* media = CMPXMedia::NewL();    
   503     CMPXMedia* media = CMPXMedia::NewL();    
   287     TInt retVal( KErrNone );
   504     TInt retVal( KErrNone );
   288     TVcxMyVideosDownloadState stateSet = EVcxMyVideosDlStateFailed;
   505     TVcxMyVideosDownloadState stateSet = EVcxMyVideosDlStateFailed;
       
   506     TVcxMyVideosDownloadState stateGet = TVcxMyVideosCollectionUtil::DownloadStateL( *media );    
       
   507     if( EVcxMyVideosDlStateNone != stateGet )
       
   508         {
       
   509         delete media;
       
   510         retVal = KErrGeneral;
       
   511         return retVal;
       
   512         }
   289     media->SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadState, stateSet );
   513     media->SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadState, stateSet );
   290     TVcxMyVideosDownloadState stateGet = TVcxMyVideosCollectionUtil::DownloadStateL( *media );    
   514     stateGet = TVcxMyVideosCollectionUtil::DownloadStateL( *media );    
   291     if( stateSet != stateGet )
   515     if( stateSet != stateGet )
   292         {
   516         {
   293         retVal = KErrGeneral;
   517         retVal = KErrGeneral;
   294         }
   518         }
   295     delete media;
   519     delete media;
   303 TInt CVcxMyVideosCollectionUtilTest::IdL( CStifItemParser& /*aItem*/ )
   527 TInt CVcxMyVideosCollectionUtilTest::IdL( CStifItemParser& /*aItem*/ )
   304     {
   528     {
   305     CMPXMedia* media = CMPXMedia::NewL();
   529     CMPXMedia* media = CMPXMedia::NewL();
   306     TInt retVal( KErrNone );
   530     TInt retVal( KErrNone );
   307     TMPXItemId idSet( 2, 7 );
   531     TMPXItemId idSet( 2, 7 );
       
   532     TMPXItemId idGet = TVcxMyVideosCollectionUtil::IdL( *media );
       
   533     if( (idGet.iId1 != 0) || (idGet.iId2 != 0) )
       
   534         {
       
   535         delete media;
       
   536         retVal = KErrGeneral;
       
   537         return retVal;
       
   538         }
   308     media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, idSet );
   539     media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, idSet );
   309     TMPXItemId idGet = TVcxMyVideosCollectionUtil::IdL( *media );;
   540     idGet = TVcxMyVideosCollectionUtil::IdL( *media );
   310     if( idSet != idGet )
   541     if( idSet != idGet )
   311         {
   542         {
   312         retVal = KErrGeneral;
   543         retVal = KErrGeneral;
   313         }
   544         }
   314     delete media;
   545     delete media;
   322 TInt CVcxMyVideosCollectionUtilTest::DurationL( CStifItemParser& /*aItem*/ )
   553 TInt CVcxMyVideosCollectionUtilTest::DurationL( CStifItemParser& /*aItem*/ )
   323     {
   554     {
   324     CMPXMedia* media = CMPXMedia::NewL();
   555     CMPXMedia* media = CMPXMedia::NewL();
   325     TInt retVal( KErrNone );
   556     TInt retVal( KErrNone );
   326     TReal32 durationSet( 150 );
   557     TReal32 durationSet( 150 );
       
   558     TReal32 durationGet = TVcxMyVideosCollectionUtil::DurationL( *media );
       
   559     if( -1 != durationGet )
       
   560         {
       
   561         delete media;
       
   562         retVal = KErrGeneral;
       
   563         return retVal;
       
   564         }
   327     media->SetTObjectValueL<TReal32>( KVcxMediaMyVideosDuration, durationSet );
   565     media->SetTObjectValueL<TReal32>( KVcxMediaMyVideosDuration, durationSet );
   328     TReal32 durationGet = TVcxMyVideosCollectionUtil::DurationL( *media );;
   566     durationGet = TVcxMyVideosCollectionUtil::DurationL( *media );
   329     if( durationSet != durationGet )
   567     if( durationSet != durationGet )
   330         {
   568         {
   331         retVal = KErrGeneral;
   569         retVal = KErrGeneral;
   332         }
   570         }
   333     delete media;
   571     delete media;
   341 TInt CVcxMyVideosCollectionUtilTest::TitleL( CStifItemParser& /*aItem*/ )
   579 TInt CVcxMyVideosCollectionUtilTest::TitleL( CStifItemParser& /*aItem*/ )
   342     {
   580     {
   343     CMPXMedia* media = CMPXMedia::NewL();
   581     CMPXMedia* media = CMPXMedia::NewL();
   344     TInt retVal( KErrNone );
   582     TInt retVal( KErrNone );
   345     _LIT( valueSet, "TeamNinja" );
   583     _LIT( valueSet, "TeamNinja" );
       
   584     HBufC* valueGet = TVcxMyVideosCollectionUtil::Title( *media ).AllocL();
       
   585     if( valueGet->Size() != 0  )
       
   586         {
       
   587         delete media;
       
   588         delete valueGet;
       
   589         retVal = KErrGeneral;
       
   590         return retVal;
       
   591         }
       
   592     delete valueGet;
   346     media->SetTextValueL( KMPXMediaGeneralTitle, valueSet );
   593     media->SetTextValueL( KMPXMediaGeneralTitle, valueSet );
   347     HBufC* valueGet = TVcxMyVideosCollectionUtil::Title( *media ).AllocL();
   594     valueGet = TVcxMyVideosCollectionUtil::Title( *media ).AllocL();
   348     if( valueGet->CompareF( valueSet ) )
   595     if( valueGet->CompareF( valueSet ) )
   349         {
   596         {
   350         retVal = KErrGeneral;
   597         retVal = KErrGeneral;
   351         }
   598         }
   352     delete media;
   599     delete media;
   361 TInt CVcxMyVideosCollectionUtilTest::RatingL( CStifItemParser& /*aItem*/ )
   608 TInt CVcxMyVideosCollectionUtilTest::RatingL( CStifItemParser& /*aItem*/ )
   362     {
   609     {
   363     CMPXMedia* media = CMPXMedia::NewL();
   610     CMPXMedia* media = CMPXMedia::NewL();
   364     TInt retVal( KErrNone );
   611     TInt retVal( KErrNone );
   365     TUint8 valueSet( 21 );
   612     TUint8 valueSet( 21 );
       
   613     TUint8 valueGet = TVcxMyVideosCollectionUtil::RatingL( *media );;
       
   614     if( 0 != valueGet )
       
   615         {
       
   616         delete media;
       
   617         retVal = KErrGeneral;
       
   618         return retVal;
       
   619         }
   366     media->SetTObjectValueL<TUint8>( KVcxMediaMyVideosRating, valueSet );
   620     media->SetTObjectValueL<TUint8>( KVcxMediaMyVideosRating, valueSet );
   367     TUint8 valueGet = TVcxMyVideosCollectionUtil::RatingL( *media );;
   621     valueGet = TVcxMyVideosCollectionUtil::RatingL( *media );;
   368     if( valueSet != valueGet )
   622     if( valueSet != valueGet )
   369         {
   623         {
   370         retVal = KErrGeneral;
   624         retVal = KErrGeneral;
   371         }
   625         }
   372     delete media;
   626     delete media;
   380 TInt CVcxMyVideosCollectionUtilTest::AudioFourCcL( CStifItemParser& /*aItem*/ )
   634 TInt CVcxMyVideosCollectionUtilTest::AudioFourCcL( CStifItemParser& /*aItem*/ )
   381     {
   635     {
   382     CMPXMedia* media = CMPXMedia::NewL();
   636     CMPXMedia* media = CMPXMedia::NewL();
   383     TInt retVal( KErrNone );
   637     TInt retVal( KErrNone );
   384     TUint32 valueSet( 21 );
   638     TUint32 valueSet( 21 );
       
   639     TUint32 valueGet = TVcxMyVideosCollectionUtil::AudioFourCcL( *media );;
       
   640     if( 0 != valueGet )
       
   641         {
       
   642         delete media;
       
   643         retVal = KErrGeneral;
       
   644         return retVal;
       
   645         }
   385     media->SetTObjectValueL<TUint32>( KVcxMediaMyVideosAudioFourCc, valueSet );
   646     media->SetTObjectValueL<TUint32>( KVcxMediaMyVideosAudioFourCc, valueSet );
   386     TUint32 valueGet = TVcxMyVideosCollectionUtil::AudioFourCcL( *media );;
   647     valueGet = TVcxMyVideosCollectionUtil::AudioFourCcL( *media );;
   387     if( valueSet != valueGet )
   648     if( valueSet != valueGet )
   388         {
   649         {
   389         retVal = KErrGeneral;
   650         retVal = KErrGeneral;
   390         }
   651         }
   391     delete media;
   652     delete media;
   399 TInt CVcxMyVideosCollectionUtilTest::AreSupportedL( CStifItemParser& /*aItem*/ )
   660 TInt CVcxMyVideosCollectionUtilTest::AreSupportedL( CStifItemParser& /*aItem*/ )
   400     {
   661     {
   401     TInt retVal( KErrNone );
   662     TInt retVal( KErrNone );
   402     CMPXMedia* media = CMPXMedia::NewL();
   663     CMPXMedia* media = CMPXMedia::NewL();
   403     RArray<TMPXAttribute> attrs;
   664     RArray<TMPXAttribute> attrs;
   404     attrs.Append( KMPXMediaGeneralMimeType );
       
   405     TBool inMds( EFalse );
   665     TBool inMds( EFalse );
       
   666     TVcxMyVideosCollectionUtil::AreSupported( *media, attrs.Array(), inMds );        
       
   667     attrs.Append( KMPXMediaFail );
   406     TVcxMyVideosCollectionUtil::AreSupported( *media, attrs.Array(), inMds );
   668     TVcxMyVideosCollectionUtil::AreSupported( *media, attrs.Array(), inMds );
       
   669     attrs.Append( KMPXMediaVideoBitRate );
       
   670     inMds = ETrue;    
       
   671     TVcxMyVideosCollectionUtil::AreSupported( *media, attrs.Array(), inMds );
       
   672     media->SetTObjectValueL<TUint16>( KMPXMediaVideoBitRate, 47 );
       
   673     TVcxMyVideosCollectionUtil::AreSupported( *media, attrs.Array(), inMds );
   407     delete media;
   674     delete media;
   408     return retVal;
   675     return retVal;
   409     }
   676     }
   410 
   677 
   411 // ----------------------------------------------------------------------------
   678 // ----------------------------------------------------------------------------
   413 // ----------------------------------------------------------------------------
   680 // ----------------------------------------------------------------------------
   414 //
   681 //
   415 TInt CVcxMyVideosCollectionUtilTest::AttrBelongsToFullSetL( CStifItemParser& /*aItem*/ )
   682 TInt CVcxMyVideosCollectionUtilTest::AttrBelongsToFullSetL( CStifItemParser& /*aItem*/ )
   416     {
   683     {
   417     TInt retVal( KErrNone );
   684     TInt retVal( KErrNone );
   418     // TMPXAttribute attr;
   685 
   419     // attr = KMPXMediaGeneralMimeType;
       
   420     if ( !( TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaGeneralComment ) &&
   686     if ( !( TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaGeneralComment ) &&
   421          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaGeneralCopyright ) &&
   687          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaGeneralCopyright ) &&
   422          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaGeneralMimeType ) &&
   688          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaGeneralMimeType ) &&
   423          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaGeneralLastPlaybackPosition ) &&
   689          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaGeneralLastPlaybackPosition ) &&
   424          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KVcxMediaMyVideosModifiedDate ) &&
   690          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KVcxMediaMyVideosModifiedDate ) &&
   428          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaVideoHeight ) &&
   694          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaVideoHeight ) &&
   429          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaVideoWidth ) &&
   695          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaVideoWidth ) &&
   430          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaVideoArtist ) ) )
   696          TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaVideoArtist ) ) )
   431         {
   697         {
   432         retVal = KErrGeneral;
   698         retVal = KErrGeneral;
       
   699         return retVal;
       
   700         }
       
   701     
       
   702     if( TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaFail ) )
       
   703         {
       
   704         retVal = KErrGeneral;
   433         }
   705         }
   434         
   706         
   435     return retVal;
   707     return retVal;
   436     }
   708     }
   437 
   709 
   453             != EVcxMyVideosOriginOther ) ||
   725             != EVcxMyVideosOriginOther ) ||
   454          ( TVcxMyVideosCollectionUtil::Origin( KVcxMvcCategoryIdAll ) 
   726          ( TVcxMyVideosCollectionUtil::Origin( KVcxMvcCategoryIdAll ) 
   455             != KErrNotFound ) )
   727             != KErrNotFound ) )
   456         {
   728         {
   457         retVal = KErrGeneral;
   729         retVal = KErrGeneral;
       
   730         return retVal;
       
   731         }
       
   732     
       
   733     if( TVcxMyVideosCollectionUtil::Origin( KCategoryIdExtraItem3 ) != KErrNotFound )
       
   734         {
       
   735         retVal = KErrGeneral;
   458         }
   736         }
   459     
   737     
   460     return retVal;
   738     return retVal;
   461     }   
   739     }   
   462 
   740 
   511         }
   789         }
   512 #endif // _DEBUG    
   790 #endif // _DEBUG    
   513     return retVal;
   791     return retVal;
   514     }
   792     }
   515 
   793 
   516 // -----------------------------------------------------------------------------
       
   517 // CVcxMyVideosCollectionUtilTest::?member_function
       
   518 // ?implementation_description
       
   519 // (other items were commented in a header).
       
   520 // -----------------------------------------------------------------------------
       
   521 //
       
   522 /*
       
   523 TInt CVcxMyVideosCollectionUtilTest::?member_function(
       
   524    CItemParser& aItem )
       
   525    {
       
   526 
       
   527    ?code
       
   528 
       
   529    }
       
   530 */
       
   531 
       
   532 // ========================== OTHER EXPORTED FUNCTIONS =========================
   794 // ========================== OTHER EXPORTED FUNCTIONS =========================
   533 // None
   795 // None
   534 
   796 
   535 //  [End of File] - Do not remove
   797 //  [End of File] - Do not remove