File: objectsaccountinfotests.cpp

package info (click to toggle)
libkgapi 5.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,784 kB
  • ctags: 3,400
  • sloc: cpp: 23,723; xml: 58; makefile: 5; sh: 1
file content (98 lines) | stat: -rw-r--r-- 3,265 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
    Copyright 2012  Dan Vratil <dan@progdan.cz>

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
    published by the Free Software Foundation; either version 2 of
    the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "objectsaccountinfotests.h"

#include <objects/accountinfo.h>

using namespace KGAPI;

void ObjectsAccountInfoTests::testAccountInfo_data()
{
    QTest::addColumn< QString >("id");
    QTest::addColumn< QString >("email");
    QTest::addColumn< QString >("name");
    QTest::addColumn< QString >("givenName");
    QTest::addColumn< QString >("familyName");
    QTest::addColumn< QString >("birthday");
    QTest::addColumn< QString >("gender");
    QTest::addColumn< QString >("link");
    QTest::addColumn< QString >("locale");
    QTest::addColumn< QString >("timezone");
    QTest::addColumn< bool >("verifiedEmail");
    QTest::addColumn< QString >("photoUrl");

    QTest::newRow("accountInfo1_czech")
        << "1234"
        << "user@gmail.com"
        << "Franta Vomáčka"
        << "Franta"
        << "Vomáčka"
        << "1991-05-20"
        << "male"
        << "https://plus.google.com/1234"
        << "en"
        << "Europe/Prague"
        << true
        << "https://lh3.googleusercontent.com/--XXXXX/XXXXX/abc-edf/photo.jpg";
}

void ObjectsAccountInfoTests::testAccountInfo()
{
    KGAPI::Objects::AccountInfo accountInfo;

    QFETCH(QString, id);
    QFETCH(QString, email);
    QFETCH(QString, name);
    QFETCH(QString, givenName);
    QFETCH(QString, familyName);
    QFETCH(QString, birthday);
    QFETCH(QString, gender);
    QFETCH(QString, link);
    QFETCH(QString, locale);
    QFETCH(QString, timezone);
    QFETCH(bool, verifiedEmail);
    QFETCH(QString, photoUrl);

    accountInfo.setId(id);
    accountInfo.setEmail(email);
    accountInfo.setName(name);
    accountInfo.setGivenName(givenName);
    accountInfo.setFamilyName(familyName);
    accountInfo.setBirthday(birthday);
    accountInfo.setGender(gender);
    accountInfo.setLink(link);
    accountInfo.setLocale(locale);
    accountInfo.setTimezone(timezone);
    accountInfo.setVerifiedEmail(verifiedEmail);
    accountInfo.setPhotoUrl(photoUrl);

    QCOMPARE(accountInfo.id(), id);
    QCOMPARE(accountInfo.email(), email);
    QCOMPARE(accountInfo.name(), name);
    QCOMPARE(accountInfo.givenName(), givenName);
    QCOMPARE(accountInfo.familyName(), familyName);
    QCOMPARE(accountInfo.birthday(), birthday);
    QCOMPARE(accountInfo.gender(), gender);
    QCOMPARE(accountInfo.link(), link);
    QCOMPARE(accountInfo.locale(), locale);
    QCOMPARE(accountInfo.timezone(), timezone);
    QCOMPARE(accountInfo.verifiedEmail(), verifiedEmail);
    QCOMPARE(accountInfo.photoUrl(), photoUrl);
}

QTEST_KDEMAIN(ObjectsAccountInfoTests, NoGUI);