uiaccelerator_plat/alf_core_toolkit_api/tsrc/src/testuiaifctkitblockshuifont.cpp
branchRCL_3
changeset 52 31fccae4f8a7
parent 22 7c5dd702d6d3
equal deleted inserted replaced
51:e5af45d51884 52: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/huifont.h>
       
    27 
       
    28 #include "testuiaifcoretoolkit.h"
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CTestUiAifCoreToolkit::TestTHFConstructorL
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 TInt CTestUiAifCoreToolkit::TestTHFConstructorL( CStifItemParser& /*aItem*/ )
       
    35     {
       
    36 
       
    37     // Print to UI
       
    38     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    39     _LIT( KTHuiFont, "In TestTHFConstructorL" );
       
    40     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTHuiFont );
       
    41     // Print to log file
       
    42     iLog->Log( KTHuiFont );
       
    43 
       
    44     THuiFont* font = new( ELeave ) THuiFont();
       
    45     CleanupStack::PushL( font );
       
    46     STIF_ASSERT_NOT_NULL( font );
       
    47     CleanupStack::PopAndDestroy( font );
       
    48 
       
    49     return KErrNone;
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CTestUiAifCoreToolkit::TestTHFConstructorWithParaL
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 TInt CTestUiAifCoreToolkit::TestTHFConstructorWithParaL( CStifItemParser& /*aItem*/ )
       
    57     {
       
    58 
       
    59     // Print to UI
       
    60     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    61     _LIT( KTHuiFont, "In TestTHFConstructorWithParaL" );
       
    62     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTHuiFont );
       
    63     // Print to log file
       
    64     iLog->Log( KTHuiFont );
       
    65 
       
    66     TFontSpec spec;
       
    67     THuiFont* font = new( ELeave ) THuiFont( 0, spec );
       
    68     CleanupStack::PushL( font );
       
    69     STIF_ASSERT_NOT_NULL( font );
       
    70     CleanupStack::PopAndDestroy( font );
       
    71 
       
    72     return KErrNone;
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CTestUiAifCoreToolkit::TestTHFConstructorWithFontL
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 TInt CTestUiAifCoreToolkit::TestTHFConstructorWithFontL( CStifItemParser& /*aItem*/ )
       
    80     {
       
    81 
       
    82     // Print to UI
       
    83     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    84     _LIT( KTHuiFont, "In TestTHFConstructorWithFontL" );
       
    85     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTHuiFont );
       
    86     // Print to log file
       
    87     iLog->Log( KTHuiFont );
       
    88 
       
    89     THuiFont* font = new( ELeave ) THuiFont();
       
    90     CleanupStack::PushL( font );
       
    91     STIF_ASSERT_NOT_NULL( font );
       
    92 
       
    93     THuiFont* testFont = new( ELeave ) THuiFont( *font );
       
    94     CleanupStack::PushL( testFont );
       
    95     STIF_ASSERT_NOT_NULL( testFont );
       
    96     CleanupStack::PopAndDestroy( testFont );
       
    97 
       
    98     CleanupStack::PopAndDestroy( font );
       
    99 
       
   100     return KErrNone;
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CTestUiAifCoreToolkit::TestTHFoperatorEqualL
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 TInt CTestUiAifCoreToolkit::TestTHFoperatorEqual( CStifItemParser& /*aItem*/ )
       
   108     {
       
   109 
       
   110     // Print to UI
       
   111     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   112     _LIT( KTHuiFont, "In TestTHFoperatorEqualL" );
       
   113     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTHuiFont );
       
   114     // Print to log file
       
   115     iLog->Log( KTHuiFont );
       
   116 
       
   117     THuiFont font;
       
   118     THuiFont testFont = font;
       
   119 
       
   120     return KErrNone;
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CTestUiAifCoreToolkit::TestTHFIdL
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 TInt CTestUiAifCoreToolkit::TestTHFIdL( CStifItemParser& /*aItem*/ )
       
   128     {
       
   129 
       
   130     // Print to UI
       
   131     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   132     _LIT( KTHuiFont, "In TestTHFIdL" );
       
   133     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTHuiFont );
       
   134     // Print to log file
       
   135     iLog->Log( KTHuiFont );
       
   136 
       
   137     TFontSpec spec;
       
   138     THuiFont* font = new( ELeave ) THuiFont( 0, spec );
       
   139     CleanupStack::PushL( font );
       
   140     STIF_ASSERT_NOT_NULL( font );
       
   141     TInt id = font->Id();
       
   142     STIF_ASSERT_EQUALS( id, 0 );
       
   143     CleanupStack::PopAndDestroy( font );
       
   144 
       
   145     return KErrNone;
       
   146     }
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // CTestUiAifCoreToolkit::TestTHFCategoryL
       
   150 // -----------------------------------------------------------------------------
       
   151 //
       
   152 TInt CTestUiAifCoreToolkit::TestTHFCategoryL( CStifItemParser& /*aItem*/ )
       
   153     {
       
   154 
       
   155     // Print to UI
       
   156     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   157     _LIT( KTHuiFont, "In TestTHFCategoryL" );
       
   158     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTHuiFont );
       
   159     // Print to log file
       
   160     iLog->Log( KTHuiFont );
       
   161 
       
   162     TFontSpec spec;
       
   163     THuiFont* font = new( ELeave ) THuiFont( 0, spec );
       
   164     CleanupStack::PushL( font );
       
   165     STIF_ASSERT_NOT_NULL( font );
       
   166     font->Category();
       
   167     CleanupStack::PopAndDestroy( font );
       
   168 
       
   169     return KErrNone;
       
   170     }
       
   171 
       
   172 // -----------------------------------------------------------------------------
       
   173 // CTestUiAifCoreToolkit::TestTHFFontSpecL
       
   174 // -----------------------------------------------------------------------------
       
   175 //
       
   176 TInt CTestUiAifCoreToolkit::TestTHFFontSpecL( CStifItemParser& /*aItem*/ )
       
   177     {
       
   178 
       
   179     // Print to UI
       
   180     _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   181     _LIT( KTHuiFont, "In TestTHFFontSpecL" );
       
   182     TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KTHuiFont );
       
   183     // Print to log file
       
   184     iLog->Log( KTHuiFont );
       
   185 
       
   186     TFontSpec spec;
       
   187     THuiFont* font = new( ELeave ) THuiFont( 0, spec );
       
   188     CleanupStack::PushL( font );
       
   189     STIF_ASSERT_NOT_NULL( font );
       
   190     font->FontSpec();
       
   191     CleanupStack::PopAndDestroy( font );
       
   192 
       
   193     return KErrNone;
       
   194     }