phoneapp/phoneuiqtviewadapter/tsrc/ut_phoneuiqtviewadapter/unit_tests.cpp
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 27 2f8f8080a020
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
    32 #include "tphonecmdparamcallstatedata.h"
    32 #include "tphonecmdparamcallstatedata.h"
    33 #include "tphonecmdparamcallheaderdata.h"
    33 #include "tphonecmdparamcallheaderdata.h"
    34 #include "tphonecmdparamemergencycallheaderdata.h"
    34 #include "tphonecmdparamemergencycallheaderdata.h"
    35 #include "tphonecmdparamboolean.h"
    35 #include "tphonecmdparamboolean.h"
    36 #include "tphonecmdparamringtone.h"
    36 #include "tphonecmdparamringtone.h"
       
    37 #include "tphonecmdparamkeycapture.h"
    37 #include "pevirtualengine.h"
    38 #include "pevirtualengine.h"
    38 #include "bubblemanagerif.h"
    39 #include "bubblemanagerif.h"
    39 #include "phoneresourceids.h"
    40 #include "phoneresourceids.h"
    40 #include "phonebubblewrapper.h"
    41 #include "phonebubblewrapper.h"
    41 #include "phoneuiqtbuttonscontroller.h"
    42 #include "phoneuiqtbuttonscontroller.h"
    42 #include "tphonecmdparamglobalnote.h"
    43 #include "tphonecmdparamglobalnote.h"
    43 #include "tphonecmdparamstring.h"
    44 #include "tphonecmdparamstring.h"
       
    45 #include "phoneindicatorcontroller.h"
    44 
    46 
    45 extern int m_phoneButtonFlags;
    47 extern int m_phoneButtonFlags;
    46 extern bool m_EPhoneViewMuteRingToneOnAnswer_called;
    48 extern bool m_EPhoneViewMuteRingToneOnAnswer_called;
    47 extern bool m_EPhoneViewStopRingTone_called;
    49 extern bool m_EPhoneViewStopRingTone_called;
    48 extern bool m_EPhoneViewMuteRingTone_called;
    50 extern bool m_EPhoneViewMuteRingTone_called;
    54 extern bool m_removeDtmfNoteCalled;
    56 extern bool m_removeDtmfNoteCalled;
    55 extern bool m_removeNoteCalled;
    57 extern bool m_removeNoteCalled;
    56 extern bool m_removeQueryCalled;
    58 extern bool m_removeQueryCalled;
    57 extern bool m_showNoteCalled;
    59 extern bool m_showNoteCalled;
    58 extern bool m_removeGlobalWaitNoteCalled;
    60 extern bool m_removeGlobalWaitNoteCalled;
       
    61 extern bool m_ordinalPositionCalled;
       
    62 extern bool m_sendToBackgroundCalled;
    59 
    63 
    60 
    64 
    61 #define PHONE_QT_VIEW_ADAPTER_TEST_MAIN(TestObject) \
    65 #define PHONE_QT_VIEW_ADAPTER_TEST_MAIN(TestObject) \
    62 int main(int argc, char *argv[]) \
    66 int main(int argc, char *argv[]) \
    63     { \
    67     { \
   100     void setToolbarActions (const QList<PhoneAction*>& actions) {m_toolbarActionCount = actions.count(); };
   104     void setToolbarActions (const QList<PhoneAction*>& actions) {m_toolbarActionCount = actions.count(); };
   101     int volumeSliderValue () { m_volumeSliderValueCalled = true; return 5; };
   105     int volumeSliderValue () { m_volumeSliderValueCalled = true; return 5; };
   102     void removeVolumeSlider () { m_removeVolumeSliderCalled = true; };
   106     void removeVolumeSlider () { m_removeVolumeSliderCalled = true; };
   103     void setVolumeSliderValue (
   107     void setVolumeSliderValue (
   104             int value, 
   108             int value, 
   105             int commandId, 
   109             int , 
   106             int maxVolumeValue, 
   110             int , 
   107             int minVolumeValue ) { m_setVolumeSliderValueCalled = true; m_volumeSliderValue = value; };
   111             int  ) { m_setVolumeSliderValueCalled = true; m_volumeSliderValue = value; };
   108 
   112 
   109     void setExpandAction(int bubbleId, int commandId) {m_expandAction[bubbleId]=commandId;};
   113     void setExpandAction(int bubbleId, int commandId) {m_expandAction[bubbleId]=commandId;};
   110     void removeExpandAction(int bubbleId) {};
   114     void removeExpandAction(int ) {};
   111     void showDialpad() {m_showDialpadCalled = true;};  
   115     void showDialpad() {m_showDialpadCalled = true;};  
   112     void hideDialpad() {m_hideDialpadCalled = true;};  
   116     void hideDialpad() {m_hideDialpadCalled = true;};  
   113     bool isDialpadVisible() 
   117     bool isDialpadVisible() 
   114         {m_dialpadVisibilityCalled = true;
   118         {m_dialpadVisibilityCalled = true;
   115     return m_isDialpadVisible; }
   119     return m_isDialpadVisible; }
   116     QString dialpadText() {return m_dialpadText;};
   120     QString dialpadText() {return m_dialpadText;};
       
   121     void clearDialpad() {};
   117     void clearAndHideDialpad() { m_clearAndHideDialpadCalled = true;};
   122     void clearAndHideDialpad() { m_clearAndHideDialpadCalled = true;};
   118     void bringToForeground() {;};
   123     void bringToForeground() {};
   119     void setMenuActions(const QList<PhoneAction*>& actions) { m_setMenuActionsCalled = true;};
   124     void setMenuActions(const QList<PhoneAction*>& ) { m_setMenuActionsCalled = true;};
   120     void shutdownPhoneApp() {;};
   125     void shutdownPhoneApp() {};
   121     void setBackButtonVisible(bool visible) {;};
   126     void setBackButtonVisible(bool ) {};
   122     HbMenu &menuReference(){return m_menu;};
   127     HbMenu &menuReference(){return m_menu;};
       
   128     void captureKey(Qt::Key key, bool capture) {
       
   129         m_capturedKey = key;
       
   130         m_captured = capture;};
   123     
   131     
   124     // From BubbleManagerIF
   132     // From BubbleManagerIF
   125     void startChanges () { m_startChangesCalled=true; };
   133     void startChanges () { m_startChangesCalled=true; };
   126     void endChanges () { m_endChangesCalled=true; };
   134     void endChanges () { m_endChangesCalled=true; };
   127     int createCallHeader () { return 0; };
   135     int createCallHeader () { return 0; };
   128     void removeCallHeader (int bubbleId) {};
   136     void removeCallHeader (int ) {};
   129     void setState (int bubbleId, PhoneCallState state) {};
   137     void setState (int , PhoneCallState ) {};
   130     void setLabel ( 
   138     void setLabel ( 
   131         int bubbleId, 
   139         int , 
   132         const QString& text, 
   140         const QString& , 
   133         Qt::TextElideMode clipDirection) {};
   141         Qt::TextElideMode ) {};
   134     void setCli (int bubbleId, 
   142     void setCli (int , 
   135                  const QString& cliText, 
   143                  const QString& , 
   136                  Qt::TextElideMode clipDirection) {};
   144                  Qt::TextElideMode ) {};
   137     void updateCLI ( 
   145     void updateCLI ( 
   138         int bubbleId, 
   146         int , 
   139         const QString& cliText, 
   147         const QString& , 
   140         Qt::TextElideMode clipDirection) {};
   148         Qt::TextElideMode ) {};
   141     void setSecondaryCli ( 
   149     void setSecondaryCli ( 
   142         int bubbleId, 
   150         int , 
   143         const QString& cliText, 
   151         const QString& , 
   144         Qt::TextElideMode clipDirection = Qt::ElideLeft) {};
   152         Qt::TextElideMode ) {};
   145     void setCallTime (int bubbleId, const QString& callTime) {};
   153     void setCallTime (int , const QString& ) {};
   146     void updateCallTime (int bubbleId, const QString& callTime) { m_updateCallTimeCalled=true; m_int=bubbleId; m_string=callTime; };
   154     void updateCallTime (int bubbleId, const QString& callTime) { m_updateCallTimeCalled=true; m_int=bubbleId; m_string=callTime; };
   147     void setCallObjectImage (int bubbleId, const QString &fileName) {};
   155     void setCallObjectImage (int , const QString &) {};
   148     void setCallObjectFromTheme (int bubbleId) {};
   156     void setCallObjectFromTheme (int ) {};
   149     void setCallObjectText (int bubbleId, const QString &text) {};
   157     void setCallObjectText (int , const QString &) {};
   150     void setCallFlags (int bubbleId, int flags) {};
   158     void setCallFlags (int , int ) {};
   151     void setCallFlag (int bubbleId, PhoneCallFlags flag, bool set) {};
   159     void setCallFlag (int , PhoneCallFlags , bool ) {};
   152     void setNumberType (int bubbleId, PhoneNumberType type) {};
   160     void setNumberType (int , PhoneNumberType ) {};
   153     void updateCallHeaderText( 
   161     void updateCallHeaderText( 
   154         int bubbleId, 
   162         int , 
   155         const QString &longText, 
   163         const QString &, 
   156         const QString &shortText, 
   164         const QString &, 
   157         Qt::TextElideMode clipDirection) {};
   165         Qt::TextElideMode ) {};
   158     void setPhoneMuted (bool muted) { m_setPhoneMutedCalled = muted; };
   166     void setPhoneMuted (bool muted) { m_setPhoneMutedCalled = muted; };
   159     int createConference (int bubble1, int bubble2) { return 1; };
   167     int createConference (int , int ) { return 1; };
   160     void removeConference () {};
   168     void removeConference () {};
   161     void addRowToConference (int bubbleId) {};
   169     void addRowToConference (int ) {};
   162     void removeRowFromConference (int bubbleId) {};
   170     void removeRowFromConference (int ) {};
   163     int conferenceRowCount () const { return 2; };
   171     int conferenceRowCount () const { return 2; };
   164     void setSelectionInConference (int rowNumber) {};
   172     void setSelectionInConference (int ) {};
   165     void setSelectionIdInConference (int bubbleId) {};
   173     void setSelectionIdInConference (int ) {};
   166     int selectionInConference () const { return 0; };
   174     int selectionInConference () const { return 0; };
   167     int selectionIdInConference () const { return 0; };
   175     int selectionIdInConference () const { return 0; };
   168     void moveHighlightOneUpInConference () {};
   176     void moveHighlightOneUpInConference () {};
   169     void moveHighlightOneDownInConference () {};
   177     void moveHighlightOneDownInConference () {};
   170     void setExpandedConferenceCallHeader (bool expanded) { m_ExpandConferenceCalled = true; };
   178     void setExpandedConferenceCallHeader (bool ) { m_ExpandConferenceCalled = true; };
   171     bool isConferenceExpanded () const { return false; };
   179     bool isConferenceExpanded () const { return false; };
   172     int shownHeaderCount () const { return 1; };
   180     int shownHeaderCount () const { return 1; };
   173     void setParticipantListCli (int aBubbleId, ParticipantListCli aParticipantCli) {};
   181     void setParticipantListCli (int , ParticipantListCli ) {};
   174     void addAction (int bubble, HbAction *action) {};
   182     void addAction (int , HbAction *) {};
   175     void clearActions (int bubble) {};
   183     void clearActions (int ) {};
   176     QGraphicsWidget* graphicsWidgetForAction (HbAction *action) const { return 0;};
   184     QGraphicsWidget* graphicsWidgetForAction (HbAction *) const { return 0;};
   177     void addParticipantListAction (HbAction *action) {};
   185     void addParticipantListAction (HbAction *) {};
   178     int expandedBubble() const { return 1; };
   186     int expandedBubble() const { return 1; };
   179     void setExpandAction(int bubbleId, HbAction* action) {};
   187     void setExpandAction(int , HbAction* ) {};
   180     void setBubbleSelectionDisabled(bool b) {};
   188     void setBubbleSelectionDisabled(bool ) {};
       
   189     void setRestrictedMode(bool ) {};
   181     
   190     
   182 signals:
   191 signals:
   183     void dialpadAboutToClose();
   192     void dialpadAboutToClose();
   184     void keyPressReleased(QKeyEvent *event);
   193     void keyPressReleased(QKeyEvent *event);
       
   194     void windowActivated();
       
   195     void windowDeactivated();
   185 
   196 
   186 public slots:
   197 public slots:
   187     void initTestCase ();
   198     void initTestCase ();
   188     void cleanupTestCase ();
   199     void cleanupTestCase ();
   189     void init ();
   200     void init ();
   232     void testNoteController();
   243     void testNoteController();
   233     void testHsToForegroundAfterCall();
   244     void testHsToForegroundAfterCall();
   234     void testCipheringInfoChange();
   245     void testCipheringInfoChange();
   235     void testSetHidden();
   246     void testSetHidden();
   236     void testBeginEndUiUpdate();
   247     void testBeginEndUiUpdate();
       
   248     void testIndicatorController();
       
   249     void testOpenLogs();
       
   250     void testSetFlags();
       
   251     void testCaptureEndKey();
   237 
   252 
   238 private:
   253 private:
   239     PhoneUIQtViewAdapter *m_adapter; // class under test
   254     PhoneUIQtViewAdapter *m_adapter; // class under test
   240     bool m_showToolbarCalled;
   255     bool m_showToolbarCalled;
   241     bool m_updateCallTimeCalled;
   256     bool m_updateCallTimeCalled;
   259     bool m_ExpandConferenceCalled;
   274     bool m_ExpandConferenceCalled;
   260     bool m_setMenuActionsCalled;
   275     bool m_setMenuActionsCalled;
   261     bool m_isDialpadVisible;
   276     bool m_isDialpadVisible;
   262     QString m_dialpadText;
   277     QString m_dialpadText;
   263     HbMenu m_menu;
   278     HbMenu m_menu;
   264 
   279     bool m_captured;
       
   280     Qt::Key m_capturedKey;
       
   281     QList<int> mParticipantListActions;
   265 };
   282 };
   266 
   283 
   267 TestPhoneUIQtViewAdapter::TestPhoneUIQtViewAdapter () :
   284 TestPhoneUIQtViewAdapter::TestPhoneUIQtViewAdapter () :
   268     m_isDialpadVisible(false),
   285     m_isDialpadVisible(false),
   269     m_dialpadText("1234567")
   286     m_dialpadText("1234567")
   322     }
   339     }
   323 }
   340 }
   324 
   341 
   325 void TestPhoneUIQtViewAdapter::addParticipantListAction(
   342 void TestPhoneUIQtViewAdapter::addParticipantListAction(
   326     int commandId,
   343     int commandId,
   327     const QString& text, 
   344     const QString& , 
   328     const HbIcon& icon)
   345     const HbIcon& )
   329 {
   346 {
   330 
   347     mParticipantListActions.append(commandId);
   331 }
   348 }
   332 
   349 
   333 void TestPhoneUIQtViewAdapter::clearParticipantListActions()
   350 void TestPhoneUIQtViewAdapter::clearParticipantListActions()
   334 {
   351 {
   335 
   352     mParticipantListActions.clear();
   336 }
   353 }
   337 
   354 
   338 void TestPhoneUIQtViewAdapter::testEPhoneViewSetTopApplicationCommand ()
   355 void TestPhoneUIQtViewAdapter::testEPhoneViewSetTopApplicationCommand ()
   339 {
   356 {
   340     TPhoneCmdParamInteger intParam;
   357     TPhoneCmdParamInteger intParam;
   404     QCOMPARE (m_bubblewrapperint, 1);
   421     QCOMPARE (m_bubblewrapperint, 1);
   405     
   422     
   406     QVERIFY (m_setCipheringCalled == true);
   423     QVERIFY (m_setCipheringCalled == true);
   407     
   424     
   408     QVERIFY (m_endChangesCalled == true);
   425     QVERIFY (m_endChangesCalled == true);
       
   426     
       
   427     QVERIFY (m_setActiveCallCalled == true);
       
   428     
       
   429     
   409 }
   430 }
   410 
   431 
   411 void TestPhoneUIQtViewAdapter::testEPhoneViewCreateEmergencyCallHeader ()
   432 void TestPhoneUIQtViewAdapter::testEPhoneViewCreateEmergencyCallHeader ()
   412 {
   433 {
   413     TPhoneCmdParamEmergencyCallHeaderData callHeader;
   434     TPhoneCmdParamEmergencyCallHeaderData callHeader;
   432     QCOMPARE (m_setCliBubbleId, 1);
   453     QCOMPARE (m_setCliBubbleId, 1);
   433     QCOMPARE (cliText, QString("emergency"));
   454     QCOMPARE (cliText, QString("emergency"));
   434     
   455     
   435     QVERIFY (m_setCipheringCalled == true);
   456     QVERIFY (m_setCipheringCalled == true);
   436     
   457     
   437     QVERIFY (m_endChangesCalled == true);    
   458     QVERIFY (m_endChangesCalled == true);
       
   459     
       
   460     QVERIFY (m_setActiveCallCalled == true);
   438 }
   461 }
   439 
   462 
   440 void TestPhoneUIQtViewAdapter::testEPhoneViewUpdateBubble ()
   463 void TestPhoneUIQtViewAdapter::testEPhoneViewUpdateBubble ()
   441 {
   464 {
   442     // Bubble id will return -1
   465     // Bubble id will return -1
   705     
   728     
   706     //Connected call
   729     //Connected call
   707     m_callStateMap.insert(0, EPEStateConnected);
   730     m_callStateMap.insert(0, EPEStateConnected);
   708     m_bubblesMap.insert(0, 0);
   731     m_bubblesMap.insert(0, 0);
   709     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);    
   732     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);    
   710     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdHold));
   733     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdMute));
   711     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   734     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   712     
   735     
   713     //Emergency
   736     //Emergency
   714     boolParam.SetBoolean(true);
   737     boolParam.SetBoolean(true);
   715     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   738     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   716     QVERIFY(false == m_actionMap.value(0)->contains(EPhoneInCallCmdHold));
   739     QVERIFY(false == m_actionMap.value(0)->contains(EPhoneInCallCmdMute));
   717     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   740     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   718     
   741     
   719     //Held and active
   742     //Held and active
   720     boolParam.SetBoolean(false);
   743     boolParam.SetBoolean(false);
   721     m_callStateMap.insert(1, EPEStateHeld);
   744     m_callStateMap.insert(1, EPEStateHeld);
   722     m_bubblesMap.insert(1, 1);    
   745     m_bubblesMap.insert(1, 1);    
   723     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   746     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   724     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdCreateConference));
   747     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdMute));
   725     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   748     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   726     QVERIFY(m_actionMap.value(1)->contains(EPhoneInCallCmdCreateConference));
   749     QVERIFY(m_actionMap.value(1)->contains(EPhoneInCallCmdMute));
   727     QVERIFY(m_actionMap.value(1)->contains(EPhoneInCallCmdEndThisActiveCall));
   750     QVERIFY(m_actionMap.value(1)->contains(EPhoneInCallCmdEndThisActiveCall));
   728     clearBubbleCommands(0);
   751     clearBubbleCommands(0);
   729     clearBubbleCommands(1);
   752     clearBubbleCommands(1);
   730 
   753 
   731     //Connected call and waiting
   754     //Connected call and waiting
   734    
   757    
   735     boolParam.SetBoolean(false);
   758     boolParam.SetBoolean(false);
   736     m_callStateMap.insert(1, EPEStateRinging);
   759     m_callStateMap.insert(1, EPEStateRinging);
   737     m_bubblesMap.insert(1, 1);    
   760     m_bubblesMap.insert(1, 1);    
   738     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   761     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   739     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdHold));
   762     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdMute));
   740     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   763     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   741     QVERIFY(m_actionMap.value(1)->contains(EPhoneCallComingCmdReject));
   764     QVERIFY(m_actionMap.value(1)->contains(EPhoneCallComingCmdReject));
   742     clearBubbleCommands(0);
   765     clearBubbleCommands(0);
   743     clearBubbleCommands(1);
   766     clearBubbleCommands(1);
   744 
   767 
   748    
   771    
   749     boolParam.SetBoolean(false);
   772     boolParam.SetBoolean(false);
   750     m_callStateMap.insert(1, EPEStateRinging);
   773     m_callStateMap.insert(1, EPEStateRinging);
   751     m_bubblesMap.insert(1, 1);    
   774     m_bubblesMap.insert(1, 1);    
   752     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   775     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   753     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdUnhold));
   776     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdMute));
   754     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   777     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   755     QVERIFY(m_actionMap.value(1)->contains(EPhoneCallComingCmdReject));
   778     QVERIFY(m_actionMap.value(1)->contains(EPhoneCallComingCmdReject));
   756     clearBubbleCommands(0);
   779     clearBubbleCommands(0);
   757     clearBubbleCommands(1);    
   780     clearBubbleCommands(1);    
   758     
   781     
   787     m_callStateMap.clear();
   810     m_callStateMap.clear();
   788     m_bubblesMap.clear();
   811     m_bubblesMap.clear();
   789     m_callStateMap.insert(0, EPEStateDialing);
   812     m_callStateMap.insert(0, EPEStateDialing);
   790     m_bubblesMap.insert(0, 0);
   813     m_bubblesMap.insert(0, 0);
   791     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   814     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   792     QVERIFY(1==m_actionMap.value(0)->size());
   815     QVERIFY(2==m_actionMap.value(0)->size());
       
   816     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdMute));
   793     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisOutgoingCall));
   817     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisOutgoingCall));
   794     clearBubbleCommands(0);
   818     clearBubbleCommands(0);
   795     
   819     
   796     //Ringing
   820     //Ringing
   797     m_callStateMap.clear();
   821     m_callStateMap.clear();
   808     m_callStateMap.clear();
   832     m_callStateMap.clear();
   809     m_bubblesMap.clear();
   833     m_bubblesMap.clear();
   810     m_callStateMap.insert(0, EPEStateConnecting);
   834     m_callStateMap.insert(0, EPEStateConnecting);
   811     m_bubblesMap.insert(0, 0);
   835     m_bubblesMap.insert(0, 0);
   812     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   836     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   813     QVERIFY(1==m_actionMap.value(0)->size());
   837     QVERIFY(2==m_actionMap.value(0)->size());
       
   838     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdMute));
   814     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisOutgoingCall));
   839     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisOutgoingCall));
   815     clearBubbleCommands(0);
   840     clearBubbleCommands(0);
   816 
   841 
   817     //Connected Conference
   842     //Connected Conference
   818     m_callStateMap.clear();
   843     m_callStateMap.clear();
   819     m_bubblesMap.clear();
   844     m_bubblesMap.clear();
   820     m_callStateMap.insert(0, EPEStateConnectedConference);
   845     m_callStateMap.insert(0, EPEStateConnectedConference);
   821     m_bubblesMap.insert(0, 0);
   846     m_bubblesMap.insert(0, 0);
   822     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   847     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   823     QVERIFY(2==m_actionMap.value(0)->size());
   848     QVERIFY(2==m_actionMap.value(0)->size());
   824     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdHold));
   849     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdMute));
   825     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   850     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   826 
   851 
   827     // Conference and held
   852     // Conference and held
   828     m_callStateMap.insert(1, EPEStateHeld);
   853     m_callStateMap.insert(1, EPEStateHeld);
   829     m_bubblesMap.insert(1, 1);    
   854     m_bubblesMap.insert(1, 1);    
   830     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   855     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   831     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdSwap));
   856     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdMute));
   832     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   857     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   833     QVERIFY(m_actionMap.value(1)->contains(EPhoneInCallCmdJoin));
   858     QVERIFY(m_actionMap.value(1)->contains(EPhoneInCallCmdMute));
   834     QVERIFY(m_actionMap.value(1)->contains(EPhoneInCallCmdEndThisActiveCall));
   859     QVERIFY(m_actionMap.value(1)->contains(EPhoneInCallCmdEndThisActiveCall));
   835     clearBubbleCommands(0);
   860     clearBubbleCommands(0);
   836     clearBubbleCommands(1);
   861     clearBubbleCommands(1);
   837     
   862     
   838     //Held conference
   863     //Held conference
   842     m_callStateMap.insert(0, EPEStateHeldConference);
   867     m_callStateMap.insert(0, EPEStateHeldConference);
   843     m_bubblesMap.insert(0, 0);
   868     m_bubblesMap.insert(0, 0);
   844     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   869     m_adapter->ExecuteCommandL (EPhoneViewSetTouchPaneButtons, &boolParam);
   845     QVERIFY(2==m_actionMap.value(0)->size());
   870     QVERIFY(2==m_actionMap.value(0)->size());
   846     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   871     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdEndThisActiveCall));
   847     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdUnhold));
   872     QVERIFY(m_actionMap.value(0)->contains(EPhoneInCallCmdMute));
   848     clearBubbleCommands(0);
   873     clearBubbleCommands(0);
   849     m_conferenceCallList.clear();
   874     m_conferenceCallList.clear();
   850     
   875     
   851     //Unknown state
   876     //Unknown state
   852     m_callStateMap.clear();
   877     m_callStateMap.clear();
   884     callHeader.SetCipheringIndicatorAllowed(true);
   909     callHeader.SetCipheringIndicatorAllowed(true);
   885     callHeader.SetCiphering(false);
   910     callHeader.SetCiphering(false);
   886     
   911     
   887     m_adapter->ExecuteCommandL (EPhoneViewCreateConference, 3, &callHeader);    
   912     m_adapter->ExecuteCommandL (EPhoneViewCreateConference, 3, &callHeader);    
   888     QVERIFY (m_creataConferenceCalled == true);
   913     QVERIFY (m_creataConferenceCalled == true);
       
   914     QVERIFY (mParticipantListActions.count()==2);
       
   915     QVERIFY (mParticipantListActions.at(0)==EPhoneInCallCmdPrivate);
       
   916     QVERIFY (mParticipantListActions.at(1)==EPhoneInCallCmdDrop);
   889     
   917     
   890     //
   918     //
   891     TPhoneCmdParamBoolean  conferenceDataValue;
   919     TPhoneCmdParamBoolean  conferenceDataValue;
   892     m_adapter->ExecuteCommandL (EPhoneViewGetCallExistsInConference, 0, &conferenceDataValue);
   920     m_adapter->ExecuteCommandL (EPhoneViewGetCallExistsInConference, 0, &conferenceDataValue);
   893     QVERIFY (conferenceDataValue.Boolean() == true);
   921     QVERIFY (conferenceDataValue.Boolean() == true);
   894     
   922     
   895     m_adapter->ExecuteCommandL(EPhoneViewRemoveConferenceBubble);
   923     m_adapter->ExecuteCommandL(EPhoneViewRemoveConferenceBubble);
   896     QVERIFY (m_removeConferenceCalled == true);
   924     QVERIFY (m_removeConferenceCalled == true);
       
   925     QVERIFY (mParticipantListActions.count()==0);
   897     
   926     
   898     m_adapter->ExecuteCommandL (EPhoneViewGetCallExistsInConference, 0, &conferenceDataValue);
   927     m_adapter->ExecuteCommandL (EPhoneViewGetCallExistsInConference, 0, &conferenceDataValue);
   899     QVERIFY (conferenceDataValue.Boolean() == false);
   928     QVERIFY (conferenceDataValue.Boolean() == false);
   900     
   929     
   901     QVERIFY (m_setCipheringCalled == true);
   930     QVERIFY (m_setCipheringCalled == true);
  1267     
  1296     
  1268     m_adapter->ExecuteCommand(EPhoneViewEndUpdate);
  1297     m_adapter->ExecuteCommand(EPhoneViewEndUpdate);
  1269     QVERIFY (m_endChangesCalled == true);
  1298     QVERIFY (m_endChangesCalled == true);
  1270 }
  1299 }
  1271 
  1300 
       
  1301 void TestPhoneUIQtViewAdapter::testIndicatorController()
       
  1302 {
       
  1303     connect( this, SIGNAL(windowActivated()), m_adapter, SLOT(handleWindowActivated()));
       
  1304     connect( this, SIGNAL(windowDeactivated()), m_adapter, SLOT(handleWindowDeactivated()));
       
  1305     emit windowActivated();
       
  1306     QVERIFY( m_disableCallIndCalled );
       
  1307     emit windowDeactivated();
       
  1308     QVERIFY( m_enableCallIndCalled );
       
  1309     
       
  1310 }
       
  1311 
       
  1312 void TestPhoneUIQtViewAdapter::testOpenLogs()
       
  1313 {
       
  1314     m_ordinalPositionCalled = false;
       
  1315     m_sendToBackgroundCalled = false;
       
  1316     TPhoneCmdParamString param;
       
  1317     m_adapter->ExecuteCommandL(EPhoneViewLaunchLogs, &param);
       
  1318     QVERIFY(m_ordinalPositionCalled);
       
  1319     QVERIFY(m_sendToBackgroundCalled);
       
  1320 }
       
  1321 
       
  1322 void TestPhoneUIQtViewAdapter::testSetFlags()
       
  1323 {
       
  1324     TPhoneCmdParamBoolean param;
       
  1325     param.SetBoolean( ETrue );
       
  1326     m_phoneButtonFlags = 0;
       
  1327     
       
  1328     m_adapter->ExecuteCommand(EPhoneViewSetBlueToothFlag,&param);
       
  1329     m_adapter->ExecuteCommand(EPhoneViewSetIhfFlag,&param);
       
  1330     m_adapter->ExecuteCommand(EPhoneViewSetMuteFlag,&param);
       
  1331     m_adapter->ExecuteCommand(EPhoneViewSetBluetoothAvailableFlag,&param);
       
  1332 
       
  1333     QVERIFY(m_phoneButtonFlags & PhoneUIQtButtonsController::Ihf);
       
  1334     QVERIFY(m_phoneButtonFlags & PhoneUIQtButtonsController::Mute);
       
  1335     QVERIFY(m_phoneButtonFlags & PhoneUIQtButtonsController::Btaa);
       
  1336     QVERIFY(m_phoneButtonFlags & PhoneUIQtButtonsController::BluetoothAvailable);
       
  1337 }
       
  1338 
       
  1339 void TestPhoneUIQtViewAdapter::testCaptureEndKey()
       
  1340 {
       
  1341     TPhoneCmdParamKeyCapture captureParam;
       
  1342     captureParam.SetKeyCode( EKeyNo );
       
  1343     m_captured = false;
       
  1344     m_capturedKey = Qt::Key_0;
       
  1345     
       
  1346     m_adapter->ExecuteCommand(EPhoneViewStartCapturingKey,&captureParam);
       
  1347     QVERIFY(m_captured);
       
  1348     QVERIFY(m_capturedKey == Qt::Key_No);
       
  1349    
       
  1350     m_adapter->ExecuteCommand(EPhoneViewStopCapturingKey,&captureParam);
       
  1351     QVERIFY(false == m_captured);
       
  1352     QVERIFY(m_capturedKey == Qt::Key_No);
       
  1353     
       
  1354     m_capturedKey = Qt::Key_0;
       
  1355     captureParam.SetKeyCode( EKeyYes );
       
  1356     
       
  1357     m_adapter->ExecuteCommand(EPhoneViewStartCapturingKey,&captureParam);
       
  1358     QVERIFY(false == m_captured);
       
  1359     QVERIFY(m_capturedKey == Qt::Key_0);
       
  1360     
       
  1361     m_adapter->ExecuteCommand(EPhoneViewStopCapturingKey,&captureParam);
       
  1362     QVERIFY(false == m_captured);
       
  1363     QVERIFY(m_capturedKey == Qt::Key_0);
       
  1364 }
       
  1365 
  1272 PHONE_QT_VIEW_ADAPTER_TEST_MAIN(TestPhoneUIQtViewAdapter)
  1366 PHONE_QT_VIEW_ADAPTER_TEST_MAIN(TestPhoneUIQtViewAdapter)
  1273 #include "unit_tests.moc"
  1367 #include "unit_tests.moc"