uiaccelerator_plat/alf_core_toolkit_api/tsrc/src/testuiaifctkitblockshuiimagevisual.cpp
branchRCL_3
changeset 19 e5af45d51884
parent 18 1801340c26a2
child 20 31fccae4f8a7
equal deleted inserted replaced
18:1801340c26a2 19:e5af45d51884
     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:  for testing the method of the CHuiTextVisual
       
    15 *
       
    16 */
       
    17 
       
    18 #include <uiacceltk\huiimagevisual.h>
       
    19 
       
    20 #include "testuiaifcoretoolkit.h"
       
    21 
       
    22 const TInt KTop = 10;
       
    23 const TInt KBottom = 20;
       
    24 const TInt KShadowDistance = 10;
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // Ctestplatalfcoretoolkit::TestHuiImageVisualAddNewL
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 TInt CTestUiAifCoreToolkit::TestHuiImageVisualAddNewL( CStifItemParser& /*aItem*/ )
       
    31     {
       
    32 
       
    33     // Print to UI
       
    34     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
    35     _LIT( KTestHuiImageVisualAddNewL, "In TestHuiImageVisualAddNewL" );
       
    36     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualAddNewL );
       
    37     // Print to log file
       
    38     iLog->Log( KTestHuiImageVisualAddNewL );
       
    39     
       
    40     TRAPD( error, iHuiImageVisual = iHuiImageVisual->AddNewL( *iHuiControl ) );
       
    41 
       
    42     return error;
       
    43 
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // Ctestplatalfcoretoolkit::TestHuiImageVisualSetScaleMode
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 TInt CTestUiAifCoreToolkit::TestHuiImageVisualSetScaleMode( CStifItemParser& /*aItem*/ )
       
    51     {
       
    52 
       
    53     // Print to UI
       
    54     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
    55     _LIT( KTestHuiImageVisualSetScaleMode, "In TestHuiImageVisualSetScaleMode" );
       
    56     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualSetScaleMode );
       
    57     // Print to log file
       
    58     iLog->Log( KTestHuiImageVisualSetScaleMode );
       
    59     
       
    60     iHuiImageVisual->SetScaleMode( CHuiImageVisual::EScaleNormal );
       
    61 
       
    62     return KErrNone;
       
    63 
       
    64     }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // Ctestplatalfcoretoolkit::TestHuiImageVisualSetImage
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 TInt CTestUiAifCoreToolkit::TestHuiImageVisualSetImageL( CStifItemParser& /*aItem*/ )
       
    71     {
       
    72 
       
    73     // Print to UI
       
    74     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
    75     _LIT( KTestHuiImageVisualSetImage, "In TestHuiImageVisualSetImage" );
       
    76     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualSetImage );
       
    77     // Print to log file
       
    78     iLog->Log( KTestHuiImageVisualSetImage );
       
    79     
       
    80     CHuiTexture* huiTexture = CHuiTexture::NewL();
       
    81     THuiImage huiImage( *huiTexture );
       
    82     
       
    83     iHuiImageVisual->SetImage( huiImage );
       
    84 
       
    85     return KErrNone;
       
    86 
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // Ctestplatalfcoretoolkit::TestHuiImageVisualSetSecondaryImage
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 TInt CTestUiAifCoreToolkit::TestHuiImageVisualSetSecondaryImageL( CStifItemParser& /*aItem*/ )
       
    94     {
       
    95 
       
    96     // Print to UI
       
    97     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
    98     _LIT( KTestHuiImageVisualSetSecondaryImage, "In TestHuiImageVisualSetSecondaryImage" );
       
    99     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualSetSecondaryImage );
       
   100     // Print to log file
       
   101     iLog->Log( KTestHuiImageVisualSetSecondaryImage );
       
   102     
       
   103     CHuiTexture* huiTexture = CHuiTexture::NewL();
       
   104     THuiImage secHuiImage( *huiTexture );
       
   105     
       
   106     iHuiImageVisual->SetSecondaryImage( secHuiImage );
       
   107 
       
   108     return KErrNone;
       
   109 
       
   110     }
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // Ctestplatalfcoretoolkit::TestHuiImageVisualImage
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 TInt CTestUiAifCoreToolkit::TestHuiImageVisualImage( CStifItemParser& /*aItem*/ )
       
   117     {
       
   118 
       
   119     // Print to UI
       
   120     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
   121     _LIT( KTestHuiImageVisualImage, "In TestHuiImageVisualImage" );
       
   122     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualImage );
       
   123     // Print to log file
       
   124     iLog->Log( KTestHuiImageVisualImage );
       
   125     
       
   126     iHuiImageVisual->Image();
       
   127 
       
   128     return KErrNone;
       
   129 
       
   130     }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // Ctestplatalfcoretoolkit::TestHuiImageVisualSecondaryImage
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 TInt CTestUiAifCoreToolkit::TestHuiImageVisualSecondaryImage( CStifItemParser& /*aItem*/ )
       
   137     {
       
   138 
       
   139     // Print to UI
       
   140     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
   141     _LIT( KTestHuiImageVisualSecondaryImage, "In TestHuiImageVisualSecondaryImage" );
       
   142     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualSecondaryImage );
       
   143     // Print to log file
       
   144     iLog->Log( KTestHuiImageVisualSecondaryImage );
       
   145     
       
   146     iHuiImageVisual->SecondaryImage();
       
   147 
       
   148     return KErrNone;
       
   149 
       
   150     }
       
   151 
       
   152 // -----------------------------------------------------------------------------
       
   153 // Ctestplatalfcoretoolkit::TestHuiImageVisualSetColor
       
   154 // -----------------------------------------------------------------------------
       
   155 //
       
   156 TInt CTestUiAifCoreToolkit::TestHuiImageVisualSetColor( CStifItemParser& /*aItem*/ )
       
   157     {
       
   158 
       
   159     // Print to UI
       
   160     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
   161     _LIT( KTestHuiImageVisualSetColor, "In TestHuiImageVisualSetColor" );
       
   162     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualSetColor );
       
   163     // Print to log file
       
   164     iLog->Log( KTestHuiImageVisualSetColor );
       
   165     
       
   166     TRgb color( 0, 0, 0 );
       
   167     
       
   168     iHuiImageVisual->SetColor( color );
       
   169 
       
   170     return KErrNone;
       
   171 
       
   172     }
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // Ctestplatalfcoretoolkit::TestHuiImageVisualSetColorMode
       
   176 // -----------------------------------------------------------------------------
       
   177 //
       
   178 TInt CTestUiAifCoreToolkit::TestHuiImageVisualSetColorMode( CStifItemParser& /*aItem*/ )
       
   179     {
       
   180 
       
   181     // Print to UI
       
   182     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
   183     _LIT( KTestHuiImageVisualSetColorMode, "In TestHuiImageVisualSetColorMode" );
       
   184     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualSetColorMode );
       
   185     // Print to log file
       
   186     iLog->Log( KTestHuiImageVisualSetColorMode );
       
   187     
       
   188     iHuiImageVisual->SetColorMode( CHuiImageVisual::EColorModulate );
       
   189 
       
   190     return KErrNone;
       
   191 
       
   192     }
       
   193 
       
   194 // -----------------------------------------------------------------------------
       
   195 // Ctestplatalfcoretoolkit::TestHuiImageVisualSetStretch
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 TInt CTestUiAifCoreToolkit::TestHuiImageVisualSetStretch( CStifItemParser& /*aItem*/ )
       
   199     {
       
   200 
       
   201     // Print to UI
       
   202     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
   203     _LIT( KTestHuiImageVisualSetStretch, "In TestHuiImageVisualSetStretch" );
       
   204     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualSetStretch );
       
   205     // Print to log file
       
   206     iLog->Log( KTestHuiImageVisualSetStretch );
       
   207     
       
   208     iHuiImageVisual->SetStretch( KTop, KBottom );
       
   209 
       
   210     return KErrNone;
       
   211 
       
   212     }
       
   213 
       
   214 // -----------------------------------------------------------------------------
       
   215 // Ctestplatalfcoretoolkit::TestHuiImageVisualSetStretchMode
       
   216 // -----------------------------------------------------------------------------
       
   217 //
       
   218 TInt CTestUiAifCoreToolkit::TestHuiImageVisualSetStretchMode( CStifItemParser& /*aItem*/ )
       
   219     {
       
   220 
       
   221     // Print to UI
       
   222     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
   223     _LIT( KTestHuiImageVisualSetStretchMode, "In TestHuiImageVisualSetStretchMode" );
       
   224     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualSetStretchMode );
       
   225     // Print to log file
       
   226     iLog->Log( KTestHuiImageVisualSetStretchMode );
       
   227     
       
   228     iHuiImageVisual->SetStretchMode( CHuiGc::EStretchFull );
       
   229 
       
   230     return KErrNone;
       
   231 
       
   232     }
       
   233 
       
   234 // -----------------------------------------------------------------------------
       
   235 // Ctestplatalfcoretoolkit::TestHuiImageVisualSetDropShadow
       
   236 // -----------------------------------------------------------------------------
       
   237 //
       
   238 TInt CTestUiAifCoreToolkit::TestHuiImageVisualSetDropShadow( CStifItemParser& /*aItem*/ )
       
   239     {
       
   240 
       
   241     // Print to UI
       
   242     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
   243     _LIT( KTestHuiImageVisualSetDropShadow, "In TestHuiImageVisualSetDropShadow" );
       
   244     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualSetDropShadow );
       
   245     // Print to log file
       
   246     iLog->Log( KTestHuiImageVisualSetDropShadow );
       
   247     
       
   248     iHuiImageVisual->SetDropShadow( KShadowDistance );
       
   249 
       
   250     return KErrNone;
       
   251 
       
   252     }
       
   253 
       
   254 // -----------------------------------------------------------------------------
       
   255 // Ctestplatalfcoretoolkit::TestHuiImageVisualSetDropShadowWithHuiMetric
       
   256 // -----------------------------------------------------------------------------
       
   257 //
       
   258 TInt CTestUiAifCoreToolkit::TestHuiImageVisualSetDropShadowWithHuiMetric( CStifItemParser& /*aItem*/ )
       
   259     {
       
   260 
       
   261     // Print to UI
       
   262     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
   263     _LIT( KTestHuiImageVisualSetDropShadowWithHuiMetric, "In TestHuiImageVisualSetDropShadowWithHuiMetric" );
       
   264     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualSetDropShadowWithHuiMetric );
       
   265     // Print to log file
       
   266     iLog->Log( KTestHuiImageVisualSetDropShadowWithHuiMetric );
       
   267     
       
   268     THuiMetric huiMetric( KShadowDistance );
       
   269     
       
   270     iHuiImageVisual->SetDropShadow( huiMetric );
       
   271 
       
   272     return KErrNone;
       
   273 
       
   274     }
       
   275 
       
   276 // -----------------------------------------------------------------------------
       
   277 // Ctestplatalfcoretoolkit::TestHuiImageVisualSetDropShadowWithHuiXYMetric
       
   278 // -----------------------------------------------------------------------------
       
   279 //
       
   280 TInt CTestUiAifCoreToolkit::TestHuiImageVisualSetDropShadowWithHuiXYMetric( CStifItemParser& /*aItem*/ )
       
   281     {
       
   282 
       
   283     // Print to UI
       
   284     _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" );
       
   285     _LIT( KTestHuiImageVisualSetDropShadowWithHuiXYMetric, "In TestHuiImageVisualSetDropShadowWithHuiXYMetric" );
       
   286     TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiImageVisualSetDropShadowWithHuiXYMetric );
       
   287     // Print to log file
       
   288     iLog->Log( KTestHuiImageVisualSetDropShadowWithHuiXYMetric );
       
   289     
       
   290     THuiMetric huiMetric( KShadowDistance );
       
   291     THuiXYMetric huiXYMetric( huiMetric );
       
   292     
       
   293     iHuiImageVisual->SetDropShadow( huiXYMetric );
       
   294 
       
   295     return KErrNone;
       
   296 
       
   297     }
       
   298 //End of file