2 * Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#include "UsersModel.h"
20#include <QDBusInterface>
24class GreeterIntegratedTest : public QObject
32 m_accounts = new QDBusInterface(QStringLiteral("org.freedesktop.Accounts"),
33 QStringLiteral("/org/freedesktop/Accounts"),
34 QStringLiteral("org.freedesktop.Accounts"),
35 QDBusConnection::sessionBus());
36 QDBusReply<bool> addReply = m_accounts->call(QStringLiteral("AddUser"),
38 QVERIFY(addReply.isValid());
39 QCOMPARE(addReply.value(), true);
41 m_user = new QDBusInterface(QStringLiteral("org.freedesktop.Accounts"),
42 QStringLiteral("/%1").arg(g_get_user_name()),
43 QStringLiteral("org.freedesktop.DBus.Properties"),
44 QDBusConnection::sessionBus());
46 m_model = new QLightDM::UsersModel();
52 QDBusReply<bool> addReply = m_accounts->call(QStringLiteral("RemoveUser"),
54 QVERIFY(addReply.isValid());
55 QCOMPARE(addReply.value(), true);
62 void testWatchRealName()
64 auto index = m_model->index(0, 0);
66 QCOMPARE(m_model->data(index, QLightDM::UsersModel::RealNameRole).toString(),
69 QDBusInterface accountsIface(m_user->service(),
71 "org.freedesktop.Accounts.User");
72 QDBusReply<void> reply = accountsIface.call(QStringLiteral("SetRealName"),
73 QStringLiteral("Test User"));
74 QVERIFY(reply.isValid());
76 QTRY_COMPARE(m_model->data(index, QLightDM::UsersModel::RealNameRole).toString(),
77 QStringLiteral("Test User"));
81 QLightDM::UsersModel *m_model;
82 QDBusInterface *m_accounts;
83 QDBusInterface *m_user;
86QTEST_MAIN(GreeterIntegratedTest)
88#include "integrated.moc"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list