uiaccelerator_plat/alf_visual_api/tsrc/src/testplatalfvisualblocksshadowborderbrush.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 alfshadowborderbrush.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // [INCLUDE FILES]
       
    21 #include <alf/alfshadowborderbrush.h>
       
    22 
       
    23 #include "testplatalfvisual.h"
       
    24 
       
    25 
       
    26 // CONSTANTS
       
    27 const TInt KGeneralNum = 100;
       
    28 const TInt KTime = 1000000;
       
    29 
       
    30 
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CTestPlatAlfVisual::TestShadowBBNewL
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 TInt CTestPlatAlfVisual::TestShadowBBNewL( CStifItemParser& /*aItem*/ )
       
    39     {
       
    40     // Print to UI
       
    41     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    42     _LIT( KTestShadowBBNewL, "TestShadowBBNewL" );
       
    43     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestShadowBBNewL );
       
    44     // Print to log file
       
    45     iLog->Log( KTestShadowBBNewL );
       
    46     
       
    47     CAlfShadowBorderBrush* borderBrush = NULL;
       
    48     
       
    49     TAlfMetric metricWidth( KGeneralNum );
       
    50     borderBrush = CAlfShadowBorderBrush::NewL( *iAlfEnv, metricWidth );
       
    51     CleanupStack::PushL( borderBrush );
       
    52     STIF_ASSERT_NOT_NULL( borderBrush );
       
    53     CleanupStack::PopAndDestroy( borderBrush );
       
    54     
       
    55     borderBrush = CAlfShadowBorderBrush::NewL( *iAlfEnv, KGeneralNum );
       
    56     CleanupStack::PushL( borderBrush );
       
    57     STIF_ASSERT_NOT_NULL( borderBrush );
       
    58     CleanupStack::PopAndDestroy( borderBrush );
       
    59     
       
    60     return KErrNone;
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CTestPlatAlfVisual::TestShadowBBNewLCL
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 TInt CTestPlatAlfVisual::TestShadowBBNewLCL( CStifItemParser& /*aItem*/ )
       
    68     {
       
    69     // Print to UI
       
    70     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    71     _LIT( KTestShadowBBNewLCL, "TestShadowBBNewLCL" );
       
    72     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestShadowBBNewLCL );
       
    73     // Print to log file
       
    74     iLog->Log( KTestShadowBBNewLCL );
       
    75     
       
    76     CAlfShadowBorderBrush* borderBrush = NULL;
       
    77     
       
    78     TAlfMetric metricWidth( KGeneralNum );
       
    79     borderBrush = CAlfShadowBorderBrush::NewLC( *iAlfEnv, metricWidth );
       
    80     STIF_ASSERT_NOT_NULL( borderBrush );
       
    81     CleanupStack::PopAndDestroy( borderBrush );
       
    82     
       
    83     borderBrush = CAlfShadowBorderBrush::NewLC( *iAlfEnv, KGeneralNum );
       
    84     STIF_ASSERT_NOT_NULL( borderBrush );
       
    85     CleanupStack::PopAndDestroy( borderBrush );
       
    86     
       
    87     return KErrNone;
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CTestPlatAlfVisual::TestShadowBBWidthMethodsL
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 TInt CTestPlatAlfVisual::TestShadowBBWidthMethodsL( CStifItemParser& /*aItem*/ )
       
    95     {
       
    96     // Print to UI
       
    97     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    98     _LIT( KTestShadowBBWidthMethodsL, "TestShadowBBWidthMethodsL" );
       
    99     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestShadowBBWidthMethodsL );
       
   100     // Print to log file
       
   101     iLog->Log( KTestShadowBBWidthMethodsL );
       
   102     
       
   103     CAlfShadowBorderBrush* borderBrush = CAlfShadowBorderBrush::NewLC( *iAlfEnv, KGeneralNum );
       
   104     STIF_ASSERT_NOT_NULL( borderBrush );
       
   105     
       
   106     const TAlfTimedValue& valueGet = borderBrush->Width();
       
   107     STIF_ASSERT_EQUALS( 0, valueGet.TimeToTargetinMilliSeconds() );
       
   108     
       
   109     TAlfTimedValue valueSet;
       
   110     valueSet.SetValueNow( 0 );
       
   111     valueSet.SetTarget( 1, KTime );
       
   112     borderBrush->SetWidth( valueSet );
       
   113     borderBrush->Width();
       
   114     STIF_ASSERT_EQUALS( 0.f, valueGet.ValueNow() );
       
   115     STIF_ASSERT_EQUALS( 1.f, valueGet.Target() );
       
   116     STIF_ASSERT_NOT_EQUALS( 0, valueGet.TimeToTargetinMilliSeconds() );
       
   117     
       
   118     TAlfMetric valueSet2( 2.f );
       
   119     borderBrush->SetWidth( valueSet2 );
       
   120     borderBrush->Width();
       
   121     STIF_ASSERT_EQUALS( 2.f, valueGet.ValueNow() );
       
   122     STIF_ASSERT_EQUALS( 2.f, valueGet.Target() );
       
   123     STIF_ASSERT_EQUALS( 0, valueGet.TimeToTargetinMilliSeconds() );
       
   124 
       
   125     CleanupStack::PopAndDestroy( borderBrush );
       
   126     
       
   127     return KErrNone;
       
   128     }
       
   129 
       
   130 
       
   131 //  [End of File]