phoneengine/phoneservices/tsrc/ut_phoneservices/unit_tests.cpp
changeset 45 6b911d05207e
parent 37 ba76fc04e6c2
child 46 bc5a64e5bc3c
equal deleted inserted replaced
37:ba76fc04e6c2 45:6b911d05207e
    19 
    19 
    20 //#include <hbglobal_p.h>
    20 //#include <hbglobal_p.h>
    21 #include "phoneservices.h"
    21 #include "phoneservices.h"
    22 #include "dialservice.h"
    22 #include "dialservice.h"
    23 #include "dtmfservice.h"
    23 #include "dtmfservice.h"
    24 #include "keysequencerecognitionservice.h"
       
    25 #include "mpekeysequencerecognitionif.h"
       
    26 
    24 
    27 bool m_dialServiceConstructed;
    25 bool m_dialServiceConstructed;
    28 bool m_dtmfServiceConstructed;
    26 bool m_dtmfServiceConstructed;
    29 bool g_keySequenceServiceConstructed;
       
    30 MPECallControlIF* m_dialServiceCallPointer;
    27 MPECallControlIF* m_dialServiceCallPointer;
    31 MPECallSettersIF* m_dialServiceParameterPointer;
    28 MPECallSettersIF* m_dialServiceParameterPointer;
    32 MPEKeySequenceRecognitionIF* g_keySequenceRecognizerParameterPointer;
       
    33 MPECallControlIF* m_dtmfServiceCallPointer;
    29 MPECallControlIF* m_dtmfServiceCallPointer;
    34 MPECallSettersIF* m_dtmfServiceParameterPointer;
    30 MPECallSettersIF* m_dtmfServiceParameterPointer;
    35 
    31 
    36 class TestPhoneServices 
    32 class TestPhoneServices 
    37     : 
    33     : 
    38     public QObject,
    34     public QObject,
    39     public MPECallControlIF,
    35     public MPECallControlIF,
    40     public MPECallSettersIF,
    36     public MPECallSettersIF
    41     public MPEKeySequenceRecognitionIF
       
    42 {
    37 {
    43     Q_OBJECT
    38     Q_OBJECT
    44 public:
    39 public:
    45     TestPhoneServices();
    40     TestPhoneServices();
    46     virtual ~TestPhoneServices();    
    41     virtual ~TestPhoneServices();    
    47 
    42 
    48 public:
       
    49     TBool ExecuteKeySequenceL(const TDesC16& aSequence);
       
    50     
       
    51 public slots:
    43 public slots:
    52     void initTestCase ();
    44     void initTestCase ();
    53     void cleanupTestCase ();
    45     void cleanupTestCase ();
    54     void init ();
    46     void init ();
    55     void cleanup ();
    47     void cleanup ();
   163 
   155 
   164 void DTMFService::stopDTMFPlay()
   156 void DTMFService::stopDTMFPlay()
   165 {
   157 {
   166 }
   158 }
   167 
   159 
   168 KeySequenceRecognitionService::KeySequenceRecognitionService(
       
   169     MPEKeySequenceRecognitionIF &keySequenceRecognizer,
       
   170     QObject* parent) 
       
   171     : 
       
   172     XQServiceProvider(
       
   173         QLatin1String("com.nokia.symbian.IDtmfPlay"), parent),
       
   174         m_keySequenceRecognizer(keySequenceRecognizer)
       
   175 {
       
   176     g_keySequenceServiceConstructed = true;
       
   177     g_keySequenceRecognizerParameterPointer = &keySequenceRecognizer;
       
   178 }
       
   179 
       
   180 bool KeySequenceRecognitionService::executeKeySequence(
       
   181     const QString &keySequence)
       
   182 {
       
   183     Q_UNUSED(keySequence);
       
   184     return true;
       
   185 }
       
   186 
       
   187 KeySequenceRecognitionService::~KeySequenceRecognitionService()
       
   188 {
       
   189 }
       
   190 
       
   191 TestPhoneServices::TestPhoneServices ()
   160 TestPhoneServices::TestPhoneServices ()
   192 {
   161 {
   193 }
   162 }
   194 
   163 
   195 TestPhoneServices::~TestPhoneServices ()
   164 TestPhoneServices::~TestPhoneServices ()
   216     m_handlePlayDTMFLCalled = false;
   185     m_handlePlayDTMFLCalled = false;
   217     m_setKeyCodeCalled = false;
   186     m_setKeyCodeCalled = false;
   218     keyValue = -1;
   187     keyValue = -1;
   219     m_dialServiceConstructed = false;
   188     m_dialServiceConstructed = false;
   220     m_dtmfServiceConstructed = false;
   189     m_dtmfServiceConstructed = false;
   221     g_keySequenceServiceConstructed = false;
   190     
   222     
   191     m_phoneServices = new PhoneServices(*this, *this, this);
   223     m_phoneServices = new PhoneServices (*this, *this, *this, this);
       
   224 
   192 
   225     QVERIFY(m_dialServiceConstructed == true);
   193     QVERIFY(m_dialServiceConstructed == true);
   226     QVERIFY(m_dialServiceCallPointer == this);
   194     QVERIFY(m_dialServiceCallPointer == this);
   227     QVERIFY(m_dialServiceParameterPointer == this);
   195     QVERIFY(m_dialServiceParameterPointer == this);
   228     
   196     
   229     QVERIFY(m_dtmfServiceConstructed == true);
   197     QVERIFY(m_dtmfServiceConstructed == true);
   230     QVERIFY(m_dtmfServiceCallPointer == this);
   198     QVERIFY(m_dtmfServiceCallPointer == this);
   231     QVERIFY(m_dtmfServiceParameterPointer == this);
   199     QVERIFY(m_dtmfServiceParameterPointer == this);
   232     
       
   233     QVERIFY(g_keySequenceServiceConstructed == true);
       
   234     QVERIFY(g_keySequenceRecognizerParameterPointer == this);
       
   235 }
   200 }
   236 
   201 
   237 void TestPhoneServices::cleanup ()
   202 void TestPhoneServices::cleanup ()
   238 {
   203 {
   239     delete m_phoneServices;
   204     delete m_phoneServices;
   240 }
       
   241 
       
   242 TBool TestPhoneServices::ExecuteKeySequenceL(const TDesC16& aSequence)
       
   243 {
       
   244     Q_UNUSED(aSequence)
       
   245     return ETrue;
       
   246 }
   205 }
   247 
   206 
   248 void TestPhoneServices::SetKeyCode( const TChar& aKeyCode )
   207 void TestPhoneServices::SetKeyCode( const TChar& aKeyCode )
   249 {
   208 {
   250     m_setKeyCodeCalled = true;
   209     m_setKeyCodeCalled = true;