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 QContact createContact(const QString& firstName, const QString& lastName); |
|
38 void addGroupMember(const QContact& group, const QContact& contact); |
|
39 void removeGroupMember(const QContact& group, const QContact& contact); |
|
40 |
|
41 private slots: |
|
42 void initTestCase(); |
|
43 void create(); |
|
44 |
|
45 void data(); |
|
46 void rowCount(); |
|
47 |
|
48 void contact(); |
|
49 void contactId(); |
|
50 void indexOfContact(); |
|
51 void indexOfContactId(); |
|
52 void contactManager(); |
|
53 void setFilter(); |
|
54 void myCard(); |
|
55 |
|
56 void rowId(); |
|
57 void dataForDisplayRole(); |
|
58 |
|
59 void handleAdded(); |
|
60 void handleChanged(); |
|
61 void handleRemoved(); |
|
62 void handleMyCardChanged(); |
|
63 void handleRelationships(); |
|
64 |
|
65 void cleanupTestCase(); |
|
66 |
|
67 private: |
|
68 QContactManager *mManager; |
|
69 CntListModel *mCntModel; |
|
70 ModelListener *mModelListener; |
|
71 bool mDataReady; |
|
72 |
|
73 friend class ModelListener; |
|
74 }; |
|
75 |
|
76 class ModelListener : public QObject |
|
77 { |
|
78 Q_OBJECT |
|
79 |
|
80 public: |
|
81 ModelListener(TestCntListModel* parent); |
|
82 |
|
83 private slots: |
|
84 void onDataChanged(QModelIndex start, QModelIndex end); |
|
85 |
|
86 private: |
|
87 TestCntListModel* mParent; |
|
88 }; |
|