uiaccelerator_plat/alf_visual_api/tsrc/src/testplatalfvisualblocksviewportlayout.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     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 functions for alfviewportlayout.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // [INCLUDE FILES]
       
    21 #include <alf/alfviewportlayout.h>
       
    22 #include <alf/alfpropertyowner.h>
       
    23 
       
    24 #include "testplatalfvisual.h"
       
    25 
       
    26 
       
    27 // Forward Declaration
       
    28 // class CTestAlfViewportLayout for testing CAlfViewportLayout
       
    29 class CTestAlfViewportLayout : public CAlfViewportLayout
       
    30     {
       
    31 public:
       
    32     // constructor
       
    33     CTestAlfViewportLayout() {}
       
    34     
       
    35     // ConstructL
       
    36     void ConstructL( CAlfControl& aOwner )
       
    37         {
       
    38         CAlfViewportLayout::ConstructL( aOwner );
       
    39         }
       
    40     
       
    41     // From CAlfViewportLayout
       
    42     void DoRemoveAndDestroyAllD()
       
    43         {
       
    44         CAlfViewportLayout::DoRemoveAndDestroyAllD();
       
    45         }
       
    46     
       
    47     // From CAlfViewportLayout
       
    48     void PropertyOwnerExtension( const TUid& aExtensionUid, TAny** aExtensionParams )
       
    49         {
       
    50         CAlfViewportLayout::PropertyOwnerExtension( aExtensionUid, aExtensionParams );
       
    51         }
       
    52     };
       
    53 
       
    54 // ============================ MEMBER FUNCTIONS ===============================
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CTestPlatAlfVisual::TestVpLayoutAddNewL
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 TInt CTestPlatAlfVisual::TestVpLayoutAddNewL( CStifItemParser& /*aItem*/ )
       
    61     {
       
    62     // Print to UI
       
    63     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    64     _LIT( KTestVpLayoutAddNewL, "TestVpLayoutAddNewL" );
       
    65     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestVpLayoutAddNewL );
       
    66     // Print to log file
       
    67     iLog->Log( KTestVpLayoutAddNewL );
       
    68     
       
    69     CAlfViewportLayout* layout = CAlfViewportLayout::AddNewL( *iAlfCtl );
       
    70     CleanupStack::PushL( layout );
       
    71     STIF_ASSERT_NOT_NULL( layout );
       
    72     CleanupStack::Pop( layout );
       
    73     
       
    74     return KErrNone;
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CTestPlatAlfVisual::TestVpLayoutConstructorL
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 TInt CTestPlatAlfVisual::TestVpLayoutConstructorL( CStifItemParser& /*aItem*/ )
       
    82     {
       
    83     // Print to UI
       
    84     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    85     _LIT( KTestVpLayoutConstructorL, "TestVpLayoutConstructorL" );
       
    86     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestVpLayoutConstructorL );
       
    87     // Print to log file
       
    88     iLog->Log( KTestVpLayoutConstructorL );
       
    89     
       
    90     CAlfViewportLayout* layout = new ( ELeave ) CAlfViewportLayout();
       
    91     CleanupStack::PushL( layout );
       
    92     STIF_ASSERT_NOT_NULL( layout );
       
    93     CleanupStack::PopAndDestroy( layout );
       
    94     
       
    95     return KErrNone;
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CTestPlatAlfVisual::TestVpLayoutConstructL
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 TInt CTestPlatAlfVisual::TestVpLayoutConstructL( CStifItemParser& /*aItem*/ )
       
   103     {
       
   104     // Print to UI
       
   105     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   106     _LIT( KTestVpLayoutConstructL, "TestVpLayoutConstructL" );
       
   107     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestVpLayoutConstructL );
       
   108     // Print to log file
       
   109     iLog->Log( KTestVpLayoutConstructL );
       
   110     
       
   111     CAlfViewportLayout* layout = new ( ELeave ) CAlfViewportLayout();
       
   112     CleanupStack::PushL( layout );
       
   113     STIF_ASSERT_NOT_NULL( layout );
       
   114     layout->ConstructL( *iAlfCtl );
       
   115     CleanupStack::PopAndDestroy( layout );
       
   116     
       
   117     return KErrNone;
       
   118     }
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // CTestPlatAlfVisual::TestVpLayoutSetVirtualSizeL
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 TInt CTestPlatAlfVisual::TestVpLayoutSetVirtualSizeL( CStifItemParser& /*aItem*/ )
       
   125     {
       
   126     // Print to UI
       
   127     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   128     _LIT( KTestVpLayoutSetVirtualSizeL, "TestVpLayoutSetVirtualSizeL" );
       
   129     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestVpLayoutSetVirtualSizeL );
       
   130     // Print to log file
       
   131     iLog->Log( KTestVpLayoutSetVirtualSizeL );
       
   132     
       
   133     CAlfViewportLayout* layout = CAlfViewportLayout::AddNewL( *iAlfCtl );
       
   134     CleanupStack::PushL( layout );
       
   135     STIF_ASSERT_NOT_NULL( layout );
       
   136     TAlfRealSize size;
       
   137     layout->SetVirtualSize( size, 1 );
       
   138     CleanupStack::Pop( layout );
       
   139     
       
   140     return KErrNone;
       
   141     }
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // CTestPlatAlfVisual::TestVpLayoutSetViewportSizeL
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 TInt CTestPlatAlfVisual::TestVpLayoutSetViewportSizeL( CStifItemParser& /*aItem*/ )
       
   148     {
       
   149     // Print to UI
       
   150     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   151     _LIT( KTestVpLayoutSetViewportSizeL, "TestVpLayoutSetViewportSizeL" );
       
   152     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestVpLayoutSetViewportSizeL );
       
   153     // Print to log file
       
   154     iLog->Log( KTestVpLayoutSetViewportSizeL );
       
   155     
       
   156     CAlfViewportLayout* layout = CAlfViewportLayout::AddNewL( *iAlfCtl );
       
   157     CleanupStack::PushL( layout );
       
   158     STIF_ASSERT_NOT_NULL( layout );
       
   159     TAlfRealSize size;
       
   160     layout->SetViewportSize( size, 1 );
       
   161     CleanupStack::Pop( layout );
       
   162     
       
   163     return KErrNone;
       
   164     }
       
   165 
       
   166 // -----------------------------------------------------------------------------
       
   167 // CTestPlatAlfVisual::TestVpLayoutSetViewportPosL
       
   168 // -----------------------------------------------------------------------------
       
   169 //
       
   170 TInt CTestPlatAlfVisual::TestVpLayoutSetViewportPosL( CStifItemParser& /*aItem*/ )
       
   171     {
       
   172     // Print to UI
       
   173     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   174     _LIT( KTestVpLayoutSetViewportPosL, "TestVpLayoutSetViewportPosL" );
       
   175     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestVpLayoutSetViewportPosL );
       
   176     // Print to log file
       
   177     iLog->Log( KTestVpLayoutSetViewportPosL );
       
   178     
       
   179     CAlfViewportLayout* layout = CAlfViewportLayout::AddNewL( *iAlfCtl );
       
   180     CleanupStack::PushL( layout );
       
   181     STIF_ASSERT_NOT_NULL( layout );
       
   182     TAlfRealPoint pos;
       
   183     layout->SetViewportPos( pos, 1 );
       
   184     CleanupStack::Pop( layout );
       
   185     
       
   186     return KErrNone;
       
   187     }
       
   188 
       
   189 // -----------------------------------------------------------------------------
       
   190 // CTestPlatAlfVisual::TestVpLayoutRemoveAndDestroyAllDL
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 TInt CTestPlatAlfVisual::TestVpLayoutRemoveAndDestroyAllDL( CStifItemParser& /*aItem*/ )
       
   194     {
       
   195     // Print to UI
       
   196     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   197     _LIT( KTestVpLayoutRemoveAndDestroyAllDL, "TestVpLayoutRemoveAndDestroyAllDL" );
       
   198     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestVpLayoutRemoveAndDestroyAllDL );
       
   199     // Print to log file
       
   200     iLog->Log( KTestVpLayoutRemoveAndDestroyAllDL );
       
   201     
       
   202     CAlfViewportLayout* layout = CAlfViewportLayout::AddNewL( *iAlfCtl );
       
   203     STIF_ASSERT_NOT_NULL( layout );
       
   204     layout->RemoveAndDestroyAllD();
       
   205     
       
   206     return KErrNone;
       
   207     }
       
   208 
       
   209 // -----------------------------------------------------------------------------
       
   210 // CTestPlatAlfVisual::TestVpLayoutUpdateChildrenLayoutL
       
   211 // -----------------------------------------------------------------------------
       
   212 //
       
   213 TInt CTestPlatAlfVisual::TestVpLayoutUpdateChildrenLayoutL( CStifItemParser& /*aItem*/ )
       
   214     {
       
   215     // Print to UI
       
   216     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   217     _LIT( KTestVpLayoutUpdateChildrenLayoutL, "TestVpLayoutUpdateChildrenLayoutL" );
       
   218     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestVpLayoutUpdateChildrenLayoutL );
       
   219     // Print to log file
       
   220     iLog->Log( KTestVpLayoutUpdateChildrenLayoutL );
       
   221     
       
   222     CAlfViewportLayout* layout = CAlfViewportLayout::AddNewL( *iAlfCtl );
       
   223     CleanupStack::PushL( layout );
       
   224     STIF_ASSERT_NOT_NULL( layout );
       
   225     layout->UpdateChildrenLayout();
       
   226     CleanupStack::Pop( layout );
       
   227     
       
   228     return KErrNone;
       
   229     }
       
   230 
       
   231 // -----------------------------------------------------------------------------
       
   232 // CTestPlatAlfVisual::TestVpLayoutFindTagL
       
   233 // -----------------------------------------------------------------------------
       
   234 //
       
   235 TInt CTestPlatAlfVisual::TestVpLayoutFindTagL( CStifItemParser& /*aItem*/ )
       
   236     {
       
   237     // Print to UI
       
   238     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   239     _LIT( KTestVpLayoutFindTagL, "TestVpLayoutFindTagL" );
       
   240     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestVpLayoutFindTagL );
       
   241     // Print to log file
       
   242     iLog->Log( KTestVpLayoutFindTagL );
       
   243     
       
   244     CAlfViewportLayout* layout = CAlfViewportLayout::AddNewL( *iAlfCtl );
       
   245     CleanupStack::PushL( layout );
       
   246     STIF_ASSERT_NOT_NULL( layout );
       
   247     _LIT8( KTagText, "Caption" );
       
   248     layout->SetTagL( KTagText );
       
   249     STIF_ASSERT_NOT_NULL( layout->FindTag( KTagText ) );
       
   250     CleanupStack::Pop( layout );
       
   251     
       
   252     return KErrNone;
       
   253     }
       
   254 
       
   255 // -----------------------------------------------------------------------------
       
   256 // CTestPlatAlfVisual::TestVpLayoutBaseUnitL
       
   257 // -----------------------------------------------------------------------------
       
   258 //
       
   259 TInt CTestPlatAlfVisual::TestVpLayoutBaseUnitL( CStifItemParser& /*aItem*/ )
       
   260     {
       
   261     // Print to UI
       
   262     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   263     _LIT( KTestVpLayoutBaseUnitL, "TestVpLayoutBaseUnitL" );
       
   264     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestVpLayoutBaseUnitL );
       
   265     // Print to log file
       
   266     iLog->Log( KTestVpLayoutBaseUnitL );
       
   267     
       
   268     CAlfViewportLayout* layout = CAlfViewportLayout::AddNewL( *iAlfCtl );
       
   269     CleanupStack::PushL( layout );
       
   270     STIF_ASSERT_NOT_NULL( layout );
       
   271     layout->BaseUnit();
       
   272     CleanupStack::Pop( layout );
       
   273     
       
   274     return KErrNone;
       
   275     }
       
   276 
       
   277 // -----------------------------------------------------------------------------
       
   278 // CTestPlatAlfVisual::TestVpLayoutDoRemoveAndDestroyAllDL
       
   279 // -----------------------------------------------------------------------------
       
   280 //
       
   281 TInt CTestPlatAlfVisual::TestVpLayoutDoRemoveAndDestroyAllDL( CStifItemParser& /*aItem*/ )
       
   282     {
       
   283     // Print to UI
       
   284     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   285     _LIT( KTestVpLayoutDoRemoveAndDestroyAllDL, "TestVpLayoutDoRemoveAndDestroyAllDL" );
       
   286     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestVpLayoutDoRemoveAndDestroyAllDL );
       
   287     // Print to log file
       
   288     iLog->Log( KTestVpLayoutDoRemoveAndDestroyAllDL );
       
   289     
       
   290     CTestAlfViewportLayout* testLayout = new ( ELeave ) CTestAlfViewportLayout;
       
   291     CleanupStack::PushL( testLayout );
       
   292     STIF_ASSERT_NOT_NULL( testLayout );
       
   293     testLayout->ConstructL( *iAlfCtl );
       
   294     testLayout->DoRemoveAndDestroyAllD();
       
   295     CleanupStack::Pop( testLayout );
       
   296     
       
   297     return KErrNone;
       
   298     }
       
   299 
       
   300 // -----------------------------------------------------------------------------
       
   301 // CTestPlatAlfVisual::TestVpLayoutPropertyOwnerExtensionL
       
   302 // -----------------------------------------------------------------------------
       
   303 //
       
   304 TInt CTestPlatAlfVisual::TestVpLayoutPropertyOwnerExtensionL( CStifItemParser& /*aItem*/ )
       
   305     {
       
   306     // Print to UI
       
   307     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   308     _LIT( KTestVpLayoutPropertyOwnerExtensionL, "TestVpLayoutPropertyOwnerExtensionL" );
       
   309     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestVpLayoutPropertyOwnerExtensionL );
       
   310     // Print to log file
       
   311     iLog->Log( KTestVpLayoutPropertyOwnerExtensionL );
       
   312     
       
   313     CTestAlfViewportLayout* testLayout = new ( ELeave ) CTestAlfViewportLayout;
       
   314     CleanupStack::PushL( testLayout );
       
   315     STIF_ASSERT_NOT_NULL( testLayout );
       
   316     testLayout->ConstructL( *iAlfCtl );
       
   317     TBool inFocusChain( EFalse );
       
   318     TAny* pInFocusChain = &inFocusChain;
       
   319     testLayout->PropertyOwnerExtension( KUidAlfPropOwnerExtControlFocusChainChanged, &pInFocusChain );
       
   320     CleanupStack::PopAndDestroy( testLayout );
       
   321     
       
   322     return KErrNone;
       
   323     }
       
   324 
       
   325 
       
   326 //  [End of File]