2 * Copyright 2017 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#include "ualwrapper.h"
18#include "xdgwatcher.h"
19#include "appdrawermodel.h"
23class AppDrawerModelTest : public QObject
28 AppDrawerModel *appDrawerModel;
33 UalWrapper::s_list << QStringLiteral("app1") << QStringLiteral("app2");
34 appDrawerModel = new AppDrawerModel(this);
35 QTRY_VERIFY(!appDrawerModel->refreshing());
37 QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 2);
40 void testUalAppAddedRemoved() {
41 QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 2);
43 UalWrapper::instance()->addMockApp("app3");
44 XdgWatcher::instance()->addMockApp("app3");
45 qApp->processEvents(); // ualwrapper is connected Queued
47 QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 3);
49 UalWrapper::instance()->removeMockApp("app3");
50 XdgWatcher::instance()->removeMockApp("app3");
51 qApp->processEvents();
53 QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 2);
57 QSignalSpy refreshingSpy(appDrawerModel, &AppDrawerModel::refreshingChanged);
59 appDrawerModel->refresh();
60 QTRY_VERIFY(!appDrawerModel->refreshing());
62 QCOMPARE(refreshingSpy.count(), 2);
63 QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 2);
67QTEST_GUILESS_MAIN(AppDrawerModelTest)
68#include "appdrawermodeltest.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