on xenial help sign in
Merge lp:~dandrader/unity8/unifyLightDMMocks
commita95cf67a9ffe5b76dbd86782d1bea619d50c26f7 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateMon 2 Feb 2015, 15:28 (12 years ago) parentb3809cb957d574
76 files changed+1577−785
debian/changelog+25 debian/control+1−1 plugins/LightDM/CMakeLists.txt+3−1 plugins/LightDM/Greeter.cpp+1−19 plugins/LightDM/Greeter.h+1−1 tests/mocks/LightDM/single-pin/UsersModelPrivate.cpp → plugins/LightDM/GreeterPrivate.h+20−14 tests/mocks/LightDM/demo/CMakeLists.txt → plugins/LightDM/liblightdm/CMakeLists.txt+6−6 tests/mocks/LightDM/Greeter.cpp → plugins/LightDM/liblightdm/Greeter.cpp+7−7 tests/mocks/LightDM/Greeter.h → plugins/LightDM/liblightdm/Greeter.h+4−3 tests/mocks/LightDM/demo/GreeterPrivate.cpp → plugins/LightDM/liblightdm/GreeterPrivate.cpp+2−2 tests/mocks/LightDM/GreeterPrivate.h → plugins/LightDM/liblightdm/GreeterPrivate.h−1 tests/mocks/LightDM/UsersModel.cpp → plugins/LightDM/liblightdm/UsersModel.cpp+6 tests/mocks/LightDM/UsersModel.h → plugins/LightDM/liblightdm/UsersModel.h+4 tests/mocks/LightDM/demo/UsersModelPrivate.cpp → plugins/LightDM/liblightdm/UsersModelPrivate.cpp+1−1 tests/mocks/LightDM/UsersModelPrivate.h → plugins/LightDM/liblightdm/UsersModelPrivate.h plugins/Unity/Indicators/CMakeLists.txt−1 plugins/Unity/Indicators/indicators.h+1−2 plugins/Unity/Indicators/plugin.cpp−2 plugins/Unity/Indicators/visibleindicatorsmodel.cpp−90 plugins/Unity/Indicators/visibleindicatorsmodel.h−56 po/en_AU.po+100−94 po/unity8.pot+43−39 qml/Panel/Indicators/MessageMenuItemFactory.qml+1 qml/Panel/Indicators/VisibleIndicators.qml−84 qml/Shell.qml+4−8 qml/Stages/PhoneStage.qml+2−2 qml/Stages/TabletStage.qml+2−2 run.sh+3−26 tests/autopilot/unity8/fixture_setup.py+35−1 tests/autopilot/unity8/indicators/__init__.py+124 tests/autopilot/unity8/indicators/tests/__init__.py+18−1 tests/autopilot/unity8/indicators/tests/test_display_indicator.py+53 tests/autopilot/unity8/indicators/tests/test_indicators.py+6−19 tests/autopilot/unity8/shell/__init__.py−13 tests/autopilot/unity8/shell/emulators/main_window.py+11−1 tests/autopilot/unity8/shell/tests/__init__.py+8−11 tests/autopilot/unity8/shell/tests/test_edges_demo.py−1 tests/autopilot/unity8/shell/tests/test_lock_screen.py+6−5 tests/mocks/LightDM/CMakeLists.txt+9−9 tests/mocks/LightDM/single-passphrase/UsersModelPrivate.cpp → tests/mocks/LightDM/MockGreeter.cpp+13−11 tests/mocks/LightDM/MockGreeter.h+37 tests/mocks/LightDM/MockUsersModel.cpp+39 tests/mocks/LightDM/single/GreeterPrivate.cpp → tests/mocks/LightDM/MockUsersModel.h+14−23 tests/mocks/LightDM/QLightDM/Greeter+17−1 tests/mocks/LightDM/QLightDM/InfographicModel−1 tests/mocks/LightDM/QLightDM/UsersModel+17−1 tests/mocks/LightDM/full/CMakeLists.txt−18 tests/mocks/LightDM/liblightdm/CMakeLists.txt+18 tests/mocks/LightDM/liblightdm/Greeter.cpp+199 tests/mocks/LightDM/liblightdm/Greeter.h+118 tests/mocks/LightDM/full/GreeterPrivate.cpp → tests/mocks/LightDM/liblightdm/GreeterPrivate.cpp+40−6 tests/mocks/LightDM/liblightdm/GreeterPrivate.h+54 tests/mocks/LightDM/liblightdm/UsersModel.cpp+134 tests/mocks/LightDM/liblightdm/UsersModel.h+69 tests/mocks/LightDM/full/UsersModelPrivate.cpp → tests/mocks/LightDM/liblightdm/UsersModelPrivate.cpp+58−6 tests/mocks/LightDM/liblightdm/UsersModelPrivate.h+63 tests/mocks/LightDM/plugin.cpp+68 tests/mocks/LightDM/single/UsersModelPrivate.cpp → tests/mocks/LightDM/plugin.h+13−14 tests/mocks/LightDM/single-passphrase/CMakeLists.txt−19 tests/mocks/LightDM/single-passphrase/GreeterPrivate.cpp−46 tests/mocks/LightDM/single-pin/CMakeLists.txt−19 tests/mocks/LightDM/single-pin/GreeterPrivate.cpp−46 tests/mocks/LightDM/single/CMakeLists.txt−18 tests/mocks/Unity/Indicators/CMakeLists.txt−1 tests/mocks/Unity/Indicators/fakeplugin.cpp−2 tests/plugins/LightDM/CMakeLists.txt+4−2 tests/plugins/LightDM/greeter.qml+5 tests/qmltests/CMakeLists.txt+19−19 tests/qmltests/Greeter/tst_Infographics.qml+10 tests/qmltests/Greeter/tst_MultiGreeter.qml+11 tests/qmltests/Panel/IndicatorTest.qml+1−7 tests/qmltests/Panel/tst_MenuContent.qml+1−1 tests/qmltests/Stages/tst_PhoneStage.qml+24 tests/qmltests/tst_Shell.qml+8−1 tests/qmltests/tst_ShellWithPin.qml+8 tests/qmltests/tst_TabletShell.qml+8
debian/changelog+25
@@ -1,3 +1,28 @@
1+unity8 (8.02+15.04.20150123.3-0ubuntu1) vivid; urgency=low
2+
3+ [ Sebastien Bacher ]
4+ * Set text hint property for the messaging menus inline reply widget
5+ (LP: #1389234)
6+
7+ [ Ying-Chun Liu ]
8+ * Added an initial set of autopilot tests for the display indicator.
9+
10+ [ Nick Dedekind ]
11+ * Removed filtering the indicator model by visibility.
12+
13+ [ Michael Zanetti ]
14+ * fixes left edge drag when in spread
15+
16+ [ Albert Astals Cid ]
17+ * Fix ninja build in a different way The previous one was adding rpath
18+ to some .so that broke our tests that use LD_LIBRARY_PATH to change
19+ which one is picked up
20+
21+ [ Leo Arias ]
22+ * Added an initial set of autopilot tests for the display indicator.
23+
24+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 23 Jan 2015 12:12:41 +0000
25+
126unity8 (8.02+15.04.20150121.2-0ubuntu1) vivid; urgency=low
227
328 [ Michael Terry ]
debian/control+1−1
@@ -48,7 +48,7 @@ Build-Depends: cmake,
4848 qtdeclarative5-dev-tools,
4949 qtdeclarative5-private-dev (>= 5.2.1),
5050 qtdeclarative5-qtmultimedia-plugin,
51− qtdeclarative5-ubuntu-settings-components (>= 0.4),
51+ qtdeclarative5-ubuntu-settings-components (>= 0.5),
5252 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 1.1.1239) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 1.1.1239),
5353 qtdeclarative5-ubuntu-web-plugin,
5454 ttf-ubuntu-font-family,
plugins/LightDM/CMakeLists.txt+3−1
@@ -4,6 +4,8 @@ pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
44# TODO: Once we split out a separate greeter process, uncomment these lines
55#pkg_check_modules(LIBLIGHTDM REQUIRED liblightdm-qt5-2)
66
7+add_subdirectory(liblightdm)
8+
79include_directories(
810 ${CMAKE_CURRENT_SOURCE_DIR}
911 ${CMAKE_CURRENT_BINARY_DIR}
@@ -28,7 +30,7 @@ add_library(LightDM-qml MODULE
2830 )
2931
3032target_link_libraries(LightDM-qml
31− MockLightDM-demo
33+ integratedLightDM
3234 unity8-private
3335# TODO: Once we split out a separate greeter process, uncomment these lines
3436# ${LIBLIGHTDM_LDFLAGS}
plugins/LightDM/Greeter.cpp+1−19
@@ -17,26 +17,8 @@
1717 */
1818
1919#include "Greeter.h"
20+#include "GreeterPrivate.h"
2021#include <libintl.h>
21−#include <QLightDM/Greeter>
22−
23−class GreeterPrivate
24−{
25−public:
26− explicit GreeterPrivate(Greeter *parent);
27−
28− QLightDM::Greeter *m_greeter;
29− bool m_active;
30− bool wasPrompted;
31− bool promptless;
32−
33−protected:
34− Greeter * const q_ptr;
35−
36−private:
37− Q_DECLARE_PUBLIC(Greeter)
38−};
39−
4022
4123GreeterPrivate::GreeterPrivate(Greeter* parent)
4224 : m_greeter(new QLightDM::Greeter(parent)),
plugins/LightDM/Greeter.h+1−1
@@ -68,7 +68,7 @@ Q_SIGNALS:
6868 // should switch to this user if possible.
6969 void requestAuthenticationUser(const QString &user);
7070
71−private:
71+protected:
7272 GreeterPrivate * const d_ptr;
7373
7474 Q_DECLARE_PRIVATE(Greeter)
tests/mocks/LightDM/single-pin/UsersModelPrivate.cpp → plugins/LightDM/GreeterPrivate.hrenamed+20−14
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2014 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -12,22 +12,28 @@
1212 *
1313 * You should have received a copy of the GNU General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Author: Michael Terry <michael.terry@canonical.com>
1715 */
1816
19−#include "../UsersModelPrivate.h"
17+#ifndef UNITY_GREETER_PRIVATE_H
18+#define UNITY_GREETER_PRIVATE_H
2019
21−namespace QLightDM
22−{
20+#include <QLightDM/Greeter>
2321
24−UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
25− : q_ptr(parent)
22+class GreeterPrivate
2623{
27− entries =
28− {
29− { "has-pin", "Has PIN", 0, 0, false, false, 0, 0 },
30− };
31−}
24+public:
25+ explicit GreeterPrivate(Greeter *parent);
26+
27+ QLightDM::Greeter *m_greeter;
28+ bool m_active;
29+ bool wasPrompted;
30+ bool promptless;
31+
32+protected:
33+ Greeter * const q_ptr;
34+
35+private:
36+ Q_DECLARE_PUBLIC(Greeter)
37+};
3238
33−}
39+#endif // UNITY_GREETER_PRIVATE_H
tests/mocks/LightDM/demo/CMakeLists.txt → plugins/LightDM/liblightdm/CMakeLists.txtrenamed+6−6
@@ -1,14 +1,14 @@
11pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
22
33set(LibLightDM_SOURCES
4− ../Greeter.cpp
5− ../UsersModel.cpp
4+ Greeter.cpp
5+ UsersModel.cpp
66 GreeterPrivate.cpp
77 UsersModelPrivate.cpp
88 ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
99 )
1010
11−add_library(MockLightDM-demo STATIC ${LibLightDM_SOURCES})
11+add_library(integratedLightDM STATIC ${LibLightDM_SOURCES})
1212add_library(MockLightDM-demo-shared SHARED ${LibLightDM_SOURCES})
1313
1414include_directories(
@@ -16,7 +16,7 @@ include_directories(
1616 ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
1717)
1818
19−target_link_libraries(MockLightDM-demo
19+target_link_libraries(integratedLightDM
2020 ${LIBUSERMETRICSOUTPUT_LDFLAGS}
2121 -lpam
2222)
@@ -25,10 +25,10 @@ target_link_libraries(MockLightDM-demo-shared
2525 -lpam
2626)
2727
28−qt5_use_modules(MockLightDM-demo Concurrent Gui)
28+qt5_use_modules(integratedLightDM Concurrent Gui)
2929qt5_use_modules(MockLightDM-demo-shared Concurrent Gui)
3030
31−set_target_properties(MockLightDM-demo PROPERTIES COMPILE_FLAGS -fPIC)
31+set_target_properties(integratedLightDM PROPERTIES COMPILE_FLAGS -fPIC)
3232set_target_properties(MockLightDM-demo-shared PROPERTIES
3333 OUTPUT_NAME lightdm-qt5-2)
3434
tests/mocks/LightDM/Greeter.cpp → plugins/LightDM/liblightdm/Greeter.cpprenamed+7−7
@@ -16,6 +16,13 @@
1616 * Author: Michael Terry <michael.terry@canonical.com>
1717 */
1818
19+
20+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21+ * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
22+ * COUNTERPART IN tests/mocks/Lightdm/liblightdm
23+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
24+
25+
1926#include "Greeter.h"
2027#include "GreeterPrivate.h"
2128#include <QtCore/QCoreApplication>
@@ -128,13 +135,6 @@ void Greeter::authenticate(const QString &username)
128135
129136 d->authenticated = false;
130137 d->authenticationUser = username;
131− d->twoFactorDone = false;
132− QTimer::singleShot(0, this, SLOT(delayedAuthentication()));
133−}
134−
135−void Greeter::delayedAuthentication()
136−{
137− Q_D(Greeter);
138138 d->handleAuthenticate();
139139}
140140
tests/mocks/LightDM/Greeter.h → plugins/LightDM/liblightdm/Greeter.hrenamed+4−3
@@ -24,6 +24,10 @@
2424#include <QtCore/QObject>
2525#include <QtCore/QVariant>
2626
27+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28+ * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
29+ * COUNTERPART IN tests/mocks/Lightdm/liblightdm
30+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
2731
2832namespace QLightDM
2933{
@@ -99,9 +103,6 @@ Q_SIGNALS:
99103protected:
100104 void sendAuthenticationComplete();
101105
102−private Q_SLOTS:
103− void delayedAuthentication();
104−
105106private:
106107 GreeterPrivate *d_ptr;
107108 Q_DECLARE_PRIVATE(Greeter)
tests/mocks/LightDM/demo/GreeterPrivate.cpp → plugins/LightDM/liblightdm/GreeterPrivate.cpprenamed+2−2
@@ -16,8 +16,8 @@
1616 * Author: Michael Terry <michael.terry@canonical.com>
1717 */
1818
19−#include "../Greeter.h"
20−#include "../GreeterPrivate.h"
19+#include "Greeter.h"
20+#include "GreeterPrivate.h"
2121#include <QFuture>
2222#include <QFutureInterface>
2323#include <QFutureWatcher>
tests/mocks/LightDM/GreeterPrivate.h → plugins/LightDM/liblightdm/GreeterPrivate.hrenamed−1
@@ -35,7 +35,6 @@ public:
3535 // These variables may not be used by all subclasses, that's no problem
3636 bool authenticated;
3737 QString authenticationUser;
38− bool twoFactorDone;
3938
4039 void handleAuthenticate();
4140 void handleRespond(const QString &response);
tests/mocks/LightDM/UsersModel.cpp → plugins/LightDM/liblightdm/UsersModel.cpprenamed+6
@@ -16,6 +16,12 @@
1616 * Author: Michael Terry <michael.terry@canonical.com>
1717 */
1818
19+
20+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21+ * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
22+ * COUNTERPART IN tests/mocks/Lightdm/liblightdm
23+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
24+
1925// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames.
2026// To use the same method of setting role name that it does, we
2127// set our compatibility to Qt4 here too.
tests/mocks/LightDM/UsersModel.h → plugins/LightDM/liblightdm/UsersModel.hrenamed+4
@@ -24,6 +24,10 @@
2424#include <QtCore/QSharedDataPointer>
2525#include <QAbstractListModel>
2626
27+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28+ * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
29+ * COUNTERPART IN tests/mocks/Lightdm/liblightdm
30+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
2731
2832namespace QLightDM
2933{
tests/mocks/LightDM/demo/UsersModelPrivate.cpp → plugins/LightDM/liblightdm/UsersModelPrivate.cpprenamed+1−1
@@ -16,7 +16,7 @@
1616 * Author: Michael Terry <michael.terry@canonical.com>
1717 */
1818
19−#include "../UsersModelPrivate.h"
19+#include "UsersModelPrivate.h"
2020
2121#include <QDir>
2222#include <QSettings>
tests/mocks/LightDM/UsersModelPrivate.h → plugins/LightDM/liblightdm/UsersModelPrivate.hrenamed

The content is the same.

plugins/Unity/Indicators/CMakeLists.txt−1
@@ -29,7 +29,6 @@ set(IndicatorsQML_SOURCES
2929 sharedunitymenumodel.cpp
3030 unitymenumodelcache.cpp
3131 unitymenumodelstack.cpp
32− visibleindicatorsmodel.cpp
3332)
3433add_definitions(-DUNITYINDICATORS_LIBRARY)
3534
plugins/Unity/Indicators/indicators.h+1−2
@@ -74,8 +74,7 @@ public:
7474 enum Roles {
7575 Identifier = 0,
7676 Position,
77− IndicatorProperties,
78− IsVisible
77+ IndicatorProperties
7978 };
8079
8180 IndicatorsModelRole(QObject*parent=0):QObject(parent) {}
plugins/Unity/Indicators/plugin.cpp−2
@@ -34,7 +34,6 @@
3434#include "sharedunitymenumodel.h"
3535#include "unitymenumodelcache.h"
3636#include "unitymenumodelstack.h"
37−#include "visibleindicatorsmodel.h"
3837
3938#include <unitymenumodel.h>
4039
@@ -55,7 +54,6 @@ void IndicatorsPlugin::registerTypes(const char *uri)
5554 qmlRegisterType<ModelActionRootState>(uri, 0, 1, "ModelActionRootState");
5655 qmlRegisterType<ActionRootState>(uri, 0, 1, "ActionRootState");
5756 qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter");
58− qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel");
5957 qmlRegisterType<SharedUnityMenuModel>(uri, 0, 1, "SharedUnityMenuModel");
6058
6159 qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton);
plugins/Unity/Indicators/visibleindicatorsmodel.cppdeleted−90
@@ -1,90 +0,0 @@
1−/*
2− * Copyright (C) 2012, 2013 Canonical, Ltd.
3− *
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.
7− *
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.
12− *
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/>.
15− */
16−
17−// self
18−#include "visibleindicatorsmodel.h"
19−#include "indicators.h"
20−
21−VisibleIndicatorsModel::VisibleIndicatorsModel(QObject *parent)
22− : QIdentityProxyModel(parent),
23− m_inserting(false)
24−{
25− QObject::connect(this, SIGNAL(rowsAboutToBeInserted(QModelIndex, int, int)), this, SLOT(onBeginRowInserted(QModelIndex, int, int)));
26− QObject::connect(this, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(onRowInserted(QModelIndex, int, int)));
27−}
28−
29−QHash<int, QByteArray> VisibleIndicatorsModel::roleNames() const
30−{
31− static QHash<int, QByteArray> roles;
32− if (roles.isEmpty())
33− {
34− roles[IndicatorsModelRole::Identifier] = "identifier";
35− roles[IndicatorsModelRole::Position] = "position";
36− roles[IndicatorsModelRole::IndicatorProperties] = "indicatorProperties";
37− roles[IndicatorsModelRole::IsVisible] = "isVisible";
38− }
39− return roles;
40−}
41−
42−void VisibleIndicatorsModel::setSourceModel(QAbstractItemModel *model)
43−{
44− if (sourceModel() != model) {
45− QIdentityProxyModel::setSourceModel(model);
46− Q_EMIT modelChanged();
47− }
48−}
49−
50−QVariantMap VisibleIndicatorsModel::visible() const
51−{
52− return m_visible;
53−}
54−
55−void VisibleIndicatorsModel::onBeginRowInserted(const QModelIndex&, int, int)
56−{
57− m_inserting = true;
58−}
59−
60−void VisibleIndicatorsModel::onRowInserted(const QModelIndex&, int, int)
61−{
62− m_inserting = false;
63−}
64−
65−void VisibleIndicatorsModel::setVisible(const QVariantMap& visible)
66−{
67− if (m_visible != visible) {
68− m_visible = visible;
69− Q_EMIT visibleChanged();
70−
71− // need to tell the view that the visible data has changed.
72− if (!m_inserting && rowCount() > 0) {
73− Q_EMIT dataChanged(index(0, 0), index(rowCount() - 1, 0), QVector<int>() << IndicatorsModelRole::IsVisible);
74− }
75− }
76−}
77−
78−QVariant VisibleIndicatorsModel::data(const QModelIndex &index, int role) const
79−{
80− if (role != IndicatorsModelRole::IsVisible) {
81− return QIdentityProxyModel::data(index, role);
82− }
83−
84− if (!index.isValid()) {
85− return false;
86− }
87−
88− QString ident = QIdentityProxyModel::data(index, IndicatorsModelRole::Identifier).toString();
89− return m_visible.value(ident, false).toBool();
90−}
plugins/Unity/Indicators/visibleindicatorsmodel.hdeleted−56
@@ -1,56 +0,0 @@
1−/*
2− * Copyright (C) 2012, 2013 Canonical, Ltd.
3− *
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.
7− *
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.
12− *
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/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−#ifndef VISIBLEINDICATORSMODEL_H
21−#define VISIBLEINDICATORSMODEL_H
22−
23−#include <QIdentityProxyModel>
24−
25−class VisibleIndicatorsModel : public QIdentityProxyModel
26−{
27− Q_OBJECT
28−
29− Q_PROPERTY(QAbstractItemModel* model READ sourceModel WRITE setSourceModel NOTIFY modelChanged)
30− Q_PROPERTY(QVariantMap visible READ visible WRITE setVisible NOTIFY visibleChanged)
31−
32−public:
33− explicit VisibleIndicatorsModel(QObject *parent = 0);
34−
35− virtual void setSourceModel(QAbstractItemModel *model);
36− virtual QHash<int, QByteArray> roleNames() const;
37− virtual QVariant data(const QModelIndex &index, int role) const;
38−
39− QVariantMap visible() const;
40− void setVisible(const QVariantMap& visible);
41−
42−public Q_SLOTS:
43− void onBeginRowInserted(const QModelIndex&, int start, int end);
44− void onRowInserted(const QModelIndex&, int start, int end);
45−
46−Q_SIGNALS:
47− void totalCountChanged();
48− void modelChanged();
49− void visibleChanged();
50−
51−private:
52− QVariantMap m_visible;
53− bool m_inserting;
54−};
55−
56−#endif // VISIBLEINDICATORSMODEL_H
po/en_AU.po+100−94
@@ -8,26 +8,26 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2014-12-10 10:55+0100\n"
11−"PO-Revision-Date: 2014-10-12 09:41+0000\n"
11+"PO-Revision-Date: 2015-01-25 05:57+0000\n"
1212"Last-Translator: Jared Norris <jarednorris@ubuntu.com>\n"
1313"Language-Team: English (Australia) <en_AU@li.org>\n"
1414"MIME-Version: 1.0\n"
1515"Content-Type: text/plain; charset=UTF-8\n"
1616"Content-Transfer-Encoding: 8bit\n"
1717"Plural-Forms: nplurals=2; plural=n != 1;\n"
18−"X-Launchpad-Export-Date: 2014-12-13 07:11+0000\n"
19−"X-Generator: Launchpad (build 17286)\n"
18+"X-Launchpad-Export-Date: 2015-01-26 06:54+0000\n"
19+"X-Generator: Launchpad (build 17306)\n"
2020
2121#: plugins/LightDM/Greeter.cpp:130
2222msgid "Password: "
2323msgstr "Password: "
2424
2525#: plugins/Unity/Launcher/launcheritem.cpp:45
26−#: plugins/Unity/Launcher/launcheritem.cpp:100
26+#: plugins/Unity/Launcher/launcheritem.cpp:91
2727msgid "Pin shortcut"
2828msgstr "Pin shortcut"
2929
30−#: plugins/Unity/Launcher/launcheritem.cpp:100
30+#: plugins/Unity/Launcher/launcheritem.cpp:91
3131msgid "Unpin shortcut"
3232msgstr "Unpin shortcut"
3333
@@ -50,45 +50,45 @@ msgid_plural "Please wait %1 minutes and then try again…"
5050msgstr[0] "Please wait %1 minute and then try again…"
5151msgstr[1] "Please wait %1 minutes and then try again…"
5252
53−#: qml/Components/Dialogs.qml:70
53+#: qml/Components/Dialogs.qml:74
5454msgid "Log out"
5555msgstr "Log out"
5656
57−#: qml/Components/Dialogs.qml:71
57+#: qml/Components/Dialogs.qml:75
5858msgid "Are you sure you want to log out?"
5959msgstr "Are you sure you want to log out?"
6060
61−#: qml/Components/Dialogs.qml:73 qml/Components/Dialogs.qml:97
62−#: qml/Components/Dialogs.qml:122
61+#: qml/Components/Dialogs.qml:77 qml/Components/Dialogs.qml:101
62+#: qml/Components/Dialogs.qml:126
6363msgid "No"
6464msgstr "No"
6565
66−#: qml/Components/Dialogs.qml:80 qml/Components/Dialogs.qml:104
67−#: qml/Components/Dialogs.qml:129
66+#: qml/Components/Dialogs.qml:84 qml/Components/Dialogs.qml:108
67+#: qml/Components/Dialogs.qml:133
6868msgid "Yes"
6969msgstr "Yes"
7070
71−#: qml/Components/Dialogs.qml:94
71+#: qml/Components/Dialogs.qml:98
7272msgid "Shut down"
7373msgstr "Shut down"
7474
75−#: qml/Components/Dialogs.qml:95
75+#: qml/Components/Dialogs.qml:99
7676msgid "Are you sure you want to shut down?"
7777msgstr "Are you sure you want to shut down?"
7878
79−#: qml/Components/Dialogs.qml:119
79+#: qml/Components/Dialogs.qml:123
8080msgid "Reboot"
8181msgstr "Reboot"
8282
83−#: qml/Components/Dialogs.qml:120
83+#: qml/Components/Dialogs.qml:124
8484msgid "Are you sure you want to reboot?"
8585msgstr "Are you sure you want to reboot?"
8686
87−#: qml/Components/Dialogs.qml:144
87+#: qml/Components/Dialogs.qml:148
8888msgid "Power"
8989msgstr "Power"
9090
91−#: qml/Components/Dialogs.qml:145
91+#: qml/Components/Dialogs.qml:149
9292msgid ""
9393"Are you sure you would like\n"
9494"to power off?"
@@ -96,15 +96,15 @@ msgstr ""
9696"Are you sure you would like\n"
9797"to power off?"
9898
99−#: qml/Components/Dialogs.qml:147
99+#: qml/Components/Dialogs.qml:151
100100msgid "Power off"
101101msgstr "Power off"
102102
103−#: qml/Components/Dialogs.qml:157
103+#: qml/Components/Dialogs.qml:161
104104msgid "Restart"
105105msgstr "Restart"
106106
107−#: qml/Components/Dialogs.qml:167
107+#: qml/Components/Dialogs.qml:171
108108msgid "Cancel"
109109msgstr "Cancel"
110110
@@ -112,43 +112,43 @@ msgstr "Cancel"
112112msgid "Skip intro"
113113msgstr "Skip intro"
114114
115−#: qml/Components/EdgeDemo.qml:125
115+#: qml/Components/EdgeDemo.qml:112
116116msgid "Right edge"
117117msgstr "Right edge"
118118
119−#: qml/Components/EdgeDemo.qml:126
119+#: qml/Components/EdgeDemo.qml:113
120120msgid "Try swiping from the right edge to unlock the phone"
121121msgstr "Try swiping from the right edge to unlock the phone"
122122
123−#: qml/Components/EdgeDemo.qml:157
123+#: qml/Components/EdgeDemo.qml:144
124124msgid "Top edge"
125125msgstr "Top edge"
126126
127−#: qml/Components/EdgeDemo.qml:158
127+#: qml/Components/EdgeDemo.qml:145
128128msgid "Try swiping from the top edge to access the indicators"
129129msgstr "Try swiping from the top edge to access the indicators"
130130
131−#: qml/Components/EdgeDemo.qml:183
131+#: qml/Components/EdgeDemo.qml:170
132132msgid "Close"
133133msgstr "Close"
134134
135−#: qml/Components/EdgeDemo.qml:184
135+#: qml/Components/EdgeDemo.qml:171
136136msgid "Swipe up again to close the settings screen"
137137msgstr "Swipe up again to close the settings screen"
138138
139−#: qml/Components/EdgeDemo.qml:214
139+#: qml/Components/EdgeDemo.qml:201
140140msgid "Left edge"
141141msgstr "Left edge"
142142
143−#: qml/Components/EdgeDemo.qml:215
143+#: qml/Components/EdgeDemo.qml:202
144144msgid "Swipe from the left to reveal the launcher for quick access to apps"
145145msgstr "Swipe from the left to reveal the launcher for quick access to apps"
146146
147−#: qml/Components/EdgeDemo.qml:242
147+#: qml/Components/EdgeDemo.qml:229
148148msgid "Well done"
149149msgstr "Well done"
150150
151−#: qml/Components/EdgeDemo.qml:243
151+#: qml/Components/EdgeDemo.qml:230
152152msgid ""
153153"You have now mastered the edge gestures and can start using the "
154154"phone<br><br>Tap on the screen to start"
@@ -156,44 +156,44 @@ msgstr ""
156156"You have now mastered the edge gestures and can start using the "
157157"phone<br><br>Tap on the screen to start"
158158
159−#: qml/Components/Lockscreen.qml:238
159+#: qml/Components/Lockscreen.qml:223
160160msgid "Return to Call"
161−msgstr ""
161+msgstr "Return to Call"
162162
163−#: qml/Components/Lockscreen.qml:238
163+#: qml/Components/Lockscreen.qml:223
164164msgid "Emergency Call"
165165msgstr "Emergency Call"
166166
167−#: qml/Components/Lockscreen.qml:270
167+#: qml/Components/Lockscreen.qml:255
168168msgid "OK"
169169msgstr "OK"
170170
171−#: qml/Dash/GenericScopeView.qml:431 qml/Dash/GenericScopeView.qml:588
171+#: qml/Dash/GenericScopeView.qml:434 qml/Dash/GenericScopeView.qml:591
172172msgid "See less"
173173msgstr "See less"
174174
175−#: qml/Dash/GenericScopeView.qml:431
175+#: qml/Dash/GenericScopeView.qml:434
176176msgid "See all"
177177msgstr "See all"
178178
179−#: qml/Dash/GenericScopeView.qml:493 qml/Dash/PageHeader.qml:267
179+#: qml/Dash/GenericScopeView.qml:496 qml/Dash/PageHeader.qml:268
180180#: qml/Panel/SearchIndicator.qml:27
181181msgid "Search"
182182msgstr "Search"
183183
184−#: qml/Dash/PageHeader.qml:260
184+#: qml/Dash/PageHeader.qml:261
185185msgid "Store"
186186msgstr "Store"
187187
188−#: qml/Dash/PageHeader.qml:277
188+#: qml/Dash/PageHeader.qml:278
189189msgid "Settings"
190190msgstr "Settings"
191191
192−#: qml/Dash/PageHeader.qml:284
192+#: qml/Dash/PageHeader.qml:285
193193msgid "Remove from Favorites"
194194msgstr "Remove from Favourites"
195195
196−#: qml/Dash/PageHeader.qml:284
196+#: qml/Dash/PageHeader.qml:285
197197msgid "Add to Favorites"
198198msgstr "Add to Favourites"
199199
@@ -227,15 +227,15 @@ msgstr "Release to refresh…"
227227
228228#: qml/Dash/ScopesList.qml:63
229229msgid "Manage"
230−msgstr ""
230+msgstr "Manage"
231231
232232#: qml/Dash/ScopesList.qml:107
233233msgid "Home"
234−msgstr ""
234+msgstr "Home"
235235
236236#: qml/Dash/ScopesList.qml:108
237237msgid "Also installed"
238−msgstr ""
238+msgstr "Also installed"
239239
240240#: qml/Greeter/Greeter.qml:174
241241msgid "Unlock"
@@ -289,49 +289,49 @@ msgstr "Unlock SIM"
289289msgid "Roaming"
290290msgstr "Roaming"
291291
292−#: qml/Shell.qml:367
292+#: qml/Shell.qml:402
293293#, qt-format
294294msgid "Enter %1"
295295msgstr "Enter %1"
296296
297−#: qml/Shell.qml:368 qml/Wizard/Pages/passwd-set.qml:60
297+#: qml/Shell.qml:394
298298msgid "Enter passphrase"
299299msgstr "Enter passphrase"
300300
301−#: qml/Shell.qml:369
301+#: qml/Shell.qml:398
302302msgid "Enter passcode"
303303msgstr "Enter passcode"
304304
305−#: qml/Shell.qml:370
305+#: qml/Shell.qml:403
306306#, qt-format
307307msgid "Sorry, incorrect %1"
308308msgstr "Sorry, incorrect %1"
309309
310−#: qml/Shell.qml:371
310+#: qml/Shell.qml:395
311311msgid "Sorry, incorrect passphrase"
312312msgstr "Sorry, incorrect passphrase"
313313
314−#: qml/Shell.qml:372
314+#: qml/Shell.qml:396
315315msgid "Please re-enter"
316316msgstr "Please re-enter"
317317
318−#: qml/Shell.qml:373
318+#: qml/Shell.qml:399
319319msgid "Sorry, incorrect passcode"
320320msgstr "Sorry, incorrect passcode"
321321
322−#: qml/Shell.qml:467 qml/Wizard/Pages/passwd-confirm.qml:53
322+#: qml/Shell.qml:444
323323msgid "Sorry, incorrect passphrase."
324324msgstr "Sorry, incorrect passphrase."
325325
326−#: qml/Shell.qml:468 qml/Wizard/Pages/passwd-confirm.qml:54
326+#: qml/Shell.qml:445
327327msgid "Sorry, incorrect passcode."
328328msgstr "Sorry, incorrect passcode."
329329
330−#: qml/Shell.qml:469
330+#: qml/Shell.qml:446
331331msgid "This will be your last attempt."
332332msgstr "This will be your last attempt."
333333
334−#: qml/Shell.qml:471
334+#: qml/Shell.qml:448
335335msgid ""
336336"If passphrase is entered incorrectly, your phone will conduct a factory "
337337"reset and all personal data will be deleted."
@@ -339,7 +339,7 @@ msgstr ""
339339"If passphrase is entered incorrectly, your phone will conduct a factory "
340340"reset and all personal data will be deleted."
341341
342−#: qml/Shell.qml:472
342+#: qml/Shell.qml:449
343343msgid ""
344344"If passcode is entered incorrectly, your phone will conduct a factory reset "
345345"and all personal data will be deleted."
@@ -349,98 +349,98 @@ msgstr ""
349349
350350#: qml/Wizard/Page.qml:89
351351msgid "Back"
352−msgstr ""
352+msgstr "Back"
353353
354354#: qml/Wizard/Pages/10-welcome.qml:27
355355msgid "Hi!"
356−msgstr ""
356+msgstr "Hi!"
357357
358358#: qml/Wizard/Pages/10-welcome.qml:44
359359msgid "Welcome to your Ubuntu phone."
360−msgstr ""
360+msgstr "Welcome to your Ubuntu phone."
361361
362362#: qml/Wizard/Pages/10-welcome.qml:52
363363msgid "Let’s get started."
364−msgstr ""
364+msgstr "Let’s get started."
365365
366366#: qml/Wizard/Pages/10-welcome.qml:88 qml/Wizard/Pages/30-passwd-type.qml:128
367367#: qml/Wizard/Pages/40-wifi.qml:197 qml/Wizard/Pages/50-location.qml:131
368368#: qml/Wizard/Pages/60-reporting.qml:50 qml/Wizard/Pages/passwd-confirm.qml:82
369369#: qml/Wizard/Pages/passwd-set.qml:90
370370msgid "Continue"
371−msgstr ""
371+msgstr "Continue"
372372
373373#: qml/Wizard/Pages/20-sim.qml:25
374374msgid "Add a SIM card and restart your device"
375−msgstr ""
375+msgstr "Add a SIM card and restart your device"
376376
377377#: qml/Wizard/Pages/20-sim.qml:55
378378msgid "Without it, you won’t be able to make calls or use text messaging."
379−msgstr ""
379+msgstr "Without it, you won’t be able to make calls or use text messaging."
380380
381381#: qml/Wizard/Pages/20-sim.qml:69 qml/Wizard/Pages/40-wifi.qml:197
382382msgid "Skip"
383−msgstr ""
383+msgstr "Skip"
384384
385385#: qml/Wizard/Pages/30-passwd-type.qml:39
386386msgid "Lock security"
387−msgstr ""
387+msgstr "Lock security"
388388
389389#: qml/Wizard/Pages/30-passwd-type.qml:74
390390msgid "Please select how you’d like to unlock your phone."
391−msgstr ""
391+msgstr "Please select how you’d like to unlock your phone."
392392
393393#: qml/Wizard/Pages/30-passwd-type.qml:97
394394msgid "Swipe"
395−msgstr ""
395+msgstr "Swipe"
396396
397397#: qml/Wizard/Pages/30-passwd-type.qml:98
398398msgid "No security"
399−msgstr ""
399+msgstr "No security"
400400
401401#: qml/Wizard/Pages/30-passwd-type.qml:100
402402msgid "Passcode"
403−msgstr ""
403+msgstr "Passcode"
404404
405405#: qml/Wizard/Pages/30-passwd-type.qml:101
406406msgid "4 digits only"
407−msgstr ""
407+msgstr "4 digits only"
408408
409409#: qml/Wizard/Pages/30-passwd-type.qml:103
410410msgid "Passphrase"
411−msgstr ""
411+msgstr "Passphrase"
412412
413413#: qml/Wizard/Pages/30-passwd-type.qml:104
414414msgid "Numbers and letters"
415−msgstr ""
415+msgstr "Numbers and letters"
416416
417417#: qml/Wizard/Pages/40-wifi.qml:28
418418msgid "Connect to Wi‑Fi"
419−msgstr ""
419+msgstr "Connect to Wi‑Fi"
420420
421421#: qml/Wizard/Pages/40-wifi.qml:147
422422msgid "Available networks…"
423−msgstr ""
423+msgstr "Available networks…"
424424
425425#: qml/Wizard/Pages/40-wifi.qml:148
426426msgid "No available networks."
427−msgstr ""
427+msgstr "No available networks."
428428
429429#: qml/Wizard/Pages/50-location.qml:27
430430msgid "Location"
431−msgstr ""
431+msgstr "Location"
432432
433433#: qml/Wizard/Pages/50-location.qml:62
434434msgid "Let the phone detect your location:"
435−msgstr ""
435+msgstr "Let the phone detect your location:"
436436
437437#: qml/Wizard/Pages/50-location.qml:69
438438msgid "Using GPS only (less accurate)"
439−msgstr ""
439+msgstr "Using GPS only (less accurate)"
440440
441441#: qml/Wizard/Pages/50-location.qml:86
442442msgid "Using GPS, anonymized Wi-Fi and cellular network info (recommended)"
443−msgstr ""
443+msgstr "Using GPS, anonymised Wi-Fi and cellular network info (recommended)"
444444
445445#. TRANSLATORS: HERE is a trademark for Nokia's location service, you probably shouldn't translate it
446446#: qml/Wizard/Pages/50-location.qml:103
@@ -448,81 +448,87 @@ msgid ""
448448"By selecting this option you agree to the Nokia HERE <a href='#'>terms and "
449449"conditions</a>."
450450msgstr ""
451+"By selecting this option you agree to the Nokia HERE <a href='#'>terms and "
452+"conditions</a>."
451453
452454#: qml/Wizard/Pages/50-location.qml:112
453455msgid "Not at all"
454−msgstr ""
456+msgstr "Not at all"
455457
456458#: qml/Wizard/Pages/50-location.qml:124
457459msgid "You can change your mind later in <b>System Settings</b>."
458−msgstr ""
460+msgstr "You can change your mind later in <b>System Settings</b>."
459461
460462#: qml/Wizard/Pages/60-reporting.qml:24
461463msgid "Improving your experience"
462−msgstr ""
464+msgstr "Improving your experience"
463465
464466#: qml/Wizard/Pages/60-reporting.qml:36
465467msgid ""
466468"Your phone is set up to automatically report errors to Canonical and its "
467469"partners, the makers of the operating system."
468470msgstr ""
471+"Your phone is set up to automatically report errors to Canonical and its "
472+"partners, the makers of the operating system."
469473
470474#: qml/Wizard/Pages/60-reporting.qml:43
471475msgid ""
472476"This can be disabled in <b>System Settings</b> under <b>Security &amp; "
473477"Privacy</b>"
474478msgstr ""
479+"This can be disabled in <b>System Settings</b> under <b>Security &amp; "
480+"Privacy</b>"
475481
476482#: qml/Wizard/Pages/80-finished.qml:24
477483msgid "All done"
478−msgstr ""
484+msgstr "All done"
479485
480486#: qml/Wizard/Pages/80-finished.qml:39
481487msgid "Nice work!"
482−msgstr ""
488+msgstr "Nice work!"
483489
484490#: qml/Wizard/Pages/80-finished.qml:46
485491msgid "Your phone is now ready to use."
486−msgstr ""
492+msgstr "Your phone is now ready to use."
487493
488494#: qml/Wizard/Pages/80-finished.qml:53
489495msgid "Finish"
490−msgstr ""
496+msgstr "Finish"
491497
492498#: qml/Wizard/Pages/here-terms.qml:27
493499msgid "Terms & Conditions"
494−msgstr ""
500+msgstr "Terms & Conditions"
495501
496502#: qml/Wizard/Pages/passwd-confirm.qml:49
497503msgid "Confirm passphrase"
498−msgstr ""
504+msgstr "Confirm passphrase"
499505
500506#: qml/Wizard/Pages/passwd-confirm.qml:50
501507msgid "Confirm passcode"
502−msgstr ""
508+msgstr "Confirm passcode"
503509
504510#: qml/Wizard/Pages/passwd-confirm.qml:53
505511#: qml/Wizard/Pages/passwd-confirm.qml:54
506512msgid "Please try again."
507−msgstr ""
513+msgstr "Please try again."
508514
509515#: qml/Wizard/Pages/passwd-set.qml:61
510516msgid "Choose your passcode"
511−msgstr ""
517+msgstr "Choose your passcode"
512518
513519#: qml/Wizard/Pages/passwd-set.qml:68
514520msgid "Passphrase must be 4 characters long"
515−msgstr ""
521+msgstr "Passphrase must be 4 characters long"
516522
517523#: qml/Wizard/StackButton.qml:39
518524#, qt-format
519525msgid "〈 %1"
520−msgstr ""
526+msgstr "〈 %1"
521527
522528#: qml/Wizard/StackButton.qml:42
523529#, qt-format
524530msgid "%1 〉"
525−msgstr ""
531+msgstr "%1 〉"
526532
527533#~ msgid "Confirm"
528534#~ msgstr "Confirm"
po/unity8.pot+43−39
@@ -8,7 +8,7 @@ msgid ""
88msgstr ""
99"Project-Id-Version: unity8\n"
1010"Report-Msgid-Bugs-To: \n"
11−"POT-Creation-Date: 2014-12-10 10:55+0100\n"
11+"POT-Creation-Date: 2015-01-22 11:09+0100\n"
1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -50,59 +50,59 @@ msgid_plural "Please wait %1 minutes and then try again…"
5050msgstr[0] ""
5151msgstr[1] ""
5252
53−#: qml/Components/Dialogs.qml:70
53+#: qml/Components/Dialogs.qml:86
5454msgid "Log out"
5555msgstr ""
5656
57−#: qml/Components/Dialogs.qml:71
57+#: qml/Components/Dialogs.qml:87
5858msgid "Are you sure you want to log out?"
5959msgstr ""
6060
61−#: qml/Components/Dialogs.qml:73 qml/Components/Dialogs.qml:97
62−#: qml/Components/Dialogs.qml:122
61+#: qml/Components/Dialogs.qml:89 qml/Components/Dialogs.qml:111
62+#: qml/Components/Dialogs.qml:134
6363msgid "No"
6464msgstr ""
6565
66−#: qml/Components/Dialogs.qml:80 qml/Components/Dialogs.qml:104
67−#: qml/Components/Dialogs.qml:129
66+#: qml/Components/Dialogs.qml:95 qml/Components/Dialogs.qml:117
67+#: qml/Components/Dialogs.qml:140
6868msgid "Yes"
6969msgstr ""
7070
71−#: qml/Components/Dialogs.qml:94
71+#: qml/Components/Dialogs.qml:108
7272msgid "Shut down"
7373msgstr ""
7474
75−#: qml/Components/Dialogs.qml:95
75+#: qml/Components/Dialogs.qml:109
7676msgid "Are you sure you want to shut down?"
7777msgstr ""
7878
79−#: qml/Components/Dialogs.qml:119
79+#: qml/Components/Dialogs.qml:131
8080msgid "Reboot"
8181msgstr ""
8282
83−#: qml/Components/Dialogs.qml:120
83+#: qml/Components/Dialogs.qml:132
8484msgid "Are you sure you want to reboot?"
8585msgstr ""
8686
87−#: qml/Components/Dialogs.qml:144
87+#: qml/Components/Dialogs.qml:154
8888msgid "Power"
8989msgstr ""
9090
91−#: qml/Components/Dialogs.qml:145
91+#: qml/Components/Dialogs.qml:155
9292msgid ""
9393"Are you sure you would like\n"
9494"to power off?"
9595msgstr ""
9696
97−#: qml/Components/Dialogs.qml:147
97+#: qml/Components/Dialogs.qml:157
9898msgid "Power off"
9999msgstr ""
100100
101−#: qml/Components/Dialogs.qml:157
101+#: qml/Components/Dialogs.qml:166
102102msgid "Restart"
103103msgstr ""
104104
105−#: qml/Components/Dialogs.qml:167
105+#: qml/Components/Dialogs.qml:175
106106msgid "Cancel"
107107msgstr ""
108108
@@ -164,32 +164,32 @@ msgstr ""
164164msgid "OK"
165165msgstr ""
166166
167−#: qml/Dash/GenericScopeView.qml:431 qml/Dash/GenericScopeView.qml:588
167+#: qml/Dash/GenericScopeView.qml:485 qml/Dash/GenericScopeView.qml:642
168168msgid "See less"
169169msgstr ""
170170
171−#: qml/Dash/GenericScopeView.qml:431
171+#: qml/Dash/GenericScopeView.qml:485
172172msgid "See all"
173173msgstr ""
174174
175−#: qml/Dash/GenericScopeView.qml:493 qml/Dash/PageHeader.qml:267
175+#: qml/Dash/GenericScopeView.qml:547 qml/Dash/PageHeader.qml:274
176176#: qml/Panel/SearchIndicator.qml:27
177177msgid "Search"
178178msgstr ""
179179
180−#: qml/Dash/PageHeader.qml:260
180+#: qml/Dash/PageHeader.qml:267
181181msgid "Store"
182182msgstr ""
183183
184−#: qml/Dash/PageHeader.qml:277
184+#: qml/Dash/PageHeader.qml:284
185185msgid "Settings"
186186msgstr ""
187187
188−#: qml/Dash/PageHeader.qml:284
188+#: qml/Dash/PageHeader.qml:291
189189msgid "Remove from Favorites"
190190msgstr ""
191191
192−#: qml/Dash/PageHeader.qml:284
192+#: qml/Dash/PageHeader.qml:291
193193msgid "Add to Favorites"
194194msgstr ""
195195
@@ -221,19 +221,19 @@ msgstr ""
221221msgid "Release to refresh…"
222222msgstr ""
223223
224−#: qml/Dash/ScopesList.qml:63
224+#: qml/Dash/ScopesList.qml:66
225225msgid "Manage"
226226msgstr ""
227227
228−#: qml/Dash/ScopesList.qml:107
228+#: qml/Dash/ScopesList.qml:112
229229msgid "Home"
230230msgstr ""
231231
232−#: qml/Dash/ScopesList.qml:108
232+#: qml/Dash/ScopesList.qml:113
233233msgid "Also installed"
234234msgstr ""
235235
236−#: qml/Greeter/Greeter.qml:174
236+#: qml/Greeter/Greeter.qml:133
237237msgid "Unlock"
238238msgstr ""
239239
@@ -277,6 +277,10 @@ msgstr ""
277277msgid "Failed, tap to retry"
278278msgstr ""
279279
280+#: qml/Panel/Indicators/MessageMenuItemFactory.qml:149
281+msgid "Reply"
282+msgstr ""
283+
280284#: qml/Panel/Indicators/ModemInfoItem.qml:105
281285msgid "Unlock SIM"
282286msgstr ""
@@ -285,55 +289,55 @@ msgstr ""
285289msgid "Roaming"
286290msgstr ""
287291
288−#: qml/Shell.qml:367
292+#: qml/Shell.qml:390
289293#, qt-format
290294msgid "Enter %1"
291295msgstr ""
292296
293−#: qml/Shell.qml:368 qml/Wizard/Pages/passwd-set.qml:60
297+#: qml/Shell.qml:391 qml/Wizard/Pages/passwd-set.qml:60
294298msgid "Enter passphrase"
295299msgstr ""
296300
297−#: qml/Shell.qml:369
301+#: qml/Shell.qml:392
298302msgid "Enter passcode"
299303msgstr ""
300304
301−#: qml/Shell.qml:370
305+#: qml/Shell.qml:393
302306#, qt-format
303307msgid "Sorry, incorrect %1"
304308msgstr ""
305309
306−#: qml/Shell.qml:371
310+#: qml/Shell.qml:394
307311msgid "Sorry, incorrect passphrase"
308312msgstr ""
309313
310−#: qml/Shell.qml:372
314+#: qml/Shell.qml:395
311315msgid "Please re-enter"
312316msgstr ""
313317
314−#: qml/Shell.qml:373
318+#: qml/Shell.qml:396
315319msgid "Sorry, incorrect passcode"
316320msgstr ""
317321
318−#: qml/Shell.qml:467 qml/Wizard/Pages/passwd-confirm.qml:53
322+#: qml/Shell.qml:490 qml/Wizard/Pages/passwd-confirm.qml:53
319323msgid "Sorry, incorrect passphrase."
320324msgstr ""
321325
322−#: qml/Shell.qml:468 qml/Wizard/Pages/passwd-confirm.qml:54
326+#: qml/Shell.qml:491 qml/Wizard/Pages/passwd-confirm.qml:54
323327msgid "Sorry, incorrect passcode."
324328msgstr ""
325329
326−#: qml/Shell.qml:469
330+#: qml/Shell.qml:492
327331msgid "This will be your last attempt."
328332msgstr ""
329333
330−#: qml/Shell.qml:471
334+#: qml/Shell.qml:494
331335msgid ""
332336"If passphrase is entered incorrectly, your phone will conduct a factory "
333337"reset and all personal data will be deleted."
334338msgstr ""
335339
336−#: qml/Shell.qml:472
340+#: qml/Shell.qml:495
337341msgid ""
338342"If passcode is entered incorrectly, your phone will conduct a factory reset "
339343"and all personal data will be deleted."
qml/Panel/Indicators/MessageMenuItemFactory.qml+1
@@ -146,6 +146,7 @@ Loader {
146146 time: timeFormatter.timeString
147147 body: getExtendedProperty(extendedData, "xCanonicalText", "")
148148 replyButtonText: getExtendedProperty(replyActionDescription, "label", "Send")
149+ replyHintText: i18n.tr("Reply")
149150 // icons
150151 avatar: getExtendedProperty(extendedData, "icon", "image://theme/contact")
151152 icon: getExtendedProperty(extendedData, "xCanonicalAppIcon", "image://theme/message")
qml/Panel/Indicators/VisibleIndicators.qmldeleted−84
@@ -1,84 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
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.
7− *
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.
12− *
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/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Unity.Indicators 0.1 as Indicators
22−import Utils 0.1
23−
24−Item {
25− property UnitySortFilterProxyModel model: filterModel
26−
27− function initialise(profile) {
28− indicatorsModel.load(profile);
29− }
30−
31− UnitySortFilterProxyModel {
32− id: filterModel
33− filterRole: Indicators.IndicatorsModelRole.IsVisible
34− filterRegExp: RegExp("^true$")
35− dynamicSortFilter: true
36−
37− model: Indicators.VisibleIndicatorsModel {
38− id: visibleIndicatorsModel
39− model: indicatorsModel
40− }
41− }
42−
43− Indicators.IndicatorsModel {
44− id: indicatorsModel
45− }
46−
47− Repeater {
48− id: repeater
49− model: indicatorsModel
50−
51− property var visibleIndicators: undefined
52− onVisibleIndicatorsChanged: {
53− if (visibleIndicators !== undefined) {
54− visibleIndicatorsModel.visible = visibleIndicators;
55− }
56− }
57−
58− delegate: IndicatorDelegate {
59− id: item
60− objectName: model.identifier + "-delegate"
61− identifier: model.identifier
62− Component.onCompleted: {
63− for(var pName in indicatorProperties) {
64− if (item.hasOwnProperty(pName)) {
65− item[pName] = indicatorProperties[pName];
66− }
67− }
68− updateVisibility();
69− }
70−
71− onEnabledChanged: {
72− updateVisibility()
73− }
74−
75− function updateVisibility() {
76− if (repeater.visibleIndicators === undefined) {
77− repeater.visibleIndicators = {}
78− }
79− repeater.visibleIndicators[model.identifier] = enabled;
80− repeater.visibleIndicatorsChanged();
81− }
82− }
83− }
84−}
qml/Shell.qml+4−8
@@ -36,11 +36,11 @@ import "Panel"
3636import "Components"
3737import "Notifications"
3838import "Stages"
39−import "Panel/Indicators"
4039import "Wizard"
4140import Unity.Notifications 1.0 as NotificationBackend
4241import Unity.Session 0.1
4342import Unity.DashCommunicator 0.1
43+import Unity.Indicators 0.1 as Indicators
4444
4545Item {
4646 id: shell
@@ -749,13 +749,9 @@ Item {
749749 minimizedPanelHeight: units.gu(3)
750750 expandedPanelHeight: units.gu(7)
751751
752− indicatorsModel: visibleIndicators.model
753− }
754−
755− VisibleIndicators {
756− id: visibleIndicators
757− // TODO: This should be sourced by device type (eg "desktop", "tablet", "phone"...)
758− Component.onCompleted: initialise(indicatorProfile)
752+ indicatorsModel: Indicators.IndicatorsModel {
753+ Component.onCompleted: load(indicatorProfile);
754+ }
759755 }
760756 callHint {
761757 greeterShown: greeter.shown || lockscreen.shown
qml/Stages/PhoneStage.qml+2−2
@@ -52,7 +52,7 @@ Rectangle {
5252 if (inverseProgress == 0 && priv.oldInverseProgress > 0) {
5353 // left edge drag released. Minimum distance is given by design.
5454 if (priv.oldInverseProgress > units.gu(22)) {
55− ApplicationManager.focusApplication("unity8-dash");
55+ ApplicationManager.requestFocusApplication("unity8-dash");
5656 }
5757 }
5858 priv.oldInverseProgress = inverseProgress;
@@ -299,7 +299,7 @@ Rectangle {
299299 x: {
300300 // focused app is always positioned at 0 except when following left edge drag
301301 if (index == 0) {
302− if (!isDash && root.inverseProgress > 0) {
302+ if (!isDash && root.inverseProgress > 0 && spreadView.phase === 0) {
303303 return root.inverseProgress;
304304 }
305305 return 0;
qml/Stages/TabletStage.qml+2−2
@@ -43,7 +43,7 @@ Rectangle {
4343 if (inverseProgress == 0 && priv.oldInverseProgress > 0) {
4444 // left edge drag released. Minimum distance is given by design.
4545 if (priv.oldInverseProgress > units.gu(22)) {
46− ApplicationManager.focusApplication("unity8-dash");
46+ ApplicationManager.requestFocusApplication("unity8-dash");
4747 }
4848 }
4949 priv.oldInverseProgress = inverseProgress;
@@ -492,7 +492,7 @@ Rectangle {
492492 interactive: !spreadView.interactive && spreadView.phase === 0 && root.interactive
493493 swipeToCloseEnabled: spreadView.interactive && !snapAnimation.running
494494 maximizedAppTopMargin: root.maximizedAppTopMargin
495− dragOffset: !isDash && model.appId == priv.mainStageAppId && root.inverseProgress > 0 ? root.inverseProgress : 0
495+ dragOffset: !isDash && model.appId == priv.mainStageAppId && root.inverseProgress > 0 && spreadView.phase === 0 ? root.inverseProgress : 0
496496 application: ApplicationManager.get(index)
497497 closeable: !isDash
498498
run.sh+3−26
@@ -6,8 +6,6 @@ export QML2_IMPORT_PATH
66QML_PHONE_SHELL_PATH=./builddir/src/unity8
77GDB=false
88FAKE=false
9−PINLOCK=false
10−KEYLOCK=false
119USE_MOCKS=false
1210MOUSE_TOUCH=true
1311
@@ -16,9 +14,6 @@ usage() {
1614 echo "Script to run the shell.\n" >&2
1715 echo "OPTIONS:" >&2
1816 echo " -f, --fake Force use of fake Qml modules." >&2
19− echo " -p, --pinlock Use a pin protected user." >&2
20− echo " -k, --keylock Use a passphrase protected user." >&2
21− echo " -l, --lightdm Use the specified lightdm mock." >&2
2217 echo " -g, --gdb Run through gdb." >&2
2318 echo " -h, --help Show this help." >&2
2419 echo " -m, --nomousetouch Run without -mousetouch argument." >&2
@@ -26,7 +21,7 @@ usage() {
2621 exit 1
2722}
2823
29−ARGS=`getopt -n$0 -u -a --longoptions="fake,pinlock,keylock,gdb,help,lightdm:,nomousetouch" -o "fpkl:ghm" -- "$@"`
24+ARGS=`getopt -n$0 -u -a --longoptions="fake,gdb,help:,nomousetouch" -o "fghm" -- "$@"`
3025[ $? -ne 0 ] && usage
3126eval set -- "$ARGS"
3227
@@ -34,12 +29,6 @@ while [ $# -gt 0 ]
3429do
3530 case "$1" in
3631 -f|--fake) USE_MOCKS=true;;
37− -p|--pinlock) USE_MOCKS=true; LIGHTDM_MOCK=single-pin;;
38− -k|--keylock) USE_MOCKS=true; LIGHTDM_MOCK=single-passphrase;;
39− -l|--lightdm) LIGHTDM_MOCK=$2; shift;
40− if [ -z "$LIGHTDM_MOCK" ]; then
41− echo "Please specify an argument to --lightdm"
42− fi;;
4332 -g|--gdb) GDB=true;;
4433 -h|--help) usage;;
4534 -m|--nomousetouch) MOUSE_TOUCH=false;;
@@ -48,23 +37,11 @@ do
4837 shift
4938done
5039
51−if [ -z "$LIGHTDM_MOCK" ]; then
52− LIGHTDM_MOCK=single
53−fi
54−
55−# Even without USE_MOCKS set, we want to fake our lightdm backend, because it's
56−# annoying to be prompted for your password when testing. To get the same
57−# backend used in production, pass '--lightdm=demo'.
58−export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/LightDM/$LIGHTDM_MOCK
59−
6040if $USE_MOCKS; then
61− rm -f $PWD/builddir/nonmirplugins/LightDM # undo symlink (from below) for cleanliness
6241 export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
63− export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics
42+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/LightDM/liblightdm:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/QMenuModel
6443else
65− # Just link our LightDM mock into the nonmirplugins folder. We don't want
66− # the rest of our plugins to be used.
67− ln -sf $PWD/builddir/tests/mocks/LightDM $PWD/builddir/nonmirplugins/
44+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/plugins/LightDM/liblightdm
6845fi
6946
7047QML_PHONE_SHELL_ARGS=""
tests/autopilot/unity8/fixture_setup.py+35−1
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -18,6 +18,8 @@
1818#
1919
2020import fixtures
21+import subprocess
22+
2123from autopilot import introspection
2224
2325from unity8 import process_helpers
@@ -62,3 +64,35 @@ class LaunchDashApp(fixtures.Fixture):
6264
6365 def stop_application(self):
6466 process_helpers.stop_job('unity8-dash')
67+
68+
69+class DisplayRotationLock(fixtures.Fixture):
70+
71+ def __init__(self, enable):
72+ super(DisplayRotationLock, self).__init__()
73+ self.enable = enable
74+
75+ def setUp(self):
76+ super(DisplayRotationLock, self).setUp()
77+ original_state = self._is_rotation_lock_enabled()
78+ if self.enable != original_state:
79+ self.addCleanup(self._set_rotation_lock, original_state)
80+ self._set_rotation_lock(self.enable)
81+
82+ def _is_rotation_lock_enabled(self):
83+ command = [
84+ 'gsettings', 'get',
85+ 'com.ubuntu.touch.system',
86+ 'rotation-lock'
87+ ]
88+ output = subprocess.check_output(command, universal_newlines=True)
89+ return True if output.count('true') else False
90+
91+ def _set_rotation_lock(self, value):
92+ value_string = 'true' if value else 'false'
93+ command = [
94+ 'gsettings', 'set',
95+ 'com.ubuntu.touch.system',
96+ 'rotation-lock', value_string
97+ ]
98+ subprocess.check_output(command)
tests/autopilot/unity8/indicators/__init__.py+124
@@ -0,0 +1,124 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+#
3+# Unity Indicators Autopilot Test Suite
4+# Copyright (C) 2015 Canonical
5+#
6+# This program is free software: you can redistribute it and/or modify
7+# it under the terms of the GNU General Public License as published by
8+# the Free Software Foundation, either version 3 of the License, or
9+# (at your option) any later version.
10+#
11+# This program is distributed in the hope that it will be useful,
12+# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+# GNU General Public License for more details.
15+# You should have received a copy of the GNU General Public License
16+# along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
18+import ubuntuuitoolkit
19+from autopilot import introspection
20+
21+from unity8.shell import emulators
22+
23+
24+class IndicatorPage(emulators.UnityEmulatorBase):
25+
26+ """Autopilot helper for the IndicatorPage component."""
27+
28+ # XXX Because of https://bugs.launchpad.net/autopilot-qt/+bug/1341671
29+ # we need to make sure it does not match in any selection.
30+ # --elopio - 2015-01-20
31+
32+ @classmethod
33+ def validate_dbus_object(cls, path, state):
34+ return False
35+
36+
37+class DisplayIndicator(object):
38+
39+ def __init__(self, main_window):
40+ self._main_window = main_window
41+
42+ def is_indicator_icon_visible(self):
43+ panel_item = self._main_window.wait_select_single(
44+ objectName='indicator-rotation-lock-panelItem')
45+ return panel_item.indicatorVisible
46+
47+ def open(self):
48+ """Open the display indicator page.
49+
50+ :return: The custom proxy object for the display indicator page.
51+
52+ """
53+ if self.is_indicator_icon_visible():
54+ return self._main_window.open_indicator_page(
55+ 'indicator-rotation-lock')
56+ else:
57+ return self._open_indicator_with_icon_not_visible()
58+
59+ def _open_indicator_with_icon_not_visible(self):
60+ # Open any displayed indicator.
61+ self._main_window.open_indicator_page('indicator-datetime')
62+ self._make_indicator_icon_visible()
63+ indicator_rotation_icon = self._main_window.select_single(
64+ objectName='indicator-rotation-lock-panelItem')
65+ self._main_window.pointing_device.click_object(indicator_rotation_icon)
66+ return self._main_window.wait_select_single(
67+ objectName='indicator-rotation-lock-page')
68+
69+ def _make_indicator_icon_visible(self):
70+ indicators_bar_flickable = self._main_window.select_single(
71+ 'IndicatorsBar').select_single(
72+ ubuntuuitoolkit.QQuickFlickable, objectName='flickable')
73+ self._swipe_flickable_to_x_end(indicators_bar_flickable)
74+
75+ def _swipe_flickable_to_x_end(self, flickable):
76+ # XXX this should be implemented as a general horizontal swiping in
77+ # the toolkit custom proxy object. -- elopio - 2015-01-20
78+ if not flickable.atXEnd:
79+ while not flickable.atXEnd:
80+ start_y = stop_y = (
81+ flickable.globalRect.y +
82+ (flickable.globalRect.height // 2))
83+ # We can't start the swipe from the border because it would
84+ # open the launcher
85+ start_x = flickable.globalRect.x + 45
86+ stop_x = (
87+ flickable.globalRect.x + flickable.globalRect.width - 5)
88+ flickable.pointing_device.drag(
89+ start_x, start_y, stop_x, stop_y)
90+ flickable.dragging.wait_for(False)
91+ flickable.moving.wait_for(False)
92+
93+ def close(self):
94+ """Close the indicator page."""
95+ self._main_window.close_indicator_page()
96+
97+
98+class DisplayIndicatorPage(IndicatorPage):
99+
100+ """Autopilot helper for the display indicator page."""
101+
102+ @classmethod
103+ def validate_dbus_object(cls, path, state):
104+ name = introspection.get_classname_from_path(path)
105+ if name == b'IndicatorPage':
106+ if state['objectName'][1] == 'indicator-rotation-lock-page':
107+ return True
108+ return False
109+
110+ def lock_rotation(self):
111+ """Toggle the rotation lock indicator to locked."""
112+ switcher = self._get_switcher()
113+ switcher.check()
114+ switcher.checked.wait_for(True)
115+
116+ def _get_switcher(self):
117+ return self.select_single(
118+ ubuntuuitoolkit.CheckBox, objectName='switcher')
119+
120+ def unlock_rotation(self):
121+ """Toggle the rotation lock indicator to unlocked."""
122+ switcher = self._get_switcher()
123+ switcher.uncheck()
124+ switcher.checked.wait_for(False)
tests/autopilot/unity8/indicators/tests/__init__.py+18−1
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity - Indicators Autopilot Test Suite
4−# Copyright (C) 2013, 2014 Canonical
4+# Copyright (C) 2013, 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -15,3 +15,20 @@
1515#
1616# You should have received a copy of the GNU General Public License
1717# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+from autopilot import platform
20+
21+from unity8 import process_helpers
22+from unity8.shell import tests
23+
24+
25+class IndicatorTestCase(tests.UnityTestCase):
26+
27+ device_emulation_scenarios = tests._get_device_emulation_scenarios()
28+
29+ def setUp(self):
30+ if platform.model() == 'Desktop':
31+ self.skipTest('Test cannot be run on the desktop.')
32+ super(IndicatorTestCase, self).setUp()
33+ self.unity_proxy = self.launch_unity()
34+ process_helpers.unlock_unity(self.unity_proxy)
tests/autopilot/unity8/indicators/tests/test_display_indicator.pynew file+53
@@ -0,0 +1,53 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+#
3+# Unity Indicators Autopilot Test Suite
4+# Copyright (C) 2015 Canonical
5+#
6+# This program is free software: you can redistribute it and/or modify
7+# it under the terms of the GNU General Public License as published by
8+# the Free Software Foundation, either version 3 of the License, or
9+# (at your option) any later version.
10+#
11+# This program is distributed in the hope that it will be useful,
12+# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+# GNU General Public License for more details.
15+#
16+# You should have received a copy of the GNU General Public License
17+# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+from unity8 import (
20+ fixture_setup,
21+ indicators,
22+)
23+from unity8.indicators import tests
24+
25+
26+class DisplayIndicatorTestCase(tests.IndicatorTestCase):
27+
28+ def test_indicator_icon_must_be_visible_after_rotation_locked(self):
29+ # TODO remove the skip when the bug is fixed. --elopio - 2015-01-20
30+ self.skipTest(
31+ 'This test fails because of bug http://pad.lv/1410915')
32+ rotation_unlocked = fixture_setup.DisplayRotationLock(False)
33+ self.useFixture(rotation_unlocked)
34+ display_indicator = indicators.DisplayIndicator(self.main_window)
35+ self.assertFalse(display_indicator.is_indicator_icon_visible())
36+
37+ display_indicator_page = display_indicator.open()
38+ display_indicator_page.lock_rotation()
39+ display_indicator.close()
40+
41+ self.assertTrue(display_indicator.is_indicator_icon_visible())
42+
43+ def test_indicator_icon_must_not_be_visible_after_rotation_unlocked(self):
44+ rotation_locked = fixture_setup.DisplayRotationLock(True)
45+ self.useFixture(rotation_locked)
46+ display_indicator = indicators.DisplayIndicator(self.main_window)
47+ self.assertTrue(display_indicator.is_indicator_icon_visible())
48+
49+ display_indicator_page = display_indicator.open()
50+ display_indicator_page.unlock_rotation()
51+ display_indicator.close()
52+
53+ self.assertFalse(display_indicator.is_indicator_icon_visible())
tests/autopilot/unity8/indicators/tests/test_indicators.py+6−19
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Indicators Autopilot Test Suite
4−# Copyright (C) 2013, 2014 Canonical
4+# Copyright (C) 2013, 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -22,23 +22,10 @@ from testscenarios import multiply_scenarios
2222
2323from autopilot import platform
2424
25−from unity8.process_helpers import unlock_unity
26−from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
25+from unity8.indicators import tests
2726
2827
29−class IndicatorTestCase(UnityTestCase):
30−
31− device_emulation_scenarios = _get_device_emulation_scenarios()
32−
33− def setUp(self):
34− if platform.model() == 'Desktop':
35− self.skipTest('Test cannot be run on the desktop.')
36− super(IndicatorTestCase, self).setUp()
37− self.unity_proxy = self.launch_unity()
38− unlock_unity(self.unity_proxy)
39−
40−
41−class IndicatorExistsTestCase(IndicatorTestCase):
28+class IndicatorExistsTestCase(tests.IndicatorTestCase):
4229
4330 indicator_scenarios = [
4431 ('Bluetooth', dict(indicator_name='indicator-bluetooth')),
@@ -51,7 +38,7 @@ class IndicatorExistsTestCase(IndicatorTestCase):
5138 ]
5239 scenarios = multiply_scenarios(
5340 indicator_scenarios,
54− IndicatorTestCase.device_emulation_scenarios
41+ tests.IndicatorTestCase.device_emulation_scenarios
5542 )
5643
5744 def setUp(self):
@@ -66,7 +53,7 @@ class IndicatorExistsTestCase(IndicatorTestCase):
6653 )
6754
6855
69−class IndicatorPageTitleMatchesWidgetTestCase(IndicatorTestCase):
56+class IndicatorPageTitleMatchesWidgetTestCase(tests.IndicatorTestCase):
7057
7158 indicator_scenarios = [
7259 ('Bluetooth', dict(indicator_name='indicator-bluetooth',
@@ -86,7 +73,7 @@ class IndicatorPageTitleMatchesWidgetTestCase(IndicatorTestCase):
8673 ]
8774 scenarios = multiply_scenarios(
8875 indicator_scenarios,
89− IndicatorTestCase.device_emulation_scenarios
76+ tests.IndicatorTestCase.device_emulation_scenarios
9077 )
9178
9279 def setUp(self):
tests/autopilot/unity8/shell/__init__.py−13
@@ -27,19 +27,6 @@ import logging
2727
2828logger = logging.getLogger(__name__)
2929
30−
31−def with_lightdm_mock(mock_type):
32− """A simple decorator that sets up the LightDM mock for a single test."""
33− def with_lightdm_mock_internal(fn):
34− @wraps(fn)
35− def wrapper(*args, **kwargs):
36− tests_self = args[0]
37− tests_self.patch_lightdm_mock(mock_type)
38− return fn(*args, **kwargs)
39− return wrapper
40− return with_lightdm_mock_internal
41−
42−
4330def disable_qml_mocking(fn):
4431 """Simple decorator that disables the QML mocks from being loaded."""
4532 @wraps(fn)
tests/autopilot/unity8/shell/emulators/main_window.py+11−1
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2012, 2013, 2014 Canonical
4+# Copyright (C) 2012, 2013, 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -88,6 +88,16 @@ class QQuickView(emulators.UnityEmulatorBase):
8888 self.wait_select_single('IndicatorsMenu', fullyOpened=True)
8989 return self._get_indicator_page(indicator_name)
9090
91+ @autopilot_logging.log_action(logger.info)
92+ def close_indicator_page(self):
93+ """Swipe to close the opened indicator, wait until it's closed."""
94+ indicators_menu = self.wait_select_single('IndicatorsMenu')
95+ end_x, end_y = input.get_center_point(indicators_menu)
96+ start_x = end_x
97+ start_y = self.height
98+ self.pointing_device.drag(start_x, start_y, end_x, end_y)
99+ indicators_menu.fullyClosed.wait_for(True)
100+
91101 @autopilot_logging.log_action(logger.info)
92102 def show_dash_swiping(self):
93103 """Show the dash swiping from the left."""
tests/autopilot/unity8/shell/tests/__init__.py+8−11
@@ -153,7 +153,6 @@ class UnityTestCase(AutopilotTestCase):
153153 self.useFixture(toolkit_fixtures.HideUnity7Launcher())
154154
155155 self._proxy = None
156− self._lightdm_mock_type = None
157156 self._qml_mock_enabled = True
158157 self._data_dirs_mock_enabled = True
159158 self._environment = {}
@@ -265,8 +264,7 @@ class UnityTestCase(AutopilotTestCase):
265264 binary_path
266265 )
267266
268− if self._lightdm_mock_type is None:
269− self.patch_lightdm_mock()
267+ self.patch_lightdm_mock()
270268
271269 if self._qml_mock_enabled:
272270 self._environment['QML2_IMPORT_PATH'] = (
@@ -338,12 +336,11 @@ class UnityTestCase(AutopilotTestCase):
338336 if data_dirs is not None:
339337 self._environment['XDG_DATA_DIRS'] = data_dirs
340338
341− def patch_lightdm_mock(self, mock_type='single'):
342− self._lightdm_mock_type = mock_type
343− logger.info("Setting up LightDM mock type '%s'", mock_type)
339+ def patch_lightdm_mock(self):
340+ logger.info("Setting up LightDM mock lib")
344341 new_ld_library_path = [
345342 get_default_extra_mock_libraries(),
346− self._get_lightdm_mock_path(mock_type)
343+ self._get_lightdm_mock_path()
347344 ]
348345 if os.getenv('LD_LIBRARY_PATH') is not None:
349346 new_ld_library_path.append(os.getenv('LD_LIBRARY_PATH'))
@@ -353,16 +350,16 @@ class UnityTestCase(AutopilotTestCase):
353350
354351 self._environment['LD_LIBRARY_PATH'] = new_ld_library_path
355352
356− def _get_lightdm_mock_path(self, mock_type):
353+ def _get_lightdm_mock_path(self):
357354 lib_path = get_mocks_library_path()
358355 lightdm_mock_path = os.path.abspath(
359− os.path.join(lib_path, "LightDM", mock_type)
356+ os.path.join(lib_path, "LightDM", "liblightdm")
360357 )
361358
362359 if not os.path.exists(lightdm_mock_path):
363360 raise RuntimeError(
364− "LightDM mock '%s' does not exist at path '%s'."
365− % (mock_type, lightdm_mock_path)
361+ "LightDM mock does not exist at path '%s'."
362+ % (lightdm_mock_path)
366363 )
367364 return lightdm_mock_path
368365
tests/autopilot/unity8/shell/tests/test_edges_demo.py−1
@@ -34,7 +34,6 @@ class EdgesDemoTestCase(tests.UnityTestCase):
3434 super(EdgesDemoTestCase, self).setUp()
3535 self._qml_mock_enabled = False
3636 self._data_dirs_mock_enabled = False
37− self._lightdm_mock_type = False
3837
3938 self.useFixture(fixture_setup.EdgesDemo(True))
4039 self.unity = self.launch_unity()
tests/autopilot/unity8/shell/tests/test_lock_screen.py+6−5
@@ -20,7 +20,6 @@
2020
2121from __future__ import absolute_import
2222
23−from unity8.shell import with_lightdm_mock
2423from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
2524
2625from autopilot.matchers import Eventually
@@ -41,9 +40,10 @@ class TestLockscreen(UnityTestCase):
4140
4241 scenarios = _get_device_emulation_scenarios()
4342
44− @with_lightdm_mock("single-pin")
4543 def test_can_unlock_pin_screen(self):
4644 """Must be able to unlock the PIN entry lock screen."""
45+
46+ self._environment['LIBLIGHTDM_MOCK_MODE'] = "single-pin"
4747 self.launch_unity()
4848 greeter = self.main_window.get_greeter()
4949
@@ -56,9 +56,10 @@ class TestLockscreen(UnityTestCase):
5656 self._enter_prompt_passphrase("1234\n")
5757 self.assertThat(greeter.shown, Eventually(Equals(False)))
5858
59− @with_lightdm_mock("single-passphrase")
6059 def test_can_unlock_passphrase_screen(self):
6160 """Must be able to unlock the passphrase entry screen."""
61+
62+ self._environment['LIBLIGHTDM_MOCK_MODE'] = "single-passphrase"
6263 self.launch_unity()
6364 greeter = self.main_window.get_greeter()
6465
@@ -71,9 +72,9 @@ class TestLockscreen(UnityTestCase):
7172 self._enter_prompt_passphrase("password")
7273 self.assertThat(greeter.shown, Eventually(Equals(False)))
7374
74− @with_lightdm_mock("single-pin")
7575 def test_pin_screen_wrong_code(self):
7676 """Entering the wrong pin code must not dismiss the lock screen."""
77+ self._environment['LIBLIGHTDM_MOCK_MODE'] = "single-pin"
7778 self.launch_unity()
7879 greeter = self.main_window.get_greeter()
7980
@@ -90,9 +91,9 @@ class TestLockscreen(UnityTestCase):
9091 self.assertThat(prompt.text, Eventually(Equals("")))
9192 self.assertThat(greeter.shown, Eventually(Equals(True)))
9293
93− @with_lightdm_mock("single-passphrase")
9494 def test_passphrase_screen_wrong_password(self):
9595 """Entering the wrong password must not dismiss the lock screen."""
96+ self._environment['LIBLIGHTDM_MOCK_MODE'] = "single-passphrase"
9697 self.launch_unity()
9798 greeter = self.main_window.get_greeter()
9899
tests/mocks/LightDM/CMakeLists.txt+9−9
@@ -4,16 +4,13 @@
44# actually using the system liblightdm in the normal plugin, this version can
55# be deleted.
66
7−add_subdirectory(demo)
8−add_subdirectory(full)
9−add_subdirectory(single)
10−add_subdirectory(single-pin)
11−add_subdirectory(single-passphrase)
7+add_subdirectory(liblightdm)
128
139include_directories(
1410 ${CMAKE_CURRENT_SOURCE_DIR}
1511 ${CMAKE_CURRENT_BINARY_DIR}
1612 ${CMAKE_SOURCE_DIR}/plugins/Utils
13+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
1714 ${CMAKE_SOURCE_DIR}/tests/mocks/libusermetrics
1815 ${libunity8-private_SOURCE_DIR}
1916)
@@ -22,9 +19,11 @@ set(QMLPLUGIN_SRC
2219 ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeter.cpp
2320 ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeterList.cpp
2421 ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
25− ${CMAKE_SOURCE_DIR}/plugins/LightDM/plugin.cpp
2622 ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
2723 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
24+ MockGreeter.cpp
25+ MockUsersModel.cpp
26+ plugin.cpp
2827 )
2928
3029add_library(MockLightDM-qml MODULE
@@ -35,9 +34,10 @@ add_library(MockLightDM-qml MODULE
3534# installed on the system. So we make sure we link to our full fake version
3635# At run time, we can point to whichever version we happen to be using via
3736# LD_LIBRARY_PATH.
38−add_dependencies(MockLightDM-qml MockLightDM-full MockUserMetrics)
37+add_dependencies(MockLightDM-qml MockLightDM MockUserMetrics)
3938target_link_libraries(MockLightDM-qml
40− MockLightDM-full
39+ -L${CMAKE_CURRENT_BINARY_DIR}/liblightdm
40+ -llightdm-qt5-2
4141 -L${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics
4242 -lusermetricsoutput
4343 unity8-private
@@ -48,5 +48,5 @@ qt5_use_modules(MockLightDM-qml DBus Gui Qml)
4848add_unity8_mock(LightDM 0.1 LightDM
4949 PREFIX mocks
5050 TARGETS MockLightDM-qml
51− ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/full"
51+ ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/liblightdm"
5252)
tests/mocks/LightDM/single-passphrase/UsersModelPrivate.cpp → tests/mocks/LightDM/MockGreeter.cpprenamed+13−11
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2014 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -13,21 +13,23 @@
1313 * You should have received a copy of the GNU General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 *
16− * Author: Michael Terry <michael.terry@canonical.com>
1716 */
1817
19−#include "../UsersModelPrivate.h"
18+#include "MockGreeter.h"
19+#include <GreeterPrivate.h>
2020
21−namespace QLightDM
21+QString MockGreeter::mockMode() const
2222{
23+ Q_D(const Greeter);
24+ return d->m_greeter->mockMode();
25+}
2326
24−UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
25− : q_ptr(parent)
27+void MockGreeter::setMockMode(QString mockMode)
2628{
27− entries =
28− {
29− { "single", "Has Passphrase", 0, 0, false, false, 0, 0 },
30− };
31−}
29+ Q_D(Greeter);
3230
31+ if (d->m_greeter->mockMode() != mockMode) {
32+ d->m_greeter->setMockMode(mockMode);
33+ Q_EMIT mockModeChanged(mockMode);
34+ }
3335}
tests/mocks/LightDM/MockGreeter.hnew file+37
@@ -0,0 +1,37 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ *
16+ */
17+
18+// The real, production, Greeter
19+#include <Greeter.h>
20+
21+#ifndef MOCK_UNITY_GREETER_H
22+#define MOCK_UNITY_GREETER_H
23+
24+class MockGreeter : public Greeter {
25+ Q_OBJECT
26+
27+ Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
28+
29+public:
30+ QString mockMode() const;
31+ void setMockMode(QString mockMode);
32+
33+Q_SIGNALS:
34+ void mockModeChanged(QString mode);
35+};
36+
37+#endif // MOCK_UNITY_GREETER_H
tests/mocks/LightDM/MockUsersModel.cppnew file+39
@@ -0,0 +1,39 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ *
16+ */
17+
18+#include "MockUsersModel.h"
19+#include <QLightDM/UsersModel>
20+#include <QSortFilterProxyModel>
21+
22+QString MockUsersModel::mockMode() const
23+{
24+ QLightDM::UsersModel* qUsersModel =
25+ static_cast<QLightDM::UsersModel*>(static_cast<QSortFilterProxyModel*>(sourceModel())->sourceModel());
26+
27+ return qUsersModel->mockMode();
28+}
29+
30+void MockUsersModel::setMockMode(QString mockMode)
31+{
32+ QLightDM::UsersModel* qUsersModel =
33+ static_cast<QLightDM::UsersModel*>(static_cast<QSortFilterProxyModel*>(sourceModel())->sourceModel());
34+
35+ if (qUsersModel->mockMode() != mockMode) {
36+ qUsersModel->setMockMode(mockMode);
37+ Q_EMIT mockModeChanged(mockMode);
38+ }
39+}
tests/mocks/LightDM/single/GreeterPrivate.cpp → tests/mocks/LightDM/MockUsersModel.hrenamed+14−23
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2014 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -13,34 +13,25 @@
1313 * You should have received a copy of the GNU General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 *
16− * Author: Michael Terry <michael.terry@canonical.com>
1716 */
1817
19−#include "../Greeter.h"
20−#include "../GreeterPrivate.h"
18+#ifndef MOCK_UNITY_USERSMODEL_H
19+#define MOCK_UNITY_USERSMODEL_H
2120
22−namespace QLightDM
23−{
21+#include <UsersModel.h>
2422
25−GreeterPrivate::GreeterPrivate(Greeter* parent)
26− : authenticated(false),
27− authenticationUser(),
28− twoFactorDone(false),
29− q_ptr(parent)
23+class MockUsersModel : public UsersModel
3024{
31−}
25+ Q_OBJECT
3226
33−void GreeterPrivate::handleAuthenticate()
34−{
35− Q_Q(Greeter);
27+ Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
3628
37− authenticated = true;
38− Q_EMIT q->authenticationComplete();
39−}
29+public:
30+ QString mockMode() const;
31+ void setMockMode(QString mockMode);
4032
41−void GreeterPrivate::handleRespond(QString const &response)
42−{
43− Q_UNUSED(response)
44−}
33+Q_SIGNALS:
34+ void mockModeChanged(QString mode);
35+};
4536
46−}
37+#endif // MOCK_UNITY_USERSMODEL_H
tests/mocks/LightDM/QLightDM/Greetermode 120000 → 100644+17−1
@@ -1 +0,0 @@
1−../Greeter.h
@@ -0,0 +1,17 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ */
16+
17+#include "../liblightdm/Greeter.h"
tests/mocks/LightDM/QLightDM/InfographicModeldeleted−1
@@ -1 +0,0 @@
1−../InfographicModel.h
tests/mocks/LightDM/QLightDM/UsersModelmode 120000 → 100644+17−1
@@ -1 +0,0 @@
1−../UsersModel.h
@@ -0,0 +1,17 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ */
16+
17+#include "../liblightdm/UsersModel.h"
tests/mocks/LightDM/full/CMakeLists.txtdeleted−18
@@ -1,18 +0,0 @@
1−set(LibLightDM_SOURCES
2− ../Greeter.cpp
3− ../UsersModel.cpp
4− GreeterPrivate.cpp
5− UsersModelPrivate.cpp
6− ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
7− )
8−
9−add_library(MockLightDM-full SHARED ${LibLightDM_SOURCES})
10−
11−qt5_use_modules(MockLightDM-full Gui)
12−
13−set_target_properties(MockLightDM-full PROPERTIES
14− OUTPUT_NAME lightdm-qt5-2)
15−
16−install(TARGETS MockLightDM-full
17− DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/full
18− )
tests/mocks/LightDM/liblightdm/CMakeLists.txtnew file+18
@@ -0,0 +1,18 @@
1+set(LibLightDM_SOURCES
2+ Greeter.cpp
3+ UsersModel.cpp
4+ GreeterPrivate.cpp
5+ UsersModelPrivate.cpp
6+ ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
7+ )
8+
9+add_library(MockLightDM SHARED ${LibLightDM_SOURCES})
10+
11+qt5_use_modules(MockLightDM Gui)
12+
13+set_target_properties(MockLightDM PROPERTIES
14+ OUTPUT_NAME lightdm-qt5-2)
15+
16+install(TARGETS MockLightDM
17+ DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/liblightdm
18+ )
tests/mocks/LightDM/liblightdm/Greeter.cppnew file+199
@@ -0,0 +1,199 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ */
16+
17+#include "Greeter.h"
18+#include "GreeterPrivate.h"
19+#include <QtCore/QCoreApplication>
20+#include <QTimer>
21+
22+namespace QLightDM
23+{
24+
25+Greeter::Greeter(QObject *parent)
26+ : QObject(parent),
27+ d_ptr(new GreeterPrivate(this))
28+{
29+}
30+
31+Greeter::~Greeter()
32+{
33+}
34+
35+QString Greeter::authenticationUser() const
36+{
37+ Q_D(const Greeter);
38+ return d->authenticationUser;
39+}
40+
41+bool Greeter::hasGuestAccountHint() const
42+{
43+ return true;
44+}
45+
46+QString Greeter::getHint(const QString &name) const
47+{
48+ Q_UNUSED(name)
49+ return "";
50+}
51+
52+QString Greeter::defaultSessionHint() const
53+{
54+ return "ubuntu";
55+}
56+
57+bool Greeter::hideUsersHint() const
58+{
59+ return false;
60+}
61+
62+bool Greeter::showManualLoginHint() const
63+{
64+ return true;
65+}
66+
67+bool Greeter::showRemoteLoginHint() const
68+{
69+ return true;
70+}
71+
72+bool Greeter::lockHint () const
73+{
74+ return false;
75+}
76+
77+QString Greeter::selectUserHint() const
78+{
79+ return "";
80+}
81+
82+bool Greeter::selectGuestHint() const
83+{
84+ return false;
85+}
86+
87+QString Greeter::autologinUserHint() const
88+{
89+ return "";
90+}
91+
92+bool Greeter::autologinGuestHint() const
93+{
94+ return false;
95+}
96+
97+int Greeter::autologinTimeoutHint() const
98+{
99+ return 0;
100+}
101+
102+bool Greeter::inAuthentication() const
103+{
104+ return false;
105+}
106+
107+QString Greeter::hostname() const
108+{
109+ return "hostname1";
110+}
111+
112+bool Greeter::isAuthenticated() const
113+{
114+ Q_D(const Greeter);
115+ return d->authenticated;
116+}
117+
118+bool Greeter::connectSync()
119+{
120+ return true;
121+}
122+
123+void Greeter::authenticate(const QString &username)
124+{
125+ Q_D(Greeter);
126+
127+ d->authenticated = false;
128+ d->authenticationUser = username;
129+ d->twoFactorDone = false;
130+ QTimer::singleShot(0, this, SLOT(delayedAuthentication()));
131+}
132+
133+void Greeter::delayedAuthentication()
134+{
135+ Q_D(Greeter);
136+ d->handleAuthenticate();
137+}
138+
139+void Greeter::authenticateAsGuest()
140+{}
141+
142+void Greeter::authenticateAutologin()
143+{}
144+
145+void Greeter::authenticateRemote(const QString &session, const QString &username)
146+{
147+ Q_UNUSED(session)
148+ Q_UNUSED(username)
149+}
150+
151+void Greeter::cancelAuthentication()
152+{}
153+
154+void Greeter::setLanguage (const QString &language)
155+{
156+ Q_UNUSED(language)
157+}
158+
159+bool Greeter::startSessionSync(const QString &session)
160+{
161+ Q_UNUSED(session)
162+ return true;
163+}
164+
165+void Greeter::respond(const QString &response)
166+{
167+ Q_D(Greeter);
168+
169+ d->handleRespond(response);
170+}
171+
172+void Greeter::sendAuthenticationComplete()
173+{
174+ if (qgetenv("UNITY_TESTING").isEmpty()) {
175+ // simulate PAM's delay
176+ QTimer::singleShot(1000, this, SIGNAL(authenticationComplete()));
177+ } else {
178+ Q_EMIT authenticationComplete();
179+ }
180+}
181+
182+QString Greeter::mockMode() const
183+{
184+ Q_D(const Greeter);
185+ return d->mockMode;
186+}
187+
188+
189+void Greeter::setMockMode(QString mockMode)
190+{
191+ Q_D(Greeter);
192+
193+ if (d->mockMode != mockMode) {
194+ d->mockMode = mockMode;
195+ Q_EMIT mockModeChanged(mockMode);
196+ }
197+}
198+
199+}
tests/mocks/LightDM/liblightdm/Greeter.hnew file+118
@@ -0,0 +1,118 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ * Copyright (C) 2010-2011 David Edmundson.
4+ * Copyright (C) 2010-2011 Robert Ancell
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License as published by
8+ * the Free Software Foundation; version 3.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+ *
18+ * Author: David Edmundson <kde@davidedmundson.co.uk>
19+ */
20+
21+#ifndef UNITY_MOCK_GREETER_H
22+#define UNITY_MOCK_GREETER_H
23+
24+#include <QtCore/QObject>
25+#include <QtCore/QVariant>
26+
27+
28+namespace QLightDM
29+{
30+ class GreeterPrivate;
31+
32+class Q_DECL_EXPORT Greeter : public QObject
33+{
34+ Q_OBJECT
35+
36+ Q_PROPERTY(bool authenticated READ isAuthenticated ) //NOTFIY authenticationComplete
37+ Q_PROPERTY(QString authenticationUser READ authenticationUser )
38+ Q_PROPERTY(QString defaultSession READ defaultSessionHint CONSTANT)
39+ Q_PROPERTY(QString selectUser READ selectUserHint CONSTANT)
40+ Q_PROPERTY(bool selectGuest READ selectGuestHint CONSTANT)
41+
42+ Q_PROPERTY(QString hostname READ hostname CONSTANT)
43+ Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT)
44+ Q_PROPERTY(bool locked READ lockHint CONSTANT)
45+
46+ Q_PROPERTY(QString hostname READ hostname CONSTANT)
47+
48+ Q_ENUMS(PromptType MessageType)
49+
50+ //Mock-only API for testing purposes
51+ Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
52+
53+public:
54+ enum PromptType {
55+ PromptTypeQuestion,
56+ PromptTypeSecret
57+ };
58+
59+ enum MessageType {
60+ MessageTypeInfo,
61+ MessageTypeError
62+ };
63+
64+ explicit Greeter(QObject* parent=0);
65+ virtual ~Greeter();
66+
67+ QString getHint(const QString &name) const;
68+ QString defaultSessionHint() const;
69+ bool hideUsersHint() const;
70+ bool showManualLoginHint() const;
71+ bool showRemoteLoginHint() const;
72+ bool lockHint () const;
73+ bool hasGuestAccountHint() const;
74+ QString selectUserHint() const;
75+ bool selectGuestHint() const;
76+ QString autologinUserHint() const;
77+ bool autologinGuestHint() const;
78+ int autologinTimeoutHint() const;
79+
80+ bool inAuthentication() const;
81+ bool isAuthenticated() const;
82+ QString authenticationUser() const;
83+ QString hostname() const;
84+
85+ QString mockMode() const;
86+ void setMockMode(QString mockMode);
87+
88+public Q_SLOTS:
89+ bool connectSync();
90+ void authenticate(const QString &username=QString());
91+ void authenticateAsGuest();
92+ void authenticateAutologin();
93+ void authenticateRemote(const QString &session=QString(), const QString &username=QString());
94+ void respond(const QString &response);
95+ void cancelAuthentication();
96+ void setLanguage (const QString &language);
97+ bool startSessionSync(const QString &session=QString());
98+
99+Q_SIGNALS:
100+ void showMessage(QString text, QLightDM::Greeter::MessageType type);
101+ void showPrompt(QString text, QLightDM::Greeter::PromptType type);
102+ void authenticationComplete();
103+ void autologinTimerExpired();
104+ void mockModeChanged(QString mode);
105+
106+protected:
107+ void sendAuthenticationComplete();
108+
109+private Q_SLOTS:
110+ void delayedAuthentication();
111+
112+private:
113+ GreeterPrivate *d_ptr;
114+ Q_DECLARE_PRIVATE(Greeter)
115+};
116+}
117+
118+#endif // UNITY_MOCK_GREETER_H
tests/mocks/LightDM/full/GreeterPrivate.cpp → tests/mocks/LightDM/liblightdm/GreeterPrivate.cpprenamed+40−6
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2014 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -12,12 +12,10 @@
1212 *
1313 * You should have received a copy of the GNU General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Author: Michael Terry <michael.terry@canonical.com>
1715 */
1816
19−#include "../Greeter.h"
20−#include "../GreeterPrivate.h"
17+#include "Greeter.h"
18+#include "GreeterPrivate.h"
2119
2220namespace QLightDM
2321{
@@ -26,14 +24,33 @@ GreeterPrivate::GreeterPrivate(Greeter* parent)
2624 : authenticated(false),
2725 authenticationUser(),
2826 twoFactorDone(false),
27+ mockMode("single"),
2928 q_ptr(parent)
3029{
30+ char *envMockMode = getenv("LIBLIGHTDM_MOCK_MODE");
31+ if (envMockMode) {
32+ mockMode = envMockMode;
33+ }
3134}
3235
3336void GreeterPrivate::handleAuthenticate()
3437{
3538 Q_Q(Greeter);
3639
40+ if (mockMode == "single") {
41+ authenticated = true;
42+ Q_EMIT q->authenticationComplete();
43+ } else if (mockMode == "single-passphrase" || mockMode == "single-pin") {
44+ Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
45+ } else if (mockMode == "full") {
46+ handleAuthenticate_full();
47+ }
48+}
49+
50+void GreeterPrivate::handleAuthenticate_full()
51+{
52+ Q_Q(Greeter);
53+
3754 // Send out any messages we need to
3855 if (authenticationUser == "info-prompt")
3956 Q_EMIT q->showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
@@ -65,7 +82,24 @@ void GreeterPrivate::handleAuthenticate()
6582 }
6683}
6784
68−void GreeterPrivate::handleRespond(const QString &response)
85+void GreeterPrivate::handleRespond(QString const &response)
86+{
87+ Q_Q(Greeter);
88+
89+ if (mockMode == "single") {
90+ // NOOP
91+ } else if (mockMode == "single-passphrase") {
92+ authenticated = (response == "password");
93+ q->sendAuthenticationComplete();
94+ } else if (mockMode == "single-pin") {
95+ authenticated = (response == "1234");
96+ q->sendAuthenticationComplete();
97+ } else if (mockMode == "full") {
98+ handleRespond_full(response);
99+ }
100+}
101+
102+void GreeterPrivate::handleRespond_full(const QString &response)
69103{
70104 Q_Q(Greeter);
71105
tests/mocks/LightDM/liblightdm/GreeterPrivate.hnew file+54
@@ -0,0 +1,54 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ */
16+
17+#ifndef UNITY_MOCK_GREETER_PRIVATE_H
18+#define UNITY_MOCK_GREETER_PRIVATE_H
19+
20+#include <QtCore/QObject>
21+
22+namespace QLightDM
23+{
24+class Greeter;
25+class GreeterImpl;
26+
27+class GreeterPrivate
28+{
29+public:
30+ explicit GreeterPrivate(Greeter* parent=0);
31+ virtual ~GreeterPrivate() = default;
32+
33+ // These variables may not be used by all subclasses, that's no problem
34+ bool authenticated;
35+ QString authenticationUser;
36+ bool twoFactorDone;
37+
38+ QString mockMode;
39+
40+ void handleAuthenticate();
41+ void handleRespond(const QString &response);
42+
43+protected:
44+ GreeterImpl *m_impl; // if the backend needs more private data
45+ Greeter * const q_ptr;
46+
47+private:
48+ void handleAuthenticate_full();
49+ void handleRespond_full(const QString &response);
50+ Q_DECLARE_PUBLIC(Greeter)
51+};
52+}
53+
54+#endif // UNITY_MOCK_GREETER_PRIVATE_H
tests/mocks/LightDM/liblightdm/UsersModel.cppnew file+134
@@ -0,0 +1,134 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ *
16+ * Author: Michael Terry <michael.terry@canonical.com>
17+ */
18+
19+// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames.
20+// To use the same method of setting role name that it does, we
21+// set our compatibility to Qt4 here too.
22+#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0)
23+
24+#include "UsersModel.h"
25+#include "UsersModelPrivate.h"
26+#include <QtCore/QDir>
27+#include <QtCore/QString>
28+#include <QtGui/QIcon>
29+
30+namespace QLightDM
31+{
32+
33+UsersModel::UsersModel(QObject *parent) :
34+ QAbstractListModel(parent),
35+ d_ptr(new UsersModelPrivate(this))
36+{
37+ Q_D(UsersModel);
38+
39+ // Extend roleNames (we want to keep the "display" role)
40+ QHash<int, QByteArray> roles = roleNames();
41+ roles[NameRole] = "name";
42+ roles[RealNameRole] = "realName";
43+ roles[LoggedInRole] = "loggedIn";
44+ roles[BackgroundRole] = "background";
45+ roles[BackgroundPathRole] = "backgroundPath";
46+ roles[SessionRole] = "session";
47+ roles[HasMessagesRole] = "hasMessages";
48+ roles[ImagePathRole] = "imagePath";
49+ setRoleNames(roles);
50+
51+ // Now modify our mock user backgrounds
52+ QDir bgdir = QDir("/usr/share/demo-assets/shell/backgrounds/");
53+ QStringList backgrounds = bgdir.entryList(QDir::Files | QDir::NoDotAndDotDot);
54+
55+ for (int i = 0, j = 0; i < d->entries.size(); i++) {
56+ Entry &entry = d->entries[i];
57+ if (entry.background.isNull() && !backgrounds.isEmpty()) {
58+ entry.background = bgdir.filePath(backgrounds[j++]);
59+ if (j >= backgrounds.length()) {
60+ j = 0;
61+ }
62+ }
63+ }
64+}
65+
66+UsersModel::~UsersModel()
67+{
68+ delete d_ptr;
69+}
70+
71+int UsersModel::rowCount(const QModelIndex &parent) const
72+{
73+ Q_D(const UsersModel);
74+
75+ if (parent.isValid()) {
76+ return 0;
77+ } else { // parent is root
78+ return d->entries.size();
79+ }
80+}
81+
82+QVariant UsersModel::data(const QModelIndex &index, int role) const
83+{
84+ Q_D(const UsersModel);
85+
86+ if (!index.isValid()) {
87+ return QVariant();
88+ }
89+
90+ int row = index.row();
91+ switch (role) {
92+ case Qt::DisplayRole:
93+ return d->entries[row].real_name;
94+ case Qt::DecorationRole:
95+ return QIcon();
96+ case UsersModel::NameRole:
97+ return d->entries[row].username;
98+ case UsersModel::RealNameRole:
99+ return d->entries[row].real_name;
100+ case UsersModel::SessionRole:
101+ return d->entries[row].session;
102+ case UsersModel::LoggedInRole:
103+ return d->entries[row].is_active;
104+ case UsersModel::BackgroundRole:
105+ return QPixmap(d->entries[row].background);
106+ case UsersModel::BackgroundPathRole:
107+ return d->entries[row].background;
108+ case UsersModel::HasMessagesRole:
109+ return d->entries[row].has_messages;
110+ case UsersModel::ImagePathRole:
111+ return "";
112+ default:
113+ return QVariant();
114+ }
115+}
116+
117+QString UsersModel::mockMode() const
118+{
119+ Q_D(const UsersModel);
120+ return d->mockMode;
121+}
122+
123+void UsersModel::setMockMode(QString mockMode)
124+{
125+ Q_D(UsersModel);
126+
127+ if (d->mockMode != mockMode) {
128+ d->mockMode = mockMode;
129+ Q_EMIT mockModeChanged(mockMode);
130+ d->resetEntries();
131+ }
132+}
133+
134+}
tests/mocks/LightDM/liblightdm/UsersModel.hnew file+69
@@ -0,0 +1,69 @@
1+/*
2+ * Copyright (C) 2013-2014 Canonical, Ltd.
3+ * Copyright (C) 2010-2011 David Edmundson.
4+ *
5+ * This program is free software; you can redistribute it and/or modify
6+ * it under the terms of the GNU General Public License as published by
7+ * the Free Software Foundation; version 3.
8+ *
9+ * This program is distributed in the hope that it will be useful,
10+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+ * GNU General Public License for more details.
13+ *
14+ * You should have received a copy of the GNU General Public License
15+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
16+ */
17+
18+#ifndef UNITY_MOCK_USERSMODEL_H
19+#define UNITY_MOCK_USERSMODEL_H
20+
21+#include <QtCore/QString>
22+#include <QtCore/QSharedDataPointer>
23+#include <QAbstractListModel>
24+
25+
26+namespace QLightDM
27+{
28+class UsersModelPrivate;
29+
30+class Q_DECL_EXPORT UsersModel : public QAbstractListModel
31+{
32+ Q_OBJECT
33+
34+ Q_ENUMS(UserModelRoles)
35+
36+ //Mock-only API for testing purposes
37+ Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
38+
39+Q_SIGNALS:
40+ void mockModeChanged(QString mode);
41+
42+public:
43+ explicit UsersModel(QObject *parent = 0);
44+ virtual ~UsersModel();
45+
46+ enum UserModelRoles {NameRole = Qt::UserRole,
47+ RealNameRole,
48+ LoggedInRole,
49+ BackgroundRole,
50+ SessionRole,
51+ HasMessagesRole,
52+ ImagePathRole,
53+ BackgroundPathRole
54+ };
55+
56+ int rowCount(const QModelIndex &parent) const;
57+ QVariant data(const QModelIndex &index, int role) const;
58+
59+ QString mockMode() const;
60+ void setMockMode(QString mockMode);
61+
62+private:
63+ UsersModelPrivate * const d_ptr;
64+ Q_DECLARE_PRIVATE(UsersModel)
65+};
66+
67+}
68+
69+#endif // UNITY_MOCK_USERSMODEL_H
tests/mocks/LightDM/full/UsersModelPrivate.cpp → tests/mocks/LightDM/liblightdm/UsersModelPrivate.cpprenamed+58−6
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2014 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -12,17 +12,69 @@
1212 *
1313 * You should have received a copy of the GNU General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Author: Michael Terry <michael.terry@canonical.com>
1715 */
1816
19−#include "../UsersModelPrivate.h"
17+#include "UsersModelPrivate.h"
18+#include "UsersModel.h"
2019
2120namespace QLightDM
2221{
2322
2423UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
25− : q_ptr(parent)
24+ : mockMode("single")
25+ , q_ptr(parent)
26+{
27+ char *envMockMode = getenv("LIBLIGHTDM_MOCK_MODE");
28+ if (envMockMode) {
29+ mockMode = envMockMode;
30+ }
31+ resetEntries();
32+}
33+
34+void UsersModelPrivate::resetEntries()
35+{
36+ Q_Q(UsersModel);
37+
38+ q->beginResetModel();
39+
40+ if (mockMode == "single") {
41+ resetEntries_single();
42+ } else if (mockMode == "single-passphrase") {
43+ resetEntries_singlePassphrase();
44+ } else if (mockMode == "single-pin") {
45+ resetEntries_singlePin();
46+ } else if (mockMode == "full") {
47+ resetEntries_full();
48+ }
49+
50+ q->endResetModel();
51+}
52+
53+void UsersModelPrivate::resetEntries_single()
54+{
55+ entries =
56+ {
57+ { "single", "Single User", 0, 0, false, false, 0, 0 },
58+ };
59+}
60+
61+void UsersModelPrivate::resetEntries_singlePassphrase()
62+{
63+ entries =
64+ {
65+ { "single", "Single User", 0, 0, false, false, 0, 0 },
66+ };
67+}
68+
69+void UsersModelPrivate::resetEntries_singlePin()
70+{
71+ entries =
72+ {
73+ { "has-pin", "Has PIN", 0, 0, false, false, 0, 0 },
74+ };
75+}
76+
77+void UsersModelPrivate::resetEntries_full()
2678{
2779 entries =
2880 {
@@ -49,4 +101,4 @@ UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
49101 };
50102}
51103
52−}
104+} // namespace QLightDM
tests/mocks/LightDM/liblightdm/UsersModelPrivate.hnew file+63
@@ -0,0 +1,63 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ */
16+
17+#ifndef UNITY_MOCK_USERSMODEL_PRIVATE_H
18+#define UNITY_MOCK_USERSMODEL_PRIVATE_H
19+
20+#include <QtCore/QList>
21+#include <QtCore/QString>
22+
23+namespace QLightDM
24+{
25+class UsersModel;
26+
27+class Entry
28+{
29+public:
30+ QString username;
31+ QString real_name;
32+ QString background;
33+ QString layouts;
34+ bool is_active;
35+ bool has_messages;
36+ QString session;
37+ QString infographic;
38+};
39+
40+class UsersModelPrivate
41+{
42+public:
43+ explicit UsersModelPrivate(UsersModel *parent = 0);
44+ virtual ~UsersModelPrivate() = default;
45+
46+ QList<Entry> entries;
47+ QString mockMode;
48+
49+ void resetEntries();
50+protected:
51+ UsersModel * const q_ptr;
52+
53+private:
54+ void resetEntries_single();
55+ void resetEntries_singlePassphrase();
56+ void resetEntries_singlePin();
57+ void resetEntries_full();
58+ Q_DECLARE_PUBLIC(UsersModel)
59+};
60+
61+}
62+
63+#endif // UNITY_MOCK_USERSMODEL_PRIVATE_H
tests/mocks/LightDM/plugin.cppnew file+68
@@ -0,0 +1,68 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ */
16+
17+#include "plugin.h"
18+#include <DBusGreeter.h>
19+#include <DBusGreeterList.h>
20+#include "MockGreeter.h"
21+#include "MockUsersModel.h"
22+#include <libusermetricsoutput/ColorTheme.h>
23+#include <libusermetricsoutput/UserMetrics.h>
24+#include <QLightDM/UsersModel>
25+
26+#include <QAbstractItemModel>
27+#include <QDBusConnection>
28+#include <QtQml/qqml.h>
29+
30+static QObject *greeter_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
31+{
32+ Q_UNUSED(engine)
33+ Q_UNUSED(scriptEngine)
34+
35+ MockGreeter *greeter = new MockGreeter;
36+ new DBusGreeter(greeter, "/");
37+ new DBusGreeterList(greeter, "/list");
38+
39+ return greeter;
40+}
41+
42+static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
43+{
44+ Q_UNUSED(engine)
45+ Q_UNUSED(scriptEngine)
46+ return new MockUsersModel;
47+}
48+
49+static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
50+{
51+ Q_UNUSED(engine)
52+ Q_UNUSED(scriptEngine)
53+ return UserMetricsOutput::UserMetrics::getInstance();
54+}
55+
56+void LightDMPlugin::registerTypes(const char *uri)
57+{
58+ qmlRegisterType<QAbstractItemModel>();
59+ qmlRegisterType<UserMetricsOutput::ColorTheme>();
60+
61+ Q_ASSERT(uri == QLatin1String("LightDM"));
62+ qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
63+ qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
64+ qmlRegisterSingletonType<MockGreeter>(uri, 0, 1, "Greeter", greeter_provider);
65+ qmlRegisterSingletonType<MockUsersModel>(uri, 0, 1, "Users", users_provider);
66+ qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable");
67+ qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
68+}
tests/mocks/LightDM/single/UsersModelPrivate.cpp → tests/mocks/LightDM/plugin.hrenamed+13−14
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2014 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -12,22 +12,21 @@
1212 *
1313 * You should have received a copy of the GNU General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Author: Michael Terry <michael.terry@canonical.com>
1715 */
1816
19−#include "../UsersModelPrivate.h"
17+#ifndef MOCK_LIGHTDM_PLUGIN_H
18+#define MOCK_LIGHTDM_PLUGIN_H
2019
21−namespace QLightDM
22−{
20+#include <QtQml/QQmlEngine>
21+#include <QtQml/QQmlExtensionPlugin>
2322
24−UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
25− : q_ptr(parent)
23+class LightDMPlugin : public QQmlExtensionPlugin
2624{
27− entries =
28− {
29− { "single", "Single User", 0, 0, false, false, 0, 0 },
30− };
31−}
25+ Q_OBJECT
26+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
27+
28+public:
29+ void registerTypes(const char *uri);
30+};
3231
33−}
32+#endif
tests/mocks/LightDM/single-passphrase/CMakeLists.txtdeleted−19
@@ -1,19 +0,0 @@
1−set(LibLightDM_SOURCES
2− ../Greeter.cpp
3− ../UsersModel.cpp
4− GreeterPrivate.cpp
5− UsersModelPrivate.cpp
6− ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
7− )
8−
9−
10−add_library(MockLightDM-single-passphrase SHARED ${LibLightDM_SOURCES})
11−
12−qt5_use_modules(MockLightDM-single-passphrase Gui)
13−
14−set_target_properties(MockLightDM-single-passphrase PROPERTIES
15− OUTPUT_NAME lightdm-qt5-2)
16−
17−install(TARGETS MockLightDM-single-passphrase
18− DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/single-passphrase
19− )
tests/mocks/LightDM/single-passphrase/GreeterPrivate.cppdeleted−46
@@ -1,46 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
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.
7− *
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.
12− *
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/>.
15− *
16− * Author: Michael Terry <michael.terry@canonical.com>
17− */
18−
19−#include "../Greeter.h"
20−#include "../GreeterPrivate.h"
21−
22−namespace QLightDM
23−{
24−
25−GreeterPrivate::GreeterPrivate(Greeter* parent)
26− : authenticated(false),
27− authenticationUser(),
28− q_ptr(parent)
29−{
30−}
31−
32−void GreeterPrivate::handleAuthenticate()
33−{
34− Q_Q(Greeter);
35− Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
36−}
37−
38−void GreeterPrivate::handleRespond(const QString &response)
39−{
40− Q_Q(Greeter);
41−
42− authenticated = (response == "password");
43− q->sendAuthenticationComplete();
44−}
45−
46−}
tests/mocks/LightDM/single-pin/CMakeLists.txtdeleted−19
@@ -1,19 +0,0 @@
1−set(LibLightDM_SOURCES
2− ../Greeter.cpp
3− ../UsersModel.cpp
4− GreeterPrivate.cpp
5− UsersModelPrivate.cpp
6− ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
7− )
8−
9−
10−add_library(MockLightDM-single-pin SHARED ${LibLightDM_SOURCES})
11−
12−qt5_use_modules(MockLightDM-single-pin Gui)
13−
14−set_target_properties(MockLightDM-single-pin PROPERTIES
15− OUTPUT_NAME lightdm-qt5-2)
16−
17−install(TARGETS MockLightDM-single-pin
18− DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/single-pin
19− )
tests/mocks/LightDM/single-pin/GreeterPrivate.cppdeleted−46
@@ -1,46 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
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.
7− *
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.
12− *
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/>.
15− *
16− * Author: Michael Terry <michael.terry@canonical.com>
17− */
18−
19−#include "../Greeter.h"
20−#include "../GreeterPrivate.h"
21−
22−namespace QLightDM
23−{
24−
25−GreeterPrivate::GreeterPrivate(Greeter* parent)
26− : authenticated(false),
27− authenticationUser(),
28− q_ptr(parent)
29−{
30−}
31−
32−void GreeterPrivate::handleAuthenticate()
33−{
34− Q_Q(Greeter);
35− Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
36−}
37−
38−void GreeterPrivate::handleRespond(const QString &response)
39−{
40− Q_Q(Greeter);
41−
42− authenticated = (response == "1234");
43− q->sendAuthenticationComplete();
44−}
45−
46−}
tests/mocks/LightDM/single/CMakeLists.txtdeleted−18
@@ -1,18 +0,0 @@
1−set(LibLightDM_SOURCES
2− ../Greeter.cpp
3− ../UsersModel.cpp
4− GreeterPrivate.cpp
5− UsersModelPrivate.cpp
6− ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
7− )
8−
9−add_library(MockLightDM-single SHARED ${LibLightDM_SOURCES})
10−
11−qt5_use_modules(MockLightDM-single Gui)
12−
13−set_target_properties(MockLightDM-single PROPERTIES
14− OUTPUT_NAME lightdm-qt5-2)
15−
16−install(TARGETS MockLightDM-single
17− DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/single
18− )
tests/mocks/Unity/Indicators/CMakeLists.txt−1
@@ -19,7 +19,6 @@ set(IndicatorsFakeQml_SOURCES
1919 ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/sharedunitymenumodel.cpp
2020 ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/unitymenumodelcache.cpp
2121 ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/unitymenumodelstack.cpp
22− ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/visibleindicatorsmodel.cpp
2322)
2423
2524add_library(IndicatorsFakeQml SHARED
tests/mocks/Unity/Indicators/fakeplugin.cpp−2
@@ -29,7 +29,6 @@
2929#include "sharedunitymenumodel.h"
3030#include "fakeunitymenumodelcache.h"
3131#include "unitymenumodelstack.h"
32−#include "visibleindicatorsmodel.h"
3332
3433#include <unitymenumodel.h>
3534
@@ -49,7 +48,6 @@ void IndicatorsFakePlugin::registerTypes(const char * uri)
4948 // external
5049 qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator");
5150 qmlRegisterType<UnityMenuModelStack>(uri, 0, 1, "UnityMenuModelStack");
52− qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel");
5351 qmlRegisterType<SharedUnityMenuModel>(uri, 0, 1, "SharedUnityMenuModel");
5452
5553 qmlRegisterSingletonType<FakeUnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton);
tests/plugins/LightDM/CMakeLists.txt+4−2
@@ -11,8 +11,10 @@ include_directories(
1111 ${LIBLIGHTDM_INCLUDE_DIRS}
1212 )
1313
14−target_link_libraries(GreeterDBusTestExec MockLightDM-full)
14+add_dependencies(GreeterDBusTestExec MockLightDM)
15+target_link_libraries(GreeterDBusTestExec -L${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm
16+ -llightdm-qt5-2)
1517
1618add_definitions(-DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
1719
18−add_binary_qml_test(GreeterDBus "${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full" MockLightDM-full "QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/tests/mocks")
20+add_binary_qml_test(GreeterDBus "${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm" MockLightDM "QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/tests/mocks")
tests/plugins/LightDM/greeter.qml+5
@@ -19,4 +19,9 @@ import LightDM 0.1 as LightDM
1919
2020Item {
2121 property var greeter: LightDM.Greeter
22+ Binding {
23+ target: LightDM.Greeter
24+ property: "mockMode"
25+ value: "full"
26+ }
2227}
tests/qmltests/CMakeLists.txt+19−19
@@ -16,11 +16,11 @@ add_qml_test(utils/Unity/Test UnityTest)
1616
1717set(qmltest_DEFAULT_TARGETS qmluitests)
1818set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
19−set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LC_ALL=C")
19+set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
2020
21−add_qml_test(. Shell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
22−add_qml_test(. ShellWithPin ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single-pin:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
23−add_qml_test(. TabletShell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
21+add_qml_test(. Shell)
22+add_qml_test(. ShellWithPin)
23+add_qml_test(. TabletShell)
2424add_qml_test(Components Background)
2525add_qml_test(Components Carousel)
2626add_qml_test(Components Dialogs)
@@ -61,10 +61,10 @@ add_qml_test(Dash/ScopeSettings ScopeSettingList)
6161add_qml_test(Dash/ScopeSettings ScopeSettingNumber)
6262add_qml_test(Dash/ScopeSettings ScopeSettingString)
6363add_qml_test(Dash/ScopeSettings ScopeSettingsWidgetFactory)
64−add_qml_test(Greeter MultiGreeter ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")
65−add_qml_test(Greeter SingleGreeter ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
66−add_qml_test(Greeter Infographics ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")
67−add_qml_test(Greeter Clock ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
64+add_qml_test(Greeter MultiGreeter)
65+add_qml_test(Greeter SingleGreeter)
66+add_qml_test(Greeter Infographics)
67+add_qml_test(Greeter Clock)
6868add_qml_test(Launcher Launcher)
6969add_qml_test(Notifications Notifications)
7070add_qml_test(Notifications VisualSnapDecisionsQueue)
@@ -72,22 +72,22 @@ add_qml_test(Notifications OptionToggle)
7272add_qml_test(Notifications SwipeToAct)
7373add_qml_test(Panel ActiveCallHint)
7474add_qml_test(Panel IndicatorItem)
75−add_qml_test(Panel IndicatorItemRow ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
76−add_qml_test(Panel IndicatorPage ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
77−add_qml_test(Panel IndicatorsBar ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
78−add_qml_test(Panel IndicatorsMenu ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
79−add_qml_test(Panel MenuContent ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
80−add_qml_test(Panel Panel ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
75+add_qml_test(Panel IndicatorItemRow)
76+add_qml_test(Panel IndicatorPage)
77+add_qml_test(Panel IndicatorsBar)
78+add_qml_test(Panel IndicatorsMenu)
79+add_qml_test(Panel MenuContent)
80+add_qml_test(Panel Panel)
8181add_qml_test(Panel SearchIndicator)
8282add_qml_test(Panel/Indicators IndicatorsLight ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
8383# These MenuItemFactory tests need the test/mocks/ to come before plugins/
8484add_qml_test(Panel/Indicators MenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS})
8585add_qml_test(Panel/Indicators MessageMenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS})
86−add_qml_test(Stages ApplicationWindow ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
87−add_qml_test(Stages PhoneStage ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
88−add_qml_test(Stages SpreadDelegate ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
89−add_qml_test(Stages SurfaceContainer ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
90−add_qml_test(Stages SessionContainer ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
86+add_qml_test(Stages ApplicationWindow)
87+add_qml_test(Stages PhoneStage ENVIRONMENT)
88+add_qml_test(Stages SpreadDelegate ENVIRONMENT)
89+add_qml_test(Stages SurfaceContainer ENVIRONMENT)
90+add_qml_test(Stages SessionContainer ENVIRONMENT)
9191add_qml_test(Stages WindowMoveResizeArea)
9292add_qml_test(Stages Splash)
9393add_qml_test(Wizard Wizard)
tests/qmltests/Greeter/tst_Infographics.qml+10
@@ -23,6 +23,16 @@ import Unity.Test 0.1 as UT
2323import LightDM 0.1 as LightDM
2424
2525Item {
26+ Binding {
27+ target: LightDM.Greeter
28+ property: "mockMode"
29+ value: "full"
30+ }
31+ Binding {
32+ target: LightDM.Users
33+ property: "mockMode"
34+ value: "full"
35+ }
2636 property variant infographicModel: LightDM.Infographic
2737
2838 width: units.gu(120)
tests/qmltests/Greeter/tst_MultiGreeter.qml+11
@@ -39,6 +39,17 @@ Item {
3939 }
4040 }
4141
42+ Binding {
43+ target: LightDM.Greeter
44+ property: "mockMode"
45+ value: "full"
46+ }
47+ Binding {
48+ target: LightDM.Users
49+ property: "mockMode"
50+ value: "full"
51+ }
52+
4253 Greeter {
4354 id: greeter
4455 width: units.gu(120)
tests/qmltests/Panel/IndicatorTest.qml+1−7
@@ -26,15 +26,9 @@ Rectangle {
2626 id: root
2727 color: "white"
2828
29− property alias indicatorsModel: __visibleIndicatorsModel
29+ property alias indicatorsModel: __indicatorsModel
3030 property alias originalModelData: __indicatorsModel.originalModelData
3131
32− Indicators.VisibleIndicatorsModel {
33− id: __visibleIndicatorsModel
34−
35− model: __indicatorsModel
36− }
37−
3832 Indicators.IndicatorsModel {
3933 id: __indicatorsModel
4034 Component.onCompleted: load();
tests/qmltests/Panel/tst_MenuContent.qml+1−1
@@ -111,7 +111,7 @@ IndicatorTest {
111111 var menuIndex = i%menuCount;
112112
113113 activate_content(menuIndex);
114− testItemObjectName = indicatorsModel.model.data(menuIndex, Indicators.IndicatorsModelRole.Identifier);
114+ testItemObjectName = indicatorsModel.data(menuIndex, Indicators.IndicatorsModelRole.Identifier);
115115 compare(listView.currentIndex, menuIndex, "Current tab index does not match selected tab index");
116116 tryCompareFunction(current_item_equals_test_item, true);
117117 }
tests/qmltests/Stages/tst_PhoneStage.qml+24
@@ -394,5 +394,29 @@ Item {
394394
395395 tryCompare(spreadView, "contentX", -spreadView.shift)
396396 }
397+
398+ function test_leftEdge_data() {
399+ return [
400+ { tag: "normal", inSpread: false, leftEdgeDragWidth: units.gu(5), shouldMoveApp: true },
401+ { tag: "inSpread", inSpread: true, leftEdgeDragWidth: units.gu(5), shouldMoveApp: false }
402+ ]
403+ }
404+
405+ function test_leftEdge(data) {
406+ addApps(2);
407+
408+ if (data.inSpread) {
409+ goToSpread();
410+ }
411+
412+ var focusedDelegate = findChild(phoneStage, "appDelegate0");
413+ phoneStage.inverseProgress = data.leftEdgeDragWidth;
414+
415+ tryCompare(focusedDelegate, "x", data.shouldMoveApp ? data.leftEdgeDragWidth : 0);
416+
417+ phoneStage.inverseProgress = 0;
418+
419+ tryCompare(focusedDelegate, "x", 0);
420+ }
397421 }
398422}
tests/qmltests/tst_Shell.qml+8−1
@@ -36,6 +36,13 @@ Item {
3636 width: units.gu(60)
3737 height: units.gu(71)
3838
39+ Component.onCompleted: {
40+ // must set the mock mode before loading the Shell
41+ LightDM.Greeter.mockMode = "single";
42+ LightDM.Users.mockMode = "single";
43+ shellLoader.active = true;
44+ }
45+
3946 QtObject {
4047 id: applicationArguments
4148
@@ -56,7 +63,7 @@ Item {
5663 anchors.fill: parent
5764 Loader {
5865 id: shellLoader
59−
66+ active: false
6067 property bool itemDestroyed: false
6168 sourceComponent: Component {
6269 Shell {
tests/qmltests/tst_ShellWithPin.qml+8
@@ -33,6 +33,13 @@ Item {
3333 width: contentRow.width
3434 height: contentRow.height
3535
36+ Component.onCompleted: {
37+ // must set the mock mode before loading the Shell
38+ LightDM.Greeter.mockMode = "single-pin";
39+ LightDM.Users.mockMode = "single-pin";
40+ shellLoader.active = true;
41+ }
42+
3643 QtObject {
3744 id: applicationArguments
3845
@@ -54,6 +61,7 @@ Item {
5461
5562 Loader {
5663 id: shellLoader
64+ active: false
5765
5866 width: units.gu(40)
5967 height: units.gu(71)
tests/qmltests/tst_TabletShell.qml+8
@@ -32,6 +32,13 @@ Row {
3232 id: root
3333 spacing: 0
3434
35+ Component.onCompleted: {
36+ // must set the mock mode before loading the Shell
37+ LightDM.Greeter.mockMode = "full";
38+ LightDM.Users.mockMode = "full";
39+ shellLoader.active = true;
40+ }
41+
3542 QtObject {
3643 id: applicationArguments
3744
@@ -51,6 +58,7 @@ Row {
5158 Loader {
5259 id: shellLoader
5360
61+ active: false
5462 width: units.gu(100)
5563 height: units.gu(80)
5664