messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationengine.cpp
branchGCC_SURGE
changeset 47 5b14749788d7
parent 43 35b64624a9e7
equal deleted inserted replaced
35:a32b19fb291e 47:5b14749788d7
    21 #include "testconversationenginestub.h"
    21 #include "testconversationenginestub.h"
    22 #include "testconversationenginestub.h"
    22 #include "testconversationenginestub.h"
    23 #include "testconversationupdatehandler.h"
    23 #include "testconversationupdatehandler.h"
    24 #include <ccsclientconversation.h>
    24 #include <ccsclientconversation.h>
    25 #include <ccsconversationentry.h>
    25 #include <ccsconversationentry.h>
    26 #include <s60qconversions.h>
    26 #include <xqconversions.h>
    27 #include <conversationsenginedefines.h>
    27 #include <conversationsenginedefines.h>
    28 
    28 
    29 
    29 
    30 void TConversationEngine::initTestCase()
    30 void TConversationEngine::initTestCase()
    31 {
    31 {
   100 
   100 
   101     // update the conversation view with modified conversation 
   101     // update the conversation view with modified conversation 
   102     TestConversationEngineStub::Instance()->
   102     TestConversationEngineStub::Instance()->
   103             UpdateConvEntry(TestConversationEngineStub::Instance()->
   103             UpdateConvEntry(TestConversationEngineStub::Instance()->
   104                                 GetConversationID());
   104                                 GetConversationID());
       
   105     
       
   106     ConversationsEngine::instance()->emitConversationModelUpdated();
   105     
   107     
   106     //conversation engine should have emitted signal
   108     //conversation engine should have emitted signal
   107     QCOMPARE( convModify.count(), 1 );
   109     QCOMPARE( convModify.count(), 1 );
   108 }
   110 }
   109 
   111 
   123     QCOMPARE( convDelete.count(), 0 );
   125     QCOMPARE( convDelete.count(), 0 );
   124     
   126     
   125     // update the conversation view with deleted entry  
   127     // update the conversation view with deleted entry  
   126     TestConversationEngineStub::Instance()->UpdateDeletedConvEntry();
   128     TestConversationEngineStub::Instance()->UpdateDeletedConvEntry();
   127 
   129 
       
   130     ConversationsEngine::instance()->emitConversationModelUpdated();
       
   131     
   128     //conversation engine should have emitted signal
   132     //conversation engine should have emitted signal
   129     QCOMPARE( convDelete.count(), 1 );
   133     QCOMPARE( convDelete.count(), 1 );
   130 }
   134 }
   131 
   135 
   132 //notify new recieved conversation and validate conversation view
   136 //notify new recieved conversation and validate conversation view
   189          
   193          
   190         qDebug() << "msgId " << msgId;
   194         qDebug() << "msgId " << msgId;
   191           
   195           
   192         //check the bunch of converation client details 
   196         //check the bunch of converation client details 
   193         QCOMPARE(fname,
   197         QCOMPARE(fname,
   194                S60QConversions::s60DescToQString(
   198                XQConversions::s60DescToQString(
   195                        *(clientConv->GetDisplayName())));
   199                        *(clientConv->GetDisplayName())));
   196           
   200           
   197         QCOMPARE(address,
   201         QCOMPARE(address,
   198                 S60QConversions::s60DescToQString(
   202                 XQConversions::s60DescToQString(
   199                         *(clientConv->GetConversationEntry()->Contact())));
   203                         *(clientConv->GetConversationEntry()->Contact())));
   200     }
   204     }
   201 }
   205 }
   202 
   206 
   203 // get conversation id associated with contact id
   207 // get conversation id associated with contact id
   318     //delete the conversation engine variable
   322     //delete the conversation engine variable
   319     delete ConversationsEngine::instance();
   323     delete ConversationsEngine::instance();
   320     //delete the stub data
   324     //delete the stub data
   321     delete TestConversationEngineStub::Instance();
   325     delete TestConversationEngineStub::Instance();
   322 }
   326 }
       
   327 
       
   328 
       
   329 //main entry point
       
   330 int main(int argc, char *argv[])
       
   331     { 
       
   332     int ret = -1;
       
   333     QCoreApplication app(argc, argv);
       
   334     QObject* tc = new TConversationEngine();
       
   335     ret =  QTest::qExec(tc, argc, argv);
       
   336 	delete tc;
       
   337     return ret;
       
   338     }
       
   339