vmbx/vmbxcpplugin/tsrc/src/ut_vmbxuiengine.cpp
branchRCL_3
changeset 44 987c9837762f
parent 43 7d48bed6ce0c
child 47 0a6dd2dc9970
equal deleted inserted replaced
43:7d48bed6ce0c 44:987c9837762f
     1 /*
       
     2 * Copyright (c) 2009 - 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 Ut_VmbxUiEngine class
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <QtTest/QtTest>
       
    20 #include <cvoicemailboxentry.h>
       
    21 
       
    22 // User includes
       
    23 #include "vmbxuiengine.h"
       
    24 #include "ut_vmbxuiengine.h"
       
    25 
       
    26 void setTestEnv(TInt aExpRet)
       
    27 {
       
    28     globalExpRet = aExpRet;
       
    29     qDebug("setTestEnv %d", globalExpRet);
       
    30 }
       
    31 
       
    32 
       
    33 /*!
       
    34     Ut_VmbxUiEngine::initTestCase
       
    35     QTestLib initialization method, called for each test case.
       
    36 */
       
    37 void Ut_VmbxUiEngine::initTestCase()
       
    38 {
       
    39     mUiEngine = new VmbxUiEngine();
       
    40     QVERIFY(mUiEngine);
       
    41 }
       
    42 
       
    43 /*!
       
    44     Ut_VmbxUiEngine::cleanupTestCase
       
    45     QTestLib cleanup method, called for each test case.
       
    46 */
       
    47 void Ut_VmbxUiEngine::cleanupTestCase()
       
    48 {
       
    49     if ( mUiEngine ) {
       
    50         delete mUiEngine;
       
    51         mUiEngine = NULL;
       
    52     }
       
    53 }
       
    54 
       
    55 /*!
       
    56     Ut_VmbxUiEngine::testGetCsVoice1Number
       
    57     testCreateVmbxEntry test case
       
    58     Connects to test object signal and verifies received data.
       
    59 */
       
    60 void Ut_VmbxUiEngine::testCsVoice1Number()
       
    61 {
       
    62     QVERIFY(mUiEngine);
       
    63     QString in("123456");
       
    64     QString out("");
       
    65     setTestEnv(KErrNone);
       
    66     mUiEngine->setCsVoiceNumber(in);
       
    67     mUiEngine->getCsVoiceNumber(out);
       
    68     QCOMPARE(in, out);
       
    69     
       
    70     setTestEnv(KErrNotFound);
       
    71     mUiEngine->setCsVoiceNumber(in);
       
    72     mUiEngine->getCsVoiceNumber(out);
       
    73     QCOMPARE(in, out);
       
    74 }
       
    75 
       
    76 /*!
       
    77     Ut_VmbxUiEngine::testGetCsVideo1Number
       
    78     testVmbxType test case
       
    79     Connects to test object signal and verifies received data.
       
    80 */
       
    81 void Ut_VmbxUiEngine::testCsVideo1Number()
       
    82 {
       
    83     QVERIFY(mUiEngine);
       
    84     
       
    85     QString in("123456");
       
    86     QString out("");
       
    87 
       
    88     setTestEnv(KErrNone);
       
    89     mUiEngine->setCsVideoNumber(in);
       
    90     mUiEngine->getCsVideoNumber(out);
       
    91     QCOMPARE(in, out);
       
    92     
       
    93     setTestEnv(KErrNotFound);
       
    94     mUiEngine->setCsVideoNumber(in);
       
    95     mUiEngine->getCsVideoNumber(out);
       
    96     QCOMPARE(in, out);
       
    97 }
       
    98 
       
    99 void Ut_VmbxUiEngine::testIsVideoSupport()
       
   100 {
       
   101     QVERIFY(mUiEngine);
       
   102     mUiEngine->isVideoSupport();
       
   103 }
       
   104 
       
   105 void Ut_VmbxUiEngine::testHandleNotifyL()
       
   106 {
       
   107     QVERIFY(mUiEngine);
       
   108     CVoiceMailboxEntry *entry = CVoiceMailboxEntry::NewL();
       
   109     QVERIFY(entry);
       
   110     mUiEngine->HandleNotifyL(*entry);
       
   111 }
       
   112 
       
   113 
       
   114 //End file