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
|
/*
This file is part of KNewStuff2.
SPDX-FileCopyrightText: 2008 Jeremy Whiting <jpwhiting@kde.org>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
// unit test for author
#include <QString>
#include <QTest>
#include "core/author.h"
const QString name = QStringLiteral("Name");
const QString email = QStringLiteral("Email@nowhere.com");
const QString jabber = QStringLiteral("something@kdetalk.net");
const QString homepage = QStringLiteral("http://www.myhomepage.com");
class testAuthor : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testProperties();
void testCopy();
void testAssignment();
};
void testAuthor::testProperties()
{
KNSCore::Author author;
author.setName(name);
author.setEmail(email);
author.setJabber(jabber);
author.setHomepage(homepage);
QCOMPARE(author.name(), name);
QCOMPARE(author.email(), email);
QCOMPARE(author.jabber(), jabber);
QCOMPARE(author.homepage(), homepage);
}
void testAuthor::testCopy()
{
KNSCore::Author author;
author.setName(name);
author.setEmail(email);
author.setJabber(jabber);
author.setHomepage(homepage);
KNSCore::Author author2(author);
QCOMPARE(author.name(), author2.name());
QCOMPARE(author.email(), author2.email());
QCOMPARE(author.jabber(), author2.jabber());
QCOMPARE(author.homepage(), author2.homepage());
}
void testAuthor::testAssignment()
{
KNSCore::Author author;
KNSCore::Author author2;
author.setName(name);
author.setEmail(email);
author.setJabber(jabber);
author.setHomepage(homepage);
author2 = author;
QCOMPARE(author.name(), author2.name());
QCOMPARE(author.email(), author2.email());
QCOMPARE(author.jabber(), author2.jabber());
QCOMPARE(author.homepage(), author2.homepage());
}
QTEST_GUILESS_MAIN(testAuthor)
#include "knewstuffauthortest.moc"
|