uifw/AvKon/tsrc/bc/bctestdom3.2/bctestdomavkonpsln/src/bctestdomakncase.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 <aknskinnableclock.h>
       
    26 #include <aknsmallindicator.h>
       
    27 /*
       
    28 The "class TAknWindowComponentLayout;" and "class CAknStylusActivatedItem;" 
       
    29 should be added when "aknstylusactivatedpopupcontent.h" is used.
       
    30 */
       
    31 class CAknStylusActivatedItem;
       
    32 class TAknWindowComponentLayout;
       
    33 #include <aknstylusactivatedpopupcontent.h>
       
    34 #include <aknsoftnotificationparameters.h>
       
    35 #include <aknnotedialog.h>
       
    36 #include <aknsoftnotifier.h>
       
    37 #include <aknstatuspaneutils.h>
       
    38 #include <aknsyncdraw.h>
       
    39 #include <akntasklist.h>
       
    40 #include <akntransitionutils.h>
       
    41 #include <aknvolumepopup.h>
       
    42 #include <aknform.h> 
       
    43 #include <aknsystemfont.h>
       
    44 #include <s32file.h>
       
    45 #include <s32strm.h>
       
    46 
       
    47 #include <avkon.mbg>
       
    48 #include <bctestdomavkonpsln.rsg>
       
    49 
       
    50 #include "bctestdomakncase.h"
       
    51 #include "bctestdomavkonpslncontainer.h"
       
    52 #include "bctestdomavkonpslnext.h"
       
    53 #include "bctestdomavkonpsln.hrh"
       
    54 
       
    55 
       
    56 //CONSTANTS
       
    57 
       
    58 const TInt KWidth = 25;
       
    59 const TInt KHeight = 25;
       
    60 const TInt KShareVolumeUid = 0x000000001;
       
    61 const TInt KViewerUid = 0x10282D0A;
       
    62 const TInt KVolumeMaxValue = 10;
       
    63 const TInt KVolumeMinValue = 0;
       
    64 const TInt KDesLength = 24;
       
    65 
       
    66 _LIT( KFilePath, "C:\\bctestlog\\rest.txt" );
       
    67 _LIT8( KMessage, "Message Descriptor" );
       
    68 _LIT( KTitle, "Title" );
       
    69 _LIT( KText, "Text" );
       
    70 _LIT( KDriver, "C:" );
       
    71 
       
    72 
       
    73 
       
    74 // ======== MEMBER FUNCTIONS ========
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // Symbian 2nd static Constructor
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 CBCTestDomAknCase* CBCTestDomAknCase::NewL( CBCTestDomAvkonPslnContainer* 
       
    81     aContainer )
       
    82     {
       
    83     CBCTestDomAknCase* self = new( ELeave ) CBCTestDomAknCase( 
       
    84         aContainer );
       
    85     CleanupStack::PushL( self );
       
    86     self->ConstructL();
       
    87     CleanupStack::Pop( self );
       
    88     return self;
       
    89     }
       
    90     
       
    91 // ---------------------------------------------------------------------------
       
    92 // C++ default constructor
       
    93 // ---------------------------------------------------------------------------
       
    94 //
       
    95 CBCTestDomAknCase::CBCTestDomAknCase( CBCTestDomAvkonPslnContainer* 
       
    96     aContainer )
       
    97     : iContainer( aContainer )
       
    98     {    
       
    99     }
       
   100     
       
   101 // ---------------------------------------------------------------------------
       
   102 // Destructor
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 CBCTestDomAknCase::~CBCTestDomAknCase()
       
   106     {  
       
   107     }
       
   108     
       
   109 // ---------------------------------------------------------------------------
       
   110 // Symbian 2nd Constructor
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 void CBCTestDomAknCase::ConstructL()
       
   114     {    
       
   115     BuildScriptL();    
       
   116     }
       
   117     
       
   118 // ---------------------------------------------------------------------------
       
   119 // CBCTestDomAknCase::BuildScriptL
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 void CBCTestDomAknCase::BuildScriptL()
       
   123     { 
       
   124     // Add script as your need.   
       
   125     AddTestL( DELAY(1), LeftCBA, KeyOK, KeyOK, TEND );    
       
   126     }
       
   127     
       
   128 // ---------------------------------------------------------------------------
       
   129 // CBCTestDomAknCase::RunL
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 void CBCTestDomAknCase::RunL( TInt aCmd )
       
   133     {
       
   134     if ( aCmd != EBCTestCmdOutline1 )
       
   135         {
       
   136         return;
       
   137         }
       
   138     switch ( aCmd )  
       
   139         {
       
   140         case EBCTestCmdOutline1:
       
   141             TestSkinnableClockL();
       
   142             TestSmallIndicatorL();
       
   143             TestSoftNotifierL();
       
   144             TestStatuspaneUtilsL();
       
   145             #ifdef RD_SCALABLE_UI_V2
       
   146             TestPopupContentL();
       
   147             #endif
       
   148             TestTransitionL();
       
   149             TestCameraSettingPageL();
       
   150             TestAknVolumePopupL();
       
   151             TestLafSystemFontL();
       
   152             TestTaskListL();
       
   153             break;
       
   154         default:
       
   155             break;
       
   156         }
       
   157     }
       
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // CBCTestDomAknCase::TestSkinnableClock()
       
   161 // ---------------------------------------------------------------------------
       
   162 //    
       
   163 void CBCTestDomAknCase::TestSkinnableClockL()
       
   164     {
       
   165     // Test some API here
       
   166     _LIT( KNewL, "CAknSkinnableClock::NewL invoked" );
       
   167     _LIT( KUpdateDisplay, "CAknSkinnableClock::NewL UpdateDisplay invoked" );
       
   168     _LIT( KSetFormatL, "CAknSkinnableClock::NewL SetFormatL invoked" );
       
   169     _LIT( KDes, "CAknSkinnableClock::~CAknSkinnableClock invoked" );
       
   170     
       
   171     CAknSkinnableClock* clock = 
       
   172         CAknSkinnableClock::NewL( iContainer, ETrue, ETrue );
       
   173     CleanupStack::PushL( clock );
       
   174     AssertNotNullL( clock, KNewL );
       
   175     
       
   176     clock->UpdateDisplay();
       
   177     AssertTrueL( ETrue, KUpdateDisplay );
       
   178     
       
   179     clock->SetFormatL( EClockDigital );
       
   180     AssertTrueL( ETrue, KSetFormatL );
       
   181     
       
   182     TPointerEvent event;
       
   183     event.iType = TPointerEvent::EButton1Down;
       
   184     event.iModifiers = 0;
       
   185     TPoint eventPos( KWidth, KHeight );
       
   186     event.iPosition = eventPos;
       
   187     event.iParentPosition = eventPos;
       
   188     
       
   189     clock->HandlePointerEventL( event );
       
   190     CleanupStack::Pop( clock );
       
   191     delete clock;
       
   192     AssertTrueL( ETrue, KDes );
       
   193     
       
   194     }
       
   195  
       
   196 // ---------------------------------------------------------------------------
       
   197 // CBCTestDomAknCase::TestSmallIndicator
       
   198 // ---------------------------------------------------------------------------
       
   199 //       
       
   200 void CBCTestDomAknCase::TestSmallIndicatorL()
       
   201     {
       
   202     // Test some API here
       
   203     _LIT( KNewL, "CAknSmallIndicator::NewL invoked" );
       
   204     _LIT( KDes, "CAknSmallIndicator::~CAknSmallIndicator invoked" );
       
   205     _LIT( KNewLC, "CAknSmallIndicator::NewLC invoked" );
       
   206     _LIT( KSetIndicatorStateL, 
       
   207         "CAknSmallIndicator::SetIndicatorStateL invoked" );
       
   208     _LIT( KHandleIndicatorTapL, 
       
   209         "CAknSmallIndicator::HandleIndicatorTapL invoked" );
       
   210     
       
   211     CAknSmallIndicator* indicator = 
       
   212         CAknSmallIndicator::NewL( TUid::Uid( KViewerUid ) );
       
   213     CleanupStack::PushL( indicator );
       
   214     AssertNotNullL( indicator, KNewL );
       
   215     
       
   216     CleanupStack::Pop( indicator );
       
   217     delete indicator;
       
   218     AssertTrueL( ETrue, KDes );
       
   219     
       
   220     indicator = CAknSmallIndicator::NewLC( TUid::Uid( KViewerUid ) );
       
   221     AssertNotNullL( indicator, KNewLC );
       
   222     
       
   223     indicator->SetIndicatorStateL( 0 );
       
   224     AssertTrueL( ETrue, KSetIndicatorStateL );
       
   225     
       
   226     indicator->HandleIndicatorTapL();
       
   227     AssertTrueL( ETrue, KHandleIndicatorTapL );
       
   228     
       
   229     CleanupStack::PopAndDestroy( indicator );
       
   230     
       
   231     }
       
   232  
       
   233 // ---------------------------------------------------------------------------
       
   234 // CBCTestDomAknCase::TestSoftNotifier
       
   235 // ---------------------------------------------------------------------------
       
   236 //    
       
   237 void CBCTestDomAknCase::TestSoftNotifierL()
       
   238     {
       
   239     
       
   240     _LIT( KNewL, "CAknSoftNotificationParameters::NewL invoked" );
       
   241     _LIT( KDes, "CAknSoftNotificationParameters::\
       
   242         ~CAknSoftNotificationParameters invoked" );
       
   243     _LIT( KNewLOver, "CAknSoftNotificationParameters::NewL overload invoked" );
       
   244     _LIT( KNewLOverLoad, 
       
   245         "CAknSoftNotificationParameters::NewL overload invoked" );
       
   246     _LIT( KNotifierNewL, "CAknSoftNotifier::NewL invoked" );
       
   247     _LIT( KNotifierDes, "CAknSoftNotifier::~CAknSoftNotifier invoked" );
       
   248     _LIT( KNewLC, "CAknSoftNotifier::NewLC invoked" );
       
   249     _LIT( KAddNotificationL, "CAknSoftNotifier::AddNotificationL invoked" );
       
   250     _LIT( KAddNotificationLOverLoad, 
       
   251         "CAknSoftNotifier::AddNotificationL overload invoked" );
       
   252     _LIT( KSetNotificationCountL, 
       
   253         "CAknSoftNotifier::SetNotificationCountL invoked" );
       
   254     _LIT( KCancelSoftNotificationL, 
       
   255         "CAknSoftNotifier::CancelSoftNotificationL invoked" );
       
   256     _LIT( KAddCustomNotificationL, 
       
   257         "CAknSoftNotifier::AddCustomNotificationL invoked" );
       
   258     _LIT( KSetCustomNotificationCountL, 
       
   259         "CAknSoftNotifier::SetCustomNotificationCountL invoked" );
       
   260     _LIT( KCancelCustomSoftNotificationL, 
       
   261         "CAknSoftNotifier::CancelCustomSoftNotificationL invoked" );
       
   262     
       
   263                 
       
   264     CAknSoftNotificationParameters* parameters =
       
   265         CAknSoftNotificationParameters::NewL();
       
   266     CleanupStack::PushL( parameters );
       
   267     AssertNotNullL( parameters, KNewL );
       
   268     
       
   269     CleanupStack::Pop( parameters );
       
   270     delete parameters;
       
   271     AssertTrueL( ETrue, KDes );
       
   272     
       
   273 
       
   274     parameters = CAknSoftNotificationParameters::
       
   275         NewL( KFilePath, 0, 0, 0, CAknNoteDialog::ENoTone);
       
   276     CleanupStack::PushL( parameters ); 
       
   277     AssertTrueL( ETrue, KNewLOver );
       
   278     CleanupStack::Pop( parameters );
       
   279     delete parameters;
       
   280     
       
   281     parameters = CAknSoftNotificationParameters::NewL( KDriver, 0, 0, 0,
       
   282         CAknNoteDialog::ENoTone,
       
   283         KNullViewId, KNullUid,
       
   284         0, KMessage );
       
   285     CleanupStack::PushL( parameters );
       
   286     AssertNotNullL( parameters, KNewLOverLoad );
       
   287     
       
   288     CAknSoftNotifier* notifier = CAknSoftNotifier::NewL();
       
   289     CleanupStack::PushL( notifier );
       
   290     AssertNotNullL( notifier, KNotifierNewL );
       
   291     CleanupStack::Pop( notifier );
       
   292     delete notifier;
       
   293     AssertTrueL( ETrue, KNotifierDes );
       
   294     
       
   295     notifier = CAknSoftNotifier::NewLC();
       
   296     AssertNotNullL( notifier, KNewLC );
       
   297     
       
   298     notifier->AddNotificationL( ENetworkInformationNotification );
       
   299     AssertTrueL( ETrue, KAddNotificationL );
       
   300     
       
   301     notifier->AddNotificationL( ENetworkInformationNotification, 1 );
       
   302     AssertTrueL( ETrue, KAddNotificationLOverLoad );
       
   303     
       
   304     notifier->SetNotificationCountL( ENetworkInformationNotification, 1 );
       
   305     AssertTrueL( ETrue, KSetNotificationCountL );
       
   306     
       
   307     notifier->CancelSoftNotificationL( ENetworkInformationNotification );
       
   308     AssertTrueL( ETrue, KCancelSoftNotificationL );
       
   309     
       
   310     notifier->AddCustomNotificationL( *parameters );
       
   311     AssertTrueL( ETrue, KAddCustomNotificationL );
       
   312     
       
   313     notifier->SetCustomNotificationCountL( *parameters, 1 );
       
   314     AssertTrueL( ETrue, KSetCustomNotificationCountL );
       
   315     
       
   316     notifier->CancelCustomSoftNotificationL( *parameters );
       
   317     AssertTrueL( ETrue, KCancelCustomSoftNotificationL );
       
   318     
       
   319     CleanupStack::PopAndDestroy( notifier );
       
   320     CleanupStack::PopAndDestroy( parameters );
       
   321     
       
   322     }
       
   323 
       
   324 // ---------------------------------------------------------------------------
       
   325 // CBCTestDomAknCase::TestStatuspaneUtils
       
   326 // ---------------------------------------------------------------------------
       
   327 //
       
   328 void CBCTestDomAknCase::TestStatuspaneUtilsL()
       
   329     {
       
   330     
       
   331     _LIT( KStaconPaneActive, "AknStatuspaneUtils::StaconPaneActive invoked" );
       
   332     _LIT( KStaconSoftKeysLeft, 
       
   333         "AknStatuspaneUtils::StaconSoftKeysLeft invoked" );
       
   334     _LIT( KStaconSoftKeysRight, 
       
   335         "AknStatuspaneUtils::StaconSoftKeysRight invoked" );
       
   336     _LIT( KIdleLayoutActive, "AknStatuspaneUtils::IdleLayoutActive invoked" );
       
   337     _LIT( KFlatLayoutActive, "AknStatuspaneUtils::FlatLayoutActive invoked" );
       
   338     _LIT( KUsualLayoutActive, 
       
   339         "AknStatuspaneUtils::UsualLayoutActive invoked" );
       
   340     _LIT( KSmallLayoutActive, 
       
   341         "AknStatuspaneUtils::SmallLayoutActive invoked" );
       
   342     _LIT( KTouchPaneCompatibleLayoutActive, 
       
   343         "AknStatuspaneUtils::TouchPaneCompatibleLayoutActive invoked" );
       
   344     _LIT( KExtendedStaconPaneActive, 
       
   345         "AknStatuspaneUtils::ExtendedStaconPaneActive invoked" );
       
   346     _LIT( KExtendedFlatLayoutActive, 
       
   347         "AknStatuspaneUtils::ExtendedFlatLayoutActive invoked" );
       
   348     
       
   349     TBool val = AknStatuspaneUtils::StaconPaneActive();
       
   350     AssertTrueL( ETrue, KStaconPaneActive );
       
   351     
       
   352     val = AknStatuspaneUtils::StaconSoftKeysLeft();
       
   353     AssertTrueL( ETrue, KStaconSoftKeysLeft );
       
   354     
       
   355     val = AknStatuspaneUtils::StaconSoftKeysRight();
       
   356     AssertTrueL( ETrue, KStaconSoftKeysRight );
       
   357     
       
   358     val = AknStatuspaneUtils::IdleLayoutActive();
       
   359     AssertTrueL( ETrue, KIdleLayoutActive );
       
   360     
       
   361     val = AknStatuspaneUtils::FlatLayoutActive();
       
   362     AssertTrueL( ETrue, KFlatLayoutActive );
       
   363     
       
   364     val = AknStatuspaneUtils::UsualLayoutActive();
       
   365     AssertTrueL( ETrue, KUsualLayoutActive );
       
   366     
       
   367     val = AknStatuspaneUtils::SmallLayoutActive();
       
   368     AssertTrueL( ETrue, KSmallLayoutActive );
       
   369     
       
   370     val = AknStatuspaneUtils::TouchPaneCompatibleLayoutActive();
       
   371     AssertTrueL( ETrue, KTouchPaneCompatibleLayoutActive );
       
   372     
       
   373     val = AknStatuspaneUtils::ExtendedStaconPaneActive();
       
   374     AssertTrueL( ETrue, KExtendedStaconPaneActive );
       
   375     
       
   376     val = AknStatuspaneUtils::ExtendedFlatLayoutActive();
       
   377     AssertTrueL( ETrue, KExtendedFlatLayoutActive );
       
   378     }
       
   379 
       
   380 // ---------------------------------------------------------------------------
       
   381 // CBCTestDomAknCase::TestPopupContent()
       
   382 // ---------------------------------------------------------------------------
       
   383 //
       
   384 void CBCTestDomAknCase::TestPopupContentL()
       
   385     {
       
   386     
       
   387     _LIT( KNewL, "CAknStylusActivatedPopUpContent::NewL invoked" );
       
   388     _LIT( KNewLOverload, "CAknStylusActivatedPopUpContent\
       
   389                          ::NewL overload invoked" );
       
   390     _LIT( KNewLRes, "CAknStylusActivatedPopUpContent\
       
   391                     ::NewL int resid overload invoked" );
       
   392     _LIT( KNewLReader, "CAknStylusActivatedPopUpContent\
       
   393                     ::NewL reader resid overload invoked" );
       
   394     _LIT( KDes, "CAknStylusActivatedPopUpContent::\
       
   395                 ~CAknStylusActivatedPopUpContent invoked" );
       
   396     _LIT( KComponentControl, "CAknStylusActivatedPopUpContent::\
       
   397                               ComponentControl invoked" );
       
   398     _LIT( KCountComponentControls, 
       
   399           "CAknStylusActivatedPopUpContent::CountComponentControls invoked" );
       
   400     _LIT( KMinimumSize, 
       
   401           "CAknStylusActivatedPopUpContent::MinimumSize invoked" );
       
   402     _LIT( KHandleResourceChange, 
       
   403           "CAknStylusActivatedPopUpContent::HandleResourceChange() invoked" );
       
   404     _LIT( KSetContainerWindowL, 
       
   405           "CAknStylusActivatedPopUpContent::SetContainerWindowL() invoked" );
       
   406     _LIT( KSetCommandObserver, 
       
   407           "CAknStylusActivatedPopUpContent::SetCommandObserver invoked" );
       
   408     _LIT( KHandlePointerEventL, 
       
   409           "CAknStylusActivatedPopUpContent::HandlePointerEventL invoked" );
       
   410     _LIT( KHandleControlEventL, 
       
   411           "CAknStylusActivatedPopUpContent::HandleControlEventL invoked" );
       
   412 
       
   413     CAknStylusActivatedPopUpContent* content 
       
   414         = CAknStylusActivatedPopUpContent::NewL( KTitle, KText );
       
   415     CleanupStack::PushL( content );
       
   416     AssertNotNullL( content, KNewL );
       
   417     
       
   418     CleanupStack::Pop( content );
       
   419     delete content;
       
   420     AssertTrueL( ETrue, KDes );
       
   421     
       
   422     TBuf<KDesLength> linktxt( KTitle );
       
   423     RArray<TAknContentLink> array;
       
   424     TAknContentLink link;
       
   425     link.iLinkText = &linktxt;
       
   426     CleanupClosePushL( array );
       
   427     array.Append( link );
       
   428     content = CAknStylusActivatedPopUpContent::NewL( KTitle, KText, array );
       
   429     CleanupStack::PushL( content );
       
   430     AssertNotNullL( content, KNewLOverload );
       
   431     CleanupStack::Pop( content );
       
   432     delete content;
       
   433     CleanupStack::PopAndDestroy( &array );
       
   434     
       
   435     content = CAknStylusActivatedPopUpContent::
       
   436               NewL( R_BCTESTDOMAVKONPSLN_AVKON_CONTENT );
       
   437     CleanupStack::PushL( content );
       
   438     AssertNotNullL( content, KNewLRes );
       
   439     
       
   440     CAknForm* frm = new ( ELeave ) CAknForm();
       
   441     CleanupStack::PushL( frm );
       
   442     frm->ConstructL();
       
   443     
       
   444     content->SetCommandObserver( *frm );
       
   445     AssertTrueL( ETrue, KSetCommandObserver );
       
   446     
       
   447     content->HandleResourceChange( 0 );
       
   448     AssertTrueL( ETrue, KHandleResourceChange );
       
   449     
       
   450     content->SetContainerWindowL( *iContainer );
       
   451     AssertTrueL( ETrue, KSetContainerWindowL );
       
   452     
       
   453     TPointerEvent event;
       
   454     event.iType = TPointerEvent::EButton1Down;
       
   455     event.iModifiers = 0;
       
   456     TPoint eventPos( KWidth, KHeight );
       
   457     event.iPosition = eventPos;
       
   458     event.iParentPosition = eventPos;
       
   459     content->HandlePointerEventL( event );
       
   460     AssertTrueL( ETrue, KHandlePointerEventL );
       
   461     
       
   462     content->HandleControlEventL( iContainer, 
       
   463         MCoeControlObserver::EEventRequestExit );
       
   464     AssertTrueL( ETrue, KHandleControlEventL );
       
   465     
       
   466     CleanupStack::Pop( frm );
       
   467     CleanupStack::Pop( content );
       
   468 
       
   469     delete content;
       
   470     delete frm;
       
   471     
       
   472     TResourceReader reader;
       
   473     CCoeEnv::Static()->CreateResourceReaderLC( reader, 
       
   474         R_BCTESTDOMAVKONPSLN_AVKON_CONTENT );
       
   475     CCoeControl* ctrl = CAknStylusActivatedPopUpContent::NewL( reader );
       
   476     CleanupStack::PushL( ctrl );
       
   477     AssertNotNullL( ctrl, KNewLReader );
       
   478     
       
   479     ctrl->ComponentControl( 0 );
       
   480     AssertTrueL( ETrue, KComponentControl );
       
   481     
       
   482     ctrl->CountComponentControls();
       
   483     AssertTrueL( ETrue, KCountComponentControls );
       
   484     
       
   485     ctrl->MinimumSize();
       
   486     AssertTrueL( ETrue, KMinimumSize );
       
   487     
       
   488     CleanupStack::PopAndDestroy( ctrl );
       
   489     CleanupStack::PopAndDestroy(); // reader
       
   490     
       
   491     }
       
   492 
       
   493 
       
   494 // ---------------------------------------------------------------------------
       
   495 // CBCTestDomAknCase::TestSyncDraw()
       
   496 // ---------------------------------------------------------------------------
       
   497 //
       
   498 void CBCTestDomAknCase::TestSyncDrawL()
       
   499     {
       
   500     
       
   501     _LIT( KConstruct, "TAknSyncControlDrawer::TAknSyncControlDrawer invoked" );
       
   502     _LIT( KSetControl, "TAknSyncControlDrawer::SetControl invoked" );
       
   503     _LIT( KMasrPrepareForDraw, 
       
   504         "TAknSyncControlDrawer::MasrPrepareForDraw invoked" );
       
   505     _LIT( KMasrDraw, "TAknSyncControlDrawer::MasrDraw invoked" );
       
   506     _LIT( KMasrDeactivateGc, 
       
   507         "TAknSyncControlDrawer::MasrDeactivateGc invoked" );
       
   508     _LIT( KMasrActivateGc,
       
   509         "TAknSyncControlDrawer::MasrActivateGc invoked" );
       
   510     _LIT( KNewL, "CAknDrawSynchronizer::NewL invoked" );
       
   511     _LIT( KAddL, "CAknDrawSynchronizer::AddL invoked" ); 
       
   512     _LIT( KSignal, "CAknDrawSynchronizer::Signal invoked" );
       
   513     _LIT( KRemove, "CAknDrawSynchronizer::Remove invoked" );
       
   514     _LIT( KDes, "CAknDrawSynchronizer::~CAknDrawSynchronizer invoked" );
       
   515           
       
   516     TAknSyncControlDrawer drawer;
       
   517     AssertTrueL( ETrue, KConstruct );
       
   518     
       
   519     drawer.SetControl( iContainer );
       
   520     AssertTrueL( ETrue, KSetControl );
       
   521     
       
   522     drawer.MasrPrepareForDraw();
       
   523     AssertTrueL( ETrue, KMasrPrepareForDraw );
       
   524     
       
   525     drawer.MasrDraw();
       
   526     AssertTrueL( ETrue, KMasrDraw );
       
   527     
       
   528     drawer.MasrDeactivateGc();
       
   529     AssertTrueL( ETrue, KMasrDeactivateGc );
       
   530     
       
   531     drawer.MasrActivateGc();
       
   532     AssertTrueL( ETrue, KMasrActivateGc );
       
   533     
       
   534     CAknDrawSynchronizer* sync = CAknDrawSynchronizer::NewL();
       
   535     CleanupStack::PushL( sync );
       
   536     AssertNotNullL( sync, KNewL );
       
   537 
       
   538     sync->AddL( &drawer );
       
   539     AssertTrueL( ETrue, KAddL );
       
   540     
       
   541     sync->Signal( &drawer );
       
   542     AssertTrueL( ETrue, KSignal );
       
   543     
       
   544     sync->Remove( &drawer );
       
   545     AssertTrueL( ETrue, KRemove );
       
   546     
       
   547     CleanupStack::PopAndDestroy( sync );
       
   548     AssertTrueL( ETrue, KDes );
       
   549     
       
   550     }
       
   551 
       
   552 // ---------------------------------------------------------------------------
       
   553 // CBCTestDomAknCase::TestTaskListL()
       
   554 // ---------------------------------------------------------------------------
       
   555 //    
       
   556 void CBCTestDomAknCase::TestTaskListL()
       
   557     {
       
   558     
       
   559     _LIT( KNewL, "CAknTaskList::NewL invoked" );
       
   560     _LIT( KNewLC, "CAknTaskList::NewLC invoked" );
       
   561     _LIT( KDes, "CAknTaskList::~CAknTaskList invoked" );
       
   562     _LIT( KUpdateListL, "CAknTaskList::UpdateListL invoked" );
       
   563     _LIT( KWgArray, "CAknTaskList::WgArray invoked" );
       
   564     _LIT( KFindRootApp, "CAknTaskList::FindRootApp invoked" );   
       
   565     _LIT( KIsRootWindowGroup, "CAknTaskList::IsRootWindowGroup invoked" );   
       
   566     
       
   567     CAknTaskList* tasklist = 
       
   568         CAknTaskList::NewL( CCoeEnv::Static()->WsSession() );
       
   569     CleanupStack::PushL( tasklist );
       
   570     AssertNotNullL( tasklist, KNewL );
       
   571     
       
   572     CleanupStack::Pop( tasklist );
       
   573     delete tasklist;
       
   574     AssertTrueL( ETrue, KDes );
       
   575     
       
   576     tasklist = CAknTaskList::NewLC( CCoeEnv::Static()->WsSession() );
       
   577     AssertNotNullL( tasklist, KNewLC );
       
   578     
       
   579     tasklist->UpdateListL();
       
   580     AssertTrueL( ETrue, KUpdateListL );
       
   581     
       
   582     tasklist->WgArray();
       
   583     AssertTrueL( ETrue, KWgArray );
       
   584     
       
   585     tasklist->FindRootApp( KNullUid );
       
   586     AssertTrueL( ETrue, KFindRootApp );
       
   587     
       
   588     TBool val = tasklist->IsRootWindowGroup( 0 );
       
   589     AssertTrueL( ETrue, KIsRootWindowGroup );
       
   590     
       
   591     CleanupStack::PopAndDestroy( tasklist );
       
   592     }
       
   593     
       
   594 // ---------------------------------------------------------------------------
       
   595 // CBCTestDomAknCase::TestTransitionL()
       
   596 // ---------------------------------------------------------------------------
       
   597 //    
       
   598 void CBCTestDomAknCase::TestTransitionL()
       
   599     {
       
   600     
       
   601     _LIT( KCAknTransition, "CAknTransition::CAknTransition invoked" );
       
   602     _LIT( KAddObserver, "CAknTransitionUtils::AddObserver invoked" );
       
   603     _LIT( KRemoveObserver, "CAknTransitionUtils::RemoveObserver invoked" );
       
   604     _LIT( KGetState, "CAknTransitionUtils::GetState invoked" );
       
   605     _LIT( KSetData, "CAknTransitionUtils::SetData invoked" );
       
   606     _LIT( KGetData, "CAknTransitionUtils::GetData invoked" );
       
   607     _LIT( KRemoveData, "CAknTransitionUtils::RemoveData invoked" );
       
   608     _LIT( KSetAllParents, "CAknTransitionUtils::SetAllParents invoked" );
       
   609     _LIT( KTransitionsEnabled, 
       
   610         "CAknTransitionUtils::TransitionsEnabled invoked" );
       
   611     _LIT( KMakeVisibleSubComponents, 
       
   612         "CAknTransitionUtils::MakeVisibleSubComponents invoked" );
       
   613     _LIT( KGetDemarcation, "CAknTransitionUtils::GetDemarcation invoked" );
       
   614     _LIT( KDes, "CAknTransition::~CAknTransition invoked" );
       
   615     
       
   616     CAknTransitionExt* observer = new ( ELeave ) CAknTransitionExt;
       
   617     CleanupStack::PushL( observer );
       
   618     AssertNotNullL( observer, KCAknTransition );
       
   619     
       
   620     TInt res = CAknTransitionUtils::AddObserver( observer, 
       
   621         CAknTransitionUtils::EEventWsBufferRedirection );
       
   622     AssertTrueL( ETrue, KAddObserver );
       
   623     
       
   624     CAknTransitionUtils::RemoveObserver( observer, 
       
   625         CAknTransitionUtils::EEventWsBufferRedirection );
       
   626     AssertTrueL( ETrue, KRemoveObserver );
       
   627     
       
   628     TInt stat;
       
   629     CAknTransitionUtils::GetState( 
       
   630         CAknTransitionUtils::EEventWsBufferRedirection, 
       
   631         &stat );
       
   632     AssertTrueL( ETrue, KGetState );
       
   633     
       
   634     TInt skey( 0 ),sdata( 0 );
       
   635     CAknTransitionUtils::SetData( skey, &sdata );
       
   636     AssertTrueL( ETrue, KSetData );
       
   637     
       
   638     CAknTransitionUtils::GetData( skey );
       
   639     AssertTrueL( ETrue, KGetData );
       
   640     
       
   641     CAknTransitionUtils::RemoveData( skey );
       
   642     AssertTrueL( ETrue, KRemoveData );
       
   643     
       
   644     CAknTransitionUtils::SetAllParents( iContainer );
       
   645     AssertTrueL( ETrue, KSetAllParents );
       
   646     
       
   647     CAknTransitionUtils::TransitionsEnabled( sdata );
       
   648     AssertTrueL( ETrue, KTransitionsEnabled );
       
   649     
       
   650     CAknTransitionUtils::MakeVisibleSubComponents( iContainer, ETrue );
       
   651     AssertTrueL( ETrue, KMakeVisibleSubComponents );
       
   652     
       
   653     TRect rect;
       
   654     CAknTransitionUtils::GetDemarcation( 
       
   655         CAknTransitionUtils::EOptionsMenu, 
       
   656         rect );
       
   657     AssertTrueL( ETrue, KGetDemarcation );
       
   658     
       
   659     CleanupStack::PopAndDestroy( observer );
       
   660     AssertTrueL( ETrue, KDes );
       
   661     
       
   662     }
       
   663     
       
   664 // ---------------------------------------------------------------------------
       
   665 // CBCTestDomAknCase::TestCameralSettingPageL()
       
   666 // ---------------------------------------------------------------------------
       
   667 //    
       
   668 void CBCTestDomAknCase::TestCameraSettingPageL()
       
   669     {
       
   670     
       
   671     _LIT( KCAknTransparentCameraSettingPage, 
       
   672         "CAknTransparentCameraSettingPage::\
       
   673         CAknTransparentCameraSettingPage invoked" );
       
   674     _LIT( KCAknTransparentCameraSettingPageDes,
       
   675         "CAknTransparentCameraSettingPage::\
       
   676         ~CAknTransparentCameraSettingPage invoked" );
       
   677     _LIT( KCAknTransparentCameraSettingPageOverload,
       
   678         "CAknTransparentCameraSettingPage::\
       
   679         CAknTransparentCameraSettingPage overload invoked" );
       
   680     _LIT( KConstructL,
       
   681         "CAknTransparentCameraSettingPage::Constructor invoked" );
       
   682     _LIT( KListBoxControl,
       
   683         "CAknTransparentCameraSettingPage::ListBoxControl invoked" );
       
   684     _LIT( KSetItemArrayAndSelectionL,
       
   685         "CAknTransparentCameraSettingPage::\
       
   686         SetItemArrayAndSelectionL invoked" );
       
   687     _LIT( KChangeBackground,
       
   688         "CAknTransparentCameraSettingPage::ChangeBackground invoked" );
       
   689     _LIT( KSetBitmapPositionAndClipRect,
       
   690         "CAknTransparentCameraSettingPage::\
       
   691         SetBitmapPositionAndClipRect invoked" );
       
   692     _LIT( KUpdateSettingL,
       
   693         "CAknTransparentCameraSettingPage::UpdateSettingL invoked" );
       
   694     _LIT( KDynamicInitL,
       
   695         "CAknTransparentCameraSettingPage::DynamicInitL invoked" );
       
   696     _LIT( KSelectCurrentItemL,
       
   697         "CAknTransparentCameraSettingPage::SelectCurrentItemL invoked" );
       
   698     _LIT( KProcessCommandL,
       
   699         "CAknTransparentCameraSettingPage::ProcessCommandL invoked" );
       
   700     _LIT( KOfferKeyEventL,
       
   701         "CAknTransparentCameraSettingPage::OfferKeyEventL invoked" );
       
   702     _LIT( KSizeChanged,
       
   703         "CAknTransparentCameraSettingPage::SizeChanged invoked" );
       
   704     _LIT( KDraw,
       
   705         "CAknTransparentCameraSettingPage::Draw invoked" );
       
   706     _LIT( KExecuteLD,
       
   707         "CAknTransparentCameraSettingPage::ExecuteLD invoked" );
       
   708     _LIT( KHandleListBoxEventL,
       
   709         "CAknTransparentCameraSettingPage::HandleListBoxEventL invoked" );
       
   710     _LIT( KHandleResourceChange,
       
   711         "CAknTransparentCameraSettingPage::HandleResourceChange invoked" );
       
   712     _LIT( KHandleControlEventL,
       
   713         "CAknTransparentCameraSettingPage::HandleControlEventL invoked" );
       
   714     _LIT( KWriteInternalStateL,
       
   715         "CAknTransparentCameraSettingPage::WriteInternalStateL invoked" );
       
   716        
       
   717     TInt index( 0 );
       
   718     CPtrCArray* array = new ( ELeave ) CPtrCArray( 1 );
       
   719     TBuf<KDesLength> txt( KTitle );
       
   720     array->AppendL( txt );
       
   721     CleanupStack::PushL( array );
       
   722     
       
   723     CAknTransparentCameraSettingPageExt* settingpage = 
       
   724         new ( ELeave ) CAknTransparentCameraSettingPageExt( 
       
   725         R_BCTESTDOMAVKONPSLN_CHECKBOX_SETTING_PAGE, 
       
   726         index, 
       
   727         array );
       
   728     CleanupStack::PushL( settingpage ); 
       
   729     AssertNotNullL( settingpage, KCAknTransparentCameraSettingPage );
       
   730     
       
   731 
       
   732     settingpage->ConstructL();
       
   733     CleanupStack::Pop( settingpage );
       
   734     
       
   735     TRect rect( 0, 0, 0, 0 );
       
   736     settingpage->Draw( rect );
       
   737     AssertTrueL( ETrue, KDraw );
       
   738     settingpage->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted );
       
   739     AssertTrueL( ETrue, KExecuteLD );
       
   740     
       
   741     settingpage = NULL;
       
   742     AssertTrueL( ETrue, KCAknTransparentCameraSettingPageDes );
       
   743 
       
   744     settingpage = new ( ELeave ) CAknTransparentCameraSettingPageExt(
       
   745         &KTitle,
       
   746         0,
       
   747         0,
       
   748         0,
       
   749         R_BCTESTDOMAVKONPSLN_CHECKBOX_SETTING_PAGE,
       
   750         index,
       
   751         array );
       
   752     CleanupStack::PushL( settingpage );
       
   753     AssertNotNullL( settingpage, KCAknTransparentCameraSettingPageOverload );
       
   754     
       
   755     settingpage->ConstructL();
       
   756     AssertTrueL( ETrue, KConstructL );
       
   757     
       
   758     settingpage->ListBoxControl();
       
   759     AssertTrueL( ETrue, KListBoxControl );
       
   760     
       
   761     CEikListBox* list = new ( ELeave ) CEikListBox();
       
   762     CleanupStack::PushL( list );
       
   763     settingpage->HandleListBoxEventL( list, 
       
   764         MEikListBoxObserver::
       
   765         EEventEnterKeyPressed );
       
   766     AssertTrueL( ETrue, KHandleListBoxEventL );
       
   767     CleanupStack::PopAndDestroy( list );
       
   768     
       
   769     settingpage->SetItemArrayAndSelectionL( array, 0 );
       
   770     AssertTrueL( ETrue, KSetItemArrayAndSelectionL );
       
   771     
       
   772     TPoint point( 0, 0 );
       
   773     settingpage->SetBitmapPositionAndClipRect( point, rect );
       
   774     AssertTrueL( ETrue, KSetBitmapPositionAndClipRect );
       
   775     
       
   776     settingpage->HandleResourceChange( index );
       
   777     AssertTrueL( ETrue, KHandleResourceChange );
       
   778     
       
   779     settingpage->UpdateSettingL();
       
   780     AssertTrueL( ETrue, KUpdateSettingL );
       
   781     
       
   782     settingpage->DynamicInitL();
       
   783     AssertTrueL( ETrue, KDynamicInitL );
       
   784     
       
   785     settingpage->SelectCurrentItemL();
       
   786     AssertTrueL( ETrue, KSelectCurrentItemL );
       
   787     
       
   788     settingpage->HandleControlEventL( iContainer, 
       
   789         MCoeControlObserver::EEventRequestCancel );
       
   790     AssertTrueL( ETrue, KHandleControlEventL );
       
   791     
       
   792     TKeyEvent keyEvent = { EKeyPause, EStdKeySpace, 0, 0  };
       
   793     
       
   794     settingpage->OfferKeyEventL( keyEvent, EEventKey );
       
   795     AssertTrueL( ETrue, KOfferKeyEventL );
       
   796     
       
   797     settingpage->SizeChanged();
       
   798     AssertTrueL( ETrue, KSizeChanged );
       
   799     
       
   800     CFbsBitmap* bmp = NULL;
       
   801     bmp = AknIconUtils::CreateIconL( AknIconUtils::AvkonIconFileName(), 
       
   802         EMbmAvkonQgn_prop_nrtyp_note );
       
   803     CleanupStack::PushL( bmp );
       
   804     AssertNotNullL( bmp );
       
   805     
       
   806     settingpage->SetBitmapPositionAndClipRect( point, rect, ETrue );
       
   807     AssertTrueL( ETrue, KSetBitmapPositionAndClipRect );
       
   808     
       
   809     settingpage->ChangeBackground( bmp );
       
   810     AssertTrueL( ETrue, KChangeBackground );
       
   811     
       
   812     CCoeEnv::Static()->AppUi()->AddToStackL( settingpage );
       
   813     settingpage->ProcessCommandL( EAknSoftkeyHide );
       
   814     AssertTrueL( ETrue, KProcessCommandL );
       
   815     
       
   816     CCoeEnv::Static()->AppUi()->RemoveFromStack( settingpage );
       
   817     
       
   818     RFileWriteStream stream;
       
   819     stream.PushL();
       
   820     stream.Replace( CCoeEnv::Static()->FsSession(), KFilePath, EFileWrite );
       
   821     settingpage->WriteInternalStateL( stream );
       
   822     AssertTrueL( ETrue, KWriteInternalStateL );
       
   823     stream.Pop();
       
   824     stream.Close();
       
   825     
       
   826     CleanupStack::PopAndDestroy( bmp );
       
   827     CleanupStack::PopAndDestroy( settingpage );
       
   828     CleanupStack::PopAndDestroy( array );
       
   829     
       
   830     }
       
   831     
       
   832 // ----------------------------------------------------------------------------
       
   833 // Test AknVolumePopup.
       
   834 // ----------------------------------------------------------------------------
       
   835 //    
       
   836 void CBCTestDomAknCase::TestAknVolumePopupL()
       
   837     {
       
   838     _LIT( KNewL, "CAknVolumePopup::NewL invoked" );
       
   839     _LIT( KNewLOverLoad, "CAknVolumePopup::NewL overload invoked" );
       
   840     _LIT( KConstructFromResource, 
       
   841         "CAknVolumePopup::ConstructFromResourceL invoked" );
       
   842     _LIT( KCountComponentControls, 
       
   843         "CAknVolumePopup::CountComponentControls invoked" );
       
   844     _LIT( KComponentControl, "CAknVolumePopup::ComponentControl invoked" );
       
   845     _LIT( KHandlePointerEventL, "CAknVolumePopup::HandlePointerEventL invoked" );
       
   846     _LIT( KOfferKeyEventL, "CAknVolumePopup::OfferKeyEventL invoked" );
       
   847     _LIT( KHandleControlEventL, "CAknVolumePopup::HandleControlEventL invoked" );
       
   848     _LIT( KHandleVolumeKeyEventL, 
       
   849         "CAknVolumePopup::HandleVolumeKeyEventL invoked" );
       
   850     _LIT( KSetRange, "CAknVolumePopup::SetRange invoked" );
       
   851     _LIT( KGetRange, "CAknVolumePopup::GetRange invoked" );
       
   852     _LIT( KValue, "CAknVlumePopup::Value invoked" );
       
   853     _LIT( KSetTitleTextL, "CAknVlumePopup::SetTitleTextL invoked" );
       
   854     _LIT( KShowProfileName, "CAknVlumePopup::ShowProfileName invoked" );
       
   855     _LIT( KShowVolumePopupL, "CAknVlumePopup::ShowVolumePopupL invoked" );
       
   856     _LIT( KCloseVolumePopup, "CAknVlumePopup::CloseVolumePopup invoked" );
       
   857          
       
   858     TUid uid = TUid::Uid( KShareVolumeUid );
       
   859     CAknVolumePopup* vol = CAknVolumePopup
       
   860          ::NewL( uid, KTitle, KVolumeMaxValue );
       
   861     CleanupStack::PushL( vol );
       
   862     AssertNotNullL( vol, KNewL );
       
   863     CleanupStack::Pop( vol );
       
   864     delete vol;
       
   865     vol = NULL;
       
   866    
       
   867     vol = CAknVolumePopup
       
   868         ::ConstructFromResourceL( R_AVKON_POPUP_VOLUME_INDICATOR );
       
   869     CleanupStack::PushL( vol );
       
   870     AssertNotNullL( vol, KConstructFromResource );
       
   871     CleanupStack::Pop( vol );
       
   872     delete vol;
       
   873     vol = NULL;
       
   874     
       
   875     vol = CAknVolumePopup::NewL( KVolumeMaxValue );
       
   876     CleanupStack::PushL( vol );
       
   877     AssertNotNullL( vol, KNewLOverLoad );
       
   878  
       
   879     TInt val = vol->CountComponentControls();
       
   880     AssertTrueL( ETrue, KCountComponentControls );
       
   881     
       
   882     vol->ComponentControl( val );
       
   883     AssertTrueL( ETrue, KComponentControl );
       
   884     
       
   885     TWsEvent wsEvent;
       
   886     TPointerEvent* ptEvent = wsEvent.Pointer();
       
   887     vol->HandlePointerEventL( *ptEvent );
       
   888     AssertTrueL( ETrue, KHandlePointerEventL );
       
   889     
       
   890     TKeyEvent keyEvent = { EKeyPause, EStdKeySpace, 0, 0  };
       
   891     
       
   892     vol->OfferKeyEventL( keyEvent, EEventKey );
       
   893     AssertTrueL( ETrue, KOfferKeyEventL );
       
   894     
       
   895     vol->HandleControlEventL( iContainer, 
       
   896         MCoeControlObserver::EEventRequestCancel );
       
   897     AssertTrueL( ETrue, KHandleControlEventL );
       
   898     
       
   899     vol->HandleVolumeKeyEventL( keyEvent, EEventKey );
       
   900     AssertTrueL( ETrue, KHandleVolumeKeyEventL );
       
   901     
       
   902     vol->SetRange( KVolumeMinValue, KVolumeMaxValue );
       
   903     AssertTrueL( ETrue, KSetRange );
       
   904     
       
   905     TInt maxVal, minVal;
       
   906     vol->GetRange( minVal, maxVal );
       
   907     AssertTrueL( ETrue, KGetRange );
       
   908     
       
   909     vol->Value();
       
   910     AssertTrueL( ETrue, KValue );
       
   911     
       
   912     vol->SetTitleTextL( KTitle );
       
   913     AssertTrueL( ETrue, KSetTitleTextL );
       
   914     
       
   915     vol->ShowProfileName( ETrue );
       
   916     AssertTrueL( ETrue, KShowProfileName );
       
   917     
       
   918     vol->ShowVolumePopupL();
       
   919     AssertTrueL( ETrue, KShowVolumePopupL );
       
   920     
       
   921     vol->CloseVolumePopup();
       
   922     AssertTrueL( ETrue, KCloseVolumePopup );
       
   923     
       
   924     CleanupStack::Pop( vol );//vol
       
   925     delete vol;
       
   926     
       
   927     }
       
   928     
       
   929 // ----------------------------------------------------------------------------
       
   930 // TestLafSystemFontL
       
   931 // ----------------------------------------------------------------------------
       
   932 //    
       
   933 void CBCTestDomAknCase::TestLafSystemFontL()
       
   934     {
       
   935     _LIT( KNewL, "CLafSystemFont::NewL() invoked" );
       
   936     _LIT( KFont, "CLafSystemFont::Font() invoked" );
       
   937     _LIT( KUid, "CLafSystemFont::Uid() invoked" );
       
   938     _LIT( KDes, "CLafSystemFont::~CLafSystemFont() invoked" );
       
   939     CLafSystemFont* font = CLafSystemFont::NewL( KNullUid, NULL );
       
   940     CleanupStack::PushL( font );
       
   941     AssertNotNullL( font, KNewL );
       
   942     
       
   943     font->Font();
       
   944     AssertTrueL( ETrue, KFont );
       
   945     
       
   946     font->Uid();
       
   947     AssertTrueL( ETrue, KUid );
       
   948     
       
   949     CleanupStack::Pop( font );
       
   950     delete font;
       
   951     AssertTrueL( ETrue, KDes );
       
   952     }
       
   953 //end of file