mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/src/unittest_mpmpxplaybackframeworkwrapper.cpp
equal
deleted
inserted
replaced
22 #include "mpxaudioeffectengine.h" |
22 #include "mpxaudioeffectengine.h" |
23 #include "unittest_mpmpxplaybackframeworkwrapper.h" |
23 #include "unittest_mpmpxplaybackframeworkwrapper.h" |
24 #include "stub/inc/mpplaybackdata.h" |
24 #include "stub/inc/mpplaybackdata.h" |
25 #include "stub/inc/mpxplaybackutility.h" |
25 #include "stub/inc/mpxplaybackutility.h" |
26 #include "stub/inc/mpsongdata.h" |
26 #include "stub/inc/mpsongdata.h" |
|
27 #include "stub/inc/mpmpxembeddedplaybackhelper.h" |
27 |
28 |
28 // Do this so we can access all member variables. |
29 // Do this so we can access all member variables. |
29 #define private public |
30 #define private public |
30 #include "mpmpxplaybackframeworkwrapper.h" |
31 #include "mpmpxplaybackframeworkwrapper.h" |
31 #include "mpmpxplaybackframeworkwrapper_p.h" |
32 #include "mpmpxplaybackframeworkwrapper_p.h" |
481 void TestMpMpxPlaybackFrameworkWrapper::testPlay() |
482 void TestMpMpxPlaybackFrameworkWrapper::testPlay() |
482 { |
483 { |
483 //Play from filename |
484 //Play from filename |
484 QString fileName = QString("z:\\system\\data\\nullsound.mp3"); |
485 QString fileName = QString("z:\\system\\data\\nullsound.mp3"); |
485 mTest->play( fileName ); |
486 mTest->play( fileName ); |
486 QVERIFY( mTestPrivate->iPlaybackUtility->iInitialized ); |
487 QCOMPARE( mTestPrivate->iEmbeddedPlaybackHelper->iFileNameToPlay, fileName ); |
487 |
488 |
488 //Play from Shareable file |
489 //Play from Shareable file |
489 mTestPrivate->iPlaybackUtility->iInitialized = false; |
490 mTestPrivate->iPlaybackUtility->iInitialized = false; |
490 _LIT( KMPXNullSoundPath, "z:\\system\\data\\nullsound.mp3" ); |
491 _LIT( KMPXNullSoundPath, "z:\\system\\data\\nullsound.mp3" ); |
491 RFs fileServerSession; |
492 RFs fileServerSession; |
496 err = file.Open( fileServerSession, KMPXNullSoundPath, EFileShareReadersOrWriters ); |
497 err = file.Open( fileServerSession, KMPXNullSoundPath, EFileShareReadersOrWriters ); |
497 if( err == KErrNone ) { |
498 if( err == KErrNone ) { |
498 XQSharableFile* sFile = new XQSharableFile(file); |
499 XQSharableFile* sFile = new XQSharableFile(file); |
499 |
500 |
500 mTest->play( *sFile ); |
501 mTest->play( *sFile ); |
501 QVERIFY( mTestPrivate->iPlaybackUtility->iInitialized ); |
502 QCOMPARE( mTestPrivate->iEmbeddedPlaybackHelper->iFileNameToPlay, sFile->fileName() ); |
502 |
503 |
503 sFile->close(); |
504 sFile->close(); |
504 delete sFile; |
505 delete sFile; |
505 sFile = 0; |
506 sFile = 0; |
506 fileServerSession.Close(); |
507 fileServerSession.Close(); |
510 } |
511 } |
511 } |
512 } |
512 else { |
513 else { |
513 QWARN("Not able to create RF Session"); |
514 QWARN("Not able to create RF Session"); |
514 } |
515 } |
|
516 |
|
517 //Play empty filename |
|
518 QSignalSpy spy(mTest, SIGNAL(corruptedStop( bool ))); |
|
519 QList<QVariant> arguments; |
|
520 QString emptyFileName = ""; |
|
521 mTest->play( emptyFileName ); |
|
522 QVERIFY( spy.count() == 1 ); |
|
523 arguments = spy.takeFirst(); |
|
524 QVERIFY( arguments.at(0).toBool() == true ); |
515 |
525 |
516 //Play command |
526 //Play command |
517 cleanup(); |
527 cleanup(); |
518 init(); |
528 init(); |
519 mTest->play(); |
529 mTest->play(); |