uiaccelerator_plat/alf_visual_api/tsrc/src/testplatalfvisualblocksframebrush.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     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:  test functions for alfvisual.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // [INCLUDE FILES]
       
    21 #include <e32svr.h>
       
    22 #include <stifparser.h>
       
    23 #include <stiftestinterface.h>
       
    24 
       
    25 #include "testplatalfvisual.h"
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CTestPlatAlfVisual::TestAlfFrameBrushNewL
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 TInt CTestPlatAlfVisual::TestAlfFrameBrushNewL( CStifItemParser& /*aItem*/ )
       
    34     {
       
    35     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    36     _LIT( KTestAlfFrameBrushNewL, "TestAlfFrameBrushNewL" );
       
    37     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfFrameBrushNewL );
       
    38     // Print to log file
       
    39     iLog->Log( KTestAlfFrameBrushNewL );
       
    40     
       
    41     TAlfImage vImage;
       
    42     TUid vUid;
       
    43     vUid.Null();
       
    44     CAlfFrameBrush* vBrush = CAlfFrameBrush::NewL( *iAlfEnv, vImage, 
       
    45             TAlfXYMetric( 0, 0) );
       
    46     CleanupStack::PushL( vBrush );
       
    47     STIF_ASSERT_NOT_NULL( vBrush );
       
    48     CleanupStack::PopAndDestroy( vBrush );
       
    49     
       
    50     vBrush = NULL;
       
    51     vBrush = CAlfFrameBrush::NewLC( *iAlfEnv, vImage, TAlfXYMetric( 0, 0 ) );
       
    52     STIF_ASSERT_NOT_NULL( vBrush );
       
    53     CleanupStack::PopAndDestroy( vBrush );
       
    54     
       
    55     vBrush = NULL;
       
    56     vBrush = CAlfFrameBrush::NewL( *iAlfEnv, KAknsIIDQsnFrList, 
       
    57             TAlfXYMetric( 0, 0 ) );
       
    58     CleanupStack::PushL( vBrush );
       
    59     STIF_ASSERT_NOT_NULL( vBrush );
       
    60     CleanupStack::PopAndDestroy( vBrush );
       
    61     
       
    62     vBrush = NULL;
       
    63     vBrush = CAlfFrameBrush::NewLC( *iAlfEnv, KAknsIIDQsnFrList, TAlfXYMetric( 0, 0 ) );
       
    64     STIF_ASSERT_NOT_NULL( vBrush );
       
    65     CleanupStack::PopAndDestroy( vBrush );
       
    66     
       
    67     vBrush = NULL;
       
    68     vBrush = CAlfFrameBrush::NewL( *iAlfEnv, KAknsIIDQsnFrList );
       
    69     CleanupStack::PushL( vBrush );
       
    70     STIF_ASSERT_NOT_NULL( vBrush );
       
    71     CleanupStack::PopAndDestroy( vBrush );
       
    72     
       
    73     vBrush = NULL;
       
    74     vBrush = CAlfFrameBrush::NewLC( *iAlfEnv, KAknsIIDQsnFrList );
       
    75     STIF_ASSERT_NOT_NULL( vBrush );
       
    76     CleanupStack::PopAndDestroy( vBrush );
       
    77     
       
    78     return KErrNone;
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CTestPlatAlfVisual::TestAlfFrameBrushSetParaL
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 TInt CTestPlatAlfVisual::TestAlfFrameBrushSetParaL( CStifItemParser& /*aItem*/ )
       
    86     {
       
    87     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    88     _LIT( KTestAlfFrameBrushSetParaL, "TestAlfFrameBrushSetParaL" );
       
    89     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfFrameBrushSetParaL );
       
    90     // Print to log file
       
    91     iLog->Log( KTestAlfFrameBrushSetParaL );
       
    92     
       
    93     TAlfImage vImage;
       
    94     TUid vUid = { 0x00000000 };
       
    95     CAlfTextureManager* vTextManager = iAlfEnv->CreateSharedTextureManagerL( vUid );
       
    96     CAlfTexture* vText = &( vTextManager->BlankTexture() );
       
    97     vImage.SetTexture( *vText );
       
    98     TAlfXYMetric vMetric;
       
    99     CAlfFrameBrush* vBrush = CAlfFrameBrush::NewL( *iAlfEnv, vImage, vMetric );
       
   100     CleanupStack::PushL( vBrush );
       
   101     
       
   102     TAlfImage vNewImage;
       
   103     TRect vInner( 0, 0, 100, 100 );
       
   104     TRect vOuter( 10, 10, 90, 90 );
       
   105     vBrush->SetFrameRectsL( vInner, vOuter );
       
   106     TAlfMetric valueSet(2.f);
       
   107     vBrush->SetEdgeOffset( valueSet );
       
   108     vBrush->SetImage( vNewImage );
       
   109     TAlfImage emptyImage;
       
   110     const TInt KMaxEnumValue = 9;
       
   111     for ( TInt i = 0;i < KMaxEnumValue; i++ )
       
   112         {
       
   113         vBrush->SetImage(CAlfFrameBrush::TFrameParts(i), emptyImage);
       
   114         }
       
   115     
       
   116     CleanupStack::PopAndDestroy( vBrush );
       
   117     
       
   118     
       
   119     return KErrNone;
       
   120     }
       
   121 
       
   122 
       
   123 // End of file
       
   124