phonesrv_plat/phone_client_ussd_api/tsrc/mt_ussd.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     1 /*
       
     2 * Copyright (c) 2010 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:  Implementation of the Mt_Ussd class
       
    15 *
       
    16 */
       
    17 
       
    18 #include <cphcltussd.h>
       
    19 #include "mt_ussd.h"
       
    20 
       
    21 /*------------------------------------------------------------------------------
       
    22 This module testing project links to phoneclient.dll.
       
    23 ------------------------------------------------------------------------------*/
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // Mt_Ussd::Mt_Ussd
       
    27 // Default constructor, remember to null new members here.
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 Mt_Ussd::Mt_Ussd():mUssd(NULL)
       
    31 {
       
    32     qDebug("Mt_Ussd in-out");
       
    33 }
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // Mt_Ussd::~Mt_Ussd
       
    37 // -----------------------------------------------------------------------------
       
    38 Mt_Ussd::~Mt_Ussd()
       
    39 {
       
    40     qDebug("~Mt_Ussd in-out");
       
    41 }
       
    42 
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // Mt_Ussd::initTestCase
       
    46 // QTestLib initialization method, called for each test case.
       
    47 // -----------------------------------------------------------------------------
       
    48 void Mt_Ussd::initTestCase()
       
    49 {
       
    50     qDebug("initTestCase in");
       
    51     mUssd = CPhCltUssd::NewL( EFalse );
       
    52     qDebug("initTestCase out");
       
    53 }
       
    54 
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // Mt_Ussd::cleanupTestCase
       
    58 // QTestLib cleanup method, called for each test case.
       
    59 // -----------------------------------------------------------------------------
       
    60 void Mt_Ussd::cleanupTestCase()
       
    61 {
       
    62     qDebug("cleanupTestCase in");
       
    63     delete mUssd;
       
    64     qDebug("cleanupTestCase out");
       
    65 }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // Mt_Ussd::testSendUssd
       
    69 // -----------------------------------------------------------------------------
       
    70 void Mt_Ussd::testSendUssdUnicode()
       
    71 {
       
    72     qDebug("testSendUssdUnicode in");
       
    73     
       
    74     mUssd->SetDCS( KPhCltDcsUnknown );
       
    75     
       
    76     _LIT( KUnicodeUSSD, "Ussd msg");
       
    77     TInt ret = mUssd->SendUssd( KUnicodeUSSD );
       
    78     qDebug("ussd str=%S, ret=%d", KUnicodeUSSD, ret);
       
    79     
       
    80     QVERIFY2(KErrNone == ret , "testSendUssdUnicode failed ");
       
    81     qDebug("testSendUssdUnicode out");
       
    82 }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // Mt_Ussd::testSendUssd
       
    86 // -----------------------------------------------------------------------------
       
    87 void Mt_Ussd::testSendUssd()
       
    88 {
       
    89     qDebug("testSendUssd in");
       
    90     
       
    91     mUssd->SetDCS( KPhCltDcsUnknown );
       
    92     _LIT8( KMsg, "*#123#" );
       
    93     TInt ret = mUssd->SendUssd( KMsg );
       
    94     qDebug("ussd str=%S, ret=%d", KMsg, ret);
       
    95     
       
    96     QVERIFY2(KErrNone == ret , "testSendUssd failed ");
       
    97     qDebug("testSendUssd out");
       
    98 }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // Mt_Ussd::testSendUssd
       
   102 // -----------------------------------------------------------------------------
       
   103 void Mt_Ussd::testSendUssdWithDCS()
       
   104 {
       
   105     qDebug("testSendUssdWithDCS in");
       
   106     
       
   107     _LIT8( KMsg, "*#123#" );
       
   108     TInt ret = mUssd->SendUssd( KMsg, KPhCltDcsUnknown );
       
   109     qDebug("ussd str=%S, ret=%d", KMsg, ret);
       
   110     
       
   111     QVERIFY2(KErrNone == ret , "testSendUssdWithDCS failed ");
       
   112     qDebug("testSendUssdWithDCS out");
       
   113 }
       
   114 
       
   115 void Mt_Ussd::testSendUssdBtn()
       
   116 {
       
   117     qDebug("testSendUssdBtn in");
       
   118     
       
   119     _LIT8( KMsg, "*100#" );
       
   120     TInt ret = mUssd->SendUssd( KMsg, KPhCltDcsUnknown );
       
   121     qDebug("ussd str=%S, ret=%d", KMsg, ret);
       
   122     
       
   123     QVERIFY2(KErrNone == ret , "testSendUssdBtn failed ");
       
   124     qDebug("testSendUssdBtn out");
       
   125 }
       
   126 
       
   127 void Mt_Ussd::testSendUssdCmcc()
       
   128 {
       
   129     qDebug("testSendUssdCmcc in");
       
   130     
       
   131     _LIT8( KMsg, "*188#" );
       
   132     TInt ret = mUssd->SendUssd( KMsg, KPhCltDcsUnknown );
       
   133     qDebug("ussd str=%S, ret=%d", KMsg, ret);
       
   134     
       
   135     QVERIFY2(KErrNone == ret , "testSendUssdCmcc failed ");
       
   136     qDebug("testSendUssdCmcc out");
       
   137 }
       
   138 
       
   139 // -----------------------------------------------------------------------------
       
   140 // main()
       
   141 // Main method implemented for directing test output to a file.
       
   142 // -----------------------------------------------------------------------------
       
   143 int main(int argc, char *argv[])
       
   144     {
       
   145     qDebug("main() in");
       
   146     QApplication app(argc, argv);
       
   147 
       
   148     qDebug("Start testing...");
       
   149     Mt_Ussd tc; 
       
   150     char *pass[3];
       
   151     pass[0] = argv[0];
       
   152     pass[1] = "-o"; 
       
   153     pass[2] = "c:\\logs\\ussd\\mt_ussdclient.txt";
       
   154     const int result = QTest::qExec(&tc, 3, pass);
       
   155     qDebug("End testing...");
       
   156     
       
   157     qDebug("main() out, result=%d", result);
       
   158     return result;
       
   159     } 
       
   160 
       
   161 //End file