uiaccelerator_plat/alf_visual_api/tsrc/src/testplatalfvisualblockstimedvalue.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 alftimedvalue.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // [INCLUDE FILES]
       
    21 #include <alf/alftimedvalue.h>
       
    22 
       
    23 #include "testplatalfvisual.h"
       
    24 
       
    25 
       
    26 // CONSTANTS
       
    27 const TInt KGeneralNum = 100;
       
    28 
       
    29 
       
    30 
       
    31 // ============================ MEMBER FUNCTIONS ===============================
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CTestPlatAlfVisual::TestTimedValueConstructor
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 TInt CTestPlatAlfVisual::TestTimedValueConstructor( CStifItemParser& /*aItem*/ )
       
    38     {
       
    39     // Print to UI
       
    40     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    41     _LIT( KTestTimedValueConstructor, "TestTimedValueConstructor" );
       
    42     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestTimedValueConstructor );
       
    43     // Print to log file
       
    44     iLog->Log( KTestTimedValueConstructor );
       
    45     
       
    46     TAlfTimedValue value1;
       
    47     TAlfTimedValue value2( 1.0 );
       
    48     TAlfTimedValue value3( 1.0, 1 );
       
    49     
       
    50     return KErrNone;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CTestPlatAlfVisual::TestTimedValueValueNow
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 TInt CTestPlatAlfVisual::TestTimedValueValueNow( CStifItemParser& /*aItem*/ )
       
    58     {
       
    59     // Print to UI
       
    60     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    61     _LIT( KTestTimedValueValueNow, "TestTimedValueValueNow" );
       
    62     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestTimedValueValueNow );
       
    63     // Print to log file
       
    64     iLog->Log( KTestTimedValueValueNow );
       
    65     
       
    66     TAlfTimedValue value;
       
    67     value.SetValueNow( 1.0 );
       
    68     STIF_ASSERT_EQUALS( TReal32( 1.0 ), value.ValueNow() );
       
    69     
       
    70     return KErrNone;
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CTestPlatAlfVisual::TestTimedValueTargetAndSpeed
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 TInt CTestPlatAlfVisual::TestTimedValueTargetAndSpeed( CStifItemParser& /*aItem*/ )
       
    78     {
       
    79     // Print to UI
       
    80     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    81     _LIT( KTestTimedValueTargetAndSpeed, "TestTimedValueTargetAndSpeed" );
       
    82     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestTimedValueTargetAndSpeed );
       
    83     // Print to log file
       
    84     iLog->Log( KTestTimedValueTargetAndSpeed );
       
    85     
       
    86     TAlfTimedValue value;
       
    87     value.SetTarget( 1.0, KGeneralNum );
       
    88     STIF_ASSERT_EQUALS( TReal32( 1.0 ), value.Target() );
       
    89     value.SetTargetWithSpeed( 1.0, 2.0 );
       
    90     STIF_ASSERT_EQUALS( TReal32( 1.0 ), value.Target() );
       
    91     STIF_ASSERT_EQUALS( TReal32( 2.0 ), value.Speed() );
       
    92     value.TimeToTargetinMilliSeconds();
       
    93     
       
    94     return KErrNone;
       
    95     }
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CTestPlatAlfVisual::TestTimedValueStyle
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 TInt CTestPlatAlfVisual::TestTimedValueStyle( CStifItemParser& /*aItem*/ )
       
   102     {
       
   103     // Print to UI
       
   104     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   105     _LIT( KTestTimedValueStyle, "TestTimedValueStyle" );
       
   106     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestTimedValueStyle );
       
   107     // Print to log file
       
   108     iLog->Log( KTestTimedValueStyle );
       
   109     
       
   110     TAlfTimedValue value;
       
   111     value.SetStyle( EAlfTimedValueStyleUseSystemDefault );
       
   112     STIF_ASSERT_EQUALS( EAlfTimedValueStyleUseSystemDefault, value.Style() );
       
   113     
       
   114     return KErrNone;
       
   115     }
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // CTestPlatAlfVisual::TestTimedValueMappingFunctionIdentifier
       
   119 // -----------------------------------------------------------------------------
       
   120 //
       
   121 TInt CTestPlatAlfVisual::TestTimedValueMappingFunctionIdentifier( CStifItemParser& /*aItem*/ )
       
   122     {
       
   123     // Print to UI
       
   124     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   125     _LIT( KTestTimedValueMappingFunctionIdentifier, "TestTimedValueMappingFunctionIdentifier" );
       
   126     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestTimedValueMappingFunctionIdentifier );
       
   127     // Print to log file
       
   128     iLog->Log( KTestTimedValueMappingFunctionIdentifier );
       
   129     
       
   130     TAlfTimedValue value;
       
   131     value.SetMappingFunctionIdentifier( 1 );
       
   132     STIF_ASSERT_EQUALS( 1, value.MappingFunctionIdentifier() );
       
   133     
       
   134     return KErrNone;
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CTestPlatAlfVisual::TestTimedValueFlags
       
   139 // -----------------------------------------------------------------------------
       
   140 //
       
   141 TInt CTestPlatAlfVisual::TestTimedValueFlags( CStifItemParser& /*aItem*/ )
       
   142     {
       
   143     // Print to UI
       
   144     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   145     _LIT( KTestTimedValueFlags, "TestTimedValueFlags" );
       
   146     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestTimedValueFlags );
       
   147     // Print to log file
       
   148     iLog->Log( KTestTimedValueFlags );
       
   149     
       
   150     TAlfTimedValue value;
       
   151     value.Flags();
       
   152     
       
   153     return KErrNone;
       
   154     }
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // CTestPlatAlfVisual::TestRealPointMethods
       
   158 // -----------------------------------------------------------------------------
       
   159 //
       
   160 TInt CTestPlatAlfVisual::TestRealPointMethods( CStifItemParser& /*aItem*/ )
       
   161     {
       
   162     // Print to UI
       
   163     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   164     _LIT( KTestRealPointMethods, "TestRealPointMethods" );
       
   165     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestRealPointMethods );
       
   166     // Print to log file
       
   167     iLog->Log( KTestRealPointMethods );
       
   168     
       
   169     TAlfRealPoint realPoint1( 1.0, 2.0 );
       
   170     TAlfRealPoint realPoint2( 0.0, 1.0 );
       
   171     
       
   172     TPoint point;
       
   173     point += realPoint1;
       
   174     
       
   175     realPoint1.AsSize();
       
   176     
       
   177     TAlfRealPoint realPoint3 = realPoint1 - realPoint2;
       
   178     TAlfRealPoint realPoint4 = realPoint2 + realPoint3;
       
   179     realPoint4 += realPoint3;
       
   180     realPoint4 -= realPoint3;
       
   181     TBool value = realPoint1 == realPoint4;
       
   182     STIF_ASSERT_TRUE( value );
       
   183     
       
   184     return KErrNone;
       
   185     }
       
   186 
       
   187 // -----------------------------------------------------------------------------
       
   188 // CTestPlatAlfVisual::TestRealSizeMethods
       
   189 // -----------------------------------------------------------------------------
       
   190 //
       
   191 TInt CTestPlatAlfVisual::TestRealSizeMethods( CStifItemParser& /*aItem*/ )
       
   192     {
       
   193     // Print to UI
       
   194     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   195     _LIT( KTestRealSizeMethods, "TestRealSizeMethods" );
       
   196     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestRealSizeMethods );
       
   197     // Print to log file
       
   198     iLog->Log( KTestRealSizeMethods );
       
   199     
       
   200     TAlfRealSize realSize1( 2.0, 2.0 );
       
   201     
       
   202     TSize size( 2, 2 );
       
   203     TAlfRealSize realSize2( size );
       
   204     
       
   205     TAlfRealPoint realPoint( 2.0, 2.0 );
       
   206     TAlfRealSize realSize3( realPoint );
       
   207     
       
   208     TSize size2;
       
   209     size2 += realSize1;
       
   210     
       
   211     return KErrNone;
       
   212     }
       
   213 
       
   214 // -----------------------------------------------------------------------------
       
   215 // CTestPlatAlfVisual::TestRealRectMethods
       
   216 // -----------------------------------------------------------------------------
       
   217 //
       
   218 TInt CTestPlatAlfVisual::TestRealRectMethods( CStifItemParser& /*aItem*/ )
       
   219     {
       
   220     // Print to UI
       
   221     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   222     _LIT( KTestRealRectMethods, "TestRealRectMethods" );
       
   223     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestRealRectMethods );
       
   224     // Print to log file
       
   225     iLog->Log( KTestRealRectMethods );
       
   226     
       
   227     TAlfRealRect realRect;
       
   228     
       
   229     TRect rect;
       
   230     rect == realRect; //operator TRect() const
       
   231     
       
   232     realRect.Width(); //TReal32 Width() const
       
   233     realRect.Height(); //TReal32 Height() const
       
   234     realRect.TopRight(); //TAlfRealPoint TopRight() const
       
   235     realRect.BottomLeft(); //TAlfRealPoint BottomLeft() const
       
   236     realRect.Size(); //TAlfRealSize Size() const
       
   237     realRect.Center(); //TAlfRealPoint Center() const
       
   238     realRect.Grow( 1.0, 1.0 ); //void Grow(TReal32 aX, TReal32 aY)
       
   239     realRect.Shrink( 1.0, 1.0 ); //void Shrink(TReal32 aX, TReal32 aY)
       
   240     
       
   241     TPoint point( 1, 1 );
       
   242     realRect.Shrink( point ); //void Shrink(const TPoint& aPoint)
       
   243     
       
   244     TAlfRealPoint realPoint( 1.0, 1.0 );
       
   245     realRect.Shrink( realPoint ); //void Shrink(const TAlfRealPoint& aPoint)
       
   246     
       
   247     realRect.Shrink( realRect ); //void Shrink(const TAlfRealRect& aRect)
       
   248     realRect.Move( 1.0, 1.0 ); //void Move(TReal32 aDx, TReal32 aDy)
       
   249     
       
   250     return KErrNone;
       
   251     }
       
   252 
       
   253 // -----------------------------------------------------------------------------
       
   254 // CTestPlatAlfVisual::TestTimedPointConstructor
       
   255 // -----------------------------------------------------------------------------
       
   256 //
       
   257 TInt CTestPlatAlfVisual::TestTimedPointConstructor( CStifItemParser& /*aItem*/ )
       
   258     {
       
   259     // Print to UI
       
   260     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   261     _LIT( KTestTimedPointConstructor, "TestTimedPointConstructor" );
       
   262     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestTimedPointConstructor );
       
   263     // Print to log file
       
   264     iLog->Log( KTestTimedPointConstructor );
       
   265     
       
   266     TAlfTimedPoint point1;
       
   267     TAlfTimedPoint point2( 1.0, 1.0 );
       
   268     TAlfTimedPoint point3( 1.0, 1.0, KGeneralNum );
       
   269     
       
   270     return KErrNone;
       
   271     }
       
   272 
       
   273 // -----------------------------------------------------------------------------
       
   274 // CTestPlatAlfVisual::TestTimedPointSetStyle
       
   275 // -----------------------------------------------------------------------------
       
   276 //
       
   277 TInt CTestPlatAlfVisual::TestTimedPointSetStyle( CStifItemParser& /*aItem*/ )
       
   278     {
       
   279     // Print to UI
       
   280     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   281     _LIT( KTestTimedPointSetStyle, "TestTimedPointSetStyle" );
       
   282     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestTimedPointSetStyle );
       
   283     // Print to log file
       
   284     iLog->Log( KTestTimedPointSetStyle );
       
   285     
       
   286     TAlfTimedPoint point;
       
   287     point.SetStyle( EAlfTimedValueStyleUseSystemDefault );
       
   288     
       
   289     return KErrNone;
       
   290     }
       
   291 
       
   292 // -----------------------------------------------------------------------------
       
   293 // CTestPlatAlfVisual::TestTimedPointSetMapFuncIdentifier
       
   294 // -----------------------------------------------------------------------------
       
   295 //
       
   296 TInt CTestPlatAlfVisual::TestTimedPointSetMapFuncIdentifier( CStifItemParser& /*aItem*/ )
       
   297     {
       
   298     // Print to UI
       
   299     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   300     _LIT( KTestTimedPointSetMapFuncIdentifier, "TestTimedPointSetMapFuncIdentifier" );
       
   301     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestTimedPointSetMapFuncIdentifier );
       
   302     // Print to log file
       
   303     iLog->Log( KTestTimedPointSetMapFuncIdentifier );
       
   304     
       
   305     TAlfTimedPoint point;
       
   306     point.SetMappingFunctionIdentifier( 1 );
       
   307     
       
   308     return KErrNone;
       
   309     }
       
   310 
       
   311 // -----------------------------------------------------------------------------
       
   312 // CTestPlatAlfVisual::TestTimedPointTargetMethods
       
   313 // -----------------------------------------------------------------------------
       
   314 //
       
   315 TInt CTestPlatAlfVisual::TestTimedPointTargetMethods( CStifItemParser& /*aItem*/ )
       
   316     {
       
   317     // Print to UI
       
   318     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   319     _LIT( KTestTimedPointTargetMethods, "TestTimedPointTargetMethods" );
       
   320     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestTimedPointTargetMethods );
       
   321     // Print to log file
       
   322     iLog->Log( KTestTimedPointTargetMethods );
       
   323     
       
   324     TAlfTimedPoint point;
       
   325     TAlfRealPoint realPoint( 1.0, 1.0 );
       
   326     point.SetTarget( realPoint, KGeneralNum );
       
   327     point.SetTarget( 1.0, KGeneralNum );
       
   328     point.SetTargetWithSpeed( realPoint, KGeneralNum );
       
   329     point.SetTargetWithSpeed( 1.0, KGeneralNum );
       
   330     point.Target();
       
   331     point.TimeToTargetinMilliSeconds();
       
   332     point.IntTarget();
       
   333     
       
   334     return KErrNone;
       
   335     }
       
   336 
       
   337 // -----------------------------------------------------------------------------
       
   338 // CTestPlatAlfVisual::TestTimedPointValueNowMethods
       
   339 // -----------------------------------------------------------------------------
       
   340 //
       
   341 TInt CTestPlatAlfVisual::TestTimedPointValueNowMethods( CStifItemParser& /*aItem*/ )
       
   342     {
       
   343     // Print to UI
       
   344     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   345     _LIT( KTestTimedPointValueNowMethods, "TestTimedPointValueNowMethods" );
       
   346     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestTimedPointValueNowMethods );
       
   347     // Print to log file
       
   348     iLog->Log( KTestTimedPointValueNowMethods );
       
   349     
       
   350     TAlfTimedPoint point;
       
   351     point.ValueNow();
       
   352     point.IntValueNow();
       
   353     
       
   354     return KErrNone;
       
   355     }
       
   356 
       
   357 
       
   358 //  [End of File]