uifw/AvKon/tsrc/bc/bctestdom5.0/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 #include <tactilefeedbackserver.h>
       
    34 
       
    35 #include "bctestdomeikcase.h"
       
    36 #include "bctestdomavkonpslncontainer.h"
       
    37 #include "bctestdomavkonpslnext.h"
       
    38 #include "bctestdomavkonpsln.hrh"
       
    39 
       
    40 //    CONSTANTS
       
    41 
       
    42 const TInt KWidth = 25;
       
    43 const TInt KHeight = 25;
       
    44 
       
    45 _LIT( KText, "Text" );
       
    46 
       
    47 
       
    48 // ============================ MEMBER FUNCTIONS ============================
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // Symbian 2nd static Constructor
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 class CEikServAppUi;
       
    55 CBCTestDomEikCase* CBCTestDomEikCase::NewL( CBCTestDomAvkonPslnContainer* 
       
    56     aContainer )
       
    57     {
       
    58     CBCTestDomEikCase* self = new( ELeave ) CBCTestDomEikCase( 
       
    59         aContainer );
       
    60     CleanupStack::PushL( self );
       
    61     self->ConstructL();
       
    62     CleanupStack::Pop( self );
       
    63     return self;
       
    64     }
       
    65     
       
    66 // ---------------------------------------------------------------------------
       
    67 // C++ default constructor
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 CBCTestDomEikCase::CBCTestDomEikCase( CBCTestDomAvkonPslnContainer* 
       
    71     aContainer )
       
    72     : iContainer( aContainer )
       
    73     {    
       
    74     }
       
    75     
       
    76 // ---------------------------------------------------------------------------
       
    77 // Destructor
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 CBCTestDomEikCase::~CBCTestDomEikCase()
       
    81     {  
       
    82     }
       
    83     
       
    84 // ---------------------------------------------------------------------------
       
    85 // Symbian 2nd Constructor
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 void CBCTestDomEikCase::ConstructL()
       
    89     {    
       
    90     BuildScriptL();    
       
    91     }
       
    92     
       
    93 // ---------------------------------------------------------------------------
       
    94 // CBCTestDomEikCase::BuildScriptL
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 void CBCTestDomEikCase::BuildScriptL()
       
    98     {
       
    99      
       
   100     const TInt scripts[] =
       
   101         {
       
   102         LeftCBA,
       
   103         Down,
       
   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     // Testcase for class MTactileFeedbackServer
       
   152     //MTactileFeedbackServer::Instance();
       
   153     //_LIT( KMInstance, "MTactileFeedbackServer::Instance" );
       
   154     //AssertTrueL( ETrue, KMInstance );
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------------------------
       
   158 // CBCTestDomEikCase::TestSettingsListBoxDataL()
       
   159 // ---------------------------------------------------------------------------
       
   160 //    
       
   161 void CBCTestDomEikCase::TestSettingsListBoxDataL()
       
   162     {
       
   163     
       
   164     _LIT( KCSettingsListBoxData, "CSettingsListBoxData::NewL invoked" );
       
   165     _LIT( KDes, "CSettingsListBoxData::~CSettingsListBoxData invoked" );
       
   166     _LIT( KDraw, "CSettingsListBoxData::Draw invoked" );
       
   167     
       
   168     CSettingsListBoxData* data = CSettingsListBoxData::NewL();
       
   169     CleanupStack::PushL( data );
       
   170     AssertNotNullL( data, KCSettingsListBoxData );
       
   171     
       
   172     iContainer->ActivateGc();
       
   173     TListItemProperties proper;
       
   174     CWindowGc& gc = iContainer->SystemGc();
       
   175 
       
   176     TRect rect( 0, 0, KWidth, KHeight );
       
   177     CFormattedCellListBoxData::TColors gulcolor;
       
   178     
       
   179     data->Draw( proper, gc, &KText, rect, ETrue, gulcolor );
       
   180     AssertTrueL( ETrue, KDraw );
       
   181     iContainer->DeactivateGc();
       
   182     
       
   183     CleanupStack::PopAndDestroy( data );
       
   184     AssertTrueL( ETrue, KDes );
       
   185     
       
   186     }
       
   187     
       
   188 // ---------------------------------------------------------------------------
       
   189 // CBCTestDomEikCase::TestEikSoftkeyImageL()
       
   190 // ---------------------------------------------------------------------------
       
   191 //    
       
   192 void CBCTestDomEikCase::TestEikSoftkeyImageL()
       
   193     {
       
   194     
       
   195     _LIT( KSetImage, "EikSoftkeyImage::SetImage() invoked" );
       
   196     _LIT( KSetLabel, "EikSoftkeyImage::SetLabel() invoked" );
       
   197     
       
   198     CEikButtonGroupContainer* container = CEikButtonGroupContainer::Current();
       
   199     EikSoftkeyImage::SetLabel( container, ETrue );
       
   200     AssertTrueL( ETrue, KSetLabel );
       
   201     
       
   202     CEikImage* image = new ( ELeave ) CEikImage;
       
   203     CleanupStack::PushL( image );
       
   204     CFbsBitmap* bmp = AknIconUtils::CreateIconL( AknIconUtils::AvkonIconFileName(),
       
   205         EMbmAvkonQgn_indi_speaker_active );                    
       
   206     image->SetPicture( bmp );
       
   207    
       
   208     EikSoftkeyImage::SetImage( container, *image, ETrue );
       
   209     AssertTrueL( ETrue, KSetImage );
       
   210     CleanupStack::Pop( image );
       
   211     
       
   212     }
       
   213     
       
   214 // ---------------------------------------------------------------------------
       
   215 // CBCTestDomEikCase::TestServAppUiBaseExtL()
       
   216 // ---------------------------------------------------------------------------
       
   217 //    
       
   218 void CBCTestDomEikCase::TestServAppUiBaseL()
       
   219     {
       
   220  
       
   221     _LIT( KHideApplicationFromFswL,
       
   222         "CEikServAppUi::HideApplicationFromFswL() invoked" );
       
   223     _LIT( KActivateDisplayIfNeeded,
       
   224         "CEikServAppUi::ActivateDisplayIfNeeded() invoked" );
       
   225     _LIT( KNewLC, "CEikServAppUiBase::NewLC() invoked" );
       
   226     _LIT( KBringAlertGroupWinForwards, 
       
   227         "CEikServAppUiBase::BringAlertGroupWinForwards() invoked" );
       
   228     _LIT( KHandleResourceChangeL, 
       
   229         "CEikServAppUiBase::HandleResourceChangeL() invoked" );
       
   230     _LIT( KHandleThreadExitL, 
       
   231         "CEikServAppUiBase::HandleThreadExitL() invoked" );
       
   232     _LIT( KHandleForegroundEventL, 
       
   233         "CEikServAppUiBase::HandleForegroundEventL() invoked" );
       
   234     _LIT( KSuppressAppSwitching,
       
   235         "CEikServAppUiBase::SuppressAppSwitching() invoked" );
       
   236     
       
   237     CEikServAppUiBase* ui = CEikServAppUiBase::NewLC();
       
   238     AssertTrueL( ETrue, KNewLC );
       
   239     
       
   240     CEikServAppUi* appui = 
       
   241         static_cast<CEikServAppUi*>(CEikonEnv::Static()->AppUi());
       
   242         
       
   243     ui = static_cast<CEikServAppUiBase*>(CEikonEnv::Static()->AppUi());
       
   244     
       
   245     //CEikServAppUiBase::HandleForegroundEventL
       
   246     ui->CEikServAppUiBase::HandleForegroundEventL( EFalse );
       
   247     AssertTrueL( ETrue, KHandleForegroundEventL );
       
   248     //CEikServAppUi::ActivateDisplayIfNeeded()
       
   249     appui->CEikServAppUi::ActivateDisplayIfNeeded();
       
   250     AssertTrueL( ETrue, KActivateDisplayIfNeeded );
       
   251     
       
   252     //CEikServAppUi::HideApplicationFromFswL()
       
   253     appui->CEikServAppUi::HideApplicationFromFswL( 0, EFalse );
       
   254     AssertTrueL( ETrue, KHideApplicationFromFswL );
       
   255     
       
   256     //CEikServAppUiBase::BringAlertGroupWinForwards()
       
   257     appui->CEikServAppUiBase::BringAlertGroupWinForwards( ETrue );
       
   258     appui->CEikServAppUiBase::BringAlertGroupWinForwards( EFalse );
       
   259     AssertTrueL( ETrue, KBringAlertGroupWinForwards );
       
   260              
       
   261     //CEikServAppUiBase::HandleThreadExitL()
       
   262     RThread thread;
       
   263     appui->HandleThreadExitL( thread );
       
   264     AssertTrueL( ETrue, KHandleThreadExitL );
       
   265     appui->HandleForegroundEventL( ETrue );
       
   266     AssertTrueL( ETrue, KHandleForegroundEventL );
       
   267     
       
   268     //CEikServAppUiBase::SuppressAppSwitching()
       
   269     appui->SuppressAppSwitching( ETrue );
       
   270     appui->SuppressAppSwitching( EFalse );
       
   271 
       
   272     AssertTrueL( ETrue, KSuppressAppSwitching );
       
   273     
       
   274     //CEikServAppUiBase::HandleResourceChangeL()
       
   275     CEikAppUi* cui = appui;
       
   276     cui->HandleResourceChangeL( 0 );
       
   277     AssertTrueL( ETrue, KHandleResourceChangeL );
       
   278     
       
   279     MEikServAppUiSessionHandler* hand = 
       
   280         static_cast<CEikServAppUi*>(CEikonEnv::Static()->AppUi());
       
   281     hand->CycleTasksL( EForwards );
       
   282     hand->NotifyAlarmServerOfTaskChangeL();
       
   283    
       
   284     }
       
   285 //end of file