2 * Copyright (C) 2015 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"
19#include <QLightDM/UsersModel>
22class GreeterUsersModelTest : public QObject
27 static int findName(QAbstractItemModel *model, const QString &name)
29 for (int i = 0; i < model->rowCount(QModelIndex()); i++) {
30 if (model->data(model->index(i, 0), QLightDM::UsersModel::NameRole).toString() == name) {
37 static QString getStringValue(QAbstractItemModel *model, const QString &name, int role)
39 int i = findName(model, name);
40 return model->data(model->index(i, 0), role).toString();
47 model = new UsersModel();
49 sourceModel = new QLightDM::UsersModel();
59 void testMangleColor()
61 QString background = getStringValue(sourceModel, "color-background", QLightDM::UsersModel::BackgroundPathRole);
62 QVERIFY(background == "#dd4814");
64 background = getStringValue(model, "color-background", QLightDM::UsersModel::BackgroundPathRole);
65 QVERIFY(background == "data:image/svg+xml,<svg><rect width='100%' height='100%' fill='#dd4814'/></svg>");
68 void testMangleEmptyName()
70 QString name = getStringValue(sourceModel, "empty-name", QLightDM::UsersModel::RealNameRole);
73 name = getStringValue(model, "empty-name", QLightDM::UsersModel::RealNameRole);
74 QVERIFY(name == "empty-name");
79 QLightDM::UsersModel *sourceModel;
82QTEST_MAIN(GreeterUsersModelTest)
84#include "usersmodel.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