2 * Copyright (C) 2017 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 * Pete Woods <pete.woods@canonical.com>
22#include <libqtdbustest/DBusTestRunner.h>
23#include <libqtdbusmock/DBusMock.h>
28using namespace QtDBusTest;
29using namespace QtDBusMock;
31class PlatformTest: public QObject
48 QScopedPointer<TestFixture> m_data;
50 void registerLogin1(bool canMultiSession, bool canGraphical)
52 m_data->mock.registerLogin1({{"DefaultSeat", QVariantMap
54 {"CanMultiSession", canMultiSession},
55 {"CanGraphical", canGraphical}
60 void registerHostname1(const QString& chassis)
62 m_data->mock.registerHostname1({
69 m_data->dbus.startServices();
76 m_data.reset(new TestFixture);
86 QTest::addColumn<QString>("chassis");
87 QTest::addColumn<bool>("result");
89 QTest::newRow("vm") << "vm" << true;
90 QTest::newRow("container") << "container" << true;
91 QTest::newRow("desktop") << "desktop" << true;
92 QTest::newRow("laptop") << "laptop" << true;
93 QTest::newRow("server") << "server" << true;
94 QTest::newRow("tablet") << "tablet" << false;
95 QTest::newRow("handset") << "handset" << false;
96 QTest::newRow("watch") << "watch" << false;
97 QTest::newRow("embedded") << "embedded" << true;
102 QFETCH(QString, chassis);
103 QFETCH(bool, result);
105 registerLogin1(true, true);
106 registerHostname1(chassis);
110 QCOMPARE(p.isPC(), result);
111 QCOMPARE(p.chassis(), chassis);
114 void testIsMultiSession_data()
116 QTest::addColumn<bool>("canMultiSession");
117 QTest::addColumn<bool>("canGraphical");
118 QTest::addColumn<bool>("result");
120 QTest::newRow("") << true << true << true;
121 QTest::newRow("") << true << false << false;
122 QTest::newRow("") << false << true << false;
123 QTest::newRow("") << false << false << false;
126 void testIsMultiSession()
128 QFETCH(bool, canMultiSession);
129 QFETCH(bool, canGraphical);
130 QFETCH(bool, result);
132 registerLogin1(canMultiSession, canGraphical);
133 registerHostname1("desktop");
137 QCOMPARE(p.isMultiSession(), result);
141QTEST_GUILESS_MAIN(PlatformTest)
142#include "platformtest.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