uifw/AvKon/tsrc/bc/S60_SDKMCL/bctestmixmcl/src/bctestmixmclgeneralcase.cpp
branchRCL_3
changeset 15 08e69e956a8c
parent 4 8ca85d2f0db7
child 23 3d340a0166ff
equal deleted inserted replaced
10:9f56a4e1b8ab 15:08e69e956a8c
    23 #include <aknpreviewpopupcontroller.h>
    23 #include <aknpreviewpopupcontroller.h>
    24 #include <eikmenub.h>
    24 #include <eikmenub.h>
    25 #include <eikenv.h>
    25 #include <eikenv.h>
    26 #include <aknutils.h>
    26 #include <aknutils.h>
    27 #include <akntoolbar.h>
    27 #include <akntoolbar.h>
       
    28 #include <caknmemoryselectionsettingitemmultidrive.h>
       
    29 #include <AknCommonDialogsDynMem.h>
    28 
    30 
    29 #include <bctestmixmcl.rsg>
    31 #include <bctestmixmcl.rsg>
    30 #include <eikedwin.h>
    32 #include <eikedwin.h>
    31 #include <aknphysics.h>
    33 #include <aknphysics.h>
       
    34 #include <aknradiobuttonsettingpage.h>
       
    35 #include <aknpopupsettingpage.h>  
       
    36 #include <ItemFinder.h>
    32 
    37 
    33 #include "bctestmixmclgeneralcase.h"
    38 #include "bctestmixmclgeneralcase.h"
    34 #include "bctestmixmclcontainer.h"
    39 #include "bctestmixmclcontainer.h"
    35 #include "bctestmixmcl.hrh"
    40 #include "bctestmixmcl.hrh"
    36 
    41 
    37 // CONSTATNS
    42 // CONSTANTS
    38 
    43 
       
    44 //
       
    45 // class CSettingPageTest
       
    46 // Helper class for testing protected setting page methods.
       
    47 //
       
    48 NONSHARABLE_CLASS( CSettingPageTest ) : public CAknSettingPage
       
    49     {   
       
    50 public:
       
    51     virtual void ProcessCommandL( TInt aCommandId );  
       
    52     };
    39 
    53 
    40 // ======== MEMBER FUNCTIONS ========
    54 // ======== MEMBER FUNCTIONS ========
    41 
    55 
    42 // ---------------------------------------------------------------------------
    56 // ---------------------------------------------------------------------------
    43 // Symbian 2nd static Constructor
    57 // Symbian 2nd static Constructor
   108     
   122     
   109     TestListBoxL();
   123     TestListBoxL();
   110     TestOptionsMenuL();
   124     TestOptionsMenuL();
   111     TestTasObjectInfoAndTasHookL();
   125     TestTasObjectInfoAndTasHookL();
   112     TestMiscApisFuncOneL();
   126     TestMiscApisFuncOneL();
   113     TestAknToolbar();
   127     TestAknToolbarL();
   114     TestAknPopupUtils();
   128     TestAknPopupUtilsL();
   115     TestAknListUtilsL(); 
   129     TestAknListUtilsL(); 
       
   130     TestRadioButtonSettingPageL();
       
   131     TestPopupSettingPageL();   
       
   132     TestItemFinder();
   116     TestEditorKineticScrollingL();
   133     TestEditorKineticScrollingL();
   117     TestAknPhysicsSuspendPhysicsL();
   134     TestAknPhysicsSuspendPhysicsL();
   118     TestAknPhysicsResumePhysicsL();
   135     TestAknPhysicsResumePhysicsL();
   119     TestCba();
   136     TestCbaL();
       
   137 	TestCommonDialogsL();
   120     }
   138     }
   121 
   139 
   122 // ---------------------------------------------------------------------------
   140 // ---------------------------------------------------------------------------
   123 // CBCTestMixMCLGeneralCase::PrepareCaseL
   141 // CBCTestMixMCLGeneralCase::PrepareCaseL
   124 // ---------------------------------------------------------------------------
   142 // ---------------------------------------------------------------------------
   187 	_LIT( KMakeVisible,
   205 	_LIT( KMakeVisible,
   188 	    "CEikListBox::MakeVisible() invoked" );
   206 	    "CEikListBox::MakeVisible() invoked" );
   189     _LIT( KItemsInSingleLine, 
   207     _LIT( KItemsInSingleLine, 
   190         "CEikListBox::ItemsInSingleLine() invoked" );
   208         "CEikListBox::ItemsInSingleLine() invoked" );
   191 
   209 
   192 	CEikFormattedCellListBox * listbox = new CEikFormattedCellListBox();
   210 	CEikFormattedCellListBox * listbox = new (ELeave) CEikFormattedCellListBox();
   193 	CleanupStack::PushL( listbox );
   211 	CleanupStack::PushL( listbox );
   194 	
   212 	
   195 	listbox->ConstructL( iContainer, EAknListBoxSelectionList );
   213 	listbox->ConstructL( iContainer, EAknListBoxSelectionList );
   196 	CDesCArrayFlat* text = new (ELeave) CDesCArrayFlat(1);
   214 	CDesCArrayFlat* text = new (ELeave) CDesCArrayFlat(1);
   197 	CleanupStack::PushL( text );
   215 	CleanupStack::PushL( text );
   339 
   357 
   340 	AssertTrueL( ETrue, KHandlePointerEvent );
   358 	AssertTrueL( ETrue, KHandlePointerEvent );
   341 	}
   359 	}
   342 
   360 
   343 // ---------------------------------------------------------------------------
   361 // ---------------------------------------------------------------------------
   344 // CBCTestMixMCLGeneralCase::TestAknPopupUtils
   362 // CBCTestMixMCLGeneralCase::TestAknPopupUtilsL
   345 // ---------------------------------------------------------------------------
   363 // ---------------------------------------------------------------------------
   346 //   
   364 //   
   347 void CBCTestMixMCLGeneralCase::TestAknPopupUtils()
   365 void CBCTestMixMCLGeneralCase::TestAknPopupUtilsL()
   348     {
   366     {
   349     TSize size( 10, 10 );
   367     TSize size( 10, 10 );
   350     TPoint point( AknPopupUtils::Position( size, ETrue ) );
   368     TPoint point( AknPopupUtils::Position( size, ETrue ) );
   351     point = AknPopupUtils::Position( size, EFalse );
   369     point = AknPopupUtils::Position( size, EFalse );
   352     point = AknPopupUtils::Position( size, NULL );
   370     point = AknPopupUtils::Position( size, NULL );
   382     AssertTrueL( ETrue, KAknListUtilsDrawSeparator );
   400     AssertTrueL( ETrue, KAknListUtilsDrawSeparator );
   383     }
   401     }
   384 
   402 
   385 	
   403 	
   386 // ---------------------------------------------------------------------------
   404 // ---------------------------------------------------------------------------
   387 // CBCTestMixMCLGeneralCase::TestAknToolbar
   405 // CBCTestMixMCLGeneralCase::TestAknToolbarL
   388 // ---------------------------------------------------------------------------
   406 // ---------------------------------------------------------------------------
   389 // 
   407 // 
   390 void CBCTestMixMCLGeneralCase::TestAknToolbar()
   408 void CBCTestMixMCLGeneralCase::TestAknToolbarL()
   391 	{
   409 	{
   392 	_LIT( KAknToolbarNew, "CAknToolbar::New toolbar is constructed" );
   410 	_LIT( KAknToolbarNew, "CAknToolbar::New toolbar is constructed" );
   393 	_LIT( KAknToolbarSetBgId, "CAknToolbar::New background skin theme ID is set" );
   411 	_LIT( KAknToolbarSetBgId, "CAknToolbar::New background skin theme ID is set" );
   394 	
   412 	
   395 	CAknToolbar* toolbar = CAknToolbar::NewL( R_BCTESTMIXMCL_TOOLBAR_FIXED );
   413 	CAknToolbar* toolbar = CAknToolbar::NewL( R_BCTESTMIXMCL_TOOLBAR_FIXED );
   399 	toolbar->SetSkinBackgroundId( KAknsIIDQsnBgAreaControlMp );
   417 	toolbar->SetSkinBackgroundId( KAknsIIDQsnBgAreaControlMp );
   400 	AssertTrueL( ETrue, KAknToolbarSetBgId );
   418 	AssertTrueL( ETrue, KAknToolbarSetBgId );
   401 	CleanupStack::PopAndDestroy( toolbar );
   419 	CleanupStack::PopAndDestroy( toolbar );
   402 	}
   420 	}
   403 
   421 
       
   422 
       
   423 // -----------------------------------------------------------------------------
       
   424 // CBCTestMixMCLGeneralCase::TestRadioButtonSettingPageL
       
   425 // -----------------------------------------------------------------------------
       
   426 //
       
   427 void CBCTestMixMCLGeneralCase::TestRadioButtonSettingPageL()
       
   428     { 
       
   429     const TInt KBufSize = 32;
       
   430     const TInt KZero = 0;
       
   431     const TInt KOne = 1;
       
   432     const TInt KTwo = 2;
       
   433     _LIT( KTestString, "Radiobuttonsettingpage test" );
       
   434     _LIT( KTestRadioButtonSettingPage, 
       
   435         "CAknRadioButtonSettingPage::ProcessCommandL tested" );
       
   436     
       
   437     CDesCArrayFlat* array = CCoeEnv::Static()->
       
   438         ReadDesCArrayResourceL( R_BCTESTMIXMCL_LIST_ITEM_ARRAY );   
       
   439     CleanupStack::PushL( array );
       
   440 
       
   441     TInt optin( KZero );
       
   442     TBuf< KBufSize > buffer( KTestString );
       
   443     CAknRadioButtonSettingPage* settingPage = new (ELeave) 
       
   444         CAknRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
       
   445                                     R_BCTESTMIXMCL_RADIOBUTTON_EDITOR, 
       
   446                                     R_BCTESTMIXMCL_RADIOBUTTON_SETTING_PAGE, 
       
   447                                     optin, array );
       
   448     CleanupStack::PushL( settingPage ); 
       
   449     
       
   450     settingPage->ConstructL();
       
   451 
       
   452     // CSettingPageTest is used to access protected method
       
   453     // CAknRadioButtonSettingPage::ProcessCommandL
       
   454     CSettingPageTest* test = reinterpret_cast<CSettingPageTest*>( settingPage );
       
   455     
       
   456     CCoeEnv::Static()->AppUi()->AddToStackL( test );
       
   457     test->ProcessCommandL( EAknSoftkeySelect );
       
   458     CCoeEnv::Static()->AppUi()->RemoveFromStack( test );  
       
   459   
       
   460     CleanupStack::PopAndDestroy( KTwo );   
       
   461     AssertTrueL( ETrue, KTestRadioButtonSettingPage );
       
   462     }
       
   463 
       
   464 // -----------------------------------------------------------------------------
       
   465 // CBCTestMixMCLGeneralCase::TestPopupSettingPageL
       
   466 // -----------------------------------------------------------------------------
       
   467 //
       
   468 void CBCTestMixMCLGeneralCase::TestPopupSettingPageL()
       
   469     {    
       
   470     _LIT( KTestPopupSettingPage, 
       
   471         "CAknPopupSettingPage::ProcessCommandL tested" );
       
   472     
       
   473     CDesCArrayFlat* item = CCoeEnv::Static()->
       
   474         ReadDesCArrayResourceL( R_BCTESTMIXMCL_LIST_ITEM_ARRAY );
       
   475     CleanupStack::PushL( item );
       
   476     
       
   477     CAknQueryValueTextArray* textArray = CAknQueryValueTextArray::NewL();
       
   478     CleanupStack::PushL( textArray );
       
   479     textArray->SetArray( *item );
       
   480     
       
   481     CAknQueryValueText* queryValueText = CAknQueryValueText::NewL();
       
   482     CleanupStack::PushL( queryValueText );
       
   483     queryValueText->SetArrayL( textArray );
       
   484     
       
   485     CAknPopupSettingPage* popupSettingPage  = new (ELeave) 
       
   486         CAknPopupSettingPage( R_BCTESTMIXMCL_POPUP_SETTING_PAGE, 
       
   487                               *queryValueText );
       
   488     
       
   489     CleanupStack::PushL( popupSettingPage );
       
   490     
       
   491     popupSettingPage->ConstructL();
       
   492     
       
   493     // CSettingPageTest is used to access protected method
       
   494     // CAknPopupSettingPage::ProcessCommandL
       
   495     CSettingPageTest* test = reinterpret_cast<CSettingPageTest*>( popupSettingPage );
       
   496     
       
   497     CCoeEnv::Static()->AppUi()->AddToStackL( popupSettingPage );
       
   498     test->ProcessCommandL( EAknSoftkeySelect );
       
   499     CCoeEnv::Static()->AppUi()->RemoveFromStack( popupSettingPage );     
       
   500     
       
   501     CleanupStack::PopAndDestroy( popupSettingPage );
       
   502     CleanupStack::PopAndDestroy( queryValueText );
       
   503     CleanupStack::PopAndDestroy( textArray );
       
   504     CleanupStack::PopAndDestroy( item );
       
   505     
       
   506     AssertTrueL( ETrue, KTestPopupSettingPage );
       
   507     }
       
   508   
   404 
   509 
   405 // ---------------------------------------------------------------------------
   510 // ---------------------------------------------------------------------------
   406 // CBCTestMixMCLGeneralCase::TestEditorKineticScrollingL
   511 // CBCTestMixMCLGeneralCase::TestEditorKineticScrollingL
   407 // ---------------------------------------------------------------------------
   512 // ---------------------------------------------------------------------------
   408 //   
   513 //   
   449     _LIT( KResumePhysics, "CAknPhysics::ResumePhysics tested" );
   554     _LIT( KResumePhysics, "CAknPhysics::ResumePhysics tested" );
   450     AssertTrueL( ETrue, KResumePhysics );
   555     AssertTrueL( ETrue, KResumePhysics );
   451     }
   556     }
   452 
   557 
   453 // ---------------------------------------------------------------------------
   558 // ---------------------------------------------------------------------------
   454 // CBCTestMixMCLGeneralCase::TestCba
   559 // CBCTestMixMCLGeneralCase::TestCbaL
   455 // ---------------------------------------------------------------------------
   560 // ---------------------------------------------------------------------------
   456 //   
   561 //   
   457 void CBCTestMixMCLGeneralCase::TestCba()
   562 void CBCTestMixMCLGeneralCase::TestCbaL()
   458     {
   563     {
   459     CEikCba* cba = static_cast<CEikCba*>( 
   564     CEikCba* cba = static_cast<CEikCba*>( 
   460         iAvkonAppUi->Cba()->ButtonGroup()->AsControl() );
   565         iAvkonAppUi->Cba()->ButtonGroup()->AsControl() );
   461     cba->EnableItemSpecificSoftkey( EFalse );
   566     cba->EnableItemSpecificSoftkey( EFalse );
   462     cba->EnableItemSpecificSoftkey( ETrue );
   567     cba->EnableItemSpecificSoftkey( ETrue );
   463     _LIT( CEikCbaEnableItemSpecificSoftkey, 
   568     _LIT( CEikCbaEnableItemSpecificSoftkey, 
   464         "CEikCba::EnableItemSpecificSoftkey tested" );
   569         "CEikCba::EnableItemSpecificSoftkey tested" );
   465     AssertTrueL( ETrue, CEikCbaEnableItemSpecificSoftkey );
   570     AssertTrueL( ETrue, CEikCbaEnableItemSpecificSoftkey );
   466     }    
   571     }    
       
   572 	
       
   573 // ---------------------------------------------------------------------------
       
   574 // CBCTestMixMCLGeneralCase::TestCommonDialogsL()
       
   575 //  common file test  
       
   576 // ---------------------------------------------------------------------------
       
   577 //
       
   578 void CBCTestMixMCLGeneralCase::TestCommonDialogsL()
       
   579     {
       
   580     _LIT( KSetIncludedMediasL, 
       
   581           "CAknMemorySelectionSettingItemMultiDrive::SetIncludedMediasL()invoked");
       
   582     
       
   583     TInt id = 1;
       
   584     TDriveNumber selDr = EDriveC;
       
   585     
       
   586     CAknMemorySelectionSettingItemMultiDrive* settingItem = 
       
   587             new ( ELeave ) CAknMemorySelectionSettingItemMultiDrive( 
       
   588             id, selDr );
       
   589     CleanupStack::PushL( settingItem );
       
   590     
       
   591     TInt includedMedias = AknCommonDialogsDynMem:: EMemoryTypePhone |
       
   592                           AknCommonDialogsDynMem:: EMemoryTypeMMC |
       
   593                           AknCommonDialogsDynMem:: EMemoryTypeRemote;
       
   594 
       
   595     settingItem->SetIncludedMediasL( includedMedias );
       
   596     AssertTrueL( ETrue, KSetIncludedMediasL );
       
   597     
       
   598     includedMedias &= (~AknCommonDialogsDynMem:: EMemoryTypePhone ); 
       
   599     settingItem->SetIncludedMediasL( includedMedias );
       
   600 
       
   601     CleanupStack::PopAndDestroy( settingItem );
       
   602     } 	
   467 
   603 
   468 // ---------------------------------------------------------------------------
   604 // ---------------------------------------------------------------------------
   469 // CBCTestMixMCLGeneralCase::ViewPositionChanged
   605 // CBCTestMixMCLGeneralCase::ViewPositionChanged
   470 // ---------------------------------------------------------------------------
   606 // ---------------------------------------------------------------------------
   471 // 
   607 // 
   491 TPoint CBCTestMixMCLGeneralCase::ViewPosition() const
   627 TPoint CBCTestMixMCLGeneralCase::ViewPosition() const
   492     {
   628     {
   493     return TPoint( 0, 0 );
   629     return TPoint( 0, 0 );
   494     }
   630     }
   495 
   631 
       
   632 // -----------------------------------------------------------------------------
       
   633 // CBCTestMixMCLGeneralCase::TestItemFinder
       
   634 // -----------------------------------------------------------------------------
       
   635 //
       
   636 void CBCTestMixMCLGeneralCase::TestItemFinder()
       
   637     {
       
   638     _LIT( KSetItemFinderObserverL,
       
   639             "CItemFinder::SetItemFinderObserverL() tested" );
       
   640 
       
   641     CItemFinder* itemfinder = CItemFinder::NewL();
       
   642     CleanupStack::PushL ( itemfinder );
       
   643 
       
   644     itemfinder->SetItemFinderObserverL( this );
       
   645     itemfinder->SetItemFinderObserverL( 0 );
       
   646     AssertTrueL( ETrue, KSetItemFinderObserverL );
       
   647 
       
   648     CleanupStack::PopAndDestroy( itemfinder );
       
   649     }
       
   650 
       
   651 
       
   652 // ---------------------------------------------------------------------------
       
   653 // CBCTestMixMCLGeneralCase::HandleFindItemEventL
       
   654 // ---------------------------------------------------------------------------
       
   655 //
       
   656 void CBCTestMixMCLGeneralCase::HandleFindItemEventL(
       
   657         const CItemFinder::CFindItemExt& /*aItem*/,
       
   658             MAknItemFinderObserver::TEventFlag /*aEvent*/, TUint /*aFlags*/)
       
   659     {
       
   660     // do nothing
       
   661     }
       
   662 
   496 //end of file
   663 //end of file
   497 
   664