phonesettings/cpphonesettingsplugins/cptelephonyutils/tsrc/ut_cpphonenotes/ut_cpphonenotes.cpp
changeset 21 92ab7f8d0eab
child 27 2f8f8080a020
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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "ut_cpphonenotes.h"
       
    19 #include "qtestmains60ui.h"
       
    20 #include <hbmainwindow.h>
       
    21 #include <HbDeviceMessageBox.h>
       
    22 #include <HbMessageBox.h>
       
    23 #define private public
       
    24 #include "cpphonenotes.h"
       
    25 
       
    26 /*!
       
    27   UT_CpPhoneNotes::UT_CpPhoneNotes
       
    28  */
       
    29 UT_CpPhoneNotes::UT_CpPhoneNotes() 
       
    30 {
       
    31     CpPhoneNotes::instance();
       
    32 }
       
    33 
       
    34 /*!
       
    35   UT_CpPhoneNotes::~UT_CpPhoneNotes
       
    36  */
       
    37 UT_CpPhoneNotes::~UT_CpPhoneNotes()
       
    38 {
       
    39     //delete m_psui;
       
    40 }
       
    41 
       
    42 /*!
       
    43   UT_CpPhoneNotes::timerEvent
       
    44  */
       
    45 void UT_CpPhoneNotes::timerEvent( QTimerEvent* event )
       
    46 {
       
    47     QString currentTest(QTest::currentTestFunction());
       
    48     qDebug() << "timerEvent:" << currentTest;
       
    49     
       
    50     if (currentTest == "t_showGlobalErrorNote") {
       
    51         verifyGlobalNote(wantedNoteText);
       
    52     }
       
    53     
       
    54     if (m_noteid1) {
       
    55         CpPhoneNotes::instance()->cancelNote(m_noteid1);
       
    56         m_noteid1 = 0;
       
    57     }
       
    58     if (m_noteid2) {
       
    59         CpPhoneNotes::instance()->cancelNote(m_noteid2);
       
    60         m_noteid2 = 0;
       
    61     }
       
    62     if (m_noteid3) {
       
    63         CpPhoneNotes::instance()->cancelNote(m_noteid3);
       
    64         m_noteid3 = 0;
       
    65     }
       
    66     
       
    67     if (visibleDialog()) {
       
    68         visibleDialog()->close();
       
    69         QTest::qWait(1);
       
    70     }
       
    71 	
       
    72 }
       
    73 
       
    74 /*!
       
    75   UT_CpPhoneNotes::visibleDialog
       
    76  */
       
    77 HbDialog *UT_CpPhoneNotes::visibleDialog()
       
    78 {
       
    79     QList<QGraphicsItem*> items = mainWindow->scene()->items();
       
    80     foreach (QGraphicsItem* item, items) {
       
    81         HbDialog *w = qobject_cast<HbDialog*>(item->parentWidget());
       
    82         if (w && w->isVisible()) {
       
    83             qDebug() << "visibleDialog: " << w->getStaticMetaObject().className() <<
       
    84                     "contentWidget: " << w->contentWidget()->getStaticMetaObject().className();
       
    85             return w;
       
    86         }
       
    87     }
       
    88     
       
    89     return 0;
       
    90 }
       
    91 
       
    92 /*!
       
    93   UT_CpPhoneNotes::verifyGlobalNote
       
    94  */
       
    95 void UT_CpPhoneNotes::verifyGlobalNote( const QString& noteText )
       
    96 {
       
    97     qDebug() << "verifyGlobalNote:" << noteText;
       
    98     HbDeviceMessageBox *note=0;
       
    99     QObject* o=0;
       
   100     QVERIFY(CpPhoneNotes::instance()->m_notesQueue->count());
       
   101     QVERIFY(o = CpPhoneNotes::instance()->m_notesQueue->at(0));
       
   102     QVERIFY(note = qobject_cast<HbDeviceMessageBox *>(o));
       
   103     QCOMPARE(note->text(), noteText);
       
   104     note->close();
       
   105     QTest::qWait(1);
       
   106 }
       
   107 
       
   108 /*!
       
   109   UT_CpPhoneNotes::appendAllEtelServices
       
   110  */
       
   111 void UT_CpPhoneNotes::appendAllEtelServices(QList<PSCallDivertingStatus*>& list)
       
   112 {   
       
   113     /** The call service has not been specified. */
       
   114     appendService(list, RMobilePhone::EServiceUnspecified);
       
   115     /** The API request applies to voice call services. */
       
   116     appendService(list, RMobilePhone::EVoiceService);
       
   117     /** The API request applies to auxiliary voice call services. */
       
   118     appendService(list, RMobilePhone::EAuxVoiceService);
       
   119     /** The API request applies to circuit switched data call services. */
       
   120     appendService(list, RMobilePhone::ECircuitDataService);
       
   121     /** The API request applies to packet data services. */
       
   122     appendService(list, RMobilePhone::EPacketDataService);
       
   123     /** The API request applies to fax call services. */
       
   124     appendService(list, RMobilePhone::EFaxService);
       
   125     /** The API request applies to short message services. */
       
   126     appendService(list, RMobilePhone::EShortMessageService);
       
   127     /** The API request applies to all mobile services. */
       
   128     appendService(list, RMobilePhone::EAllServices);
       
   129     /** All teleservices */
       
   130     appendService(list, RMobilePhone::EAllTele);
       
   131     /** Telephony */
       
   132     appendService(list, RMobilePhone::ETelephony);
       
   133     /** All data teleservices */
       
   134     appendService(list, RMobilePhone::EAllDataTele);
       
   135     /** Voice Broadcast Service (VBS) Bearer Service */
       
   136     appendService(list, RMobilePhone::EAllDataExSms);
       
   137     /** All teleservices except SMS */
       
   138     appendService(list, RMobilePhone::EAllTeleExcSms);
       
   139     /** All PLMN specific teleservices */
       
   140     appendService(list, RMobilePhone::EAllPlmnTele);
       
   141     /** PLMN specific teleservice 1 */
       
   142     appendService(list, RMobilePhone::EPlmnTele1);
       
   143     /** PLMN specific teleservice 2 */
       
   144     appendService(list, RMobilePhone::EPlmnTele2);
       
   145     /** PLMN specific teleservice 3 */
       
   146     appendService(list, RMobilePhone::EPlmnTele3);
       
   147     /** PLMN specific teleservice 4 */
       
   148     appendService(list, RMobilePhone::EPlmnTele4);
       
   149     /** PLMN specific teleservice 5 */
       
   150     appendService(list, RMobilePhone::EPlmnTele5);
       
   151     /** PLMN specific teleservice 6 */
       
   152     appendService(list, RMobilePhone::EPlmnTele6);
       
   153     /** PLMN specific teleservice 7 */
       
   154     appendService(list, RMobilePhone::EPlmnTele7);
       
   155     /** PLMN specific teleservice 8 */
       
   156     appendService(list, RMobilePhone::EPlmnTele8);
       
   157     /** PLMN specific teleservice 9 */
       
   158     appendService(list, RMobilePhone::EPlmnTele9);
       
   159     /** PLMN specific teleservice 10 */
       
   160     appendService(list, RMobilePhone::EPlmnTeleA);
       
   161     /** PLMN specific teleservice 11 */
       
   162     appendService(list, RMobilePhone::EPlmnTeleB);
       
   163     /** PLMN specific teleservice 12 */
       
   164     appendService(list, RMobilePhone::EPlmnTeleC);
       
   165     /** PLMN specific teleservice 13 */
       
   166     appendService(list, RMobilePhone::EPlmnTeleD);
       
   167     /** PLMN specific teleservice 14 */
       
   168     appendService(list, RMobilePhone::EPlmnTeleE);
       
   169     /** PLMN specific teleservice 15 */
       
   170     appendService(list, RMobilePhone::EPlmnTeleF);
       
   171     /** All bearer services */
       
   172     appendService(list, RMobilePhone::EAllBearer);
       
   173     /** All async services */
       
   174     appendService(list, RMobilePhone::EAllAsync);
       
   175     /** All sync services */
       
   176     appendService(list, RMobilePhone::EAllSync);
       
   177     /** All data circuit sync */
       
   178     appendService(list, RMobilePhone::ESyncData);
       
   179     /** All data circuit async */
       
   180     appendService(list, RMobilePhone::EAsyncData);
       
   181     /** All packet data services */
       
   182     appendService(list, RMobilePhone::EPacketData);
       
   183     /** All pad access services */
       
   184     appendService(list, RMobilePhone::EPadAccess);
       
   185     /** All PLMN specific bearer services */
       
   186     appendService(list, RMobilePhone::EAllPlmnBearer);
       
   187     /** PLMN specific bearer service 1 */
       
   188     appendService(list, RMobilePhone::EPlmnBearerServ1);
       
   189     /** PLMN specific bearer service 2 */
       
   190     appendService(list, RMobilePhone::EPlmnBearerServ2);
       
   191     /** PLMN specific bearer service 3 */
       
   192     appendService(list, RMobilePhone::EPlmnBearerServ3);
       
   193     /** PLMN specific bearer service 4 */
       
   194     appendService(list, RMobilePhone::EPlmnBearerServ4);
       
   195     /** PLMN specific bearer service 5 */
       
   196     appendService(list, RMobilePhone::EPlmnBearerServ5);
       
   197     /** PLMN specific bearer service 6 */
       
   198     appendService(list, RMobilePhone::EPlmnBearerServ6);
       
   199     /** PLMN specific bearer service 7 */
       
   200     appendService(list, RMobilePhone::EPlmnBearerServ7);
       
   201     /** PLMN specific bearer service 8 */
       
   202     appendService(list, RMobilePhone::EPlmnBearerServ8);
       
   203     /** PLMN specific bearer service 9 */
       
   204     appendService(list, RMobilePhone::EPlmnBearerServ9);
       
   205     /** PLMN specific bearer service 10 */
       
   206     appendService(list, RMobilePhone::EPlmnBearerServA);
       
   207     /** PLMN specific bearer service 11 */
       
   208     appendService(list, RMobilePhone::EPlmnBearerServB);
       
   209     /** PLMN specific bearer service 12 */
       
   210     appendService(list, RMobilePhone::EPlmnBearerServC);
       
   211     /** PLMN specific bearer service 13 */
       
   212     appendService(list, RMobilePhone::EPlmnBearerServD);
       
   213     /** PLMN specific bearer service 14 */
       
   214     appendService(list, RMobilePhone::EPlmnBearerServE);
       
   215     /** PLMN specific bearer service 15 */
       
   216     appendService(list, RMobilePhone::EPlmnBearerServF);
       
   217     /** Alternative tele services */
       
   218     appendService(list, RMobilePhone::EAltTele);
       
   219     /** Voice Group Call Service (VGCS) */
       
   220     appendService(list, RMobilePhone::EVoiceGroupCall);
       
   221     /** Voice Broadcast Service (VBS) */
       
   222     appendService(list, RMobilePhone::EVoiceBroadcast);
       
   223     /** All GPRS Bearer Services */
       
   224     appendService(list, RMobilePhone::EAllGprsBearer);
       
   225 }
       
   226 
       
   227 /*!
       
   228   UT_CpPhoneNotes::appendService
       
   229  */
       
   230 void UT_CpPhoneNotes::appendService(
       
   231         QList<PSCallDivertingStatus*>& list, RMobilePhone::TMobileService service )
       
   232 {
       
   233     PSCallDivertingStatus* item = new PSCallDivertingStatus;
       
   234     item->iServiceGroup = service;
       
   235     list.append(item);
       
   236 }
       
   237 
       
   238 /*!
       
   239   UT_CpPhoneNotes::init
       
   240  */
       
   241 void UT_CpPhoneNotes::init()
       
   242 {
       
   243     initialize();
       
   244     timerid = startTimer(3000);
       
   245     m_noteid1 = 0;
       
   246     m_noteid2 = 0;
       
   247     m_noteid3 = 0;
       
   248 }
       
   249 
       
   250 /*!
       
   251   UT_CpPhoneNotes::cleanup
       
   252  */
       
   253 void UT_CpPhoneNotes::cleanup()
       
   254 {
       
   255     reset();
       
   256     if (timerid) {
       
   257         killTimer(timerid);
       
   258         timerid = 0;
       
   259     }
       
   260 }
       
   261 
       
   262 /*!
       
   263   UT_CpPhoneNotes::t_memleak
       
   264  */
       
   265 void UT_CpPhoneNotes::t_memleak()
       
   266 {
       
   267     
       
   268 }
       
   269 
       
   270 /*!
       
   271   UT_CpPhoneNotes::t_showProgressNote
       
   272  */
       
   273 void UT_CpPhoneNotes::t_showProgressNote()
       
   274 {
       
   275     CpPhoneNotes::instance()->showGlobalProgressNote(m_noteid1, "test");
       
   276     CpPhoneNotes::instance()->showGlobalProgressNote(m_noteid2, "test");
       
   277     QTest::qWait(5000);
       
   278 }
       
   279 
       
   280 /*!
       
   281   UT_CpPhoneNotes::t_showGlobalProgressNote
       
   282  */
       
   283 void UT_CpPhoneNotes::t_showGlobalProgressNote()
       
   284 {
       
   285     CpPhoneNotes::instance()->showGlobalProgressNote(m_noteid1, "test");
       
   286     QTest::qWait(5000);
       
   287 }
       
   288 
       
   289 /*!
       
   290   UT_CpPhoneNotes::t_showGlobalNote
       
   291  */
       
   292 void UT_CpPhoneNotes::t_showGlobalNote()
       
   293 {
       
   294     CpPhoneNotes::instance()->showGlobalNote(m_noteid1, "MessageTypeQuestion",HbMessageBox::MessageTypeQuestion );
       
   295     CpPhoneNotes::instance()->showGlobalNote(m_noteid2, "MessageTypeInformation",HbMessageBox::MessageTypeInformation);
       
   296     CpPhoneNotes::instance()->showGlobalNote(m_noteid3, "MessageTypeWarning",HbMessageBox::MessageTypeWarning );
       
   297     
       
   298 }
       
   299 
       
   300 /*!
       
   301   UT_CpPhoneNotes::t_showGlobalErrorNote
       
   302  */
       
   303 void UT_CpPhoneNotes::t_showGlobalErrorNote()
       
   304 {
       
   305     int errorcode = -1;
       
   306     wantedNoteText = "";
       
   307     expect("Tools::errorCodeTextMapping").with(errorcode,wantedNoteText).returns(true);
       
   308     CpPhoneNotes::instance()->showGlobalErrorNote(m_noteid1, errorcode );
       
   309     QVERIFY( verify() );
       
   310 
       
   311 }
       
   312 
       
   313 /*!
       
   314   UT_CpPhoneNotes::t_showBasicServiceList
       
   315  */
       
   316 void UT_CpPhoneNotes::t_showBasicServiceList()
       
   317 {
       
   318     QList<unsigned char> basicServiceGroupIds;
       
   319     basicServiceGroupIds << Telephony;
       
   320     basicServiceGroupIds << AllDataTele;
       
   321     CpPhoneNotes::instance()->
       
   322         showBasicServiceList("Basic Service List", basicServiceGroupIds );
       
   323 }
       
   324 
       
   325 /*!
       
   326   UT_CpPhoneNotes::t_showBasicServiceCallDivertList
       
   327  */
       
   328 void UT_CpPhoneNotes::t_showBasicServiceCallDivertList()
       
   329 {
       
   330     QList<PSCallDivertingStatus*> statusList;
       
   331     int selection = 0;
       
   332     CallDivertType divertType = NoCallDivert;
       
   333     CallDivertType divertDetailType = NoCallDivert;
       
   334     CpPhoneNotes::instance()->showBasicServiceCallDivertList( 
       
   335         "title", statusList, selection, divertType, divertDetailType );
       
   336     
       
   337     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllServices).returns(AllTeleAndBearer);
       
   338     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllTele).returns(AllTele);
       
   339 
       
   340     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EVoiceService).returns(Telephony);
       
   341     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::ETelephony).returns(Telephony);
       
   342     
       
   343     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllDataTele).returns(AllDataTele);
       
   344     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EFaxService).returns(Fax);
       
   345     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EShortMessageService).returns(Sms);
       
   346     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllDataExSms).returns(AllDataExSms);
       
   347     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllTeleExcSms).returns(AllTeleExcSms);
       
   348     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllPlmnTele).returns(AllPlmnTele);
       
   349     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele1).returns(PlmnTele1);
       
   350     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele2).returns(PlmnTele2);
       
   351     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele3).returns(PlmnTele3);
       
   352     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele4).returns(PlmnTele4);
       
   353     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele5).returns(PlmnTele5);
       
   354     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele6).returns(PlmnTele6);
       
   355     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele7).returns(PlmnTele7);
       
   356     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele8).returns(PlmnTele8);
       
   357     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele9).returns(PlmnTele9);
       
   358     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTeleA).returns(PlmnTeleA);
       
   359     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTeleB).returns(PlmnTeleB);
       
   360     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTeleC).returns(PlmnTeleC);
       
   361     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTeleD).returns(PlmnTeleD);
       
   362     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTeleE).returns(PlmnTeleE);
       
   363     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTeleF).returns(PlmnTeleF);
       
   364     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllBearer).returns(AllBearer);
       
   365     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllAsync).returns(AllAsync);
       
   366     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllSync).returns(AllSync);
       
   367     
       
   368     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::ECircuitDataService).returns(SyncData);
       
   369     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::ESyncData).returns(SyncData);
       
   370     
       
   371     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPacketDataService).returns(AsyncData);
       
   372     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAsyncData).returns(AsyncData);
       
   373     
       
   374     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPacketData).returns(PacketData);
       
   375     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPadAccess).returns(PadAccess);
       
   376     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllPlmnBearer).returns(AllPlmnBearer);
       
   377     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ1).returns(PlmnBearerServ1);
       
   378     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ2).returns(PlmnBearerServ2);
       
   379     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ3).returns(PlmnBearerServ3);
       
   380     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ4).returns(PlmnBearerServ4);
       
   381     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ5).returns(PlmnBearerServ5);
       
   382     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ6).returns(PlmnBearerServ6);
       
   383     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ7).returns(PlmnBearerServ7);
       
   384     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ8).returns(PlmnBearerServ8);
       
   385     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ9).returns(PlmnBearerServ9);
       
   386     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServA).returns(PlmnBearerServA);
       
   387     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServB).returns(PlmnBearerServB);
       
   388     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServC).returns(PlmnBearerServC);
       
   389     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServD).returns(PlmnBearerServD);
       
   390     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServE).returns(PlmnBearerServE);
       
   391     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServF).returns(PlmnBearerServF);
       
   392     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAuxVoiceService).returns(AltTele);
       
   393     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAltTele).returns(AltTele);
       
   394     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EServiceUnspecified).returns(Unknown);
       
   395     // ??
       
   396     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EVoiceGroupCall).returns(Unknown);
       
   397     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EVoiceBroadcast).returns(Unknown);
       
   398     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllGprsBearer).returns(Unknown);
       
   399 
       
   400     expect("Tools::videoSupported").returns(true);
       
   401     appendAllEtelServices( statusList );
       
   402     divertType = CallDivertWithNumber;
       
   403     CpPhoneNotes::instance()->showBasicServiceCallDivertList( 
       
   404         "title", statusList, selection, divertType, divertDetailType );
       
   405     QVERIFY( verify() );
       
   406 
       
   407     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllServices).returns(AllTeleAndBearer);
       
   408     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllTele).returns(AllTele);
       
   409 
       
   410     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EVoiceService).returns(Telephony);
       
   411     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::ETelephony).returns(Telephony);
       
   412     
       
   413     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllDataTele).returns(AllDataTele);
       
   414     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EFaxService).returns(Fax);
       
   415     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EShortMessageService).returns(Sms);
       
   416     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllDataExSms).returns(AllDataExSms);
       
   417     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllTeleExcSms).returns(AllTeleExcSms);
       
   418     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllPlmnTele).returns(AllPlmnTele);
       
   419     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele1).returns(PlmnTele1);
       
   420     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele2).returns(PlmnTele2);
       
   421     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele3).returns(PlmnTele3);
       
   422     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele4).returns(PlmnTele4);
       
   423     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele5).returns(PlmnTele5);
       
   424     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele6).returns(PlmnTele6);
       
   425     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele7).returns(PlmnTele7);
       
   426     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele8).returns(PlmnTele8);
       
   427     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTele9).returns(PlmnTele9);
       
   428     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTeleA).returns(PlmnTeleA);
       
   429     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTeleB).returns(PlmnTeleB);
       
   430     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTeleC).returns(PlmnTeleC);
       
   431     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTeleD).returns(PlmnTeleD);
       
   432     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTeleE).returns(PlmnTeleE);
       
   433     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnTeleF).returns(PlmnTeleF);
       
   434     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllBearer).returns(AllBearer);
       
   435     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllAsync).returns(AllAsync);
       
   436     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllSync).returns(AllSync);
       
   437     
       
   438     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::ECircuitDataService).returns(SyncData);
       
   439     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::ESyncData).returns(SyncData);
       
   440     
       
   441     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPacketDataService).returns(AsyncData);
       
   442     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAsyncData).returns(AsyncData);
       
   443     
       
   444     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPacketData).returns(PacketData);
       
   445     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPadAccess).returns(PadAccess);
       
   446     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllPlmnBearer).returns(AllPlmnBearer);
       
   447     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ1).returns(PlmnBearerServ1);
       
   448     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ2).returns(PlmnBearerServ2);
       
   449     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ3).returns(PlmnBearerServ3);
       
   450     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ4).returns(PlmnBearerServ4);
       
   451     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ5).returns(PlmnBearerServ5);
       
   452     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ6).returns(PlmnBearerServ6);
       
   453     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ7).returns(PlmnBearerServ7);
       
   454     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ8).returns(PlmnBearerServ8);
       
   455     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServ9).returns(PlmnBearerServ9);
       
   456     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServA).returns(PlmnBearerServA);
       
   457     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServB).returns(PlmnBearerServB);
       
   458     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServC).returns(PlmnBearerServC);
       
   459     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServD).returns(PlmnBearerServD);
       
   460     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServE).returns(PlmnBearerServE);
       
   461     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EPlmnBearerServF).returns(PlmnBearerServF);
       
   462     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAuxVoiceService).returns(AltTele);
       
   463     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAltTele).returns(AltTele);
       
   464     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EServiceUnspecified).returns(Unknown);
       
   465     // ??
       
   466     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EVoiceGroupCall).returns(Unknown);
       
   467     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EVoiceBroadcast).returns(Unknown);
       
   468     expect("Tools::convertEtelMobileServiceCode").with(RMobilePhone::EAllGprsBearer).returns(Unknown);
       
   469 
       
   470     expect("Tools::videoSupported").returns(false);
       
   471     divertType = CallDivertWithNumberAndTimeout;
       
   472     CpPhoneNotes::instance()->showBasicServiceCallDivertList( 
       
   473         "title", statusList, selection, divertType, divertDetailType );
       
   474     QVERIFY( verify() );
       
   475 }
       
   476 
       
   477 /*!
       
   478   UT_CpPhoneNotes::t_showCallDivertDetails
       
   479  */
       
   480 void UT_CpPhoneNotes::t_showCallDivertDetails()
       
   481 {
       
   482     expect("CpSettingsWrapper::numberGroupingSupported").returns(QVariant(true));
       
   483     PSCallDivertingStatus status;
       
   484     CpPhoneNotes::instance()->showCallDivertDetails(status);
       
   485     QVERIFY( verify() );
       
   486 
       
   487     expect("CpSettingsWrapper::numberGroupingSupported").returns(QVariant(false));
       
   488     status.iTimeout = 30;
       
   489     CpPhoneNotes::instance()->showCallDivertDetails(status);
       
   490     QVERIFY( verify() );
       
   491 }
       
   492 
       
   493 /*!
       
   494   UT_CpPhoneNotes::t_cancelNote
       
   495  */
       
   496 void UT_CpPhoneNotes::t_cancelNote()
       
   497 {
       
   498     CpPhoneNotes::instance()->showGlobalProgressNote(m_noteid1, "test");
       
   499     QTest::qWait(5000);
       
   500 }
       
   501 
       
   502 QTEST_MAIN_S60UI(UT_CpPhoneNotes)