imagehandling_plat/thumbnailmanager_api/tsrc/src/ThumbnailManagerTestBlocks.cpp
changeset 30 b67379558a75
parent 14 2edacbf5d3f9
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/src/ThumbnailManagerTestBlocks.cpp	Wed Jun 23 18:33:48 2010 +0300
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/src/ThumbnailManagerTestBlocks.cpp	Tue Jul 06 14:37:18 2010 +0300
@@ -67,6 +67,7 @@
         ENTRY( "CheckThumbnailSizeL", CThumbnailManagerTest::CheckThumbnailSizeL ),
         ENTRY( "SetThumbnailEnumSizeL", CThumbnailManagerTest::SetThumbnailEnumSizeL ),
         ENTRY( "CreateSourceInstancePathL", CThumbnailManagerTest::CreateSourceInstancePathL ),
+        ENTRY( "CreateSourceInstancePathTargetL", CThumbnailManagerTest::CreateSourceInstancePathTargetL ),
         ENTRY( "CreateSourceInstanceHandleL", CThumbnailManagerTest::CreateSourceInstanceHandleL ),
         ENTRY( "CreateSourceInstanceBufferL", CThumbnailManagerTest::CreateSourceInstanceBufferL ),
         ENTRY( "CreateSourceInstanceBitmapL", CThumbnailManagerTest::CreateSourceInstanceBitmapL ),
@@ -87,7 +88,7 @@
         ENTRY( "SetDisplayModeL", CThumbnailManagerTest::SetDisplayModeL ),
         ENTRY( "CheckDisplayModeL", CThumbnailManagerTest::CheckDisplayModeL ),
         ENTRY( "DeleteThumbnails", CThumbnailManagerTest::DeleteThumbnails ),
-        ENTRY( "DeleteThumbnailsByIdL", CThumbnailManagerTest::DeleteThumbnailsByIdL ),
+        ENTRY( "CreateThumbnailsByUrlL", CThumbnailManagerTest::CreateThumbnailsByUrlL ),
         ENTRY( "CreateThumbnails", CThumbnailManagerTest::CreateThumbnails ),
         ENTRY( "UpdatePathL", CThumbnailManagerTest::UpdatePathL ),
         ENTRY( "GetSupportedMimeTypesL", CThumbnailManagerTest::GetSupportedMimeTypesL )
@@ -300,6 +301,53 @@
     return KErrNone;
     }
 
+TInt CThumbnailManagerTest::CreateSourceInstancePathTargetL( CStifItemParser& aItem )
+    {
+    _LIT( KPanicTxt, "CreateSrcPathTarget" );
+    __ASSERT_ALWAYS( !iObjectSource, User::Panic( KPanicTxt, 0 ));
+
+    TPtrC path;
+    User::LeaveIfError( aItem.GetNextString( path ));
+
+    TPtrC target;
+    User::LeaveIfError( aItem.GetNextString( target ));
+    
+    TPtrC mimeType;
+    User::LeaveIfError( aItem.GetNextString( mimeType ));
+    
+    TInt virtual1 = 0;
+    aItem.GetNextInt( virtual1 );
+    
+    TInt virtual2 = 0;
+    aItem.GetNextInt( virtual2 );
+    
+    TFileName filePath( iDataPath );
+    filePath.Append( path );
+    filePath.ZeroTerminate();
+    
+    if (virtual1)
+        {
+        filePath.Delete(2,1);
+        }
+    
+    TFileName targetPath( iDataPath );
+    targetPath.Append( target );
+    targetPath.ZeroTerminate();
+    
+    if (virtual2)
+        {
+        targetPath.Delete(2,1);
+        }
+    
+    iLog->Log( _L( "CreateSourceInstancePathTargetL - path = %S, target = %S" ), &filePath );
+    
+    delete iObjectSource;
+    iObjectSource = NULL;
+    
+    iObjectSource = CThumbnailObjectSource::NewL( filePath, targetPath, mimeType );
+    return KErrNone;
+    }
+
 TInt CThumbnailManagerTest::CreateSourceInstanceHandleL( CStifItemParser& aItem )
     {
     _LIT( KPanicTxt, "CreateSrcHandle" );
@@ -627,6 +675,7 @@
 TInt CThumbnailManagerTest::CheckThumbnailCenrepL( CStifItemParser& aItem )
     {
     TInt err = KErrNone;
+    TBool full = EFalse;
     
     TInt sizeType;
     TInt displaymode = 0;
@@ -634,6 +683,12 @@
     User::LeaveIfError( aItem.GetNextInt( displaymode ));
     
     TThumbnailSize size = (TThumbnailSize)sizeType;
+    if (size == EImageFullScreenThumbnailSize ||
+        size == EVideoFullScreenThumbnailSize ||
+        size == EAudioFullScreenThumbnailSize)
+        {
+        full = ETrue;
+        }
     
     if ( iThumbnail )
         {
@@ -663,6 +718,10 @@
             {
             iLog->Log( _L( "CheckThumbnailCenrepL - ok" ));
             }
+        else if (full && (thumbSize.iWidth <= width && thumbSize.iHeight <= height))
+            {
+            iLog->Log( _L( "CheckThumbnailCenrepL - fullscreen ok, not upscaled" ));
+            }
         else
             {
             iLog->Log( _L( "CheckThumbnailCenrepL - size mismatch" ));
@@ -724,12 +783,42 @@
     return KErrNone;
     }
 
-TInt CThumbnailManagerTest::DeleteThumbnailsByIdL( CStifItemParser&  aItem )
+TInt CThumbnailManagerTest::CreateThumbnailsByUrlL( CStifItemParser&  aItem )
     {
+    _LIT( KPanicTxt, "CreateSrcPath" );
+    __ASSERT_ALWAYS( !iObjectSource, User::Panic( KPanicTxt, 0 ));
+
+    TPtrC path;
+    User::LeaveIfError( aItem.GetNextString( path ));
+
     TInt id = 0;
-    User::LeaveIfError( aItem.GetNextInt( id ));
+    aItem.GetNextInt( id );
+    
+    TFileName filePath( iDataPath );
+    filePath.Append( path );
+    filePath.ZeroTerminate();
+    
+    iLog->Log( _L( "CreateSourceInstancePathL - path = %S" ), &filePath );
+    
+    delete iObjectSource;
+    iObjectSource = NULL;
+    
+    iObjectSource = CThumbnailObjectSource::NewL( filePath, id );
     
-    iEngine->DeleteThumbnails( id );
+    id = iEngine->CreateThumbnails( *iObjectSource );
+    if (id < 0)
+        {
+        iLog->Log( _L( "CreateThumbnails - error %d" ), id );
+        return id;  
+        }
+    else
+        {
+        iPreviousRequestId = id;
+        iLog->Log( _L( "CreateThumbnails - request id %d" ), iPreviousRequestId );
+        }
+    
+    iCreateThumbnails = ETrue;
+    
     return KErrNone;
     }