classicui_pub/toolbar_api/tsrc/src/testsdktoolbarblocksakntoolbarobserver.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2008 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 AknToolbarObserver.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // [INCLUDE FILES]
       
    20 #include <e32svr.h>
       
    21 #include <stifparser.h>
       
    22 #include <stiftestinterface.h>
       
    23 #include <akntoolbarobserver.h>
       
    24 
       
    25 #include <testsdktoolbar.rsg>
       
    26 #include "testsdktoolbar.h"
       
    27 #include "testsdktoolbarcontrol.h"
       
    28 
       
    29 // ======== MEMBER FUNCTIONS ========
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CTestSDKToolbar::TestToolbarObserverDynInitToolbarL
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 TInt CTestSDKToolbar::TestToolbarObserverDynInitToolbarL( CStifItemParser& /*aItem*/ )
       
    36     {
       
    37 
       
    38     // Print to UI
       
    39     _LIT( KTestSDKToolbar, "testsdktoolbarobserver" );
       
    40     _LIT( KTestToolbarExtSetShown, "DynInitToolbar" );
       
    41     TestModuleIf().Printf( 0, KTestSDKToolbar, KTestToolbarExtSetShown );
       
    42     // Print to log file
       
    43     iLog->Log( KTestToolbarExtSetShown );
       
    44 
       
    45     CTestToolbarControl* observer = CTestToolbarControl::NewL();
       
    46     CleanupStack::PushL( observer );
       
    47     CAknToolbar* toolbar = CAknToolbar::NewL( R_TOOLBAR );
       
    48     CleanupStack::PushL( toolbar );
       
    49 
       
    50     observer->DoDynInitToolbarL( R_TOOLBAR, toolbar );
       
    51 
       
    52     CleanupStack::PopAndDestroy( toolbar );
       
    53     CleanupStack::PopAndDestroy( observer );
       
    54     return KErrNone;
       
    55 
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CTestSDKToolbar::TestToolbarObserverReservedL
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 TInt CTestSDKToolbar::TestToolbarObserverReservedL( CStifItemParser& /*aItem*/ )
       
    63     {
       
    64 
       
    65     // Print to UI
       
    66     _LIT( KTestSDKToolbar, "testsdktoolbarobserver" );
       
    67     _LIT( KTestToolbarObserverReserved_1L, "Reserved_1" );
       
    68     TestModuleIf().Printf( 0, KTestSDKToolbar, KTestToolbarObserverReserved_1L );
       
    69     // Print to log file
       
    70     iLog->Log( KTestToolbarObserverReserved_1L );
       
    71 
       
    72     CTestToolbarControl* observer = CTestToolbarControl::NewL();
       
    73     CleanupStack::PushL( observer );
       
    74 
       
    75     TInt reserved = observer->DoMAknToolbarObserver_Reserved_1();
       
    76     STIF_ASSERT_EQUALS( 1, reserved );
       
    77 
       
    78     CleanupStack::PopAndDestroy( observer );
       
    79     return KErrNone;
       
    80 
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CTestSDKToolbar::TestToolbarObserverReservedTwoL
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 TInt CTestSDKToolbar::TestToolbarObserverReservedTwoL( CStifItemParser& /*aItem*/ )
       
    88     {
       
    89 
       
    90     // Print to UI
       
    91     _LIT( KTestSDKToolbar, "testsdktoolbarobserver" );
       
    92     _LIT( KTestToolbarObserverReserved_2L, "Reserved_2" );
       
    93     TestModuleIf().Printf( 0, KTestSDKToolbar, KTestToolbarObserverReserved_2L );
       
    94     // Print to log file
       
    95     iLog->Log( KTestToolbarObserverReserved_2L );
       
    96 
       
    97     CTestToolbarControl* observer = CTestToolbarControl::NewL();
       
    98     CleanupStack::PushL( observer );
       
    99     
       
   100     TInt reserved = observer->DoMAknToolbarObserver_Reserved_2();
       
   101     STIF_ASSERT_EQUALS( 1, reserved );
       
   102 
       
   103     CleanupStack::PopAndDestroy( observer );
       
   104     return KErrNone;
       
   105 
       
   106     }
       
   107