uiaccelerator_plat/alf_core_toolkit_api/tsrc/src/testuiaifctkitblockshuitransf.cpp
branchRCL_3
changeset 20 31fccae4f8a7
parent 10 7c5dd702d6d3
equal deleted inserted replaced
19:e5af45d51884 20:31fccae4f8a7
       
     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 api of alf_core_toolkit
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // [INCLUDE FILES]
       
    21 #include <e32svr.h>
       
    22 #include <stifparser.h>
       
    23 #include <stiftestinterface.h>
       
    24 #include <uiacceltk/huienv.h>
       
    25 #include <uiacceltk/huicontrol.h>
       
    26 #include <uiacceltk/huitransformation.h>
       
    27 
       
    28 #include "testuiaifcoretoolkit.h"
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CTestUiAifCoreToolkit::TestCHTranNewL
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 TInt CTestUiAifCoreToolkit::TestCHTranNewL( CStifItemParser& /*aItem*/ )
       
    35     {
       
    36 
       
    37     // Print to UI
       
    38     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    39     _LIT( KCHuiTransformation, "In TestCHTranNewL" );
       
    40     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
    41     // Print to log file
       
    42     iLog->Log( KCHuiTransformation );
       
    43 
       
    44     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
    45     CleanupStack::PushL( transfor );
       
    46     STIF_ASSERT_NOT_NULL( transfor );
       
    47     CleanupStack::PopAndDestroy( transfor );
       
    48 
       
    49     return KErrNone;
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CTestUiAifCoreToolkit::TestCHTranNewLCL
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 TInt CTestUiAifCoreToolkit::TestCHTranNewLCL( CStifItemParser& /*aItem*/ )
       
    57     {
       
    58 
       
    59     // Print to UI
       
    60     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    61     _LIT( KCHuiTransformation, "In TestCHTranNewLCL" );
       
    62     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
    63     // Print to log file
       
    64     iLog->Log( KCHuiTransformation );
       
    65 
       
    66     CHuiTransformation* transfor = CHuiTransformation::NewLC();
       
    67     STIF_ASSERT_NOT_NULL( transfor );
       
    68     CleanupStack::Pop();
       
    69     delete transfor;
       
    70     transfor = NULL;
       
    71 
       
    72     return KErrNone;
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CTestUiAifCoreToolkit::TestCHTranCountL
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 TInt CTestUiAifCoreToolkit::TestCHTranCountL( CStifItemParser& /*aItem*/ )
       
    80     {
       
    81 
       
    82     // Print to UI
       
    83     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    84     _LIT( KCHuiTransformation, "In TestCHTranCountL" );
       
    85     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
    86     // Print to log file
       
    87     iLog->Log( KCHuiTransformation );
       
    88 
       
    89     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
    90     CleanupStack::PushL( transfor );
       
    91     STIF_ASSERT_NOT_NULL( transfor );
       
    92     TInt count = transfor->Count();
       
    93     STIF_ASSERT_EQUALS( count, 0 );
       
    94     transfor->Translate( 1, 1 );
       
    95     count = transfor->Count();
       
    96     STIF_ASSERT_EQUALS( count, 1 );
       
    97     CleanupStack::PopAndDestroy( transfor );
       
    98 
       
    99     return KErrNone;
       
   100     }
       
   101 
       
   102 // -----------------------------------------------------------------------------
       
   103 // CTestUiAifCoreToolkit::TestCHTranNonIdentityCountL
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 TInt CTestUiAifCoreToolkit::TestCHTranNonIdentityCountL( CStifItemParser& /*aItem*/ )
       
   107     {
       
   108 
       
   109     // Print to UI
       
   110     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   111     _LIT( KCHuiTransformation, "In TestCHTranNonIdentityCountL" );
       
   112     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   113     // Print to log file
       
   114     iLog->Log( KCHuiTransformation );
       
   115 
       
   116     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   117     CleanupStack::PushL( transfor );
       
   118     STIF_ASSERT_NOT_NULL( transfor );
       
   119     TInt count = transfor->NonIdentityCount();
       
   120     STIF_ASSERT_EQUALS( count, 0 );
       
   121     transfor->Translate( 1, 1 );
       
   122     count = transfor->NonIdentityCount();
       
   123     STIF_ASSERT_EQUALS( count, 1 );
       
   124     CleanupStack::PopAndDestroy( transfor );
       
   125 
       
   126     return KErrNone;
       
   127     }
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CTestUiAifCoreToolkit::TestCHTranStepL
       
   131 // -----------------------------------------------------------------------------
       
   132 //
       
   133 TInt CTestUiAifCoreToolkit::TestCHTranStepL( CStifItemParser& /*aItem*/ )
       
   134     {
       
   135 
       
   136     // Print to UI
       
   137     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   138     _LIT( KCHuiTransformation, "In TestCHTranStepL" );
       
   139     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   140     // Print to log file
       
   141     iLog->Log( KCHuiTransformation );
       
   142 
       
   143     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   144     CleanupStack::PushL( transfor );
       
   145     STIF_ASSERT_NOT_NULL( transfor );
       
   146     transfor->Translate( 1, 1 );
       
   147     transfor->Step( 0 );
       
   148     CleanupStack::PopAndDestroy( transfor );
       
   149 
       
   150     return KErrNone;
       
   151     }
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 // CTestUiAifCoreToolkit::TestCHTranoperatorL
       
   155 // -----------------------------------------------------------------------------
       
   156 //
       
   157 TInt CTestUiAifCoreToolkit::TestCHTranoperatorL( CStifItemParser& /*aItem*/ )
       
   158     {
       
   159 
       
   160     // Print to UI
       
   161     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   162     _LIT( KCHuiTransformation, "In TestCHTranoperatorL" );
       
   163     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   164     // Print to log file
       
   165     iLog->Log( KCHuiTransformation );
       
   166 
       
   167     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   168     CleanupStack::PushL( transfor );
       
   169     STIF_ASSERT_NOT_NULL( transfor );
       
   170     transfor->Translate( 1, 1 );
       
   171     CHuiTransformation::TTransform trans = ( *transfor )[ 0 ];
       
   172     CleanupStack::PopAndDestroy( transfor );
       
   173 
       
   174     return KErrNone;
       
   175     }
       
   176 
       
   177 // -----------------------------------------------------------------------------
       
   178 // CTestUiAifCoreToolkit::TestCHTranLoadIdentityL
       
   179 // -----------------------------------------------------------------------------
       
   180 //
       
   181 TInt CTestUiAifCoreToolkit::TestCHTranLoadIdentityL( CStifItemParser& /*aItem*/ )
       
   182     {
       
   183 
       
   184     // Print to UI
       
   185     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   186     _LIT( KCHuiTransformation, "In TestCHTranLoadIdentityL" );
       
   187     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   188     // Print to log file
       
   189     iLog->Log( KCHuiTransformation );
       
   190 
       
   191     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   192     CleanupStack::PushL( transfor );
       
   193     STIF_ASSERT_NOT_NULL( transfor );
       
   194     transfor->Translate( 1, 1 );
       
   195     transfor->LoadIdentity();
       
   196     CleanupStack::PopAndDestroy( transfor );
       
   197 
       
   198     return KErrNone;
       
   199     }
       
   200 
       
   201 // -----------------------------------------------------------------------------
       
   202 // CTestUiAifCoreToolkit::TestCHTranTranslateL
       
   203 // -----------------------------------------------------------------------------
       
   204 //
       
   205 TInt CTestUiAifCoreToolkit::TestCHTranTranslateL( CStifItemParser& /*aItem*/ )
       
   206     {
       
   207 
       
   208     // Print to UI
       
   209     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   210     _LIT( KCHuiTransformation, "In TestCHTranTranslateL" );
       
   211     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   212     // Print to log file
       
   213     iLog->Log( KCHuiTransformation );
       
   214 
       
   215     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   216     CleanupStack::PushL( transfor );
       
   217     STIF_ASSERT_NOT_NULL( transfor );
       
   218     transfor->Translate( 1, 1 );
       
   219     CleanupStack::PopAndDestroy( transfor );
       
   220 
       
   221     return KErrNone;
       
   222     }
       
   223 
       
   224 // -----------------------------------------------------------------------------
       
   225 // CTestUiAifCoreToolkit::TestCHTranTranslateWithValueL
       
   226 // -----------------------------------------------------------------------------
       
   227 //
       
   228 TInt CTestUiAifCoreToolkit::TestCHTranTranslateWithValueL( CStifItemParser& /*aItem*/ )
       
   229     {
       
   230 
       
   231     // Print to UI
       
   232     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   233     _LIT( KCHuiTransformation, "In TestCHTranTranslateWithValueL" );
       
   234     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   235     // Print to log file
       
   236     iLog->Log( KCHuiTransformation );
       
   237 
       
   238     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   239     CleanupStack::PushL( transfor );
       
   240     STIF_ASSERT_NOT_NULL( transfor );
       
   241     THuiTimedValue value1;
       
   242     THuiTimedValue value2;
       
   243     transfor->Translate( value1, value2 );
       
   244     CleanupStack::PopAndDestroy( transfor );
       
   245 
       
   246     return KErrNone;
       
   247     }
       
   248 
       
   249 // -----------------------------------------------------------------------------
       
   250 // CTestUiAifCoreToolkit::TestCHTranScaleL
       
   251 // -----------------------------------------------------------------------------
       
   252 //
       
   253 TInt CTestUiAifCoreToolkit::TestCHTranScaleL( CStifItemParser& /*aItem*/ )
       
   254     {
       
   255 
       
   256     // Print to UI
       
   257     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   258     _LIT( KCHuiTransformation, "In TestCHTranScaleL" );
       
   259     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   260     // Print to log file
       
   261     iLog->Log( KCHuiTransformation );
       
   262 
       
   263     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   264     CleanupStack::PushL( transfor );
       
   265     STIF_ASSERT_NOT_NULL( transfor );
       
   266     transfor->Scale( 1, 1 );
       
   267     CleanupStack::PopAndDestroy( transfor );
       
   268 
       
   269     return KErrNone;
       
   270     }
       
   271 
       
   272 // -----------------------------------------------------------------------------
       
   273 // CTestUiAifCoreToolkit::TestCHTranScaleWithValueL
       
   274 // -----------------------------------------------------------------------------
       
   275 //
       
   276 TInt CTestUiAifCoreToolkit::TestCHTranScaleWithValueL( CStifItemParser& /*aItem*/ )
       
   277     {
       
   278 
       
   279     // Print to UI
       
   280     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   281     _LIT( KCHuiTransformation, "In TestCHTranScaleWithValueL" );
       
   282     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   283     // Print to log file
       
   284     iLog->Log( KCHuiTransformation );
       
   285 
       
   286     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   287     CleanupStack::PushL( transfor );
       
   288     STIF_ASSERT_NOT_NULL( transfor );
       
   289     THuiTimedValue value1;
       
   290     THuiTimedValue value2;
       
   291     transfor->Scale( value1, value2 );
       
   292     CleanupStack::PopAndDestroy( transfor );
       
   293 
       
   294     return KErrNone;
       
   295     }
       
   296 
       
   297 // -----------------------------------------------------------------------------
       
   298 // CTestUiAifCoreToolkit::TestCHTranScaleWithThreeL
       
   299 // -----------------------------------------------------------------------------
       
   300 //
       
   301 TInt CTestUiAifCoreToolkit::TestCHTranScaleWithThreeL( CStifItemParser& /*aItem*/ )
       
   302     {
       
   303 
       
   304     // Print to UI
       
   305     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   306     _LIT( KCHuiTransformation, "In TestCHTranScaleWithThreeL" );
       
   307     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   308     // Print to log file
       
   309     iLog->Log( KCHuiTransformation );
       
   310 
       
   311     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   312     CleanupStack::PushL( transfor );
       
   313     STIF_ASSERT_NOT_NULL( transfor );
       
   314     transfor->Scale( 1, 1, 1 );
       
   315     CleanupStack::PopAndDestroy( transfor );
       
   316 
       
   317     return KErrNone;
       
   318     }
       
   319 
       
   320 // -----------------------------------------------------------------------------
       
   321 // CTestUiAifCoreToolkit::TestCHTranScaleWithThreeValueL
       
   322 // -----------------------------------------------------------------------------
       
   323 //
       
   324 TInt CTestUiAifCoreToolkit::TestCHTranScaleWithThreeValueL( CStifItemParser& /*aItem*/ )
       
   325     {
       
   326 
       
   327     // Print to UI
       
   328     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   329     _LIT( KCHuiTransformation, "In TestCHTranScaleWithThreeValueL" );
       
   330     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   331     // Print to log file
       
   332     iLog->Log( KCHuiTransformation );
       
   333 
       
   334     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   335     CleanupStack::PushL( transfor );
       
   336     STIF_ASSERT_NOT_NULL( transfor );
       
   337     THuiTimedValue value1;
       
   338     THuiTimedValue value2;
       
   339     THuiTimedValue value3;
       
   340     transfor->Scale( value1, value2, value3 );
       
   341     CleanupStack::PopAndDestroy( transfor );
       
   342 
       
   343     return KErrNone;
       
   344     }
       
   345 
       
   346 // -----------------------------------------------------------------------------
       
   347 // CTestUiAifCoreToolkit::TestCHTranRotateL
       
   348 // -----------------------------------------------------------------------------
       
   349 //
       
   350 TInt CTestUiAifCoreToolkit::TestCHTranRotateL( CStifItemParser& /*aItem*/ )
       
   351     {
       
   352 
       
   353     // Print to UI
       
   354     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   355     _LIT( KCHuiTransformation, "In TestCHTranRotateL" );
       
   356     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   357     // Print to log file
       
   358     iLog->Log( KCHuiTransformation );
       
   359 
       
   360     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   361     CleanupStack::PushL( transfor );
       
   362     STIF_ASSERT_NOT_NULL( transfor );
       
   363     transfor->Rotate( 1 );
       
   364     CleanupStack::PopAndDestroy( transfor );
       
   365 
       
   366     return KErrNone;
       
   367     }
       
   368 
       
   369 // -----------------------------------------------------------------------------
       
   370 // CTestUiAifCoreToolkit::TestCHTranRotateValueL
       
   371 // -----------------------------------------------------------------------------
       
   372 //
       
   373 TInt CTestUiAifCoreToolkit::TestCHTranRotateValueL( CStifItemParser& /*aItem*/ )
       
   374     {
       
   375 
       
   376     // Print to UI
       
   377     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   378     _LIT( KCHuiTransformation, "In TestCHTranRotateValueL" );
       
   379     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   380     // Print to log file
       
   381     iLog->Log( KCHuiTransformation );
       
   382 
       
   383     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   384     CleanupStack::PushL( transfor );
       
   385     STIF_ASSERT_NOT_NULL( transfor );
       
   386     THuiTimedValue angle;
       
   387     transfor->Rotate( angle );
       
   388     CleanupStack::PopAndDestroy( transfor );
       
   389 
       
   390     return KErrNone;
       
   391     }
       
   392 
       
   393 // -----------------------------------------------------------------------------
       
   394 // CTestUiAifCoreToolkit::TestCHTranRotateFourL
       
   395 // -----------------------------------------------------------------------------
       
   396 //
       
   397 TInt CTestUiAifCoreToolkit::TestCHTranRotateFourL( CStifItemParser& /*aItem*/ )
       
   398     {
       
   399 
       
   400     // Print to UI
       
   401     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   402     _LIT( KCHuiTransformation, "In TestCHTranRotateFourL" );
       
   403     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   404     // Print to log file
       
   405     iLog->Log( KCHuiTransformation );
       
   406 
       
   407     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   408     CleanupStack::PushL( transfor );
       
   409     STIF_ASSERT_NOT_NULL( transfor );
       
   410     transfor->Rotate( 1, 1, 1, 1 );
       
   411     CleanupStack::PopAndDestroy( transfor );
       
   412 
       
   413     return KErrNone;
       
   414     }
       
   415 
       
   416 // -----------------------------------------------------------------------------
       
   417 // CTestUiAifCoreToolkit::TestCHTranRotateValueThreeL
       
   418 // -----------------------------------------------------------------------------
       
   419 //
       
   420 TInt CTestUiAifCoreToolkit::TestCHTranRotateValueThreeL( CStifItemParser& /*aItem*/ )
       
   421     {
       
   422 
       
   423     // Print to UI
       
   424     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   425     _LIT( KCHuiTransformation, "In TestCHTranRotateValueThreeL" );
       
   426     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiTransformation );
       
   427     // Print to log file
       
   428     iLog->Log( KCHuiTransformation );
       
   429 
       
   430     CHuiTransformation* transfor = CHuiTransformation::NewL();
       
   431     CleanupStack::PushL( transfor );
       
   432     STIF_ASSERT_NOT_NULL( transfor );
       
   433     THuiTimedValue angle;
       
   434     transfor->Rotate( angle, 1, 1, 1 );
       
   435     CleanupStack::PopAndDestroy( transfor );
       
   436 
       
   437     return KErrNone;
       
   438     }