1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef UT_QTCONTACTS_TRACKERPLUGIN_H |
|
43 #define UT_QTCONTACTS_TRACKERPLUGIN_H |
|
44 |
|
45 #include <QObject> |
|
46 #include <QtTest/QtTest> |
|
47 #include <QString> |
|
48 #include <qcontactrequests.h> |
|
49 |
|
50 QTM_BEGIN_NAMESPACE |
|
51 class QContactLocalIdFetchRequest; |
|
52 class QContactFetchRequest; |
|
53 QTM_END_NAMESPACE |
|
54 |
|
55 class QContactTrackerEngine; |
|
56 QTM_USE_NAMESPACE |
|
57 |
|
58 /** |
|
59 * QtContacts Tracker plugin unittests |
|
60 */ |
|
61 class ut_qtcontacts_trackerplugin : public QObject |
|
62 { |
|
63 Q_OBJECT |
|
64 public: |
|
65 ut_qtcontacts_trackerplugin(); |
|
66 private slots: |
|
67 void initTestCase(); |
|
68 void cleanupTestCase(); |
|
69 void cleanup(); |
|
70 void testSavePhoneNumber(); |
|
71 void testPhoneNumberContext(); |
|
72 void testWritingOnlyWorkMobile(); |
|
73 void testContacts(); |
|
74 void testContact(); |
|
75 void testAvatar(); |
|
76 |
|
77 void testSaveEmailAddress(); |
|
78 void testSaveName(); |
|
79 void testSaveAddress(); |
|
80 |
|
81 void testRemoveContact(); |
|
82 void testSaveContacts(); |
|
83 void testRemoveContacts(); |
|
84 void testUrl(); |
|
85 |
|
86 // void testGroups(); |
|
87 // void testGroup(); |
|
88 // void testSaveGroup(); |
|
89 // void testRemoveGroup(); |
|
90 // void testDetailDefinitions(); |
|
91 // void testDetailDefinition(); |
|
92 // void testSaveDetailDefinition(); |
|
93 // void testRemoveDetailDefinition(); |
|
94 void testSyncContactManagerContactsAddedSince(); |
|
95 void testSyncTrackerEngineContactsIdsAddedSince(); |
|
96 void testSyncContactManagerContactIdsAddedSince(); |
|
97 void testContactsAddedSince(); |
|
98 void testContactsModifiedSince(); |
|
99 void testContactsRemovedSince(); |
|
100 // void testGroupsAddedSince(); |
|
101 // void testGroupsModifiedSince(); |
|
102 // void testGroupsRemovedSince(); |
|
103 void testNcoTypes(); |
|
104 void testQRelationshipAndMetacontacts(); |
|
105 void testAsyncReadContacts(); |
|
106 void testFilterContacts(); |
|
107 void testFilterContactsEndsWith(); |
|
108 void testFilterTwoNameFields(); |
|
109 void testTrackerUriToUniqueId(); |
|
110 void testIMContactsAndMetacontactMasterPresence(); |
|
111 void testIMContactsFilterring(); |
|
112 void testContactsWithoutMeContact(); |
|
113 |
|
114 private: |
|
115 void syncContactsAddedSinceHelper(QDateTime& start, QList<QContactLocalId>& addedIds); |
|
116 |
|
117 void insertContact(const QString& URI, QContactLocalId uid, QString imId, QString imStatus, QString accountPath, QString protocol = "jabber"); |
|
118 void updateIMContactStatus(const QString& uri, QString imStatus); |
|
119 QContact contact(QContactLocalId uid, QStringList detailsToLoad = QStringList()); |
|
120 QList<QContact> contacts(QList<QContactLocalId> uids, QStringList detailsToLoad = QStringList()); |
|
121 |
|
122 private: |
|
123 QContactTrackerEngine *trackerEngine; |
|
124 QContactManager::Error error; |
|
125 QMap<int, QContactManager::Error>* errorMap; |
|
126 // Filtering and sort options used for QContactTrackerEngine. |
|
127 // Not used. |
|
128 QContactFilter queryFilter; |
|
129 QList<QContactSortOrder> sortOrders; |
|
130 QList<QContactLocalId> addedContacts; |
|
131 }; |
|
132 |
|
133 class Slots: public QObject |
|
134 { |
|
135 Q_OBJECT |
|
136 public: |
|
137 QList<QContactLocalId> ids; |
|
138 QList<QContact> contacts; |
|
139 public slots: |
|
140 void progress(QContactLocalIdFetchRequest* self, bool appendOnly); |
|
141 void progress(QContactFetchRequest* self, bool appendOnly); |
|
142 private: |
|
143 QString requestStatusToString(QContactAbstractRequest::Status status); |
|
144 }; |
|
145 #endif |
|