phonesettings/cpphonesettingsplugins/cptelephonyutils/tsrc/ut_cpplugincommon/ut_cpplugincommon.cpp
changeset 78 baacf668fe89
parent 76 cfea66083b62
equal deleted inserted replaced
76:cfea66083b62 78:baacf668fe89
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    73 /*!
    73 /*!
    74   UT_CpPluginCommon::t_showCallDuration
    74   UT_CpPluginCommon::t_showCallDuration
    75  */
    75  */
    76 void UT_CpPluginCommon::t_showCallDuration()
    76 void UT_CpPluginCommon::t_showCallDuration()
    77 {
    77 {
    78     EXPECT(XQSettingsManager, readItemValue).
    78     // Case CenrepKeyValueOff
    79         returns(QVariant(23324));
    79     EXPECT(XQSettingsManager, readItemValue).returns(QVariant(0));
    80     
    80     mWrapper->showCallDuration();
       
    81     QVERIFY(verify());
       
    82     
       
    83     // Case CenrepKeyValueOn
       
    84     EXPECT(XQSettingsManager, readItemValue).returns(QVariant(1));
    81     mWrapper->showCallDuration();
    85     mWrapper->showCallDuration();
    82     QVERIFY(verify());
    86     QVERIFY(verify());
    83 }
    87 }
    84 
    88 
    85 /*!
    89 /*!
   222 /*!
   226 /*!
   223   UT_CpPluginCommon::t_isOngoingCall
   227   UT_CpPluginCommon::t_isOngoingCall
   224  */
   228  */
   225 void UT_CpPluginCommon::t_isOngoingCall()
   229 void UT_CpPluginCommon::t_isOngoingCall()
   226 {
   230 {
       
   231     // Case EPSCTsyCallStateNone
   227     EXPECT(XQSettingsManager, readItemValue).
   232     EXPECT(XQSettingsManager, readItemValue).
   228                     returns(QVariant(1));
   233                     returns(QVariant(1));
   229     mWrapper->isOngoingCall();
   234     mWrapper->isOngoingCall();
   230     QVERIFY( verify() );
   235     QVERIFY( verify() );
       
   236     
       
   237     // Case EPSCTsyCallStateConnected
       
   238     EXPECT(XQSettingsManager, readItemValue).
       
   239                     returns(QVariant(7));
       
   240     mWrapper->isOngoingCall();
       
   241     QVERIFY( verify() );    
       
   242 }
       
   243 
       
   244 /*!
       
   245   UT_CpPluginCommon::t_forbiddenIconSupported
       
   246  */
       
   247 void UT_CpPluginCommon::t_forbiddenIconSupported()
       
   248 {
       
   249     EXPECT(XQSettingsManager, readItemValue).
       
   250                 returns(QVariant(true));
       
   251     mWrapper->forbiddenIconSupported(); 
       
   252     QVERIFY( verify() );
       
   253 }
       
   254 
       
   255 /*!
       
   256   UT_CpPluginCommon::t_isConnectedToNetwork
       
   257  */
       
   258 void UT_CpPluginCommon::t_isConnectedToNetwork()
       
   259 {
       
   260     // Not connected to network
       
   261     QT_TRAP_THROWING(SmcDefaultValue< QSystemNetworkInfo::NetworkStatus >::
       
   262             SetL(QSystemNetworkInfo::NoNetworkAvailable));
       
   263     EXPECT(QtMobility::QSystemNetworkInfo, networkStatus).
       
   264             with(QSystemNetworkInfo::WcdmaMode);
       
   265     EXPECT(QtMobility::QSystemNetworkInfo, networkStatus).
       
   266             with(QSystemNetworkInfo::GsmMode);
       
   267     mWrapper->isConnectedToNetwork(); 
       
   268     QVERIFY( verify() );
       
   269     
       
   270     // Connected to network
       
   271     QT_TRAP_THROWING(SmcDefaultValue< QSystemNetworkInfo::NetworkStatus >::
       
   272             SetL(QSystemNetworkInfo::Connected));
       
   273     EXPECT(QtMobility::QSystemNetworkInfo, networkStatus).
       
   274             with(QSystemNetworkInfo::WcdmaMode);
       
   275     EXPECT(QtMobility::QSystemNetworkInfo, networkStatus).
       
   276             with(QSystemNetworkInfo::GsmMode);
       
   277     mWrapper->isConnectedToNetwork(); 
       
   278     QVERIFY( verify() );
   231 }
   279 }
   232 
   280 
   233 QTEST_MAIN_S60(UT_CpPluginCommon)
   281 QTEST_MAIN_S60(UT_CpPluginCommon)