phoneapp/phoneuiqtviewadapter/tsrc/ut_phoneresourceadapter/unit_tests.cpp
changeset 21 92ab7f8d0eab
child 22 6bb1b21d2484
equal deleted inserted replaced
4:c84cf270c54f 21:92ab7f8d0eab
       
     1 /*!
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Unit tests for PhoneResourceAdapter.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QtTest/QtTest>
       
    19 #include <QtGui>
       
    20 #include <hbapplication.h>
       
    21 #include <QSignalSpy>
       
    22 #include <QVariant>
       
    23 #include <hbaction.h>
       
    24 //#include <hbglobal_p.h>
       
    25 #include <phoneappvoipcommands.hrh>
       
    26 #include "phoneresourceadapter.h"
       
    27 #include "phoneresourceids.h"
       
    28 #include "phoneui.hrh"
       
    29 
       
    30 #define PHONE_QT_RESOURCE_ADAPTER_TEST_MAIN(TestObject) \
       
    31 int main(int argc, char *argv[]) \
       
    32 { \
       
    33     HbApplication app(argc, argv); \
       
    34     TestObject tc; \
       
    35     QResource::registerResource("../hbcore.rcc"); \
       
    36     int ret = QTest::qExec(&tc, argc, argv); \
       
    37     /* Core dump if HbIconLoader instance is not destroyed before the application instance. */ \
       
    38     /* HbIconLoader uses QCoreApplication::aboutToQuit() signal to destroy itself. */ \
       
    39     /* app.exec() where the signal is normally emitted is not called here. */ \
       
    40     /* So, invoking the signal explicitly. */ \
       
    41     QMetaObject::invokeMethod(&app, "aboutToQuit", Qt::DirectConnection); \
       
    42     return ret; \
       
    43 }
       
    44 
       
    45 class TestPhoneResourceAdapter : public QObject
       
    46 {
       
    47     Q_OBJECT
       
    48 public:
       
    49     TestPhoneResourceAdapter();
       
    50     virtual ~TestPhoneResourceAdapter();
       
    51 
       
    52 public slots:
       
    53     void initTestCase ();
       
    54     void cleanupTestCase ();
       
    55     void init ();
       
    56     void cleanup (); 
       
    57     
       
    58 private slots:
       
    59     void testConvert ();
       
    60     void testConvertToString ();
       
    61     void testConvertToString2 ();
       
    62     void testDefaultToolbarResourceId();
       
    63     void testConvertCommandToString();
       
    64     void testConvertToHbActions();
       
    65 
       
    66 private:
       
    67     void testIncallToolbar (int id); // helper function
       
    68     
       
    69 private:
       
    70     PhoneResourceAdapter *m_resourceAdapter; // class under test
       
    71 };
       
    72 
       
    73 TestPhoneResourceAdapter::TestPhoneResourceAdapter ()
       
    74 {
       
    75 }
       
    76 
       
    77 TestPhoneResourceAdapter::~TestPhoneResourceAdapter ()
       
    78 {
       
    79 }
       
    80 
       
    81 void TestPhoneResourceAdapter::initTestCase ()
       
    82 {
       
    83     m_resourceAdapter = PhoneResourceAdapter::Instance (this);
       
    84 }
       
    85 
       
    86 void TestPhoneResourceAdapter::cleanupTestCase ()
       
    87 {
       
    88     delete m_resourceAdapter;
       
    89 }
       
    90 
       
    91 void TestPhoneResourceAdapter::init ()
       
    92 {
       
    93 }
       
    94 
       
    95 void TestPhoneResourceAdapter::cleanup ()
       
    96 {
       
    97 }
       
    98 
       
    99 void TestPhoneResourceAdapter::testConvert ()
       
   100 {
       
   101     // For coverage
       
   102     m_resourceAdapter = PhoneResourceAdapter::Instance (this);
       
   103     PhoneUIQtButtonsController* buttonsController = 
       
   104         m_resourceAdapter->buttonsController ();
       
   105     
       
   106 
       
   107     QMap<PhoneAction::ActionType, PhoneAction *> map;
       
   108     map = m_resourceAdapter->convert (R_PHONEUI_INCOMING_CALL_BUTTONS);
       
   109     QCOMPARE (map.size (), 2);
       
   110     PhoneAction *action = map [PhoneAction::LeftButton];
       
   111     QCOMPARE (action->text (), QString ("Answer"));
       
   112     QCOMPARE (action->icon (), HbIcon(":/pri_large_button_answer.svg"));
       
   113     QCOMPARE (action->command (), (int)EPhoneCallComingCmdAnswer);
       
   114     action = map [PhoneAction::RightButton];
       
   115     QCOMPARE (action->text (), QString ("Reject"));
       
   116     QCOMPARE (action->icon (), HbIcon(":/qtg_large_button_reject.svg"));
       
   117     QCOMPARE (action->command (), (int)EPhoneCallComingCmdReject);
       
   118     
       
   119     map = m_resourceAdapter->convert (R_PHONEUI_INCALL_BUTTONS);
       
   120     QCOMPARE (map.size (), 2);
       
   121     action = map [PhoneAction::LeftButton];
       
   122     QCOMPARE (action->text (), QString ("Hold"));
       
   123     QCOMPARE (action->icon (), HbIcon(":/qtg_large_button_hold.svg"));
       
   124     QCOMPARE (action->command (), (int)EPhoneInCallCmdHold);
       
   125     action = map [PhoneAction::RightButton];
       
   126     QCOMPARE (action->text (), QString ("End call"));
       
   127     QCOMPARE (action->icon (), HbIcon(":/pri_large_button_endcall.svg"));
       
   128     QCOMPARE (action->command (), (int)EPhoneInCallCmdEndThisActiveCall);
       
   129     
       
   130     map = m_resourceAdapter->convert (R_PHONEUI_INCALL_HELD_BUTTONS);
       
   131     QCOMPARE (map.size (), 2);
       
   132     action = map [PhoneAction::LeftButton];
       
   133     QCOMPARE (action->text (), QString ("Unhold"));
       
   134     QCOMPARE (action->icon (), HbIcon(":/qtg_large_button_onhold.svg"));
       
   135     QCOMPARE (action->command (), (int)EPhoneInCallCmdUnhold);
       
   136     action = map [PhoneAction::RightButton];
       
   137     QCOMPARE (action->text (), QString ("End call"));
       
   138     QCOMPARE (action->icon (), HbIcon(":/pri_large_button_endcall.svg"));
       
   139     QCOMPARE (action->command (), (int)EPhoneInCallCmdEndThisActiveCall);
       
   140     
       
   141     map = m_resourceAdapter->convert (R_PHONEUI_WAITING_CALL_BUTTONS);
       
   142     QCOMPARE (map.size (), 2);
       
   143     action = map [PhoneAction::LeftButton];
       
   144     QCOMPARE (action->text (), QString ("Answer"));
       
   145     QCOMPARE (action->icon (), HbIcon(":/pri_large_button_answer.svg"));
       
   146     QCOMPARE (action->command (), (int)EPhoneCallComingCmdAnswer);
       
   147     action = map [PhoneAction::RightButton];
       
   148     QCOMPARE (action->text (), QString ("Reject"));
       
   149     QCOMPARE (action->icon (), HbIcon(":/qtg_large_button_reject.svg"));
       
   150     QCOMPARE (action->command (), (int)EPhoneCallComingCmdReject);
       
   151 
       
   152     map = m_resourceAdapter->convert (R_PHONEUI_TWO_SINGLES_BUTTONS);
       
   153     QCOMPARE (map.size (), 2);
       
   154     action = map [PhoneAction::LeftButton];
       
   155     QCOMPARE (action->text (), QString ("Swap"));
       
   156     QCOMPARE (action->icon (), HbIcon(":/qgn_indi_button_swap.svg"));
       
   157     QCOMPARE (action->command (), (int)EPhoneInCallCmdSwap);
       
   158     action = map [PhoneAction::RightButton];
       
   159     QCOMPARE (action->text (), QString ("End call"));
       
   160     QCOMPARE (action->icon (), HbIcon(":/pri_large_button_endcall.svg"));
       
   161     QCOMPARE (action->command (), (int)EPhoneInCallCmdEndThisActiveCall);    
       
   162     
       
   163     map = m_resourceAdapter->convert (R_PHONEUI_CALLHANDLING_INCOMINGCALL_CBA);
       
   164     QCOMPARE (map.size (), 2);
       
   165     action = map [PhoneAction::ToolbarButton1];
       
   166     QCOMPARE (action->icon (), HbIcon(":/qtg_large_comp_message.svg"));    
       
   167     action = map [PhoneAction::ToolbarButton2];
       
   168     QCOMPARE (action->icon (), HbIcon(":/qtg_large_tb_silence.svg"));
       
   169     QCOMPARE (action->command (), (int)EPhoneCallComingCmdSilent);    
       
   170     
       
   171     map = m_resourceAdapter->convert (R_PHONEUI_CALLHANDLING_INCOMINGCALL_REJECT_CBA);
       
   172     QCOMPARE (map.size (), 2);
       
   173     action = map [PhoneAction::ToolbarButton1];
       
   174     QCOMPARE (action->icon (), HbIcon(":/qtg_large_comp_message.svg"));    
       
   175     action = map [PhoneAction::ToolbarButton2];
       
   176     QCOMPARE (action->icon (), HbIcon(":/qtg_large_tb_silence.svg"));
       
   177     //Command is disabled
       
   178     //QCOMPARE (action->command (), (int)EPhoneCallComingCmdReject);    
       
   179      
       
   180     map = m_resourceAdapter->convert (R_PHONEUI_CALLHANDLING_INCOMINGCALL_SOFT_REJECT_CBA);
       
   181     QCOMPARE (map.size (), 2);
       
   182     action = map [PhoneAction::ToolbarButton1];
       
   183     QCOMPARE (action->icon (), HbIcon(":/qtg_large_comp_message.svg"));    
       
   184     action = map [PhoneAction::ToolbarButton2];
       
   185     QCOMPARE (action->icon (), HbIcon(":/qtg_large_tb_silence.svg"));
       
   186     //Command is disabled
       
   187     //QCOMPARE (action->command (), (int)EPhoneCallComingCmdReject); 
       
   188 
       
   189     map = m_resourceAdapter->convert (R_PHONEUI_CALLHANDLING_CALLWAITING_CBA);
       
   190     QCOMPARE (map.size (), 2);
       
   191     action = map [PhoneAction::ToolbarButton1];
       
   192     QCOMPARE (action->icon (), HbIcon(":/qtg_large_comp_message.svg"));    
       
   193     action = map [PhoneAction::ToolbarButton2];
       
   194     QCOMPARE (action->icon (), HbIcon(":/qtg_large_tb_join.svg"));
       
   195     QCOMPARE (action->command (), (int)EPhoneInCallCmdJoin);    
       
   196     
       
   197     testIncallToolbar( R_PHONEUI_DIALER_CBA );
       
   198     testIncallToolbar( R_PHONEUI_INCALL_DIALER_CBA );
       
   199     testIncallToolbar( R_PHONEUI_CALLHANDLING_CALLSETUP_EMPTY_DTMFDIALER_CBA );
       
   200     testIncallToolbar( R_PHONEUI_CALLHANDLING_INCALL_UNHOLD_CBA );
       
   201     testIncallToolbar( R_PHONEUI_CALLHANDLING_INCALL_UNMUTE_CBA );
       
   202     
       
   203     map = m_resourceAdapter->convert (R_PHONEUI_MTCAL_INCOMING_CALL);
       
   204     QCOMPARE (map.size (), 1);
       
   205     action = map [PhoneAction::Text];
       
   206     QCOMPARE (action->text (), QString ("calling"));
       
   207 
       
   208     map = m_resourceAdapter->convert (R_PHONEUI_INCALL_CALL_DISCONNECTED);
       
   209     QCOMPARE (map.size (), 1);
       
   210     action = map [PhoneAction::Text];
       
   211     QCOMPARE (action->text (), QString ("disconnected"));
       
   212     
       
   213     map = m_resourceAdapter->convert (R_PHONEUI_INCALL_CALL_HELD);
       
   214     QCOMPARE (map.size (), 1);
       
   215     action = map [PhoneAction::Text];
       
   216     QCOMPARE (action->text (), QString ("on hold"));
       
   217 
       
   218     map = m_resourceAdapter->convert (R_PHONEUI_MULTC_WAITING);
       
   219     QCOMPARE (map.size (), 1);
       
   220     action = map [PhoneAction::Text];
       
   221     QCOMPARE (action->text (), QString ("waiting"));
       
   222 
       
   223     map = m_resourceAdapter->convert (R_PHONEUI_INCALL_CALL_NUMBER, 3);
       
   224     QCOMPARE (map.size (), 1);
       
   225     action = map [PhoneAction::Text];
       
   226     QCOMPARE (action->text (), QString ("Call 3"));
       
   227 
       
   228     map = m_resourceAdapter->convert (R_PHONEUI_CALL_SETUP_BUTTONS);
       
   229     QCOMPARE (map.size (), 1);
       
   230     action = map [PhoneAction::LeftButton];
       
   231     QCOMPARE (action->text (), QString ("End call"));
       
   232     QCOMPARE (action->icon (), HbIcon(":/pri_large_button_endcall.svg"));
       
   233     QCOMPARE (action->command (), (int)EPhoneInCallCmdEndThisOutgoingCall);
       
   234     
       
   235     map = m_resourceAdapter->convert (R_PHONEUI_TIME_DURAT_LONG_WITH_ZERO);
       
   236     QCOMPARE (map.size (), 1);
       
   237     action = map [PhoneAction::Text];
       
   238     QCOMPARE (action->text (), QString ("%:0%H%:1%T%:2%S%:3"));
       
   239     
       
   240     map = m_resourceAdapter->convert (R_PHONEUI_OUT_GOING_CALL);
       
   241     QCOMPARE (map.size (), 1);
       
   242     action = map [PhoneAction::Text];
       
   243     QCOMPARE (action->text (), QString ("Calling"));
       
   244 
       
   245     map = m_resourceAdapter->convert (R_PHONEUI_MTCAL_CLI_WITHHELD);
       
   246     QCOMPARE (map.size (), 1);
       
   247     action = map [PhoneAction::Text];
       
   248     QCOMPARE (action->text (), QString ("Private number"));
       
   249     
       
   250     map = m_resourceAdapter->convert (R_PHONEUI_MTCAL_CALL);
       
   251     QCOMPARE (map.size (), 1);
       
   252     action = map [PhoneAction::Text];
       
   253     QCOMPARE (action->text (), QString ("Call"));
       
   254     
       
   255     map = m_resourceAdapter->convert (R_PHONEUI_EMERGENCY_CALL_HEADER);
       
   256     QCOMPARE (map.size (), 1);
       
   257     action = map [PhoneAction::Text];
       
   258     QCOMPARE (action->text (), QString ("Emergency call"));
       
   259 
       
   260     map = m_resourceAdapter->convert (R_PHONEUI_ATTEMPTING_EMERGENCY_CALL_TEXT);
       
   261     QCOMPARE (map.size (), 1);
       
   262     action = map [PhoneAction::Text];
       
   263     QCOMPARE (action->text (), QString ("Attempting"));
       
   264     
       
   265     map = m_resourceAdapter->convert (R_PHONEUI_EMERGENCY_CALL_BUTTONS);
       
   266     QCOMPARE (map.size (), 1);
       
   267     action = map [PhoneAction::LeftButton];
       
   268     QCOMPARE (action->text (), QString ("End call"));
       
   269     QCOMPARE (action->icon (), HbIcon(":/pri_large_button_endcall.svg"));
       
   270     QCOMPARE (action->command (), (int)EPhoneCmdEnd);
       
   271     
       
   272     map = m_resourceAdapter->convert (R_PHONEUI_CALLHANDLING_EMERGENCY_CBA);
       
   273     QCOMPARE (map.size (), 2);
       
   274     action = map [PhoneAction::ToolbarButton1];
       
   275     QCOMPARE (action->icon (), HbIcon(":/qtg_large_tb_dialler.svg"));
       
   276     action = map [PhoneAction::ToolbarButton2];
       
   277     QCOMPARE (action->icon (), HbIcon(":/qtg_large_tb_loudsp_unmute.svg"));
       
   278     QCOMPARE (action->command (), (int)EPhoneInCallCmdActivateIhf);        
       
   279     
       
   280     map = m_resourceAdapter->convert (R_PHONEUI_CONFERENCE_CALL);
       
   281     QCOMPARE (map.size (), 1);
       
   282     action = map [PhoneAction::Text];
       
   283     QCOMPARE (action->text (), QString ("Conference"));
       
   284     
       
   285     TBuf<10> buffer(_L("123"));
       
   286     map = m_resourceAdapter->convert (R_PHONEUI_SENDING_DTMF_WAIT_NOTE_TEXT, &buffer);
       
   287     QCOMPARE (map.size(), 1);
       
   288     action = map[PhoneAction::Text];
       
   289     QCOMPARE (action->text(), QString("Sending:\n123"));
       
   290     
       
   291     map = m_resourceAdapter->convert(R_PHONEUI_DTMF_WAIT_CHARACTER_CONFIRMATION_QUERY_TEXT, &buffer);
       
   292     QCOMPARE(map.size(), 1);
       
   293     action = map[PhoneAction::Text];
       
   294     QCOMPARE(action->text(), QString("Send string:\n123"));
       
   295     
       
   296     // TODO
       
   297     map = m_resourceAdapter->convert (R_PHONEUI_CALLHANDLING_INCALL_HANDSET_CBA);
       
   298     
       
   299     map = m_resourceAdapter->convert (0);
       
   300     QCOMPARE (map.size (), 0);
       
   301 }
       
   302 
       
   303 void TestPhoneResourceAdapter::testConvertToString ()
       
   304 {
       
   305     m_resourceAdapter = PhoneResourceAdapter::Instance (this);
       
   306         
       
   307     QString testString = m_resourceAdapter->convertToString(R_PHONE_ERROR_CALL_NOT_ALLOWED); 
       
   308     QCOMPARE( testString, QString ("Call not allowed") );
       
   309     
       
   310     QString testString2 = m_resourceAdapter->convertToString(R_ERROR_NOTE_NOT_ALLOWED); 
       
   311     QCOMPARE( testString2, QString ("Not allowed") );
       
   312     
       
   313     QString testString3 = m_resourceAdapter->convertToString(R_NOTETEXT_INVALID_PHONENUMBER); 
       
   314     QCOMPARE( testString3, QString ("Invalid phone number") );
       
   315     
       
   316     QString testString4 = m_resourceAdapter->convertToString(R_NOTETEXT_NO_ANSWER); 
       
   317     QCOMPARE( testString4, QString ("No answer") );
       
   318     
       
   319     QString testString5 = m_resourceAdapter->convertToString(R_PHONE_ERROR_NUMBER_BUSY); 
       
   320     QCOMPARE( testString5, QString ("Number busy") );
       
   321     
       
   322     QString testString6 = m_resourceAdapter->convertToString(R_PHONE_SS_NOTIFICATION_MOCAL_WAITING_TEXT); 
       
   323     QCOMPARE( testString6, QString ("Waiting") );
       
   324     
       
   325     QString testString7 = m_resourceAdapter->convertToString(R_PHONE_SS_NOTIFICATION_INCAL_INFO_HOLD_TEXT); 
       
   326     QCOMPARE( testString7, QString ("On hold") );
       
   327     
       
   328     QString testString8 = m_resourceAdapter->convertToString(R_INCAL_INFO_HOLD_TEXT); 
       
   329     QCOMPARE( testString8, QString ("On hold") );
       
   330     
       
   331     QString testString9 = m_resourceAdapter->convertToString(R_INCAL_REMOTE_ACTIVE_TEXT); 
       
   332     QCOMPARE( testString9, QString ("Connected") );
       
   333     
       
   334     QString testString10 = m_resourceAdapter->convertToString(R_INCAL_INFO_CONF_HOLD_TEXT); 
       
   335     QCOMPARE( testString10, QString ("Conference on hold") );
       
   336     
       
   337     QString testString11 = m_resourceAdapter->convertToString(R_PHONE_INCALL_INFO_NO_NETWORK_SUPPORT); 
       
   338     QCOMPARE( testString11, QString ("No network support for video call") );
       
   339     
       
   340     QString testString12 = m_resourceAdapter->convertToString(0); 
       
   341     QCOMPARE( testString12, QString ("") );
       
   342 }
       
   343 
       
   344 void TestPhoneResourceAdapter::testConvertToString2 ()
       
   345 {
       
   346     m_resourceAdapter = PhoneResourceAdapter::Instance (this);
       
   347         
       
   348     QString testString = m_resourceAdapter->convertToString(
       
   349             R_PHONE_TEXT_COLP_CONNECTED, QString("123456"));
       
   350     
       
   351     QCOMPARE( testString, QString ("Connected to 123456") );
       
   352        
       
   353     QString testString2 = m_resourceAdapter->convertToString(0, QString()); 
       
   354     QCOMPARE( testString2, QString ("") );
       
   355 }
       
   356 
       
   357 void TestPhoneResourceAdapter::testIncallToolbar (int id)
       
   358 {
       
   359     QMap<PhoneAction::ActionType, PhoneAction *> map;
       
   360     PhoneAction *action;
       
   361     map = m_resourceAdapter->convert (id);
       
   362     QCOMPARE (map.size (), 4);
       
   363     
       
   364     switch(id) {
       
   365     case R_PHONEUI_CALLHANDLING_INCALL_UNMUTE_CBA:
       
   366         action = map [PhoneAction::ToolbarButton1];
       
   367         QCOMPARE (action->icon (), HbIcon(":/qtg_large_tb_dialler.svg"));
       
   368         action = map [PhoneAction::ToolbarButton2];
       
   369         QCOMPARE (action->icon (), HbIcon(":/qtg_large_tb_unmute.svg"));
       
   370         QCOMPARE (action->command (), (int)EPhoneInCallCmdUnmute);    
       
   371         action = map [PhoneAction::ToolbarButton3];
       
   372         QCOMPARE (action->icon (), HbIcon(":/qtg_large_tb_loudsp_unmute.svg"));
       
   373         QCOMPARE (action->command (), (int)EPhoneInCallCmdActivateIhf);        
       
   374         break;
       
   375     default:    
       
   376         action = map [PhoneAction::ToolbarButton1];
       
   377         QCOMPARE (action->icon (), HbIcon(":/qtg_large_tb_dialler.svg"));
       
   378         action = map [PhoneAction::ToolbarButton2];
       
   379         QCOMPARE (action->icon (), HbIcon(":/qtg_large_tb_mute.svg"));
       
   380         QCOMPARE (action->command (), (int)EPhoneInCallCmdMute);    
       
   381         action = map [PhoneAction::ToolbarButton3];
       
   382         QCOMPARE (action->icon (), HbIcon(":/qtg_large_tb_loudsp_unmute.svg"));
       
   383         QCOMPARE (action->command (), (int)EPhoneInCallCmdActivateIhf);
       
   384         break;
       
   385     }
       
   386 }
       
   387 
       
   388 void TestPhoneResourceAdapter::testDefaultToolbarResourceId()
       
   389 {
       
   390     QVERIFY(m_resourceAdapter->defaultToolbarResourceId()==
       
   391             R_PHONEUI_CALLHANDLING_INCOMINGCALL_CBA);
       
   392 }
       
   393 
       
   394 void TestPhoneResourceAdapter::testConvertCommandToString ()
       
   395 {
       
   396     m_resourceAdapter = PhoneResourceAdapter::Instance (this);
       
   397     
       
   398     QString testString = m_resourceAdapter->convertCommandToString(
       
   399             EPhoneInCallCmdEndAllCalls);    
       
   400     QCOMPARE( testString, QString ("End all calls") );
       
   401     
       
   402     testString = m_resourceAdapter->convertCommandToString(
       
   403             EPhoneInCallCmdTransfer);    
       
   404     QCOMPARE( testString, QString ("Transfer") );
       
   405     
       
   406     testString = m_resourceAdapter->convertCommandToString(
       
   407             EPhoneInCallCmdSwitchToVideo);    
       
   408     QCOMPARE( testString, QString ("Call back with video call") );
       
   409     
       
   410     testString = m_resourceAdapter->convertCommandToString(
       
   411             EPhoneCmdHandoverToWlan);    
       
   412     QCOMPARE( testString, QString ("Handover to WLAN") );
       
   413     
       
   414     testString = m_resourceAdapter->convertCommandToString(
       
   415             EPhoneCmdHandoverToGsm);    
       
   416     QCOMPARE( testString, QString ("Handover to GSM") );
       
   417     
       
   418     testString = m_resourceAdapter->convertCommandToString(0); 
       
   419     QCOMPARE( testString, QString ("") );
       
   420 }
       
   421 
       
   422 void TestPhoneResourceAdapter::testConvertToHbActions()
       
   423 {
       
   424     m_resourceAdapter = PhoneResourceAdapter::Instance (this);
       
   425     
       
   426     QList<HbAction*> testList = m_resourceAdapter->convertToHbActions(R_PHONEUI_DTMF_WAIT_CHARACTER_CONFIRMATION_QUERY);    
       
   427     QCOMPARE( testList.count(), 2 );
       
   428     QCOMPARE( (int)EPhoneInCallCmdContinueSendingDtmfString, 
       
   429               testList.at(0)->data().toInt());
       
   430     QCOMPARE( (int)EPhoneInCallCmdCancelSendingDtmfString, 
       
   431               testList.at(1)->data().toInt());
       
   432     qDeleteAll(testList);
       
   433     testList.clear();
       
   434     
       
   435     testList = m_resourceAdapter->convertToHbActions(R_PHONEUI_SENDING_DTMF_WAIT_NOTE);    
       
   436     QCOMPARE( testList.count(), 1 );
       
   437     QCOMPARE( (int)EPhoneInCallCmdCancelSendingDtmfString, 
       
   438               testList.at(0)->data().toInt());
       
   439     qDeleteAll(testList);
       
   440     testList.clear();
       
   441     
       
   442     testList = m_resourceAdapter->convertToHbActions(0);    
       
   443     QCOMPARE( testList.count(), 0 );
       
   444 }
       
   445 
       
   446 PHONE_QT_RESOURCE_ADAPTER_TEST_MAIN(TestPhoneResourceAdapter)
       
   447 #include "unit_tests.moc"