phoneapp/phoneuiqtviewadapter/tsrc/ut_phoneresourceadapter/unit_tests.cpp
changeset 45 6b911d05207e
parent 37 ba76fc04e6c2
child 46 bc5a64e5bc3c
equal deleted inserted replaced
37:ba76fc04e6c2 45:6b911d05207e
    19 #include <QtGui>
    19 #include <QtGui>
    20 #include <hbapplication.h>
    20 #include <hbapplication.h>
    21 #include <QSignalSpy>
    21 #include <QSignalSpy>
    22 #include <QVariant>
    22 #include <QVariant>
    23 #include <hbaction.h>
    23 #include <hbaction.h>
    24 //#include <hbglobal_p.h>
       
    25 #include <phoneappvoipcommands.hrh>
    24 #include <phoneappvoipcommands.hrh>
       
    25 #include <xqphoneappcommands.h>
    26 #include "phoneresourceadapter.h"
    26 #include "phoneresourceadapter.h"
       
    27 #include "phoneuiqtbuttonscontroller.h"
    27 #include "phoneresourceids.h"
    28 #include "phoneresourceids.h"
    28 #include "phoneui.hrh"
    29 #include "phoneui.hrh"
    29 
    30 
    30 #define PHONE_QT_RESOURCE_ADAPTER_TEST_MAIN(TestObject) \
    31 #define PHONE_QT_RESOURCE_ADAPTER_TEST_MAIN(TestObject) \
    31 int main(int argc, char *argv[]) \
    32 int main(int argc, char *argv[]) \
    60     void testConvertToString ();
    61     void testConvertToString ();
    61     void testConvertToString2 ();
    62     void testConvertToString2 ();
    62     void testDefaultToolbarResourceId();
    63     void testDefaultToolbarResourceId();
    63     void testConvertCommandToString();
    64     void testConvertCommandToString();
    64     void testConvertToHbActions();
    65     void testConvertToHbActions();
       
    66     void testConvertToToolBarCommandList();
    65 
    67 
    66 private:
    68 private:
    67     void testIncallToolbar (int id); // helper function
    69     void testIncallToolbar (int id); // helper function
    68     
    70     
    69 private:
    71 private:
   104         m_resourceAdapter->buttonsController ();
   106         m_resourceAdapter->buttonsController ();
   105     
   107     
   106 
   108 
   107     QMap<PhoneAction::ActionType, PhoneAction *> map;
   109     QMap<PhoneAction::ActionType, PhoneAction *> map;
   108     PhoneAction *action = map [PhoneAction::LeftButton];
   110     PhoneAction *action = map [PhoneAction::LeftButton];
   109 
       
   110     map = m_resourceAdapter->convert (R_PHONEUI_CALLHANDLING_INCOMINGCALL_CBA);
       
   111     QCOMPARE (map.size (), 2);
       
   112     action = map [PhoneAction::ToolbarButton1];
       
   113     QCOMPARE (action->icon (), HbIcon("qtg_mono_send"));    
       
   114     action = map [PhoneAction::ToolbarButton2];
       
   115     QCOMPARE (action->icon (), HbIcon("qtg_mono_speaker_off"));
       
   116     QCOMPARE (action->command (), (int)EPhoneCallComingCmdSilent);    
       
   117     
       
   118     map = m_resourceAdapter->convert (R_PHONEUI_CALLHANDLING_INCOMINGCALL_REJECT_CBA);
       
   119     QCOMPARE (map.size (), 2);
       
   120     action = map [PhoneAction::ToolbarButton1];
       
   121     QCOMPARE (action->icon (), HbIcon("qtg_mono_send"));    
       
   122     action = map [PhoneAction::ToolbarButton2];
       
   123     QCOMPARE (action->icon (), HbIcon("qtg_mono_reject_call"));
       
   124     //Command is disabled
       
   125     //QCOMPARE (action->command (), (int)EPhoneCallComingCmdReject);    
       
   126      
       
   127     map = m_resourceAdapter->convert (R_PHONEUI_CALLHANDLING_INCOMINGCALL_SOFT_REJECT_CBA);
       
   128     QCOMPARE (map.size (), 2);
       
   129     action = map [PhoneAction::ToolbarButton1];
       
   130     QCOMPARE (action->icon (), HbIcon("qtg_mono_send"));    
       
   131     action = map [PhoneAction::ToolbarButton2];
       
   132     QCOMPARE (action->icon (), HbIcon("qtg_mono_speaker_off"));
       
   133     //Command is disabled
       
   134     //QCOMPARE (action->command (), (int)EPhoneCallComingCmdReject); 
       
   135 
       
   136     map = m_resourceAdapter->convert (R_PHONEUI_CALLHANDLING_CALLWAITING_CBA);
       
   137     QCOMPARE (map.size (), 2);
       
   138     action = map [PhoneAction::ToolbarButton1];
       
   139     QCOMPARE (action->icon (), HbIcon("qtg_mono_send"));    
       
   140     action = map [PhoneAction::ToolbarButton2];
       
   141     QCOMPARE (action->icon (), HbIcon("qtg_mono_join_call"));
       
   142     QCOMPARE (action->command (), (int)EPhoneInCallCmdJoin);    
       
   143     
       
   144     testIncallToolbar( R_PHONEUI_DIALER_CBA );
       
   145     testIncallToolbar( R_PHONEUI_INCALL_DIALER_CBA );
       
   146     testIncallToolbar( R_PHONEUI_CALLHANDLING_CALLSETUP_EMPTY_DTMFDIALER_CBA );
       
   147     testIncallToolbar( R_PHONEUI_CALLHANDLING_INCALL_UNHOLD_CBA );
       
   148     testIncallToolbar( R_PHONEUI_CALLHANDLING_INCALL_UNMUTE_CBA );
       
   149     
   111     
   150     map = m_resourceAdapter->convert (R_PHONEUI_MTCAL_INCOMING_CALL);
   112     map = m_resourceAdapter->convert (R_PHONEUI_MTCAL_INCOMING_CALL);
   151     QCOMPARE (map.size (), 1);
   113     QCOMPARE (map.size (), 1);
   152     action = map [PhoneAction::Text];
   114     action = map [PhoneAction::Text];
   153     QVERIFY( false == action->text().isEmpty() );
   115     QVERIFY( false == action->text().isEmpty() );
   165     map = m_resourceAdapter->convert (R_PHONEUI_MULTC_WAITING);
   127     map = m_resourceAdapter->convert (R_PHONEUI_MULTC_WAITING);
   166     QCOMPARE (map.size (), 1);
   128     QCOMPARE (map.size (), 1);
   167     action = map [PhoneAction::Text];
   129     action = map [PhoneAction::Text];
   168     QVERIFY( false == action->text().isEmpty() );
   130     QVERIFY( false == action->text().isEmpty() );
   169 
   131 
   170     map = m_resourceAdapter->convert (R_PHONEUI_INCALL_CALL_NUMBER, 3);
       
   171     QCOMPARE (map.size (), 1);
       
   172     action = map [PhoneAction::Text];
       
   173     QVERIFY( false == action->text().isEmpty() );
       
   174     
       
   175     map = m_resourceAdapter->convert (R_PHONEUI_TIME_DURAT_LONG_WITH_ZERO);
   132     map = m_resourceAdapter->convert (R_PHONEUI_TIME_DURAT_LONG_WITH_ZERO);
   176     QCOMPARE (map.size (), 1);
   133     QCOMPARE (map.size (), 1);
   177     action = map [PhoneAction::Text];
   134     action = map [PhoneAction::Text];
   178     QVERIFY( false == action->text().isEmpty() );
   135     QVERIFY( false == action->text().isEmpty() );
   179     
   136     
   184 
   141 
   185     map = m_resourceAdapter->convert (R_PHONEUI_MTCAL_CLI_WITHHELD);
   142     map = m_resourceAdapter->convert (R_PHONEUI_MTCAL_CLI_WITHHELD);
   186     QCOMPARE (map.size (), 1);
   143     QCOMPARE (map.size (), 1);
   187     action = map [PhoneAction::Text];
   144     action = map [PhoneAction::Text];
   188     QVERIFY( false == action->text().isEmpty() );
   145     QVERIFY( false == action->text().isEmpty() );
   189     
   146 
   190     map = m_resourceAdapter->convert (R_PHONEUI_MTCAL_CALL);
   147     map = m_resourceAdapter->convert (R_PHONEUI_MTCAL_CLI_UNKNOWN);
   191     QCOMPARE (map.size (), 1);
   148     QCOMPARE (map.size (), 1);
   192     action = map [PhoneAction::Text];
   149     action = map [PhoneAction::Text];
   193     QVERIFY( false == action->text().isEmpty() );
   150     QVERIFY( false == action->text().isEmpty() );
   194     
   151 
   195     map = m_resourceAdapter->convert (R_PHONEUI_EMERGENCY_CALL_HEADER);
   152     map = m_resourceAdapter->convert (R_PHONEUI_EMERGENCY_CALL_HEADER);
   196     QCOMPARE (map.size (), 1);
   153     QCOMPARE (map.size (), 1);
   197     action = map [PhoneAction::Text];
   154     action = map [PhoneAction::Text];
   198     QVERIFY( false == action->text().isEmpty() );
   155     QVERIFY( false == action->text().isEmpty() );
   199 
   156 
   205     map = m_resourceAdapter->convert (R_PHONEUI_EMERGENCY_CALL_BUTTONS);
   162     map = m_resourceAdapter->convert (R_PHONEUI_EMERGENCY_CALL_BUTTONS);
   206     QCOMPARE (map.size (), 1);
   163     QCOMPARE (map.size (), 1);
   207     action = map [PhoneAction::LeftButton];
   164     action = map [PhoneAction::LeftButton];
   208     QVERIFY( false == action->text().isEmpty() );
   165     QVERIFY( false == action->text().isEmpty() );
   209     QCOMPARE (action->icon (), HbIcon("qtg_mono_end_call"));
   166     QCOMPARE (action->icon (), HbIcon("qtg_mono_end_call"));
   210     QCOMPARE (action->command (), (int)EPhoneCmdEnd);
   167     QCOMPARE (action->command (), (int)EPhoneCmdEnd);   
   211     
       
   212     map = m_resourceAdapter->convert (R_PHONEUI_CALLHANDLING_EMERGENCY_CBA);
       
   213     QCOMPARE (map.size (), 2);
       
   214     action = map [PhoneAction::ToolbarButton1];
       
   215     QCOMPARE (action->icon (), HbIcon("qtg_mono_dialer"));
       
   216     action = map [PhoneAction::ToolbarButton2];
       
   217     QCOMPARE (action->icon (), HbIcon("qtg_mono_speaker"));
       
   218     QCOMPARE (action->command (), (int)EPhoneInCallCmdActivateIhf);        
       
   219     
   168     
   220     map = m_resourceAdapter->convert (R_PHONEUI_CONFERENCE_CALL);
   169     map = m_resourceAdapter->convert (R_PHONEUI_CONFERENCE_CALL);
   221     QCOMPARE (map.size (), 1);
   170     QCOMPARE (map.size (), 1);
   222     action = map [PhoneAction::Text];
   171     action = map [PhoneAction::Text];
   223     QVERIFY( false == action->text().isEmpty() );
   172     QVERIFY( false == action->text().isEmpty() );
   227     QCOMPARE (map.size(), 1);
   176     QCOMPARE (map.size(), 1);
   228     action = map[PhoneAction::Text];
   177     action = map[PhoneAction::Text];
   229     QVERIFY( false == action->text().isEmpty() );
   178     QVERIFY( false == action->text().isEmpty() );
   230     
   179     
   231     map = m_resourceAdapter->convert(R_PHONEUI_DTMF_WAIT_CHARACTER_CONFIRMATION_QUERY_TEXT, &buffer);
   180     map = m_resourceAdapter->convert(R_PHONEUI_DTMF_WAIT_CHARACTER_CONFIRMATION_QUERY_TEXT, &buffer);
   232     QCOMPARE(map.size(), 1);
       
   233     action = map[PhoneAction::Text];
       
   234     QVERIFY( false == action->text().isEmpty() );
       
   235     
       
   236     map = m_resourceAdapter->convert(R_PHONE_IMEI_STRING, &buffer);
       
   237     QCOMPARE(map.size(), 1);
       
   238     action = map[PhoneAction::Text];
       
   239     QVERIFY( false == action->text().isEmpty() );
       
   240 
       
   241     map = m_resourceAdapter->convert(R_PHONEUI_LIFE_TIMER_STRING, &buffer);
       
   242     QCOMPARE(map.size(), 1);
   181     QCOMPARE(map.size(), 1);
   243     action = map[PhoneAction::Text];
   182     action = map[PhoneAction::Text];
   244     QVERIFY( false == action->text().isEmpty() );
   183     QVERIFY( false == action->text().isEmpty() );
   245     
   184     
   246     // TODO
   185     // TODO
   305     QString testString17 = m_resourceAdapter->convertToString(R_PHONE_SS_NOTIFICATION_INCAL_TRANSFERRED_TEXT); 
   244     QString testString17 = m_resourceAdapter->convertToString(R_PHONE_SS_NOTIFICATION_INCAL_TRANSFERRED_TEXT); 
   306     QVERIFY( false == testString17.isEmpty() );    
   245     QVERIFY( false == testString17.isEmpty() );    
   307  
   246  
   308     QString testString18 = m_resourceAdapter->convertToString(R_PHONE_ERROR_NO_SERVICE); 
   247     QString testString18 = m_resourceAdapter->convertToString(R_PHONE_ERROR_NO_SERVICE); 
   309     QVERIFY( false == testString18.isEmpty() ); 
   248     QVERIFY( false == testString18.isEmpty() ); 
       
   249     
       
   250     QString testString19 = m_resourceAdapter->convertToString(R_NOTETEXT_NUMBER_BARRED); 
       
   251     QVERIFY( false == testString19.isEmpty() ); 
       
   252     
       
   253     QString testString20 = m_resourceAdapter->convertToString(R_PHONEUI_NO_VIDEO_NETWORK); 
       
   254     QVERIFY( false == testString20.isEmpty() ); 
       
   255     
       
   256     QString testString21 = m_resourceAdapter->convertToString(R_PHONEUI_VIDEO_CALL_NOT_POSSIBLE); 
       
   257     QVERIFY( false == testString21.isEmpty() ); 
       
   258     
       
   259     QString testString22 = m_resourceAdapter->convertToString(R_CALL_INFO_CAUSE_VALUE127); 
       
   260     QVERIFY( false == testString22.isEmpty() ); 
       
   261     
       
   262     QString testString23 = m_resourceAdapter->convertToString(R_CALL_INFO_NOT_SUPPORTED); 
       
   263     QVERIFY( false == testString23.isEmpty() ); 
       
   264     
       
   265     QString testString24 = m_resourceAdapter->convertToString(R_CALL_INFO_SERVICE_NOT_AVAILABLE); 
       
   266     QVERIFY( false == testString24.isEmpty() ); 
       
   267     
       
   268     QString testString25 = m_resourceAdapter->convertToString(R_CALL_INFO_CAUSE_VALUE38); 
       
   269     QVERIFY( false == testString25.isEmpty() ); 
       
   270     
       
   271     QString testString26 = m_resourceAdapter->convertToString(R_CALL_INFO_CAUSE_VALUE55); 
       
   272     QVERIFY( false == testString26.isEmpty() ); 
       
   273     
       
   274     QString testString27 = m_resourceAdapter->convertToString(R_CALL_INFO_CAUSE_VALUE58); 
       
   275     QVERIFY( false == testString27.isEmpty() ); 
       
   276     
       
   277     QString testString28 = m_resourceAdapter->convertToString(R_NOTE_PHONE_OUT_OF_3G_COVERAGE); 
       
   278     QVERIFY( false == testString28.isEmpty() ); 
       
   279     
       
   280     QString testString29 = m_resourceAdapter->convertToString(R_NOTE_VIDEO_CALL_ONLY_POSSIBLE_UNDER_3G_COVERAGE); 
       
   281     QVERIFY( false == testString29.isEmpty() ); 
       
   282     
       
   283     QString testString30 = m_resourceAdapter->convertToString(R_NOTE_CALLED_NUMBER_HAS_BARRED_INCOMING_CALLS); 
       
   284     QVERIFY( false == testString30.isEmpty() ); 
       
   285     
       
   286     QString testString31 = m_resourceAdapter->convertToString(R_INCAL_REMOTE_CREATE_CONFERENCE_TEXT); 
       
   287     QVERIFY( false == testString31.isEmpty() ); 
       
   288     
       
   289     QString testString32 = m_resourceAdapter->convertToString(R_NOTETEXT_CALL_BARRINGS); 
       
   290     QVERIFY( false == testString32.isEmpty() ); 
       
   291     
       
   292     QString testString33 = m_resourceAdapter->convertToString(R_CALL_INFO_CAUSE_VALUE16); 
       
   293     QVERIFY( false == testString33.isEmpty() ); 
       
   294     
       
   295     QString testString34 = m_resourceAdapter->convertToString(R_CALL_INFO_CAUSE_VALUE18); 
       
   296     QVERIFY( false == testString34.isEmpty() ); 
       
   297     
       
   298     QString testString35 = m_resourceAdapter->convertToString(R_CALL_INFO_CAUSE_VALUE21); 
       
   299     QVERIFY( false == testString35.isEmpty() ); 
       
   300     
       
   301     QString testString36 = m_resourceAdapter->convertToString(R_CALL_INFO_CAUSE_VALUE22); 
       
   302     QVERIFY( false == testString36.isEmpty() ); 
       
   303     
       
   304     QString testString37 = m_resourceAdapter->convertToString(R_CALL_INFO_CAUSE_VALUE34); 
       
   305     QVERIFY( false == testString37.isEmpty() ); 
       
   306     
       
   307     QString testString38 = m_resourceAdapter->convertToString(R_PHONE_ERROR_CALL_NOT_ALLOWED_FDN); 
       
   308     QVERIFY( false == testString38.isEmpty() ); 
       
   309     
       
   310     QString testString39 = m_resourceAdapter->convertToString(R_NOTE_UNABLE_TO_MAKE_VIDEO_CALL_NOT_SUPPORTED_BY_OTHER_PHONE); 
       
   311     QVERIFY( false == testString39.isEmpty() ); 
       
   312 
       
   313     QString testString40 = m_resourceAdapter->convertToString(R_NOTETEXT_DIVERTING_INCOMING_CALL); 
       
   314     QVERIFY( false == testString40.isEmpty() ); 
       
   315         
       
   316     QString testString41 = m_resourceAdapter->convertToString(R_NOTETEXT_DIVERTING); 
       
   317     QVERIFY( false == testString41.isEmpty() ); 
       
   318     
       
   319     QString testString42 = m_resourceAdapter->convertToString(R_NOTETEXT_ALL_INCOMING_CALLS_DIVERTED); 
       
   320     QVERIFY( false == testString42.isEmpty() ); 
       
   321         
       
   322     QString testString43 = m_resourceAdapter->convertToString(R_PHONE_ERROR_CHECK_CLIR); 
       
   323     QVERIFY( false == testString43.isEmpty() ); 
       
   324     
       
   325     QString testString44 = m_resourceAdapter->convertToString(R_PHONE_SS_NOTIFICATION_CLIR_SUPPR_REJECT_TEXT); 
       
   326     QVERIFY( false == testString44.isEmpty() ); 
       
   327     
       
   328     QString testString45 = m_resourceAdapter->convertToString(R_NOTE_TEXT_CLIR_CHANGE); 
       
   329     QVERIFY( false == testString45.isEmpty() ); 
       
   330     
       
   331     QString testString46 = m_resourceAdapter->convertToString(R_PHONE_ERROR_CHECK_NETWORK_SERVICES); 
       
   332     QVERIFY( false == testString46.isEmpty() ); 
       
   333     
       
   334     QString testString47 = m_resourceAdapter->convertToString(R_PHONE_INCALL_INFO_VIDEO_CALL_NOT_ALLOWED_DURING_RESTORE); 
       
   335     QVERIFY( false == testString47.isEmpty() ); 
   310     
   336     
   311     QString testString99 = m_resourceAdapter->convertToString(0); 
   337     QString testString99 = m_resourceAdapter->convertToString(0); 
   312     QCOMPARE( testString99, QString ("") );
   338     QCOMPARE( testString99, QString ("") );
   313 }
   339 }
   314 
   340 
   357 }
   383 }
   358 
   384 
   359 void TestPhoneResourceAdapter::testDefaultToolbarResourceId()
   385 void TestPhoneResourceAdapter::testDefaultToolbarResourceId()
   360 {
   386 {
   361     QVERIFY(m_resourceAdapter->defaultToolbarResourceId()==
   387     QVERIFY(m_resourceAdapter->defaultToolbarResourceId()==
   362             R_PHONEUI_CALLHANDLING_INCOMINGCALL_CBA);
   388             R_PHONEUI_INCALL_DIALER_CBA);
   363 }
   389 }
   364 
   390 
   365 void TestPhoneResourceAdapter::testConvertCommandToString ()
   391 void TestPhoneResourceAdapter::testConvertCommandToString ()
   366 {
   392 {
   367     m_resourceAdapter = PhoneResourceAdapter::Instance (this);
   393     m_resourceAdapter = PhoneResourceAdapter::Instance (this);
   370             EPhoneInCallCmdEndAllCalls);    
   396             EPhoneInCallCmdEndAllCalls);    
   371     QVERIFY( false == testString.isEmpty() );
   397     QVERIFY( false == testString.isEmpty() );
   372     
   398     
   373     testString = m_resourceAdapter->convertCommandToString(
   399     testString = m_resourceAdapter->convertCommandToString(
   374             EPhoneInCallCmdTransfer);    
   400             EPhoneInCallCmdTransfer);    
   375     QVERIFY( false == testString.isEmpty() );
       
   376     
       
   377     testString = m_resourceAdapter->convertCommandToString(
       
   378             EPhoneInCallCmdSwitchToVideo);    
       
   379     QVERIFY( false == testString.isEmpty() );
   401     QVERIFY( false == testString.isEmpty() );
   380     
   402     
   381     testString = m_resourceAdapter->convertCommandToString(
   403     testString = m_resourceAdapter->convertCommandToString(
   382             EPhoneCmdHandoverToWlan);    
   404             EPhoneCmdHandoverToWlan);    
   383     QVERIFY( false == testString.isEmpty() );
   405     QVERIFY( false == testString.isEmpty() );
   412     
   434     
   413     testList = m_resourceAdapter->convertToHbActions(0);    
   435     testList = m_resourceAdapter->convertToHbActions(0);    
   414     QCOMPARE( testList.count(), 0 );
   436     QCOMPARE( testList.count(), 0 );
   415 }
   437 }
   416 
   438 
       
   439 void TestPhoneResourceAdapter::testConvertToToolBarCommandList ()
       
   440 {
       
   441     m_resourceAdapter = PhoneResourceAdapter::Instance(this);
       
   442     PhoneUIQtButtonsController* buttonsController = 
       
   443         m_resourceAdapter->buttonsController();
       
   444     
       
   445     QList<PhoneAction::ToolBarItem> testList;
       
   446     
       
   447     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_CALLHANDLING_INCOMINGCALL_CBA);
       
   448     QCOMPARE(2,testList.count());
       
   449     QVERIFY(PhoneCallComingCmdSoftReject == testList.at(0).mCommandId);
       
   450     QVERIFY(PhoneCallComingCmdSilent == testList.at(1).mCommandId);
       
   451     QVERIFY(true == testList.at(0).mEnabled);
       
   452     QVERIFY(true == testList.at(1).mEnabled);
       
   453     testList.clear();
       
   454     
       
   455     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_CALLHANDLING_INCOMINGCALL_REJECT_CBA);
       
   456     QCOMPARE(2,testList.count());
       
   457     QVERIFY(PhoneCallComingCmdSoftReject == testList.at(0).mCommandId);
       
   458     QVERIFY(PhoneInCallCmdReject == testList.at(1).mCommandId);
       
   459     QVERIFY(true == testList.at(0).mEnabled);
       
   460     QVERIFY(true == testList.at(1).mEnabled);
       
   461     testList.clear(); 
       
   462     
       
   463     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_CALLHANDLING_INCOMINGCALL_SOFT_REJECT_CBA);
       
   464     QCOMPARE(2,testList.count());
       
   465     QVERIFY(PhoneCallComingCmdSoftReject == testList.at(0).mCommandId);
       
   466     QVERIFY(PhoneCallComingCmdSilent == testList.at(1).mCommandId);
       
   467     QVERIFY(true == testList.at(0).mEnabled);
       
   468     QVERIFY(false == testList.at(1).mEnabled);
       
   469     testList.clear(); 
       
   470     
       
   471     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_CALLHANDLING_CALLWAITING_CBA);
       
   472     QCOMPARE(2,testList.count());
       
   473     QVERIFY(PhoneCallComingCmdSoftReject == testList.at(0).mCommandId);
       
   474     QVERIFY(PhoneInCallCmdJoinToConference == testList.at(1).mCommandId);
       
   475     QVERIFY(true == testList.at(0).mEnabled);
       
   476     QVERIFY(false == testList.at(1).mEnabled);
       
   477     testList.clear(); 
       
   478     
       
   479     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_CALLHANDLING_EMERGENCY_CBA);
       
   480     QCOMPARE(2,testList.count());
       
   481     QVERIFY(PhoneInCallCmdActivateIhf == testList.at(0).mCommandId);
       
   482     QVERIFY(PhoneInCallCmdOpenDialer == testList.at(1).mCommandId);
       
   483     QVERIFY(true == testList.at(0).mEnabled);
       
   484     QVERIFY(true == testList.at(1).mEnabled);
       
   485     testList.clear(); 
       
   486     
       
   487     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_DIALER_CBA);
       
   488     QCOMPARE(4,testList.count());
       
   489     QVERIFY(PhoneInCallCmdActivateIhf == testList.at(0).mCommandId);
       
   490     QVERIFY(PhoneInCallCmdHold == testList.at(1).mCommandId);
       
   491     QVERIFY(PhoneInCallCmdOpenContacts == testList.at(2).mCommandId);
       
   492     QVERIFY(PhoneInCallCmdOpenDialer == testList.at(3).mCommandId);
       
   493     QVERIFY(true == testList.at(0).mEnabled);
       
   494     QVERIFY(true == testList.at(1).mEnabled);
       
   495     QVERIFY(true == testList.at(2).mEnabled);
       
   496     QVERIFY(true == testList.at(3).mEnabled);
       
   497     testList.clear(); 
       
   498     
       
   499     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_CALLHANDLING_CALLSETUP_EMPTY_DTMFDIALER_CBA);
       
   500     QCOMPARE(4,testList.count());
       
   501     QVERIFY(PhoneInCallCmdActivateIhf == testList.at(0).mCommandId);
       
   502     QVERIFY(PhoneInCallCmdHold == testList.at(1).mCommandId);
       
   503     QVERIFY(PhoneInCallCmdOpenContacts == testList.at(2).mCommandId);
       
   504     QVERIFY(PhoneInCallCmdOpenDialer == testList.at(3).mCommandId);
       
   505     QVERIFY(true == testList.at(0).mEnabled);
       
   506     QVERIFY(true == testList.at(1).mEnabled);
       
   507     QVERIFY(true == testList.at(2).mEnabled);
       
   508     QVERIFY(true == testList.at(3).mEnabled);
       
   509     testList.clear(); 
       
   510     
       
   511     // Set flags hold and ihf
       
   512     buttonsController->setButtonFlags(PhoneUIQtButtonsController::Ihf,true);
       
   513     buttonsController->setButtonFlags(PhoneUIQtButtonsController::Hold,true);
       
   514     
       
   515     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_CALLHANDLING_EMERGENCY_CBA);
       
   516     QCOMPARE(2,testList.count());
       
   517     QVERIFY(PhoneInCallCmdDeactivateIhf == testList.at(0).mCommandId);
       
   518     QVERIFY(PhoneInCallCmdOpenDialer == testList.at(1).mCommandId);
       
   519     QVERIFY(true == testList.at(0).mEnabled);
       
   520     QVERIFY(true == testList.at(1).mEnabled);
       
   521     testList.clear(); 
       
   522     
       
   523     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_INCALL_DIALER_CBA);
       
   524     QCOMPARE(4,testList.count());
       
   525     QVERIFY(PhoneInCallCmdDeactivateIhf == testList.at(0).mCommandId);
       
   526     QVERIFY(PhoneInCallCmdUnhold == testList.at(1).mCommandId);
       
   527     QVERIFY(PhoneInCallCmdOpenContacts == testList.at(2).mCommandId);
       
   528     QVERIFY(PhoneInCallCmdOpenDialer == testList.at(3).mCommandId);
       
   529     QVERIFY(true == testList.at(0).mEnabled);
       
   530     QVERIFY(true == testList.at(1).mEnabled);
       
   531     QVERIFY(true == testList.at(2).mEnabled);
       
   532     QVERIFY(true == testList.at(3).mEnabled);
       
   533     testList.clear(); 
       
   534     
       
   535     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_CALLHANDLING_CALLSETUP_EMPTY_DTMFDIALER_CBA);
       
   536     QCOMPARE(4,testList.count());
       
   537     QVERIFY(PhoneInCallCmdDeactivateIhf == testList.at(0).mCommandId);
       
   538     QVERIFY(PhoneInCallCmdUnhold == testList.at(1).mCommandId);
       
   539     QVERIFY(PhoneInCallCmdOpenContacts == testList.at(2).mCommandId);
       
   540     QVERIFY(PhoneInCallCmdOpenDialer == testList.at(3).mCommandId);
       
   541     QVERIFY(true == testList.at(0).mEnabled);
       
   542     QVERIFY(true == testList.at(1).mEnabled);
       
   543     QVERIFY(true == testList.at(2).mEnabled);
       
   544     QVERIFY(true == testList.at(3).mEnabled);
       
   545     testList.clear(); 
       
   546     
       
   547     // Set flag multi call
       
   548     buttonsController->setButtonFlags(PhoneUIQtButtonsController::MultiCall,true);
       
   549     
       
   550     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_CALLHANDLING_INCALL_UNHOLD_CBA);
       
   551     QCOMPARE(4,testList.count());
       
   552     QVERIFY(PhoneInCallCmdDeactivateIhf == testList.at(0).mCommandId);
       
   553     QVERIFY(PhoneInCallCmdSwap == testList.at(1).mCommandId);
       
   554     QVERIFY(PhoneInCallCmdCreateConference == testList.at(2).mCommandId);
       
   555     QVERIFY(PhoneInCallCmdOpenDialer == testList.at(3).mCommandId);
       
   556     QVERIFY(true == testList.at(0).mEnabled);
       
   557     QVERIFY(true == testList.at(1).mEnabled);
       
   558     QVERIFY(true == testList.at(2).mEnabled);
       
   559     QVERIFY(true == testList.at(3).mEnabled);
       
   560     testList.clear(); 
       
   561     
       
   562     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_CALLHANDLING_CALLSETUP_EMPTY_DTMFDIALER_CBA);
       
   563     QCOMPARE(4,testList.count());
       
   564     QVERIFY(PhoneInCallCmdDeactivateIhf == testList.at(0).mCommandId);
       
   565     QVERIFY(PhoneInCallCmdSwap == testList.at(1).mCommandId);
       
   566     QVERIFY(PhoneInCallCmdCreateConference == testList.at(2).mCommandId);
       
   567     QVERIFY(PhoneInCallCmdOpenDialer == testList.at(3).mCommandId);
       
   568     QVERIFY(true == testList.at(0).mEnabled);
       
   569     QVERIFY(true == testList.at(1).mEnabled);
       
   570     QVERIFY(true == testList.at(2).mEnabled);
       
   571     QVERIFY(true == testList.at(3).mEnabled);
       
   572     testList.clear();
       
   573     
       
   574     // Set flag outgoing and conference call
       
   575     buttonsController->setButtonFlags(PhoneUIQtButtonsController::Outgoing,true);
       
   576     buttonsController->setButtonFlags(PhoneUIQtButtonsController::Conference,true);
       
   577     
       
   578     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_CALLHANDLING_INCALL_UNMUTE_CBA);
       
   579     QCOMPARE(4,testList.count());
       
   580     QVERIFY(PhoneInCallCmdDeactivateIhf == testList.at(0).mCommandId);
       
   581     QVERIFY(PhoneInCallCmdSwap == testList.at(1).mCommandId);
       
   582     QVERIFY(PhoneInCallCmdJoinToConference == testList.at(2).mCommandId);
       
   583     QVERIFY(PhoneInCallCmdOpenDialer == testList.at(3).mCommandId);
       
   584     QVERIFY(true == testList.at(0).mEnabled);
       
   585     QVERIFY(false == testList.at(1).mEnabled);
       
   586     QVERIFY(false == testList.at(2).mEnabled);
       
   587     QVERIFY(true == testList.at(3).mEnabled);
       
   588     testList.clear(); 
       
   589     
       
   590     testList = m_resourceAdapter->convertToToolBarCommandList(R_PHONEUI_CALLHANDLING_CALLSETUP_EMPTY_DTMFDIALER_CBA);
       
   591     QCOMPARE(4,testList.count());
       
   592     QVERIFY(PhoneInCallCmdDeactivateIhf == testList.at(0).mCommandId);
       
   593     QVERIFY(PhoneInCallCmdSwap == testList.at(1).mCommandId);
       
   594     QVERIFY(PhoneInCallCmdJoinToConference == testList.at(2).mCommandId);
       
   595     QVERIFY(PhoneInCallCmdOpenDialer == testList.at(3).mCommandId);
       
   596     QVERIFY(true == testList.at(0).mEnabled);
       
   597     QVERIFY(false == testList.at(1).mEnabled);
       
   598     QVERIFY(false == testList.at(2).mEnabled);
       
   599     QVERIFY(true == testList.at(3).mEnabled);
       
   600     testList.clear(); 
       
   601 }
       
   602 
   417 PHONE_QT_RESOURCE_ADAPTER_TEST_MAIN(TestPhoneResourceAdapter)
   603 PHONE_QT_RESOURCE_ADAPTER_TEST_MAIN(TestPhoneResourceAdapter)
   418 #include "unit_tests.moc"
   604 #include "unit_tests.moc"