uifw/AvKon/tsrc/bc/bctestdom3.2/bctestdomcoreui/src/bctestdomcoreuicase.cpp
changeset 21 558113899881
parent 0 2f259fa3e83a
equal deleted inserted replaced
14:3320e4e6e8bb 21:558113899881
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include <w32std.h>
    19 #include <w32std.h>
    20 #include <coecntrl.h>
    20 #include <coecntrl.h>
    21 #include <vuicaddvoicetagdialog.h>
    21 
    22 #include <vuicchangevoicetagdialog.h>
       
    23 #include <vuicerasevoicetagdialog.h>
       
    24 #include <vuicplaybackvoicetagdialog.h>
       
    25 #include <vuicvoicedialer.h>
       
    26 #include <vuicvoicetagcontact.h>
       
    27 #include <vuicvoicetagfield.h>
       
    28 #include <vuicvoicerecog.h>
       
    29 #include <vuicvoicerecogdialog.h>
       
    30 #include <bctestdomcoreui.rsg>
    22 #include <bctestdomcoreui.rsg>
    31 
    23 
    32 #include "bctestdomcoreuicase.h" 
    24 #include "bctestdomcoreuicase.h" 
    33 #include "bctestdomcoreuicontainer.h"
    25 #include "bctestdomcoreuicontainer.h"
    34 #include "bctestdomcoreui.hrh"
    26 #include "bctestdomcoreui.hrh"
   150 // ---------------------------------------------------------------------------
   142 // ---------------------------------------------------------------------------
   151 //    
   143 //    
   152 void CBCTestDomCoreUiCase::TestFunctionL()
   144 void CBCTestDomCoreUiCase::TestFunctionL()
   153     {
   145     {
   154     TestMenuSATInterfaceL();
   146     TestMenuSATInterfaceL();
   155     TestAddVoiceTagDialogL();
       
   156     TestChangeVoiceTagDialogL();
       
   157     TestEraseVoiceTagDialogL();
       
   158     TestVoiceDialerL();
       
   159     TestVoiceTagContactL();
       
   160     TestVoiceTagFieldL();
       
   161     TestVoiceRecogL();
   147     TestVoiceRecogL();
       
   148     TestVoiceRecognitionDialogL();
       
   149         
   162     }
   150     }
   163 
   151 
   164 // ---------------------------------------------------------------------------
   152 // ---------------------------------------------------------------------------
   165 // CBCTestDomCoreUiCase::TestMenuSATInterfaceL
   153 // CBCTestDomCoreUiCase::TestMenuSATInterfaceL
   166 // ---------------------------------------------------------------------------
   154 // ---------------------------------------------------------------------------
   183     _LIT( msiLogSatUi2, "CMenuSATInterface::MakeSatUiVisible( , , )" );
   171     _LIT( msiLogSatUi2, "CMenuSATInterface::MakeSatUiVisible( , , )" );
   184     AssertNotNullL( menuSI, msiLogSatUi2 );
   172     AssertNotNullL( menuSI, msiLogSatUi2 );
   185         
   173         
   186     CleanupStack::PopAndDestroy( menuSI );
   174     CleanupStack::PopAndDestroy( menuSI );
   187     }
   175     }
   188 
       
   189 // ---------------------------------------------------------------------------
       
   190 // CBCTestDomCoreUiCase::TestAddVoiceTagDialogL
       
   191 // ---------------------------------------------------------------------------
       
   192 //    
       
   193 void CBCTestDomCoreUiCase::TestAddVoiceTagDialogL()
       
   194     {
       
   195     CPbkContactEngine* pbk = CPbkContactEngine::NewL();
       
   196     CleanupStack::PushL( pbk );//push
       
   197     CPbkContactItem* contactItem = pbk->CreateEmptyContactL();
       
   198     CleanupStack::PushL( contactItem );//push
       
   199     
       
   200     CAddVoiceTagDialog* addDial = new( ELeave ) CAddVoiceTagDialog( *contactItem, 1 );
       
   201     CleanupStack::PushL( addDial );//push
       
   202     _LIT( msiLogAddVoiceTagDialog, "CAddVoiceTagDialog::CAddVoiceTagDialog()" );
       
   203     AssertNotNullL( addDial, msiLogAddVoiceTagDialog );
       
   204     
       
   205     addDial->ExecuteLD();
       
   206     _LIT( msiLogExecuteLD, "CAddVoiceTagDialog::ExecuteLD()" );
       
   207     AssertTrueL( ETrue, msiLogExecuteLD );
       
   208     
       
   209     CleanupStack::PopAndDestroy( addDial );
       
   210     CleanupStack::PopAndDestroy( contactItem );
       
   211     CleanupStack::PopAndDestroy( pbk );
       
   212     _LIT( msiLogDesc, "CAddVoiceTagDialog::~CAddVoiceTagDialog()" );
       
   213     AssertTrueL( ETrue, msiLogDesc );
       
   214 
       
   215     }
       
   216     
       
   217 // ---------------------------------------------------------------------------
       
   218 // CBCTestDomCoreUiCase::TestChangeVoiceTagDialogL
       
   219 // ---------------------------------------------------------------------------
       
   220 //    
       
   221 void CBCTestDomCoreUiCase::TestChangeVoiceTagDialogL()
       
   222     {
       
   223     CPbkContactEngine* pbk = CPbkContactEngine::NewL();
       
   224     CleanupStack::PushL( pbk ); //push
       
   225     CPbkContactItem* contactItem = pbk->CreateEmptyContactL();
       
   226     CleanupStack::PushL( contactItem );//push
       
   227     
       
   228     CChangeVoiceTagDialog  *changeDial = new( ELeave ) CChangeVoiceTagDialog( *contactItem, 1 );    
       
   229     CleanupStack::PushL( changeDial );//push, because ExecuteLD() just return a error.
       
   230     _LIT( msiLogChangeVoiceTagDialog, "CChangeVoiceTagDialog::CChangeVoiceTagDialog()" );
       
   231     AssertNotNullL( changeDial, msiLogChangeVoiceTagDialog );
       
   232 
       
   233     changeDial->ExecuteLD();
       
   234     _LIT( msiLogExecuteLD, "CChangeVoiceTagDialog::ExecuteLD()" );
       
   235     AssertTrueL( ETrue, msiLogExecuteLD );
       
   236     
       
   237     CleanupStack::PopAndDestroy( changeDial );
       
   238     CleanupStack::PopAndDestroy( contactItem );
       
   239     CleanupStack::PopAndDestroy( pbk );
       
   240     _LIT( msiLogDesc, "CChangeVoiceTagDialog::~CChangeVoiceTagDialog()" );
       
   241     AssertTrueL( ETrue, msiLogDesc );
       
   242     
       
   243     }
       
   244 
       
   245 // ---------------------------------------------------------------------------
       
   246 // CBCTestDomCoreUiCase::TestEraseVoiceTagDialogL
       
   247 // ---------------------------------------------------------------------------
       
   248 //    
       
   249 void CBCTestDomCoreUiCase::TestEraseVoiceTagDialogL()
       
   250     {
       
   251     CPbkContactEngine* pbk = CPbkContactEngine::NewL();
       
   252     CleanupStack::PushL( pbk );//push
       
   253     CPbkContactItem* contactItem = pbk->CreateEmptyContactL();
       
   254     CleanupStack::PushL( contactItem );//push
       
   255     
       
   256     CEraseVoiceTagDialog *eraseDial =new( ELeave ) CEraseVoiceTagDialog( *contactItem, 1 );
       
   257     CleanupStack::PushL( eraseDial );//push, because ExecuteLD() just return a error.
       
   258     _LIT( msiLogCEraseVoiceTagDialog, "CEraseVoiceTagDialog::CEraseVoiceTagDialog()" );
       
   259     AssertNotNullL( eraseDial, msiLogCEraseVoiceTagDialog );
       
   260 
       
   261     eraseDial->ExecuteLD();  
       
   262     _LIT( msiLogExecuteLD, "CEraseVoiceTagDialog::ExecuteLD()" );
       
   263     AssertTrueL( ETrue, msiLogExecuteLD );
       
   264     
       
   265     CleanupStack::PopAndDestroy( eraseDial );
       
   266     CleanupStack::PopAndDestroy( contactItem );
       
   267     CleanupStack::PopAndDestroy( pbk );
       
   268     _LIT( msiLogDesc, "CEraseVoiceTagDialog::~CEraseVoiceTagDialog()" );
       
   269     AssertTrueL( ETrue, msiLogDesc );
       
   270 
       
   271     }
       
   272     
       
   273 // ---------------------------------------------------------------------------
       
   274 // CBCTestDomCoreUiCase::TestVoiceDialerL
       
   275 // ---------------------------------------------------------------------------
       
   276 //    
       
   277 void CBCTestDomCoreUiCase::TestVoiceDialerL()
       
   278     {
       
   279     CVoiceDialer* voiceDial = CVoiceDialer::NewL();
       
   280     CleanupStack::PushL( voiceDial );//push
       
   281     _LIT( msiLogNewL, "CVoiceDialer::NewL()" );
       
   282     AssertNotNullL( voiceDial, msiLogNewL );
       
   283     _LIT( msiLogNewLC, "CVoiceDialer::NewLC()" );
       
   284     AssertTrueL( ETrue, msiLogNewLC );
       
   285         
       
   286     voiceDial->VoiceTagAvailable();  
       
   287     _LIT( msiLogVTA, "CVoiceDialer::VoiceTagAvailable()" );
       
   288     AssertTrueL( ETrue, msiLogVTA );
       
   289     
       
   290     CPbkContactEngine* pbk = CPbkContactEngine::NewL();
       
   291     CleanupStack::PushL( pbk );//push
       
   292     
       
   293     CPbkContactItem* contactItem = pbk->CreateEmptyContactL();
       
   294     CleanupStack::PushL( contactItem );//push
       
   295   
       
   296     voiceDial->EraseVoiceTag( *contactItem, 1 );
       
   297     _LIT( msiLogVT, "CVoiceDialer::EraseVoiceTag()" );
       
   298     AssertTrueL( ETrue, msiLogVT );
       
   299     
       
   300     CVoiceTagContact* voiceTag = CVoiceTagContact::NewL();
       
   301     CleanupStack::PushL( voiceTag );//push
       
   302     
       
   303     voiceDial->GetContactsWithVoiceTagL( *voiceTag );
       
   304     _LIT( msiLogGCW, "CVoiceDialer::GetContactsWithVoiceTagL()" );
       
   305     AssertTrueL( ETrue, msiLogGCW );
       
   306     
       
   307     CVoiceTagField *voiceTagField = CVoiceTagField::NewL();
       
   308     CleanupStack::PushL( voiceTagField );//push
       
   309     
       
   310     voiceDial->GetFieldsWithVoiceTagL( *contactItem , *voiceTagField );
       
   311     _LIT( msiLogGFW, "CVoiceDialer::GetFieldsWithVoiceTagL()" );
       
   312     AssertTrueL( ETrue, msiLogGFW );
       
   313     
       
   314     CleanupStack::PopAndDestroy( voiceTagField );
       
   315     CleanupStack::PopAndDestroy( voiceTag );
       
   316     CleanupStack::PopAndDestroy( contactItem );
       
   317     CleanupStack::PopAndDestroy( pbk );
       
   318     CleanupStack::PopAndDestroy( voiceDial );
       
   319 
       
   320     }
       
   321 
       
   322 // ---------------------------------------------------------------------------
       
   323 // CBCTestDomCoreUiCase::TestVoiceTagContactL
       
   324 // ---------------------------------------------------------------------------
       
   325 //    
       
   326 void CBCTestDomCoreUiCase::TestVoiceTagContactL()
       
   327     {
       
   328     CVoiceTagContact* voiceTagContact = CVoiceTagContact::NewL(); 
       
   329     CleanupStack::PushL( voiceTagContact );//push
       
   330     _LIT( msiLogNewL, "CVoiceTagContact::NewL()" );
       
   331     AssertNotNullL( voiceTagContact, msiLogNewL );
       
   332     _LIT( msiLogNewLC, "CVoiceTagContact::NewLC()" );
       
   333     AssertTrueL( ETrue, msiLogNewLC );
       
   334     
       
   335     TContactItemId aCID = 12345;
       
   336     
       
   337     voiceTagContact->AddL( aCID, 1 );
       
   338     _LIT( msiLogAddL, "CVoiceTagContact::AddL()" );
       
   339     AssertTrueL( ETrue, msiLogAddL );
       
   340 
       
   341     voiceTagContact->Count();
       
   342     _LIT( msiLogCount, "CVoiceTagContact::Count()" );
       
   343     AssertTrueL( ETrue, msiLogCount );
       
   344 
       
   345     voiceTagContact->ContactId( 0 );
       
   346     _LIT( msiLogContactId, "CVoiceTagContact::ContactId()" );
       
   347     AssertTrueL( ETrue, msiLogContactId );
       
   348 
       
   349     voiceTagContact->FieldIndex( 0 );
       
   350      _LIT( msiLogFieldIndex, "CVoiceTagContact::FieldIndex()" );
       
   351     AssertTrueL( ETrue, msiLogFieldIndex );
       
   352 
       
   353     voiceTagContact->Reset();
       
   354      _LIT( msiLogReset, "CVoiceTagContact::Reset()" );
       
   355     AssertTrueL( ETrue, msiLogReset );
       
   356 
       
   357     CleanupStack::PopAndDestroy( voiceTagContact );
       
   358    
       
   359     }
       
   360     
       
   361 // ---------------------------------------------------------------------------
       
   362 // CBCTestDomCoreUiCase::TestVoiceTagFieldL
       
   363 // ---------------------------------------------------------------------------
       
   364 //    
       
   365 void CBCTestDomCoreUiCase::TestVoiceTagFieldL()
       
   366     {
       
   367     CVoiceTagField* voiceTagField = CVoiceTagField::NewL();
       
   368     CleanupStack::PushL( voiceTagField );//push
       
   369     _LIT( msiLogNewL, "CVoiceTagField::NewL()" );
       
   370     AssertNotNullL( voiceTagField, msiLogNewL );
       
   371     _LIT( msiLogNewLC, "CVoiceTagField::NewLC()" );
       
   372     AssertTrueL( ETrue, msiLogNewLC );
       
   373     
       
   374     voiceTagField->AddL(0);
       
   375     _LIT( msiLogAddL, "CVoiceTagField::AddL()" );
       
   376     AssertTrueL( ETrue, msiLogAddL );
       
   377 
       
   378     voiceTagField->Count();
       
   379     _LIT( msiLogCount, "CVoiceTagField::Count()" );
       
   380     AssertTrueL( ETrue, msiLogCount );
       
   381 
       
   382     voiceTagField->FieldIndex(0);
       
   383      _LIT( msiLogFieldIndex, "CVoiceTagField::FieldIndex()" );
       
   384     AssertTrueL( ETrue, msiLogFieldIndex );
       
   385 
       
   386     voiceTagField->Reset();
       
   387      _LIT( msiLogReset, "CVoiceTagField::Reset()" );
       
   388     AssertTrueL( ETrue, msiLogReset );
       
   389     
       
   390     CleanupStack::PopAndDestroy( voiceTagField );    
       
   391     }
       
   392     
   176     
   393 // ---------------------------------------------------------------------------
   177 // ---------------------------------------------------------------------------
   394 // CBCTestDomCoreUiCase::TestVoiceRecogL
   178 // CBCTestDomCoreUiCase::TestVoiceRecogL
   395 // ---------------------------------------------------------------------------
   179 // ---------------------------------------------------------------------------
   396 //    
   180 //    
   397 void CBCTestDomCoreUiCase::TestVoiceRecogL()
   181 void CBCTestDomCoreUiCase::TestVoiceRecogL()
   398     {
   182     {
   399     CVoiceRecog* voiceRecog = CVoiceRecog::NewL();
   183  
   400     CleanupStack::PushL( voiceRecog );//push
       
   401 
       
   402     _LIT( msiLogNewL, "VoiceRecog::NewL()" );
       
   403     AssertNotNullL( voiceRecog, msiLogNewL );
       
   404     _LIT( msiLogNewLC, "VoiceRecog::NewLC()" );
       
   405     AssertTrueL( ETrue, msiLogNewLC );
       
   406 
       
   407     CleanupStack::PopAndDestroy( voiceRecog );    
       
   408     }
   184     }
   409 
   185 
   410 // ---------------------------------------------------------------------------
       
   411 // CBCTestDomCoreUiCase::TestPlaybackVoiceTagDialogL
       
   412 // ---------------------------------------------------------------------------
       
   413 //    
       
   414 void CBCTestDomCoreUiCase::TestPlaybackVoiceTagDialogL()
       
   415     {
       
   416     CPbkContactEngine* pbk = CPbkContactEngine::NewL();
       
   417     CleanupStack::PushL( pbk );//push
       
   418     CPbkContactItem* contactItem = pbk->CreateEmptyContactL();
       
   419     CleanupStack::PushL( contactItem );//push
       
   420 
       
   421     TContactItemId contactItemId = contactItem->Id();
       
   422     
       
   423     CPlaybackVoiceTagDialog* playbackDial = new( ELeave ) CPlaybackVoiceTagDialog( contactItemId, 0);
       
   424     _LIT( msiLogCon, "CPlaybackVoiceTagDialog::CPlaybackVoiceTagDialog()" );
       
   425     AssertTrueL( ETrue, msiLogCon );
       
   426     
       
   427     MNssContextListArray* contList = NULL;
       
   428     TInt errorCode = 0;
       
   429     playbackDial->GetContextListCompleted( contList, errorCode);
       
   430   
       
   431     //error,can't find resource.
       
   432     TRAPD( error, playbackDial->ExecuteLD() )
       
   433 
       
   434     if( error )
       
   435     {
       
   436     _LIT( msiLogErr, "some resources can't be find!" );
       
   437     AssertTrueL( ETrue, msiLogErr );
       
   438     }
       
   439     else
       
   440     {
       
   441     _LIT( msiLogExecuteLD, "CPlaybackVoiceTagDialog::ExecuteLD()" );        
       
   442     AssertTrueL( ETrue, msiLogExecuteLD );
       
   443     }
       
   444    
       
   445     CleanupStack::PopAndDestroy( contactItem );
       
   446     CleanupStack::PopAndDestroy( pbk );
       
   447     _LIT( msiLogDesc, "::~CPlaybackVoiceTagDialog()" );
       
   448     AssertTrueL( ETrue, msiLogDesc );
       
   449     
       
   450     }
       
   451     
       
   452 // ---------------------------------------------------------------------------
   186 // ---------------------------------------------------------------------------
   453 // CBCTestDomCoreUiCase::TestVoiceRecognitionDialogL
   187 // CBCTestDomCoreUiCase::TestVoiceRecognitionDialogL
   454 // ---------------------------------------------------------------------------
   188 // ---------------------------------------------------------------------------
   455 //    
   189 //    
   456 void CBCTestDomCoreUiCase::TestVoiceRecognitionDialogL()
   190 void CBCTestDomCoreUiCase::TestVoiceRecognitionDialogL()
   457     {
   191     {
   458     CVoiceRecognitionDialog* voiceRec = new( ELeave ) CVoiceRecognitionDialog();
       
   459     _LIT( msiLogVRD, "CVoiceRecognitionDialog::CVoiceRecognitionDialog()" );
       
   460     AssertTrueL( ETrue, msiLogVRD );
       
   461     
       
   462     voiceRec->ExecuteLD();
       
   463     _LIT( msiLogExecuteLD, "CVoiceRecognitionDialog::ExecuteLD()" );
       
   464     AssertTrueL( ETrue, msiLogExecuteLD );
       
   465 
   192 
   466     CVoiceRecognitionDialog* voiceRec2 = new( ELeave ) CVoiceRecognitionDialog();
       
   467     voiceRec2->Cancel();
       
   468     _LIT( msiLogCancel, "CVoiceRecognitionDialog::Cancel()" );
       
   469     AssertTrueL( ETrue, msiLogCancel );
       
   470 
       
   471     _LIT( msiLogDesc, "CVoiceRecognitionDialog::~CVoiceRecognitionDialog()" );
       
   472     AssertTrueL( ETrue, msiLogDesc );
       
   473     
   193     
   474     }
   194     }
   475 
   195