uiaccelerator_plat/alf_visual_api/tsrc/src/testplatalfvisualblocksimagebrush.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::TestAlfImageBrushNewL
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 TInt CTestPlatAlfVisual::TestAlfImageBrushNewL( CStifItemParser& /*aItem*/ )
       
    34     {
       
    35     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    36     _LIT( KTestAlfImageBrushNewL, "TestAlfImageBrushNewL" );
       
    37     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfImageBrushNewL );
       
    38     // Print to log file
       
    39     iLog->Log( KTestAlfImageBrushNewL );
       
    40     
       
    41     TAlfImage vImage;
       
    42     TUid vUid = { 0x00000000 };
       
    43     CAlfTextureManager* vTextManager = iAlfEnv->CreateSharedTextureManagerL( vUid );
       
    44     CAlfTexture* vText = &( vTextManager->BlankTexture() );
       
    45     vImage.SetTexture( *vText );
       
    46     CAlfImageBrush* vBrush = CAlfImageBrush::NewL( *iAlfEnv, vImage );
       
    47     CleanupStack::PushL( vBrush );
       
    48     STIF_ASSERT_NOT_NULL( vBrush );
       
    49     CleanupStack::PopAndDestroy( vBrush );
       
    50     
       
    51     vBrush = NULL;
       
    52     vBrush = CAlfImageBrush::NewLC( *iAlfEnv, vImage );
       
    53     STIF_ASSERT_NOT_NULL( vBrush );
       
    54     CleanupStack::PopAndDestroy( vBrush );
       
    55     
       
    56     return KErrNone;
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CTestPlatAlfVisual::TestAlfImageBrushSetAndGetParaL
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 TInt CTestPlatAlfVisual::TestAlfImageBrushSetAndGetParaL( CStifItemParser& /*aItem*/ )
       
    64     {
       
    65     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    66     _LIT( KTestAlfImageBrushSetAndGetParaL, "TestAlfImageBrushSetAndGetParaL" );
       
    67     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfImageBrushSetAndGetParaL );
       
    68     // Print to log file
       
    69     iLog->Log( KTestAlfImageBrushSetAndGetParaL );
       
    70     
       
    71     TAlfImage vImage;
       
    72     TUid vUid = { 0x00000000 };
       
    73     CAlfTextureManager* vTextManager = iAlfEnv->CreateSharedTextureManagerL( vUid );
       
    74     CAlfTexture* vText = &( vTextManager->BlankTexture() );
       
    75     vImage.SetTexture( *vText );
       
    76     CAlfImageBrush* vBrush = CAlfImageBrush::NewLC( *iAlfEnv, vImage );
       
    77     vBrush->SetScale( CAlfImageVisual::EScaleFitHeight );
       
    78     TAlfImage vNewImage;
       
    79     CAlfTexture* vNewText = &( vTextManager->BlankTexture() );
       
    80     vNewImage.SetTexture( *vNewText );
       
    81     vBrush->SetImage( vNewImage );
       
    82     vBrush->SetBorders( 1, 1, 1, 1 );
       
    83     TAlfTimedPoint vPoint( 1, 1 );
       
    84     vBrush->SetOffset( vPoint );
       
    85     TAlfTimedValue vValue( 1 );
       
    86     vBrush->SetScale( vValue );
       
    87     vBrush->Image();
       
    88     vBrush->BorderDrawingEnabled();
       
    89     vBrush->CenterDrawingEnabled();
       
    90     vBrush->Offset();
       
    91     vBrush->Scale();
       
    92     
       
    93     CleanupStack::PopAndDestroy( vBrush );
       
    94     
       
    95     return KErrNone;
       
    96     }
       
    97 
       
    98 
       
    99 // End of file
       
   100