uifw/AvKon/tsrc/bc/bctestdom3.2/bctestdomavkonpsln/src/bctestdomeikcase.cpp
changeset 21 558113899881
parent 14 3320e4e6e8bb
child 22 75713bee6484
child 33 b3425bf29f82
equal deleted inserted replaced
14:3320e4e6e8bb 21:558113899881
     1 /*
       
     2 * Copyright (c) 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <w32std.h>
       
    20 #include <e32const.h>
       
    21 #include <coecntrl.h>
       
    22 #include <barsread.h>
       
    23 #include <badesca.h>
       
    24 #include <fbs.h>
       
    25 #include <aknnotedialog.h>
       
    26 #include <eikalmct.h>
       
    27 #include <eikslbd.h>
       
    28 #include <eiksoftkeyimage.h>
       
    29 #include <eikimage.h> 
       
    30 #include <avkon.mbg>
       
    31 #include <akniconutils.h>
       
    32 #include <eiksrvui.h>
       
    33 
       
    34 #include "bctestdomeikcase.h"
       
    35 #include "bctestdomavkonpslncontainer.h"
       
    36 #include "bctestdomavkonpslnext.h"
       
    37 #include "bctestdomavkonpsln.hrh"
       
    38 
       
    39 //    CONSTANTS
       
    40 
       
    41 const TInt KWidth = 25;
       
    42 const TInt KHeight = 25;
       
    43 
       
    44 _LIT( KText, "Text" );
       
    45 
       
    46 
       
    47 // ============================ MEMBER FUNCTIONS ============================
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // Symbian 2nd static Constructor
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 class CEikServAppUi;
       
    54 CBCTestDomEikCase* CBCTestDomEikCase::NewL( CBCTestDomAvkonPslnContainer* 
       
    55     aContainer )
       
    56     {
       
    57     CBCTestDomEikCase* self = new( ELeave ) CBCTestDomEikCase( 
       
    58         aContainer );
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL();
       
    61     CleanupStack::Pop( self );
       
    62     return self;
       
    63     }
       
    64     
       
    65 // ---------------------------------------------------------------------------
       
    66 // C++ default constructor
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 CBCTestDomEikCase::CBCTestDomEikCase( CBCTestDomAvkonPslnContainer* 
       
    70     aContainer )
       
    71     : iContainer( aContainer )
       
    72     {    
       
    73     }
       
    74     
       
    75 // ---------------------------------------------------------------------------
       
    76 // Destructor
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 CBCTestDomEikCase::~CBCTestDomEikCase()
       
    80     {  
       
    81     }
       
    82     
       
    83 // ---------------------------------------------------------------------------
       
    84 // Symbian 2nd Constructor
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 void CBCTestDomEikCase::ConstructL()
       
    88     {    
       
    89     BuildScriptL();    
       
    90     }
       
    91     
       
    92 // ---------------------------------------------------------------------------
       
    93 // CBCTestDomEikCase::BuildScriptL
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 void CBCTestDomEikCase::BuildScriptL()
       
    97     {
       
    98      
       
    99     const TInt scripts[] =
       
   100         {
       
   101         DELAY(1),        // delay between commands is 1*0.1 seconds = 0.1 seconds
       
   102         LeftCBA,
       
   103         REP(Down, 1),
       
   104         LeftCBA
       
   105         };
       
   106     AddTestScriptL(scripts, sizeof(scripts)/sizeof(TInt));  
       
   107     }
       
   108     
       
   109 // ---------------------------------------------------------------------------
       
   110 // CBCTestDomEikCase::RunL
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 void CBCTestDomEikCase::RunL( TInt aCmd )
       
   114     {
       
   115     if ( aCmd != EBCTestCmdOutline2 )
       
   116         {
       
   117         return;
       
   118         }
       
   119     switch ( aCmd )  
       
   120         {
       
   121         case EBCTestCmdOutline2:
       
   122             TestServAppUiBaseL();
       
   123             TestAlarmControlL();
       
   124             TestSettingsListBoxDataL();
       
   125             TestEikSoftkeyImageL();
       
   126             break;
       
   127         default:
       
   128             break;
       
   129         }
       
   130     }
       
   131     
       
   132 // ---------------------------------------------------------------------------
       
   133 // CBCTestDomAknCase::TestAlarmControlL()
       
   134 // ---------------------------------------------------------------------------
       
   135 //
       
   136 void CBCTestDomEikCase::TestAlarmControlL()
       
   137     {
       
   138     _LIT( KCEikAlarmControl, "CEikAlarmControl::EikAlarmControl invoked" );
       
   139     _LIT( KConstructL, "CEikAlarmControl::ConstructL invoked" );
       
   140     _LIT( KDes, "CEikAlarmControl::~EikAlarmControl invoked" );
       
   141     
       
   142     CEikAlarmControl* contrl = new ( ELeave ) CEikAlarmControl( NULL, NULL );
       
   143     CleanupStack::PushL( contrl );
       
   144     AssertNotNullL( contrl, KCEikAlarmControl );
       
   145     contrl->ConstructL();
       
   146     AssertTrueL( ETrue, KConstructL );
       
   147     
       
   148     CleanupStack::PopAndDestroy( contrl );
       
   149     AssertTrueL( ETrue, KDes );
       
   150     }
       
   151 
       
   152 // ---------------------------------------------------------------------------
       
   153 // CBCTestDomEikCase::TestSettingsListBoxDataL()
       
   154 // ---------------------------------------------------------------------------
       
   155 //    
       
   156 void CBCTestDomEikCase::TestSettingsListBoxDataL()
       
   157     {
       
   158     
       
   159     _LIT( KCSettingsListBoxData, "CSettingsListBoxData::NewL invoked" );
       
   160     _LIT( KDes, "CSettingsListBoxData::~CSettingsListBoxData invoked" );
       
   161     _LIT( KDraw, "CSettingsListBoxData::Draw invoked" );
       
   162     
       
   163     CSettingsListBoxData* data = CSettingsListBoxData::NewL();
       
   164     CleanupStack::PushL( data );
       
   165     AssertNotNullL( data, KCSettingsListBoxData );
       
   166     
       
   167     iContainer->ActivateGc();
       
   168     TListItemProperties proper;
       
   169     CWindowGc& gc = iContainer->SystemGc();
       
   170 
       
   171     TRect rect( 0, 0, KWidth, KHeight );
       
   172     CFormattedCellListBoxData::TColors gulcolor;
       
   173     
       
   174     data->Draw( proper, gc, &KText, rect, ETrue, gulcolor );
       
   175     AssertTrueL( ETrue, KDraw );
       
   176     iContainer->DeactivateGc();
       
   177     
       
   178     CleanupStack::PopAndDestroy( data );
       
   179     AssertTrueL( ETrue, KDes );
       
   180     
       
   181     }
       
   182     
       
   183 // ---------------------------------------------------------------------------
       
   184 // CBCTestDomEikCase::TestEikSoftkeyImageL()
       
   185 // ---------------------------------------------------------------------------
       
   186 //    
       
   187 void CBCTestDomEikCase::TestEikSoftkeyImageL()
       
   188     {
       
   189     
       
   190     _LIT( KSetImage, "EikSoftkeyImage::SetImage() invoked" );
       
   191     _LIT( KSetLabel, "EikSoftkeyImage::SetLabel() invoked" );
       
   192     
       
   193     CEikButtonGroupContainer* container = CEikButtonGroupContainer::Current();
       
   194     EikSoftkeyImage::SetLabel( container, ETrue );
       
   195     AssertTrueL( ETrue, KSetLabel );
       
   196     
       
   197     CEikImage* image = new ( ELeave ) CEikImage;
       
   198     CleanupStack::PushL( image );
       
   199     CFbsBitmap* bmp = AknIconUtils::CreateIconL( AknIconUtils::AvkonIconFileName(),
       
   200         EMbmAvkonQgn_indi_speaker_active );                    
       
   201     image->SetPicture( bmp );
       
   202    
       
   203     EikSoftkeyImage::SetImage( container, *image, ETrue );
       
   204     AssertTrueL( ETrue, KSetImage );
       
   205     CleanupStack::Pop( image );
       
   206     
       
   207     }
       
   208     
       
   209 // ---------------------------------------------------------------------------
       
   210 // CBCTestDomEikCase::TestServAppUiBaseExtL()
       
   211 // ---------------------------------------------------------------------------
       
   212 //    
       
   213 void CBCTestDomEikCase::TestServAppUiBaseL()
       
   214     {
       
   215  
       
   216     _LIT( KHideApplicationFromFswL,
       
   217         "CEikServAppUi::HideApplicationFromFswL() invoked" );
       
   218     _LIT( KActivateDisplayIfNeeded,
       
   219         "CEikServAppUi::ActivateDisplayIfNeeded() invoked" );
       
   220     _LIT( KNewLC, "CEikServAppUiBase::NewLC() invoked" );
       
   221     _LIT( KBringAlertGroupWinForwards, 
       
   222         "CEikServAppUiBase::BringAlertGroupWinForwards() invoked" );
       
   223     _LIT( KHandleResourceChangeL, 
       
   224         "CEikServAppUiBase::HandleResourceChangeL() invoked" );
       
   225     _LIT( KHandleThreadExitL, 
       
   226         "CEikServAppUiBase::HandleThreadExitL() invoked" );
       
   227     _LIT( KHandleForegroundEventL, 
       
   228         "CEikServAppUiBase::HandleForegroundEventL() invoked" );
       
   229     _LIT( KSuppressAppSwitching,
       
   230         "CEikServAppUiBase::SuppressAppSwitching() invoked" );
       
   231     
       
   232     CEikServAppUiBase* ui = CEikServAppUiBase::NewLC();
       
   233     AssertTrueL( ETrue, KNewLC );
       
   234     
       
   235     CEikServAppUi* appui = 
       
   236         static_cast<CEikServAppUi*>(CEikonEnv::Static()->AppUi());
       
   237     appui->ActivateDisplayIfNeeded();
       
   238     AssertTrueL( ETrue, KActivateDisplayIfNeeded );
       
   239     
       
   240     appui->HideApplicationFromFswL( 0, EFalse );
       
   241     AssertTrueL( ETrue, KHideApplicationFromFswL );
       
   242     
       
   243     appui->BringAlertGroupWinForwards( ETrue );
       
   244     appui->BringAlertGroupWinForwards( EFalse );
       
   245     AssertTrueL( ETrue, KBringAlertGroupWinForwards );
       
   246     
       
   247     RThread thread;
       
   248     appui->HandleThreadExitL( thread );
       
   249     AssertTrueL( ETrue, KHandleThreadExitL );
       
   250     appui->HandleForegroundEventL( ETrue );
       
   251     AssertTrueL( ETrue, KHandleForegroundEventL );
       
   252     
       
   253     appui->SuppressAppSwitching( ETrue );
       
   254     appui->SuppressAppSwitching( EFalse );
       
   255     AssertTrueL( ETrue, KSuppressAppSwitching );
       
   256     
       
   257     CEikAppUi* cui = appui;
       
   258     cui->HandleResourceChangeL( 0 );
       
   259     AssertTrueL( ETrue, KHandleResourceChangeL );
       
   260     
       
   261     MEikServAppUiSessionHandler* hand = 
       
   262         static_cast<CEikServAppUi*>(CEikonEnv::Static()->AppUi());
       
   263     hand->CycleTasksL( EForwards );
       
   264     hand->NotifyAlarmServerOfTaskChangeL();
       
   265    
       
   266     }
       
   267 //end of file