uiaccelerator_plat/alf_core_toolkit_api/tsrc/src/testuiaifctkitblockshskcontrol.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/huienv.h>
       
    25 #include <uiacceltk/huicontrol.h>
       
    26 #include <uiacceltk/huisoftkeycontrol.h>
       
    27 
       
    28 #include "testuiaifcoretoolkit.h"
       
    29 
       
    30 _LIT( KLabel, "label" );
       
    31 // -----------------------------------------------------------------------------
       
    32 // CTestUiAifCoreToolkit::TestCHSKCNewL
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 TInt CTestUiAifCoreToolkit::TestCHSKCNewL( CStifItemParser& /*aItem*/ )
       
    36     {
       
    37 
       
    38     // Print to UI
       
    39     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    40     _LIT( KCHuiStatic, "In TestCHSKCNewL" );
       
    41     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiStatic );
       
    42     // Print to log file
       
    43     iLog->Log( KCHuiStatic );
       
    44 
       
    45     CHuiSoftKeyControl* keyControl = CHuiSoftKeyControl::NewL( *iHuiEnv );
       
    46     CleanupStack::PushL( keyControl );
       
    47     STIF_ASSERT_NOT_NULL( keyControl );
       
    48     CleanupStack::PopAndDestroy( keyControl );
       
    49 
       
    50     return KErrNone;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CTestUiAifCoreToolkit::TestCHSKCNewLCL
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 TInt CTestUiAifCoreToolkit::TestCHSKCNewLCL( CStifItemParser& /*aItem*/ )
       
    58     {
       
    59 
       
    60     // Print to UI
       
    61     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    62     _LIT( KCHuiStatic, "In TestCHSKCNewLCL" );
       
    63     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiStatic );
       
    64     // Print to log file
       
    65     iLog->Log( KCHuiStatic );
       
    66 
       
    67     CHuiSoftKeyControl* keyControl = CHuiSoftKeyControl::NewLC( *iHuiEnv );
       
    68     STIF_ASSERT_NOT_NULL( keyControl );
       
    69     CleanupStack::Pop();
       
    70     delete keyControl;
       
    71 
       
    72     return KErrNone;
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CTestUiAifCoreToolkit::TestCHSKCDestructL
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 TInt CTestUiAifCoreToolkit::TestCHSKCDestructL( CStifItemParser& /*aItem*/ )
       
    80     {
       
    81 
       
    82     // Print to UI
       
    83     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    84     _LIT( KCHuiStatic, "In TestCHSKCDestructL" );
       
    85     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiStatic );
       
    86     // Print to log file
       
    87     iLog->Log( KCHuiStatic );
       
    88 
       
    89     CHuiSoftKeyControl* keyControl = CHuiSoftKeyControl::NewL( *iHuiEnv );
       
    90     CleanupStack::PushL( keyControl );
       
    91     STIF_ASSERT_NOT_NULL( keyControl );
       
    92     CleanupStack::Pop( keyControl );
       
    93     delete keyControl;
       
    94 
       
    95     return KErrNone;
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CTestUiAifCoreToolkit::TestCHSKCSetLabelL
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 TInt CTestUiAifCoreToolkit::TestCHSKCSetLabelL( CStifItemParser& /*aItem*/ )
       
   103     {
       
   104 
       
   105     // Print to UI
       
   106     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   107     _LIT( KCHuiStatic, "In TestCHSKCSetLabelL" );
       
   108     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiStatic );
       
   109     // Print to log file
       
   110     iLog->Log( KCHuiStatic );
       
   111 
       
   112     CHuiSoftKeyControl* keyControl = CHuiSoftKeyControl::NewL( *iHuiEnv );
       
   113     CleanupStack::PushL( keyControl );
       
   114     STIF_ASSERT_NOT_NULL( keyControl );
       
   115 
       
   116     TPtrC ptr( KLabel );
       
   117     keyControl->SetLabelL( EHuiSoftKeyUpper, ptr );
       
   118     CleanupStack::Pop( keyControl );
       
   119     delete keyControl;
       
   120 
       
   121     return KErrNone;
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CTestUiAifCoreToolkit::TestCHSKCSetBackgroundL
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 TInt CTestUiAifCoreToolkit::TestCHSKCSetBackgroundL( CStifItemParser& /*aItem*/ )
       
   129     {
       
   130 
       
   131     // Print to UI
       
   132     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   133     _LIT( KCHuiStatic, "In TestCHSKCSetBackgroundL" );
       
   134     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiStatic );
       
   135     // Print to log file
       
   136     iLog->Log( KCHuiStatic );
       
   137 
       
   138     CHuiSoftKeyControl* keyControl = CHuiSoftKeyControl::NewL( *iHuiEnv );
       
   139     CleanupStack::PushL( keyControl );
       
   140     STIF_ASSERT_NOT_NULL( keyControl );
       
   141 
       
   142     THuiImage* image = new( ELeave ) THuiImage();
       
   143     CleanupStack::PushL( image );
       
   144     keyControl->SetBackgroundL( *image, 100, 100 );
       
   145     CleanupStack::PopAndDestroy( image );
       
   146     CleanupStack::PopAndDestroy( keyControl );
       
   147 
       
   148     return KErrNone;
       
   149     }
       
   150 
       
   151 // -----------------------------------------------------------------------------
       
   152 // CTestUiAifCoreToolkit::TestCHSKCSetAnimationTimesL
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 TInt CTestUiAifCoreToolkit::TestCHSKCSetAnimationTimesL( CStifItemParser& /*aItem*/ )
       
   156     {
       
   157 
       
   158     // Print to UI
       
   159     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   160     _LIT( KCHuiStatic, "In TestCHSKCSetAnimationTimesL" );
       
   161     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiStatic );
       
   162     // Print to log file
       
   163     iLog->Log( KCHuiStatic );
       
   164 
       
   165     CHuiSoftKeyControl* keyControl = CHuiSoftKeyControl::NewL( *iHuiEnv );
       
   166     CleanupStack::PushL( keyControl );
       
   167     STIF_ASSERT_NOT_NULL( keyControl );
       
   168     keyControl->SetAnimationTimes( 0, 100 );
       
   169     CleanupStack::PopAndDestroy( keyControl );
       
   170 
       
   171     return KErrNone;
       
   172     }
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CTestUiAifCoreToolkit::TestCHSKCEnterViewL
       
   176 // -----------------------------------------------------------------------------
       
   177 //
       
   178 TInt CTestUiAifCoreToolkit::TestCHSKCEnterViewL( CStifItemParser& /*aItem*/ )
       
   179     {
       
   180 
       
   181     // Print to UI
       
   182     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   183     _LIT( KCHuiStatic, "In TestCHSKCEnterViewL" );
       
   184     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiStatic );
       
   185     // Print to log file
       
   186     iLog->Log( KCHuiStatic );
       
   187 
       
   188 //    CHuiSoftKeyControl* keyControl = CHuiSoftKeyControl::NewL( *iHuiEnv );
       
   189 //    CleanupStack::PushL( keyControl );
       
   190 //    STIF_ASSERT_NOT_NULL( keyControl );
       
   191 //    TRect rect( 1, 1, 1, 1 );
       
   192 //    iHuiEnv->CHuiEnv::Display( 0 );
       
   193 //    keyControl->EnterView();
       
   194 //    CleanupStack::PopAndDestroy( keyControl );
       
   195 
       
   196     return KErrNone;
       
   197     }
       
   198 
       
   199 // -----------------------------------------------------------------------------
       
   200 // CTestUiAifCoreToolkit::TestCHSKCExitViewL
       
   201 // -----------------------------------------------------------------------------
       
   202 //
       
   203 TInt CTestUiAifCoreToolkit::TestCHSKCExitViewL( CStifItemParser& /*aItem*/ )
       
   204     {
       
   205 
       
   206     // Print to UI
       
   207     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   208     _LIT( KCHuiStatic, "In TestCHSKCExitViewL" );
       
   209     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiStatic );
       
   210     // Print to log file
       
   211     iLog->Log( KCHuiStatic );
       
   212 
       
   213 //    CHuiSoftKeyControl* keyControl = CHuiSoftKeyControl::NewL( *iHuiEnv );
       
   214 //    CleanupStack::PushL( keyControl );
       
   215 //    STIF_ASSERT_NOT_NULL( keyControl );
       
   216 //    keyControl->EnterView();
       
   217 //    keyControl->ExitView();
       
   218 //    CleanupStack::PopAndDestroy( keyControl );
       
   219 
       
   220     return KErrNone;
       
   221     }
       
   222 
       
   223 // -----------------------------------------------------------------------------
       
   224 // CTestUiAifCoreToolkit::TestCHSKCSetBackgroundTypeL
       
   225 // -----------------------------------------------------------------------------
       
   226 //
       
   227 TInt CTestUiAifCoreToolkit::TestCHSKCSetBackgroundTypeL( CStifItemParser& /*aItem*/ )
       
   228     {
       
   229 
       
   230     // Print to UI
       
   231     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   232     _LIT( KCHuiStatic, "In TestCHSKCSetBackgroundTypeL" );
       
   233     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KCHuiStatic );
       
   234     // Print to log file
       
   235     iLog->Log( KCHuiStatic );
       
   236 
       
   237     CHuiSoftKeyControl* keyControl = CHuiSoftKeyControl::NewL( *iHuiEnv );
       
   238     CleanupStack::PushL( keyControl );
       
   239     STIF_ASSERT_NOT_NULL( keyControl );
       
   240     keyControl->SetBackgroundType( EHuiBackgroundTypeLight );
       
   241     keyControl->SetBackgroundType( EHuiBackgroundTypeDark );
       
   242     CleanupStack::PopAndDestroy( keyControl );
       
   243 
       
   244     return KErrNone;
       
   245     }