on xenial help sign in
Merge
commit36fffbd1c7d97d8f06be88dd8a8605873cd33f8d authorAlbert Astals <albert.astals@canonical.com> dateTue 10 Dec 2013, 15:00 (13 years ago) parent67326dc98a3fda
28 files changed+552−26
Components/EdgeDemo.qml+1 Components/FilterGrid.qml+1−1 Dash/DashFilterGrid.qml+6−2 Dash/Generic/GenericCarousel.qml+1 Dash/GenericScopeView.qml+2 Greeter/Greeter.qml+1−1 Greeter/LoginList.qml+11 Shell.qml+9−1 debian/changelog+62 debian/control−1 plugins/LightDM/CMakeLists.txt+2−1 plugins/LightDM/DBusGreeterList.cpp+77 plugins/LightDM/DBusGreeterList.h+61 plugins/LightDM/Greeter.cpp+1 plugins/LightDM/Greeter.h+6−1 plugins/LightDM/plugin.cpp+14−2 plugins/Unity/Launcher/backend/launcherbackend.cpp+4−2 po/ar.po+5−5 po/gl.po+6−6 tests/mocks/LightDM/CMakeLists.txt+2−1 tests/mocks/Unity/fake_scope.cpp+1−1 tests/plugins/CMakeLists.txt+1 tests/plugins/LightDM/CMakeLists.txt+24 tests/plugins/LightDM/dbus.cpp+166 tests/plugins/LightDM/greeter.qml+22 tests/qmltests/Dash/tst_GenericScopeView.qml+54 tests/qmltests/Greeter/tst_Phone.qml+1−1 tests/qmltests/Greeter/tst_Tablet.qml+11
Components/EdgeDemo.qml+1
@@ -31,6 +31,7 @@ Item {
3131 property bool dashEnabled: true
3232 property bool panelEnabled: true
3333 property bool panelContentEnabled: true
34+ property bool running: !launcherEnabled || !dashEnabled || !panelEnabled || !panelContentEnabled
3435
3536 property bool paused: false
3637
Components/FilterGrid.qml+1−1
@@ -67,7 +67,7 @@ Item {
6767 property alias highlightIndex: iconTileGrid.highlightIndex
6868 readonly property alias currentItem: iconTileGrid.currentItem
6969
70− implicitHeight: !filterAnimation.running ? childrenRect.height : height
70+ height: !filterAnimation.running ? childrenRect.height : height
7171 clip: filterAnimation.running
7272
7373 NumberAnimation {
Dash/DashFilterGrid.qml+6−2
@@ -37,7 +37,7 @@ DashRenderer {
3737 expandable: filterGrid.expandable
3838 delegateCreationBegin: filterGrid.delegateCreationBegin
3939 delegateCreationEnd: filterGrid.delegateCreationEnd
40− implicitHeight: filterGrid.implicitHeight
40+ height: filterGrid.height
4141 margins: filterGrid.margins
4242 uncollapsedHeight: filterGrid.uncollapsedHeight
4343 verticalSpacing: filterGrid.verticalSpacing
@@ -48,7 +48,7 @@ DashRenderer {
4848
4949 FilterGrid {
5050 id: filterGrid
51− anchors.fill: parent
51+ width: dashFilterGrid.width
5252 minimumHorizontalSpacing: units.gu(0.5)
5353 delegateWidth: units.gu(11)
5454 delegateHeight: units.gu(9.5)
@@ -56,5 +56,9 @@ DashRenderer {
5656 model: dashFilterGrid.model
5757 filter: dashFilterGrid.filter
5858 highlightIndex: dashFilterGrid.highlightIndex
59+
60+ onFilterChanged: {
61+ dashFilterGrid.filter = filter
62+ }
5963 }
6064}
Dash/Generic/GenericCarousel.qml+1
@@ -28,6 +28,7 @@ DashCarousel {
2828
2929 BaseCarouselDelegate {
3030 id: item
31+ objectName: "carouselDelegate"
3132
3233 UbuntuShape {
3334 anchors.fill: parent
Dash/GenericScopeView.qml+2
@@ -126,6 +126,7 @@ FocusScope {
126126
127127 delegate: ListItems.Base {
128128 id: baseItem
129+ objectName: "dashCategory" + category
129130 highlightWhenPressed: false
130131
131132 readonly property bool expandable: rendererLoader.item ? rendererLoader.item.expandable : false
@@ -271,6 +272,7 @@ FocusScope {
271272
272273 sectionProperty: "name"
273274 sectionDelegate: ListItems.Header {
275+ objectName: "dashSectionHeader" + delegate.category
274276 property var delegate: categoryView.item(delegateIndex)
275277 width: categoryView.width
276278 text: section
Greeter/Greeter.qml+1−1
@@ -51,7 +51,7 @@ Showable {
5151 signal unlocked(int uid)
5252
5353 onRightTeaserPressedChanged: {
54− if (rightTeaserPressed && !locked && x == 0) {
54+ if (rightTeaserPressed && (!locked || narrowMode) && x == 0) {
5555 teasingTimer.start();
5656 }
5757 }
Greeter/LoginList.qml+11
@@ -289,5 +289,16 @@ Item {
289289 }
290290 passwordInput.text = "";
291291 }
292+
293+ onRequestAuthenticationUser: {
294+ // Find index for requested user, if it exists
295+ for (var i = 0; i < userList.model.count; i++) {
296+ if (user == userList.model.data(i, LightDM.UserRoles.NameRole)) {
297+ moveTimer.start();
298+ userList.currentIndex = i;
299+ return;
300+ }
301+ }
302+ }
292303 }
293304}
Shell.qml+9−1
@@ -667,7 +667,12 @@ FocusScope {
667667 dragAreaWidth: shell.edgeSize
668668 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
669669
670− onShowDashHome: showHome()
670+ onShowDashHome: {
671+ if (edgeDemo.running)
672+ return;
673+
674+ showHome()
675+ }
671676 onDash: {
672677 if (stages.shown) {
673678 stages.hide();
@@ -676,6 +681,9 @@ FocusScope {
676681 }
677682 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("applications.scope", false, true)
678683 onLauncherApplicationSelected:{
684+ if (edgeDemo.running)
685+ return;
686+
679687 greeter.hide()
680688 shell.activateApplication(appId)
681689 }
debian/changelog+62
@@ -1,3 +1,65 @@
1+unity8 (7.84+14.04.20131206.1-0ubuntu1) trusty; urgency=low
2+
3+ [ Michal Hruby ]
4+ * Ensure DashContent's ListView's currentItem is set if the model is
5+ not empty.
6+
7+ [ Michał Sawicz ]
8+ * Don't generate build-deps .deb twice and allow overriding
9+ QML2_IMPORT_PATH in ./run.
10+
11+ [ Albert Astals ]
12+ * Remove unused Applications/ folder .
13+ * Implement an 'interface' for Dash Renderers.
14+ * Use deelistmodel's conversion method Instead of a copy of the code .
15+ * Remove icons we don't use .
16+ * Do not start apps or go to dash on demo If you are pulling the
17+ launcher out while in demo mode it doesn't make sense to let you
18+ start applications. Besides it locks you out because it starts the
19+ app and the demo is still not finished so you can't really use any
20+ of the edges to escape Bug #1233696. (LP: #1233696)
21+ * Add a test for the carousel showing the preview when being clicked .
22+ * Fix collapsing of categories not working and the
23+ expansion/collapsing animation +test.
24+
25+ [ Timo Jyrinki ]
26+ * Depend on either Qt 5.2 or libqt5v8-5-private-dev.
27+ * qtdeclarative5-private-dev 5.0.2-6ubuntu5 now depends directly on Qt
28+ V8 private headers. The remaining "qtdeclarative5-private-dev"
29+ dependency is enough now both when compiling against 5.0.2 or 5.2.
30+
31+ [ Pete Woods ]
32+ * Handle optional parameterized action properties. (LP: #1256258)
33+
34+ [ Andrea Cimitan ]
35+ * Implement an 'interface' for Dash Renderers.
36+
37+ [ Michael Zanetti ]
38+ * Added music preview.
39+ * rename some parameters from desktopFile to appId as scopes are now
40+ changed to give us the appId.
41+ * unhardcode launcher's search paths for .desktop files.
42+ * Enable teasing of the phone greeter even though we have a
43+ lockscreen.
44+ * check if variant is valid to avoid asserting in debug mode when the
45+ connection to AccountsService doesn't work for some reason .
46+
47+ [ Michael Terry ]
48+ * Add the DBus greeter API from the desktop greeter into the unity8
49+ greeter.
50+
51+ [ Daniel d'Andrada ]
52+ * Dash: disable close mode when you click outside app thumbnails To
53+ leave the termination mode you can now just mouse/touch press
54+ anywhere outside the running applications' thumbnails The other way,
55+ which still works, is long-pressing a thumbnail once more. (LP:
56+ #1193414)
57+
58+ [ Ubuntu daily release ]
59+ * Automatic snapshot from revision 579
60+
61+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 06 Dec 2013 13:15:57 +0000
62+
163unity8 (7.84+14.04.20131128.2-0ubuntu1) trusty; urgency=low
264
365 [ Michal Hruby ]
debian/control−1
@@ -16,7 +16,6 @@ Build-Depends: cmake,
1616 libnih-dev,
1717 libpulse-dev,
1818 libqmenumodel-dev (>= 0.2.7),
19− qtdeclarative5-dev (>= 5.2~) | libqt5v8-5-private-dev,
2019 libunity-api-dev (>= 7.80.4),
2120 libunity-mir-dev,
2221 libunity-scopes-json-def-phone,
plugins/LightDM/CMakeLists.txt+2−1
@@ -17,6 +17,7 @@ include_directories(
1717
1818set(QMLPLUGIN_SRC
1919 ../Utils/qsortfilterproxymodelqml.cpp # FIXME evaluate a more generic approach for using other plugins
20+ DBusGreeterList.cpp
2021 Greeter.cpp
2122 plugin.cpp
2223 UsersModel.cpp
@@ -33,7 +34,7 @@ target_link_libraries(LightDM-qml
3334 ${LIBUSERMETRICSOUTPUT_LDFLAGS}
3435 )
3536
36−qt5_use_modules(LightDM-qml Gui Qml)
37+qt5_use_modules(LightDM-qml DBus Gui Qml)
3738
3839# export the qmldir qmltypes and plugin files
3940export_qmlfiles(LightDM LightDM)
plugins/LightDM/DBusGreeterList.cppnew file+77
@@ -0,0 +1,77 @@
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+
17+#include "DBusGreeterList.h"
18+#include "Greeter.h"
19+
20+#include <QDBusMessage>
21+#include <QStringList>
22+
23+DBusGreeterList::DBusGreeterList(Greeter *greeter, const QDBusConnection &connection, const QString &path)
24+ : QObject(greeter),
25+ m_greeter(greeter),
26+ m_connection(connection),
27+ m_path(path)
28+{
29+ connect(m_greeter, SIGNAL(authenticationUserChanged(const QString &)), this, SLOT(authenticationUserChangedHandler(const QString &)));
30+ connect(m_greeter, SIGNAL(promptlessChanged()), this, SLOT(promptlessChangedHandler()));
31+}
32+
33+QString DBusGreeterList::GetActiveEntry() const
34+{
35+ return m_greeter->authenticationUser();
36+}
37+
38+void DBusGreeterList::SetActiveEntry(const QString &entry)
39+{
40+ Q_EMIT m_greeter->requestAuthenticationUser(entry);
41+}
42+
43+bool DBusGreeterList::entryIsLocked() const
44+{
45+ return !m_greeter->promptless();
46+}
47+
48+void DBusGreeterList::authenticationUserChangedHandler(const QString &user)
49+{
50+ notifyPropertyChanged("ActiveEntry", user);
51+ Q_EMIT EntrySelected(user);
52+}
53+
54+void DBusGreeterList::promptlessChangedHandler()
55+{
56+ notifyPropertyChanged("EntryIsLocked", entryIsLocked());
57+ Q_EMIT entryIsLockedChanged();
58+}
59+
60+// Manually emit a PropertiesChanged signal over DBus, because QtDBus
61+// doesn't do it for us on Q_PROPERTIES, oddly enough.
62+void DBusGreeterList::notifyPropertyChanged(const QString& propertyName, const QVariant &value)
63+{
64+ QDBusMessage message;
65+ QVariantMap changedProps;
66+
67+ changedProps.insert(propertyName, value);
68+
69+ message = QDBusMessage::createSignal(m_path,
70+ "org.freedesktop.DBus.Properties",
71+ "PropertiesChanged");
72+ message << "com.canonical.UnityGreeter.List";
73+ message << changedProps;
74+ message << QStringList();
75+
76+ m_connection.send(message);
77+}
plugins/LightDM/DBusGreeterList.hnew file+61
@@ -0,0 +1,61 @@
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+
17+#ifndef UNITY_DBUSGREETERLIST_H
18+#define UNITY_DBUSGREETERLIST_H
19+
20+#include <QDBusConnection>
21+#include <QObject>
22+
23+class Greeter;
24+class QDBusInterface;
25+
26+/** This is an internal class used to talk with the indicators.
27+ */
28+
29+class DBusGreeterList : public QObject
30+{
31+ Q_OBJECT
32+ Q_CLASSINFO("D-Bus Interface", "com.canonical.UnityGreeter.List")
33+
34+ Q_PROPERTY(QString ActiveEntry READ GetActiveEntry WRITE SetActiveEntry NOTIFY EntrySelected) // since 14.04
35+ Q_PROPERTY(bool EntryIsLocked READ entryIsLocked NOTIFY entryIsLockedChanged) // since 14.04
36+
37+public:
38+ explicit DBusGreeterList(Greeter *greeter, const QDBusConnection &connection, const QString &path);
39+
40+ Q_SCRIPTABLE void SetActiveEntry(const QString &entry); // since 13.04
41+ Q_SCRIPTABLE QString GetActiveEntry() const; // since 13.10
42+
43+ bool entryIsLocked() const;
44+
45+Q_SIGNALS:
46+ Q_SCRIPTABLE void EntrySelected(const QString &entry); // since 13.10
47+
48+ void entryIsLockedChanged();
49+
50+private Q_SLOTS:
51+ void authenticationUserChangedHandler(const QString &user);
52+ void promptlessChangedHandler();
53+ void notifyPropertyChanged(const QString &propertyName, const QVariant &value);
54+
55+private:
56+ Greeter *m_greeter;
57+ QDBusConnection m_connection;
58+ QString m_path;
59+};
60+
61+#endif
plugins/LightDM/Greeter.cpp+1
@@ -88,6 +88,7 @@ void Greeter::authenticate(const QString &username)
8888 }
8989
9090 d->m_greeter->authenticate(username);
91+ Q_EMIT authenticationUserChanged(username);
9192}
9293
9394void Greeter::respond(const QString &response)
plugins/LightDM/Greeter.h+6−1
@@ -35,7 +35,7 @@ class Greeter : public QObject
3535 Q_OBJECT
3636
3737 Q_PROPERTY(bool authenticated READ isAuthenticated)
38− Q_PROPERTY(QString authenticationUser READ authenticationUser)
38+ Q_PROPERTY(QString authenticationUser READ authenticationUser NOTIFY authenticationUserChanged)
3939 Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged)
4040
4141public:
@@ -54,8 +54,13 @@ Q_SIGNALS:
5454 void showMessage(const QString &text, bool isError);
5555 void showPrompt(const QString &text, bool isSecret);
5656 void authenticationComplete();
57+ void authenticationUserChanged(const QString &user);
5758 void promptlessChanged();
5859
60+ // This signal is emitted by external agents like indicators, and the UI
61+ // should switch to this user if possible.
62+ void requestAuthenticationUser(const QString &user);
63+
5964private:
6065 GreeterPrivate * const d_ptr;
6166
plugins/LightDM/plugin.cpp+14−2
@@ -18,20 +18,32 @@
1818 */
1919
2020#include "plugin.h"
21+#include "DBusGreeterList.h"
2122#include "Greeter.h"
2223#include "UsersModel.h"
2324#include <libusermetricsoutput/ColorTheme.h>
2425#include <libusermetricsoutput/UserMetrics.h>
2526#include <QLightDM/UsersModel>
2627
27−#include <QtCore/QAbstractItemModel>
28+#include <QAbstractItemModel>
29+#include <QDBusConnection>
2830#include <QtQml/qqml.h>
2931
32+static const char* GREETER_LIST_DBUS_PATH = "/list";
33+static const char* GREETER_DBUS_SERVICE = "com.canonical.UnityGreeter";
34+
3035static QObject *greeter_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
3136{
3237 Q_UNUSED(engine)
3338 Q_UNUSED(scriptEngine)
34− return new Greeter();
39+
40+ Greeter *greeter = new Greeter();
41+ QDBusConnection connection = QDBusConnection::sessionBus();
42+ DBusGreeterList *list = new DBusGreeterList(greeter, connection, GREETER_LIST_DBUS_PATH);
43+ connection.registerObject(GREETER_LIST_DBUS_PATH, list, QDBusConnection::ExportScriptableContents);
44+ connection.registerService(GREETER_DBUS_SERVICE);
45+
46+ return greeter;
3547}
3648
3749static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
plugins/Unity/Launcher/backend/launcherbackend.cpp+4−2
@@ -183,8 +183,10 @@ void LauncherBackend::syncFromAccounts()
183183
184184 if (m_accounts && !m_user.isEmpty()) {
185185 QVariant variant = m_accounts->getUserProperty(m_user, "com.canonical.unity.AccountsService", "launcher-items");
186− apps = qdbus_cast<QList<QVariantMap>>(variant.value<QDBusArgument>());
187− defaults = isDefaultsItem(apps);
186+ if (variant.isValid() && variant.canConvert<QDBusArgument>()) {
187+ apps = qdbus_cast<QList<QVariantMap>>(variant.value<QDBusArgument>());
188+ defaults = isDefaultsItem(apps);
189+ }
188190 }
189191
190192 if (m_accounts && defaults) { // Checking accounts as it'll be null when !useStorage
po/ar.po+5−5
@@ -8,7 +8,7 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2013-11-29 09:21+0100\n"
11−"PO-Revision-Date: 2013-11-15 12:29+0000\n"
11+"PO-Revision-Date: 2013-12-05 06:55+0000\n"
1212"Last-Translator: Ibrahim Saed <ibraheem5000@gmail.com>\n"
1313"Language-Team: Arabic <ar@li.org>\n"
1414"MIME-Version: 1.0\n"
@@ -16,8 +16,8 @@ msgstr ""
1616"Content-Transfer-Encoding: 8bit\n"
1717"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n % 100 >= "
1818"3 && n % 100 <= 10 ? 3 : n % 100 >= 11 && n % 100 <= 99 ? 4 : 5;\n"
19−"X-Launchpad-Export-Date: 2013-11-30 05:33+0000\n"
20−"X-Generator: Launchpad (build 16856)\n"
19+"X-Launchpad-Export-Date: 2013-12-06 06:30+0000\n"
20+"X-Generator: Launchpad (build 16863)\n"
2121
2222#: Components/EdgeDemoOverlay.qml:151
2323msgid "Skip intro"
@@ -154,11 +154,11 @@ msgstr "ابحث"
154154#: plugins/Unity/Launcher/launcheritem.cpp:43
155155#: plugins/Unity/Launcher/launcheritem.cpp:73
156156msgid "Lock to Launcher"
157−msgstr ""
157+msgstr "ثبّت في الشريط"
158158
159159#: plugins/Unity/Launcher/launcheritem.cpp:73
160160msgid "Unlock from Launcher"
161−msgstr ""
161+msgstr "فُك التثبيت من الشريط"
162162
163163#: Shell.qml:439
164164#, qt-format
po/gl.po+6−6
@@ -8,15 +8,15 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2013-11-29 09:21+0100\n"
11−"PO-Revision-Date: 2013-10-03 18:49+0000\n"
11+"PO-Revision-Date: 2013-12-06 17:15+0000\n"
1212"Last-Translator: Marcos Lans <Unknown>\n"
1313"Language-Team: Galician <gl@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: 2013-11-30 05:33+0000\n"
19−"X-Generator: Launchpad (build 16856)\n"
18+"X-Launchpad-Export-Date: 2013-12-07 06:35+0000\n"
19+"X-Generator: Launchpad (build 16869)\n"
2020
2121#: Components/EdgeDemoOverlay.qml:151
2222msgid "Skip intro"
@@ -139,7 +139,7 @@ msgstr "Falando…"
139139
140140#: Notifications/NotificationMenuItemFactory.qml:89
141141msgid "Show password"
142−msgstr ""
142+msgstr "Mostrar contrasinal"
143143
144144#: Panel/SearchIndicator.qml:27
145145msgid "Search"
@@ -148,11 +148,11 @@ msgstr "Buscar"
148148#: plugins/Unity/Launcher/launcheritem.cpp:43
149149#: plugins/Unity/Launcher/launcheritem.cpp:73
150150msgid "Lock to Launcher"
151−msgstr ""
151+msgstr "Manter no Iniciador"
152152
153153#: plugins/Unity/Launcher/launcheritem.cpp:73
154154msgid "Unlock from Launcher"
155−msgstr ""
155+msgstr "Non manter no Iniciador"
156156
157157#: Shell.qml:439
158158#, qt-format
tests/mocks/LightDM/CMakeLists.txt+2−1
@@ -17,6 +17,7 @@ include_directories(
1717)
1818
1919set(QMLPLUGIN_SRC
20+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeterList.cpp
2021 ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
2122 ${CMAKE_SOURCE_DIR}/plugins/LightDM/plugin.cpp
2223 ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
@@ -39,7 +40,7 @@ target_link_libraries(MockLightDM-qml
3940 -lusermetricsoutput
4041 )
4142
42−qt5_use_modules(MockLightDM-qml Gui Qml)
43+qt5_use_modules(MockLightDM-qml DBus Gui Qml)
4344
4445# copy qmldir file into build directory for shadow builds
4546file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
tests/mocks/Unity/fake_scope.cpp+1−1
@@ -204,7 +204,7 @@ DeeModel* create_categories_model(unsigned category_count) {
204204 std::to_string(i).c_str(),
205205 ("Category "+std::to_string(i)).c_str(),
206206 "gtk-apply",
207− "grid",
207+ i % 2 == 0 ? "grid" : "carousel",
208208 hints);
209209 }
210210 return category_model;
tests/plugins/CMakeLists.txt+1
@@ -1,4 +1,5 @@
11add_subdirectory(AccountsService)
2+add_subdirectory(LightDM)
23add_subdirectory(ListViewWithPageHeader)
34add_subdirectory(Ubuntu)
45add_subdirectory(Unity)
tests/plugins/LightDM/CMakeLists.txtnew file+24
@@ -0,0 +1,24 @@
1+add_executable(test-lightdm-dbus
2+ dbus.cpp
3+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
4+ )
5+qt5_use_modules(test-lightdm-dbus Core DBus Quick Test)
6+
7+include_directories(
8+ ${CMAKE_CURRENT_BINARY_DIR}
9+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
10+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM
11+ ${LIBLIGHTDM_INCLUDE_DIRS}
12+ )
13+
14+target_link_libraries(test-lightdm-dbus
15+ -L${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full
16+ -llightdm-qt5-2
17+ )
18+
19+add_definitions(-DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
20+
21+add_custom_target(testLightDMDBus dbus-launch env QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/tests/mocks LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full ${CMAKE_CURRENT_BINARY_DIR}/test-lightdm-dbus)
22+add_dependencies(testLightDMDBus test-lightdm-dbus)
23+
24+add_dependencies(qmluitests testLightDMDBus)
tests/plugins/LightDM/dbus.cppnew file+166
@@ -0,0 +1,166 @@
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+
17+#include "Greeter.h"
18+
19+#include <QDBusInterface>
20+#include <QDBusReply>
21+#include <QSignalSpy>
22+#include <QQuickItem>
23+#include <QQuickView>
24+#include <QtTestGui>
25+
26+class GreeterDBusTest : public QObject
27+{
28+ Q_OBJECT
29+
30+Q_SIGNALS:
31+ void PropertiesChangedRelay(const QString &interface, const QVariantMap &changed, const QStringList &invalidated);
32+
33+private Q_SLOTS:
34+
35+ void initTestCase()
36+ {
37+ // Qt doesn't like us connecting to PropertiesChanged using normal
38+ // SIGNAL method, because QtDBus doesn't know about PropertiesChanged.
39+ // So we connect the hard way for the benefit of any tests that want
40+ // to watch.
41+ QDBusConnection::sessionBus().connect(
42+ "com.canonical.UnityGreeter",
43+ "/list",
44+ "org.freedesktop.DBus.Properties",
45+ "PropertiesChanged",
46+ this,
47+ SIGNAL(PropertiesChangedRelay(const QString&, const QVariantMap&, const QStringList&)));
48+ }
49+
50+ void init()
51+ {
52+ view = new QQuickView();
53+ view->setSource(QUrl::fromLocalFile(CURRENT_SOURCE_DIR "/greeter.qml"));
54+ greeter = dynamic_cast<Greeter*>(view->rootObject()->property("greeter").value<QObject*>());
55+ QVERIFY(greeter);
56+ QVERIFY(greeter->authenticationUser() == "");
57+ view->show();
58+ QTest::qWaitForWindowExposed(view);
59+
60+ dbusList = new QDBusInterface("com.canonical.UnityGreeter",
61+ "/list",
62+ "com.canonical.UnityGreeter.List",
63+ QDBusConnection::sessionBus(), view);
64+ QVERIFY(dbusList->isValid());
65+ }
66+
67+ void cleanup()
68+ {
69+ delete view;
70+ }
71+
72+ void testGetActiveEntry()
73+ {
74+ greeter->authenticate("has-password");
75+
76+ QDBusReply<QString> reply = dbusList->call("GetActiveEntry");
77+ QVERIFY(reply.isValid());
78+ QVERIFY(reply.value() == "has-password");
79+ }
80+
81+ void testSetActiveEntry()
82+ {
83+ QSignalSpy spy(greeter, SIGNAL(requestAuthenticationUser(QString)));
84+ QDBusReply<void> reply = dbusList->call("SetActiveEntry", "has-password");
85+ QVERIFY(reply.isValid());
86+ spy.wait();
87+
88+ QCOMPARE(spy.count(), 1);
89+ QList<QVariant> arguments = spy.takeFirst();
90+ QVERIFY(arguments.at(0).toString() == "has-password");
91+ }
92+
93+ void testEntrySelectedSignal()
94+ {
95+ QSignalSpy spy(dbusList, SIGNAL(EntrySelected(QString)));
96+ greeter->authenticate("has-password");
97+ spy.wait();
98+
99+ QCOMPARE(spy.count(), 1);
100+ QList<QVariant> arguments = spy.takeFirst();
101+ QVERIFY(arguments.at(0).toString() == "has-password");
102+ }
103+
104+ void testActiveEntryGet()
105+ {
106+ greeter->authenticate("has-password");
107+ QVERIFY(dbusList->property("ActiveEntry").toString() == "has-password");
108+ }
109+
110+ void testActiveEntrySet()
111+ {
112+ QSignalSpy spy(greeter, SIGNAL(requestAuthenticationUser(QString)));
113+ QVERIFY(dbusList->setProperty("ActiveEntry", "has-password"));
114+ spy.wait();
115+
116+ QCOMPARE(spy.count(), 1);
117+ QList<QVariant> arguments = spy.takeFirst();
118+ QVERIFY(arguments.at(0).toString() == "has-password");
119+ }
120+
121+ void testActiveEntryChanged()
122+ {
123+ QSignalSpy spy(this, SIGNAL(PropertiesChangedRelay(QString, QVariantMap, QStringList)));
124+ greeter->authenticate("has-password");
125+ spy.wait();
126+
127+ QCOMPARE(spy.count(), 1);
128+ QList<QVariant> arguments = spy.takeFirst();
129+ QVERIFY(arguments.at(0).toString() == "com.canonical.UnityGreeter.List");
130+ QVERIFY(arguments.at(1).toMap().contains("ActiveEntry"));
131+ QVERIFY(arguments.at(1).toMap()["ActiveEntry"] == "has-password");
132+ }
133+
134+ void testEntryIsLockedGet()
135+ {
136+ QVERIFY(dbusList->property("EntryIsLocked").toBool());
137+
138+ greeter->authenticate("no-password");
139+ QVERIFY(!dbusList->property("EntryIsLocked").toBool());
140+
141+ greeter->authenticate("has-password");
142+ QVERIFY(dbusList->property("EntryIsLocked").toBool());
143+ }
144+
145+ void testEntryIsLockedChanged()
146+ {
147+ QSignalSpy spy(this, SIGNAL(PropertiesChangedRelay(QString, QVariantMap, QStringList)));
148+ greeter->authenticate("no-password");
149+ spy.wait();
150+
151+ QCOMPARE(spy.count(), 2); // once for locked, once for user; first will be locked mode
152+ QList<QVariant> arguments = spy.takeFirst();
153+ QVERIFY(arguments.at(0).toString() == "com.canonical.UnityGreeter.List");
154+ QVERIFY(arguments.at(1).toMap().contains("EntryIsLocked"));
155+ QVERIFY(arguments.at(1).toMap()["EntryIsLocked"] == false);
156+ }
157+
158+private:
159+ QQuickView *view;
160+ Greeter *greeter;
161+ QDBusInterface *dbusList;
162+};
163+
164+QTEST_MAIN(GreeterDBusTest)
165+
166+#include "dbus.moc"
tests/plugins/LightDM/greeter.qmlnew file+22
@@ -0,0 +1,22 @@
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 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+import QtQuick 2.0
18+import LightDM 0.1 as LightDM
19+
20+Item {
21+ property var greeter: LightDM.Greeter
22+}
tests/qmltests/Dash/tst_GenericScopeView.qml+54
@@ -19,6 +19,7 @@ import QtTest 1.0
1919import Unity 0.1
2020import ".."
2121import "../../../Dash"
22+import "../../../Components"
2223import Ubuntu.Components 0.1
2324import Unity.Test 0.1 as UT
2425
@@ -43,6 +44,7 @@ Item {
4344 GenericScopeView {
4445 id: genericScopeView
4546 anchors.fill: parent
47+ searchHistory: SearchHistoryModel {}
4648
4749 UT.UnityTestCase {
4850 name: "GenericScopeView"
@@ -222,6 +224,58 @@ Item {
222224 genericScopeView.scope = scopes.get(0)
223225 tryCompare(genericScopeView.scope, "searchQuery", "")
224226 }
227+
228+ function test_filter_expand_collapse() {
229+ // wait for the item to be there
230+ tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader0") != undefined; }, true);
231+
232+ var header = findChild(genericScopeView, "dashSectionHeader0")
233+ var category = findChild(genericScopeView, "dashCategory0")
234+
235+ waitForRendering(header);
236+ verify(category.expandable);
237+ verify(category.filtered);
238+
239+ var initialHeight = category.height;
240+ var middleHeight;
241+ mouseClick(header, header.width / 2, header.height / 2);
242+ tryCompareFunction(function() { middleHeight = category.height; return category.height > initialHeight; }, true);
243+ tryCompare(category, "filtered", false);
244+ verify(category.height > middleHeight);
245+
246+ mouseClick(header, header.width / 2, header.height / 2);
247+ verify(category.expandable);
248+ tryCompare(category, "filtered", true);
249+ }
250+
251+ function test_showPreviewCarousel() {
252+ tryCompareFunction(function() { return findChild(genericScopeView, "carouselDelegate") != undefined; }, true);
253+ var tile = findChild(genericScopeView, "carouselDelegate");
254+ mouseClick(tile, tile.width / 2, tile.height / 2);
255+ var openEffect = findChild(genericScopeView, "openEffect");
256+ tryCompare(openEffect, "gap", 1);
257+
258+ // check for it opening successfully
259+ var previewListView = findChild(genericScopeView, "previewListView");
260+ var currentPreviewItem = findChild(genericScopeView, "previewLoader0");
261+ tryCompareFunction(function() {
262+ var parts = currentPreviewItem.source.toString().split("/");
263+ var name = parts[parts.length - 1];
264+ return name == "DashPreviewPlaceholder.qml";
265+ },
266+ true);
267+ tryCompareFunction(function() {
268+ var parts = currentPreviewItem.source.toString().split("/");
269+ var name = parts[parts.length - 1];
270+ return name == "GenericPreview.qml";
271+ },
272+ true);
273+ tryCompare(currentPreviewItem, "progress", 1);
274+ tryCompare(previewListView, "open", true);
275+
276+ closePreview();
277+ tryCompare(previewListView, "open", false);
278+ }
225279 }
226280 }
227281}
tests/qmltests/Greeter/tst_Phone.qml+1−1
@@ -103,7 +103,7 @@ Item {
103103 mouseClick(greeter, greeter.width - units.gu(5), greeter.height - units.gu(1));
104104 greeter.minX = 0; // This is needed because the transition actually makes x jump once before animating
105105
106− if (!data.locked && !data.moved) {
106+ if (!data.moved) {
107107 // Check if it has been moved over by 2 GUs. Give it a 2 pixel grace area
108108 // because animation duration and teaseTimer are the same duration and
109109 // might cause slight offsets
tests/qmltests/Greeter/tst_Tablet.qml+11
@@ -324,5 +324,16 @@ Item {
324324 tryCompare(greeter, "rightTeaserPressed", false)
325325 }
326326
327+ function test_dbus_set_active_entry() {
328+ select_user("no-password") // to guarantee a selected signal
329+ selectionSpy.clear()
330+ LightDM.Greeter.requestAuthenticationUser("has-password")
331+
332+ selectionSpy.wait()
333+ tryCompare(selectionSpy, "count", 1)
334+
335+ var userlist = findChild(greeter, "userList")
336+ compare(greeter.model.data(userlist.currentIndex, LightDM.UserRoles.NameRole), "has-password")
337+ }
327338 }
328339}