uiaccelerator_plat/alf_visual_api/tsrc/src/testplatalfvisualblocksflowlayout.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 alfvisual.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // [INCLUDE FILES]
       
    21 #include <e32svr.h>
       
    22 #include <stifparser.h>
       
    23 #include <stiftestinterface.h>
       
    24 
       
    25 #include "testplatalfvisual.h"
       
    26 
       
    27 // CONSTANTS
       
    28 const TInt KBufSize = 64;
       
    29 
       
    30 // FORWARD DECLARATION
       
    31 /*This class test protected functions of CAlfFlowLayout*/
       
    32 class CTestCAlfFlowLayout : public CAlfFlowLayout
       
    33     {
       
    34 public:
       
    35     /**
       
    36     * C++ default constructor.
       
    37     */
       
    38     CTestCAlfFlowLayout();
       
    39     /**
       
    40     * Destructor.
       
    41     */
       
    42     ~CTestCAlfFlowLayout();
       
    43     /**
       
    44     * TestProtectedFuncForVisual test protected functions of CAlfFlowLayout
       
    45     * @since S60 5.0
       
    46     * @param aItem is not used.
       
    47     * @return Symbian OS error code.
       
    48     */
       
    49     TInt TestProtectedFuncForVisual( CStifItemParser& aItem );
       
    50     };
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CTestCAlfFlowLayout::CTestCAlfFlowLayout
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CTestCAlfFlowLayout::CTestCAlfFlowLayout(){}
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CTestCAlfFlowLayout::~CTestCAlfFlowLayout
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 CTestCAlfFlowLayout::~CTestCAlfFlowLayout(){}
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CTestCAlfFlowLayout::TestProtectedFuncForVisual
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 TInt CTestCAlfFlowLayout::TestProtectedFuncForVisual( CStifItemParser& /*aItem*/ )
       
    69     {
       
    70     TUid vUid = { 0x00000000 };
       
    71     PropertyOwnerExtension( vUid, NULL );
       
    72     DoRemoveAndDestroyAllD();
       
    73     return KErrNone;
       
    74     }
       
    75 
       
    76 // ============================ MEMBER FUNCTIONS ===============================
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CTestPlatAlfVisual::TestAlfFlowLayoutAddNewL
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 TInt CTestPlatAlfVisual::TestAlfFlowLayoutAddNewL( CStifItemParser& /*aItem*/ )
       
    83     {
       
    84     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
    85     _LIT( KTestAlfFlowLayoutAddNewL, "TestAlfFlowLayoutAddNewL" );
       
    86     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfFlowLayoutAddNewL );
       
    87     // Print to log file
       
    88     iLog->Log( KTestAlfFlowLayoutAddNewL );
       
    89     
       
    90     CAlfFlowLayout* vLayout = CAlfFlowLayout::AddNewL( *iAlfCtl );
       
    91     STIF_ASSERT_NOT_NULL( vLayout );
       
    92     
       
    93     return KErrNone;
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CTestPlatAlfVisual::TestAlfFlowLayoutFullConstructL
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 TInt CTestPlatAlfVisual::TestAlfFlowLayoutFullConstructL( CStifItemParser& /*aItem*/ )
       
   101     {
       
   102     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   103     _LIT( KTestAlfFlowLayoutFullConstructL, "TestAlfFlowLayoutFullConstructL" );
       
   104     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfFlowLayoutFullConstructL );
       
   105     // Print to log file
       
   106     iLog->Log( KTestAlfFlowLayoutFullConstructL );
       
   107     
       
   108     CAlfFlowLayout* vLayout = new ( ELeave ) CAlfFlowLayout;
       
   109     CleanupStack::PushL( vLayout );
       
   110     vLayout->ConstructL( *iAlfCtl );
       
   111     CleanupStack::Pop( vLayout );
       
   112     
       
   113     return KErrNone;
       
   114     }
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 // CTestPlatAlfVisual::TestAlfFlowLayoutForLayoutL
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 TInt CTestPlatAlfVisual::TestAlfFlowLayoutForLayoutL( CStifItemParser& /*aItem*/ )
       
   121     {
       
   122     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   123     _LIT( KTestAlfFlowLayoutForLayoutL, "TestAlfFlowLayoutForLayoutL" );
       
   124     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfFlowLayoutForLayoutL );
       
   125     // Print to log file
       
   126     iLog->Log( KTestAlfFlowLayoutForLayoutL );
       
   127     
       
   128     CAlfFlowLayout* vLayout = CAlfFlowLayout::AddNewL( *iAlfCtl );
       
   129     vLayout->BaseUnit();
       
   130     
       
   131     return KErrNone;
       
   132     }
       
   133 
       
   134 // -----------------------------------------------------------------------------
       
   135 // CTestPlatAlfVisual::TestAlfFlowLayoutForVisualL
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 TInt CTestPlatAlfVisual::TestAlfFlowLayoutForVisualL( CStifItemParser& /*aItem*/ )
       
   139     {
       
   140     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   141     _LIT( KTestAlfFlowLayoutForVisualL, "TestAlfFlowLayoutForVisualL" );
       
   142     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfFlowLayoutForVisualL );
       
   143     // Print to log file
       
   144     iLog->Log( KTestAlfFlowLayoutForVisualL );
       
   145     
       
   146     CAlfFlowLayout* vLayout = CAlfFlowLayout::AddNewL( *iAlfCtl );
       
   147     _LIT8( KTest, "tset" );
       
   148     TBuf8<KBufSize> vBuf( KTest );
       
   149     vLayout->FindTag( vBuf );
       
   150     vLayout->UpdateChildrenLayout();
       
   151     vLayout->RemoveAndDestroyAllD();
       
   152     
       
   153     return KErrNone;
       
   154     }
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // CTestPlatAlfVisual::TestAlfFlowLayoutProtectedFuncL
       
   158 // -----------------------------------------------------------------------------
       
   159 //
       
   160 TInt CTestPlatAlfVisual::TestAlfFlowLayoutProtectedFuncL( CStifItemParser& aItem )
       
   161     {
       
   162     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   163     _LIT( KTestAlfFlowLayoutProtectedFuncL, "TestAlfFlowLayoutProtectedFuncL" );
       
   164     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfFlowLayoutProtectedFuncL );
       
   165     // Print to log file
       
   166     iLog->Log( KTestAlfFlowLayoutProtectedFuncL );
       
   167     
       
   168     CTestCAlfFlowLayout* vLayout = new ( ELeave ) CTestCAlfFlowLayout;
       
   169     CleanupStack::PushL( vLayout );
       
   170     vLayout->ConstructL( *iAlfCtl );
       
   171     vLayout->TestProtectedFuncForVisual( aItem );
       
   172     CleanupStack::Pop( vLayout );
       
   173     
       
   174     return KErrNone;
       
   175     }
       
   176 
       
   177 // -----------------------------------------------------------------------------
       
   178 // CTestPlatAlfVisual::TestAlfFlowLayoutSetParametersL
       
   179 // -----------------------------------------------------------------------------
       
   180 //
       
   181 TInt CTestPlatAlfVisual::TestAlfFlowLayoutSetParametersL( CStifItemParser& /*aItem*/ )
       
   182     {
       
   183     _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
       
   184     _LIT( KTestAlfFlowLayoutSetParametersL, "TestAlfFlowLayoutSetParametersL" );
       
   185     TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfFlowLayoutSetParametersL );
       
   186     // Print to log file
       
   187     iLog->Log( KTestAlfFlowLayoutSetParametersL );
       
   188     
       
   189     CAlfFlowLayout* vLayout = CAlfFlowLayout::AddNewL( *iAlfCtl );
       
   190     vLayout->SetFlowDirection( CAlfFlowLayout::EFlowHorizontal );
       
   191     vLayout->SetCentering( ETrue );
       
   192     vLayout->SetMode( CAlfFlowLayout::EModeCenterPerpendicular );
       
   193     vLayout->Mode();
       
   194     
       
   195     return KErrNone;
       
   196     }
       
   197 
       
   198 // End of file
       
   199