uiaccelerator_plat/alf_core_toolkit_api/tsrc/src/testuiaifctkitblockshuilinevisual.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:  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/huilinevisual.h>
       
    25 #include <uiacceltk/huienv.h>
       
    26 #include <uiacceltk/huicontrol.h>
       
    27 #include <uiacceltk/huilayout.h>
       
    28 #include <uiacceltk/huiownedpointer.h>
       
    29 #include <uiacceltk/huicurvepath.h>
       
    30 
       
    31 #include "testuiaifcoretoolkit.h"
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CTestUiAifCoreToolkit::TestCHLVAddNewL
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 TInt CTestUiAifCoreToolkit::TestCHLVAddNewL( CStifItemParser& /*aItem*/ )
       
    38     {
       
    39 
       
    40     // Print to UI
       
    41     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    42     _LIT( KTestCHuiLayout, "In TestCHLVAddNewL" );
       
    43     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTestCHuiLayout );
       
    44     // Print to log file
       
    45     iLog->Log( KTestCHuiLayout );
       
    46 
       
    47     CHuiLayout* layout = CHuiLayout::AddNewL( *iHuiControl );
       
    48     CHuiLineVisual* visual = CHuiLineVisual::AddNewL( *iHuiControl, layout );
       
    49     STIF_ASSERT_NOT_NULL( visual );
       
    50 
       
    51     return KErrNone;
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CTestUiAifCoreToolkit::TestCHLVSetPathL
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 TInt CTestUiAifCoreToolkit::TestCHLVSetPathL( CStifItemParser& /*aItem*/ )
       
    59     {
       
    60 
       
    61     // Print to UI
       
    62     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    63     _LIT( KTestCHuiLayout, "In TestCHLVSetPathL" );
       
    64     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTestCHuiLayout );
       
    65     // Print to log file
       
    66     iLog->Log( KTestCHuiLayout );
       
    67 
       
    68     CHuiLayout* layout = CHuiLayout::AddNewL( *iHuiControl );
       
    69     CHuiLineVisual* visual = CHuiLineVisual::AddNewL( *iHuiControl, layout );
       
    70     STIF_ASSERT_NOT_NULL( visual );
       
    71 
       
    72     CHuiCurvePath* path = CHuiCurvePath::NewL();
       
    73     CleanupStack::PushL( path );
       
    74     visual->SetPath( path, EHuiDoesNotHaveOwnership );
       
    75     CleanupStack::Pop( path );
       
    76     delete path;
       
    77 
       
    78     return KErrNone;
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CTestUiAifCoreToolkit::TestCHLVPathL
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 TInt CTestUiAifCoreToolkit::TestCHLVPathL( CStifItemParser& /*aItem*/ )
       
    86     {
       
    87 
       
    88     // Print to UI
       
    89     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    90     _LIT( KTestCHuiLayout, "In TestCHLVPathL" );
       
    91     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTestCHuiLayout );
       
    92     // Print to log file
       
    93     iLog->Log( KTestCHuiLayout );
       
    94 
       
    95     CHuiLayout* layout = CHuiLayout::AddNewL( *iHuiControl );
       
    96     CHuiLineVisual* visual = CHuiLineVisual::AddNewL( *iHuiControl, layout );
       
    97     STIF_ASSERT_NOT_NULL( visual );
       
    98 
       
    99     CHuiCurvePath* path = CHuiCurvePath::NewL();
       
   100     CleanupStack::PushL( path );
       
   101     visual->SetPath( path, EHuiDoesNotHaveOwnership );
       
   102     visual->Path();
       
   103     CleanupStack::Pop( path );
       
   104     delete path;
       
   105 
       
   106     return KErrNone;
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CTestUiAifCoreToolkit::TestCHLVSetImageL
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 TInt CTestUiAifCoreToolkit::TestCHLVSetImageL( CStifItemParser& /*aItem*/ )
       
   114     {
       
   115 
       
   116     // Print to UI
       
   117     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   118     _LIT( KTestCHuiLayout, "In TestCHLVSetImageL" );
       
   119     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTestCHuiLayout );
       
   120     // Print to log file
       
   121     iLog->Log( KTestCHuiLayout );
       
   122 
       
   123     CHuiLayout* layout = CHuiLayout::AddNewL( *iHuiControl );
       
   124 
       
   125     CHuiLineVisual* visual = CHuiLineVisual::AddNewL( *iHuiControl, layout );
       
   126     STIF_ASSERT_NOT_NULL( visual );
       
   127     THuiImage* image = new( ELeave ) THuiImage();
       
   128     CleanupStack::PushL( image );
       
   129     visual->SetImage( *image );
       
   130     CleanupStack::Pop( image );
       
   131     delete image;
       
   132 
       
   133     return KErrNone;
       
   134     }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CTestUiAifCoreToolkit::TestCHLVSetAlphaFunctionL
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 TInt CTestUiAifCoreToolkit::TestCHLVSetAlphaFunctionL( CStifItemParser& /*aItem*/ )
       
   141     {
       
   142 
       
   143     // Print to UI
       
   144     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   145     _LIT( KTestCHuiLayout, "In TestCHLVSetAlphaFunctionL" );
       
   146     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTestCHuiLayout );
       
   147     // Print to log file
       
   148     iLog->Log( KTestCHuiLayout );
       
   149 
       
   150     CHuiLayout* layout = CHuiLayout::AddNewL( *iHuiControl );
       
   151     CHuiLineVisual* visual = CHuiLineVisual::AddNewL( *iHuiControl, layout );
       
   152     STIF_ASSERT_NOT_NULL( visual );
       
   153     CHuiCurvePath* path = CHuiCurvePath::NewL();
       
   154     CleanupStack::PushL( path );
       
   155     visual->SetAlphaFunction( path );
       
   156     CleanupStack::Pop( path );
       
   157     delete path;
       
   158 
       
   159     return KErrNone;
       
   160     }
       
   161 
       
   162 // -----------------------------------------------------------------------------
       
   163 // CTestUiAifCoreToolkit::TestCHLVSetWidthFunctionL
       
   164 // -----------------------------------------------------------------------------
       
   165 //
       
   166 TInt CTestUiAifCoreToolkit::TestCHLVSetWidthFunctionL( CStifItemParser& /*aItem*/ )
       
   167     {
       
   168 
       
   169     // Print to UI
       
   170     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   171     _LIT( KTestCHuiLayout, "In TestCHLVSetWidthFunctionL" );
       
   172     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTestCHuiLayout );
       
   173     // Print to log file
       
   174     iLog->Log( KTestCHuiLayout );
       
   175 
       
   176     CHuiLayout* layout = CHuiLayout::AddNewL( *iHuiControl );
       
   177     CHuiLineVisual* visual = CHuiLineVisual::AddNewL( *iHuiControl, layout );
       
   178     STIF_ASSERT_NOT_NULL( visual );
       
   179     CHuiCurvePath* path = CHuiCurvePath::NewL();
       
   180     CleanupStack::PushL( path );
       
   181     visual->SetWidthFunction( path );
       
   182     CleanupStack::Pop( path );
       
   183     delete path;
       
   184 
       
   185     return KErrNone;
       
   186     }
       
   187 
       
   188 // -----------------------------------------------------------------------------
       
   189 // CTestUiAifCoreToolkit::TestCHLVSetColorL
       
   190 // -----------------------------------------------------------------------------
       
   191 //
       
   192 TInt CTestUiAifCoreToolkit::TestCHLVSetColorL( CStifItemParser& /*aItem*/ )
       
   193     {
       
   194 
       
   195     // Print to UI
       
   196     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   197     _LIT( KTestCHuiLayout, "In TestCHLVSetColorL" );
       
   198     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTestCHuiLayout );
       
   199     // Print to log file
       
   200     iLog->Log( KTestCHuiLayout );
       
   201 
       
   202     CHuiLayout* layout = CHuiLayout::AddNewL( *iHuiControl );
       
   203     CHuiLineVisual* visual = CHuiLineVisual::AddNewL( *iHuiControl, layout );
       
   204     STIF_ASSERT_NOT_NULL( visual );
       
   205     visual->SetColor( KRgbRed );
       
   206 
       
   207     return KErrNone;
       
   208     }