phonebookengines/cntlistmodel/tsrc/ut_cntlistmodel/inc/ut_cntlistmodel.h
changeset 46 efe85016a067
child 66 554fe4dbbb59
equal deleted inserted replaced
40:b46a585f6909 46:efe85016a067
       
     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 
       
    18 #include <QtTest/QtTest>
       
    19 #include <QObject>
       
    20 #include <qtcontacts.h>
       
    21 
       
    22 QTM_BEGIN_NAMESPACE
       
    23 class QContactManager;
       
    24 QTM_END_NAMESPACE
       
    25 
       
    26 QTM_USE_NAMESPACE
       
    27 
       
    28 class CntListModel;
       
    29 class ModelListener;
       
    30 
       
    31 class TestCntListModel : public QObject
       
    32 {
       
    33     Q_OBJECT
       
    34 
       
    35 private:
       
    36     void contactReady(int start, int end);
       
    37 
       
    38 private slots:
       
    39 	void initTestCase();
       
    40 	void create();
       
    41 	
       
    42 	void data();
       
    43 	void rowCount();
       
    44 	
       
    45 	void contact();
       
    46 	void indexOfContact();
       
    47 	void contactManager();
       
    48 	void setFilter();
       
    49 	void myCard();
       
    50 
       
    51 	void rowId();
       
    52 	void dataForDisplayRole();
       
    53 
       
    54     void handleAdded();
       
    55     void handleChanged();
       
    56     void handleRemoved();
       
    57 	void handleMyCardChanged();
       
    58 	
       
    59 	void cleanupTestCase();
       
    60 	
       
    61 private:
       
    62     QContactManager *mManager;
       
    63     CntListModel    *mCntModel;
       
    64     ModelListener   *mModelListener;
       
    65     bool             mDataReady;
       
    66 
       
    67 friend class ModelListener;
       
    68 };
       
    69 
       
    70 class ModelListener : public QObject
       
    71 {
       
    72     Q_OBJECT
       
    73 
       
    74 public:
       
    75     ModelListener(TestCntListModel* parent);
       
    76 
       
    77 private slots:
       
    78     void onDataChanged(QModelIndex start, QModelIndex end);
       
    79 
       
    80 private:
       
    81     TestCntListModel* mParent;
       
    82 };