qtmobility/plugins/contacts/qtcontacts-tracker/tests/ut_qtcontacts_trackerplugin/ut_qtcontacts_trackerplugin.h
changeset 4 90517678cc4f
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
       
     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 testMergeTwoOnlineContacts();
       
   105     void testQRelationshipAndMergingContacts();
       
   106     void testAsyncReadContacts();
       
   107     void testFilterContacts();
       
   108     void testFilterContactsEndsWith();
       
   109     void testFilterTwoNameFields();
       
   110     void testTrackerUriToUniqueId();
       
   111     void testIMContactsAndMetacontactMasterPresence();
       
   112     void testIMContactsFilterring();
       
   113     void testContactsWithoutMeContact();
       
   114     void testDefinitionNames();
       
   115 
       
   116 private:
       
   117     void syncContactsAddedSinceHelper(QDateTime& start, QList<QContactLocalId>& addedIds);
       
   118 
       
   119     void insertContact(const QString& contactURI, QContactLocalId uid, QString imId, QString imStatus, QString accountPath, QString protocol = "jabber");
       
   120     void updateIMContactStatus(const QString& uri, QString imStatus);
       
   121     QContact contact(QContactLocalId uid, QStringList detailsToLoad = QStringList());
       
   122     QList<QContact> contacts(QList<QContactLocalId> uids, QStringList detailsToLoad = QStringList());
       
   123 
       
   124 private:
       
   125     QContactTrackerEngine *trackerEngine;
       
   126     QContactManager::Error error;
       
   127     QMap<int, QContactManager::Error>* errorMap;
       
   128     // Filtering and sort options used for QContactTrackerEngine.
       
   129     // Not used.
       
   130     QContactFilter queryFilter;
       
   131     QList<QContactSortOrder> sortOrders;
       
   132     QList<QContactLocalId> addedContacts;
       
   133 };
       
   134 
       
   135 class Slots: public QObject
       
   136 {
       
   137     Q_OBJECT
       
   138 public:
       
   139     QList<QContactLocalId> ids;
       
   140     QList<QContact> contacts;
       
   141 public slots:
       
   142     void idResultsAvailable();
       
   143     void resultsAvailable();
       
   144 
       
   145 };
       
   146 #endif