phonebookui/cnthistorymodel/tsrc/mt_cnthistorymodel/mt_cnthistorymodel.cpp
changeset 71 7cc7d74059f9
parent 47 7cbcb2896f0e
child 81 640d30f4fb64
--- a/phonebookui/cnthistorymodel/tsrc/mt_cnthistorymodel/mt_cnthistorymodel.cpp	Thu Sep 02 20:16:15 2010 +0300
+++ b/phonebookui/cnthistorymodel/tsrc/mt_cnthistorymodel/mt_cnthistorymodel.cpp	Fri Sep 17 08:27:32 2010 +0300
@@ -39,7 +39,7 @@
 
 void TestCntHistoryModel::testLogsInsertions()
 {   
-    QSignalSpy spy( model, SIGNAL(rowsInserted(const QModelIndex &, int, int)));
+    QSignalSpy spy( model, SIGNAL(modelReset()));
     model->d_ptr->logsRowsInserted(QModelIndex(), 0, 0);
     
     QVERIFY(model->rowCount() == 1);
@@ -86,7 +86,7 @@
     msgs.append(msg2);
     msgs.append(msg3);
     
-    QSignalSpy spy( model, SIGNAL(rowsInserted(const QModelIndex &, int, int)));
+    QSignalSpy spy( model, SIGNAL(modelReset()));
     model->d_ptr->messagesReady(msgs);
     
     QVERIFY(model->rowCount() == 3);
@@ -223,6 +223,10 @@
     var = modelIndex.data(Qt::BackgroundRole);
     QVERIFY(var.type() > (QVariant::UserType - 1));
     
+    // ConversationRole
+    var = modelIndex.data(CntConverstaionIdRole);
+    QVERIFY(var.type() == QVariant::Int);
+    
     // Invalid role
     var = modelIndex.data(-10);
     QVERIFY(var.type() == QVariant::Invalid);
@@ -271,7 +275,7 @@
     } 
     
     // Sort ascending
-    QSignalSpy spy( model, SIGNAL( rowsInserted(const QModelIndex &, int, int)));
+    QSignalSpy spy( model, SIGNAL(modelReset()));
     model->sortAndRefresh(Qt::AscendingOrder);
     
     QVERIFY(spy.count() == 1);    
@@ -282,7 +286,7 @@
     }
     
     // Sort descending
-    QSignalSpy spy1( model, SIGNAL( rowsInserted(const QModelIndex &, int, int)));
+    QSignalSpy spy1( model, SIGNAL( modelReset()));
     model->sortAndRefresh(Qt::DescendingOrder);
     
     QVERIFY(spy1.count() == 1);    
@@ -307,6 +311,11 @@
     QSignalSpy spy1( model, SIGNAL( rowsRemoved(const QModelIndex &, int, int)));
     model->clearHistory();
     QVERIFY(spy1.count() == 0);
+    
+    // test reset
+    QSignalSpy spy2( model, SIGNAL(modelReset()));
+    model->d_ptr->handleLogsReset();
+    QVERIFY(spy2.count() == 1);
 }
 
 void TestCntHistoryModel::testMarkSeen()