vmbx/vmbxengine/tsrc/ut_vmbxengine/src/ut_simhandler.cpp
changeset 19 e44a8c097b15
child 27 7eb70891911c
equal deleted inserted replaced
15:d7fc66ccd6fb 19:e44a8c097b15
       
     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 #include <QtTest/QtTest>
       
    18 #include <cvoicemailboxentry.h>
       
    19 #include "vmbxsimhandler.h"
       
    20 #include "ut_simhandler.h"
       
    21 
       
    22 Ut_SimHandler::Ut_SimHandler():mSim(NULL)
       
    23 {
       
    24     createSim();
       
    25 }
       
    26 
       
    27 Ut_SimHandler::~Ut_SimHandler()
       
    28 {
       
    29     deleteSim();
       
    30 }
       
    31 
       
    32 void Ut_SimHandler::testCreateAndDelete()
       
    33 {
       
    34     createSim();
       
    35     deleteSim(); 
       
    36 }
       
    37 
       
    38 //void Ut_SimHandler::testGetL()
       
    39 //{
       
    40 //    createSim();
       
    41 //    TInt err = KErrNotFound;
       
    42 //    CVoiceMailboxEntry *entry = NULL;
       
    43 //    
       
    44 //    TRAP(err, entry = CVoiceMailboxEntry::NewL());
       
    45 //    qDebug("CVoiceMailboxEntry::NewL %d", err);
       
    46 //    mSim->GetL(*entry);
       
    47 //    
       
    48 //    delete entry;
       
    49 //    entry = NULL;
       
    50 //    deleteSim(); 
       
    51 //}
       
    52 //
       
    53 //void Ut_SimHandler::testSave()
       
    54 //{
       
    55 //    createSim();
       
    56 //    
       
    57 //    TInt err = KErrNotFound;
       
    58 //    CVoiceMailboxEntry *entry = NULL;
       
    59 //    
       
    60 //    TRAP(err, entry = CVoiceMailboxEntry::NewL());
       
    61 //    qDebug("CVoiceMailboxEntry::NewL %d", err);    
       
    62 //    QCOMPARE(mSim->Save(*entry), KErrNone);
       
    63 //    
       
    64 //    deleteSim(); 
       
    65 //}
       
    66 
       
    67 void Ut_SimHandler::testIsWritable()
       
    68 {
       
    69     createSim();
       
    70     QCOMPARE(mSim->IsWritable(), 1);
       
    71     deleteSim();     
       
    72 }
       
    73 
       
    74 void Ut_SimHandler::testNotifyStoreEvent()
       
    75 {
       
    76     createSim();
       
    77     TRequestStatus status;
       
    78     TUint32 event;
       
    79     TInt index; 
       
    80     mSim->NotifyStoreEvent(status, event, index);
       
    81     deleteSim();      
       
    82 }
       
    83 
       
    84 
       
    85 void Ut_SimHandler::testPhoneBookType()
       
    86 {
       
    87     createSim();
       
    88     QCOMPARE(mSim->PhoneBookType(), EMBDNPhoneBook);
       
    89     deleteSim(); 
       
    90 }
       
    91 
       
    92 void Ut_SimHandler::testCancelAsyncRequest()
       
    93 {
       
    94     createSim();
       
    95     TInt req = -1;
       
    96     mSim->CancelAsyncRequest(req);
       
    97     deleteSim();  
       
    98 }
       
    99 
       
   100 void Ut_SimHandler::createSim()
       
   101 {
       
   102     if (!mSim){
       
   103         TRAPD(err, mSim = CVmbxSimHandler::NewL());
       
   104         QVERIFY(mSim);  
       
   105         qDebug("Create CVmbxSimHandler", err);
       
   106     }
       
   107 }
       
   108 
       
   109 void Ut_SimHandler::deleteSim()
       
   110 {
       
   111     delete mSim;
       
   112     mSim = NULL;
       
   113     qDebug("Delete CVmbxSimHandler");
       
   114 }