| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
| 4 | ** Contact: http://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the test suite of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at http://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 2.1 or version 3 as published by the Free |
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and |
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the |
| 22 | ** following information to ensure the GNU Lesser General Public License |
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and |
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 25 | ** |
| 26 | ** As a special exception, The Qt Company gives you certain additional |
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception |
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 29 | ** |
| 30 | ** $QT_END_LICENSE$ |
| 31 | ** |
| 32 | ****************************************************************************/ |
| 33 | |
| 34 | #ifndef tst_QVERSITCONTACTIMPORTER_H |
| 35 | #define tst_QVERSITCONTACTIMPORTER_H |
| 36 | |
| 37 | #include <QObject> |
| 38 | #include <QtVersit/qversitcontactimporter.h> |
| 39 | #include <QtVersit/qversitdocument.h> |
| 40 | |
| 41 | QT_BEGIN_NAMESPACE_VERSIT |
| 42 | class QVersitContactImporter; |
| 43 | class QVersitContactImporterPrivate; |
| 44 | QT_END_NAMESPACE_VERSIT |
| 45 | |
| 46 | QTVERSIT_USE_NAMESPACE |
| 47 | |
| 48 | class MyQVersitContactImporterPropertyHandler; |
| 49 | class MyQVersitResourceHandler; |
| 50 | |
| 51 | class tst_QVersitContactImporter : public QObject |
| 52 | { |
| 53 | Q_OBJECT |
| 54 | |
| 55 | private slots: // Tests |
| 56 | void init(); |
| 57 | void cleanup(); |
| 58 | |
| 59 | void testName(); |
| 60 | void testNameWithFormatted(); |
| 61 | void testAddress(); |
| 62 | void testAddressWithoutSubTypes(); |
| 63 | void testTel(); |
| 64 | void testTelWithoutSubTypes(); |
| 65 | void testEmail(); |
| 66 | void testUrl(); |
| 67 | void testUid(); |
| 68 | void testOrganizationName(); |
| 69 | void testOrganizationTitle(); |
| 70 | void testOrganizationLogo(); |
| 71 | void testOrganizationAssistant(); |
| 72 | void testOrganizationRole(); |
| 73 | void testTimeStamp(); |
| 74 | void testVersion(); |
| 75 | void testVersion_data(); |
| 76 | void testMultipleVersions(); |
| 77 | void testAnniversary(); |
| 78 | void testBirthday(); |
| 79 | void testGender(); |
| 80 | void testNickname(); |
| 81 | void testAvatarUrl(); |
| 82 | void testAvatarInvalid(); |
| 83 | void testGeo(); |
| 84 | void testNote(); |
| 85 | void testDisplayLabel(); |
| 86 | void testOnlineAccount(); |
| 87 | void testFamily(); |
| 88 | void testFavorite(); |
| 89 | void testFavorite_data(); |
| 90 | void testMultipleFavorites(); |
| 91 | void testSound(); |
| 92 | void testTag(); |
| 93 | void testExtendedDetail(); |
| 94 | void testExtendedDetail_data(); |
| 95 | void testMultipleExtendedDetails(); |
| 96 | void testPref(); |
| 97 | void testPropertyHandler(); |
| 98 | void testInvalidDocument(); |
| 99 | void testEmailWithContextOther(); |
| 100 | |
| 101 | private: // Utilities |
| 102 | |
| 103 | QVersitDocument createDocumentWithProperty(const QVersitProperty& property); |
| 104 | |
| 105 | QVersitDocument createDocumentWithNameAndPhoto( |
| 106 | const QString& name, |
| 107 | QByteArray image, |
| 108 | const QString& photoType); |
| 109 | |
| 110 | void addVersionPropertyToDocument(QString sequenceNumber, QString extendedVersion, QVersitDocument &document); |
| 111 | void addFavoritePropertyToDocument(QString favorite, QString index, QVersitDocument &document); |
| 112 | void addExtendedDetailPropertyToDocument(QString name, QString data, QVersitDocument &document); |
| 113 | |
| 114 | private: |
| 115 | QVersitContactImporter* mImporter; |
| 116 | MyQVersitContactImporterPropertyHandler* mPropertyHandler; |
| 117 | MyQVersitResourceHandler* mResourceHandler; |
| 118 | }; |
| 119 | |
| 120 | #endif // tst_QVERSITCONTACTIMPORTER_H |
| 121 | |