on xenial help sign in
Merge trunk
commit2133dde79df81d93990c83970221365632a3e7fa authorGerry Boland <gerry.boland@canonical.com> dateFri 27 Jun 2014, 14:16 (12 years ago) parenta5c39f19ecb67c
46 files changed+945−141
debian/changelog+55 debian/control+1−1 plugins/Dash/CardCreator.js+24−14 plugins/Powerd/Powerd.cpp+16−16 plugins/Powerd/Powerd.h+8−8 plugins/Unity/CMakeLists.txt+1 plugins/Unity/Session/CMakeLists.txt+17 plugins/Unity/Session/dbusunitysessionservice.cpp+46 plugins/Unity/Session/dbusunitysessionservice.h+82 plugins/Unity/Session/plugin.cpp+40 plugins/Unity/Session/plugin.h+34 plugins/Unity/Session/qmldir+3 po/es.po+7−7 po/sl.po+6−6 qml/Components/ResponsiveVerticalJournal.qml+74 qml/Dash/CardCarousel.qml−2 qml/Dash/CardFilterGrid.qml+1−4 qml/Dash/CardVerticalJournal.qml+86 qml/Dash/DashRenderer.qml−7 qml/Dash/GenericScopeView.qml+10−1 qml/Greeter/LoginList.qml+4−4 qml/Notifications/Notification.qml+13 qml/Shell.qml+26−1 src/main.cpp+1 tests/mocks/AccountsService/AccountsService.cpp+3−1 tests/mocks/AccountsService/CMakeLists.txt−2 tests/mocks/Powerd/Powerd.h+7−7 tests/mocks/Unity/Launcher/CMakeLists.txt−2 tests/mocks/Unity/Launcher/MockLauncherItem.cpp+3−1 tests/mocks/Unity/fake_categories.cpp+1−1 tests/mocks/Unity/fake_scope.cpp+5 tests/mocks/Unity/fake_scope.h+2 tests/plugins/Dash/cardcreator/1.res+15−9 tests/plugins/Dash/cardcreator/2.res+2−1 tests/plugins/Dash/cardcreator/3.res+21−15 tests/plugins/Dash/cardcreator/4.res+2−1 tests/plugins/Dash/cardcreator/5.res+21−16 tests/plugins/Unity/CMakeLists.txt+1 tests/plugins/Unity/Session/CMakeLists.txt+20 tests/plugins/Unity/Session/sessionbackendtest.cpp+64 tests/qmltests/CMakeLists.txt+1 tests/qmltests/Components/tst_LazyImage.qml−1 tests/qmltests/Components/tst_ResponsiveVerticalJournal.qml+183 tests/qmltests/Dash/tst_Card.qml+9 tests/qmltests/Notifications/tst_Notifications.qml+29−12 tests/qmltests/tst_Shell.qml+1−1
debian/changelog+55
@@ -1,3 +1,58 @@
1+unity8 (7.89+14.10.20140627-0ubuntu1) utopic; urgency=low
2+
3+ [ Michael Terry ]
4+ * Fix path in launcher mock after moving our mock icons, to avoid a
5+ lot of "icon not found" warnings during qmluitests.
6+ * Fix the testMultiGreeter qmluitest. Incoming method variables are
7+ apparently read-only in Qt5.3. (LP: #1332488)
8+
9+ [ CI bot ]
10+ * Resync trunk
11+
12+ [ Michał Sawicz ]
13+ * Adapt scope mock to new api and quiet unused variable warnings.
14+ * Fix dynamic overlay height. (LP: #1334879)
15+ * Don't center items in CardVerticalJournal, kind of beats the
16+ purpose... Also don't bind unnecessarily.
17+
18+ [ Ying-Chun Liu ]
19+ * Fix LP:1330957 Fix some failed test cases. (LP: #1330957)
20+
21+ [ Albert Astals ]
22+ * Don't seem to need this waitForRendering And makes test fail in 5.3
23+
24+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 27 Jun 2014 08:47:58 +0000
25+
26+unity8 (7.89+14.10.20140624.1-0ubuntu1) utopic; urgency=low
27+
28+ [ Alberto Aguirre ]
29+ * Update Powerd plugin and Shell.qml to accommodate changes in the
30+ display power state notification.
31+
32+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 24 Jun 2014 17:11:08 +0000
33+
34+unity8 (7.89+14.10.20140624-0ubuntu1) utopic; urgency=low
35+
36+ [ Ying-Chun Liu ]
37+ * Add logout support. Reviewed by: Daniel d'Andrada (LP: #1302213)
38+
39+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 24 Jun 2014 08:17:09 +0000
40+
41+unity8 (7.89+14.10.20140623.1-0ubuntu1) utopic; urgency=low
42+
43+ [ Michał Sawicz ]
44+ * Make so that fixedArtShapeSize actually fixes artShapeSize.
45+
46+ [ Albert Astals ]
47+ * Add VerticalJournal integration to Dash/scopes/QML (LP: #1326467)
48+ * Make so that fixedArtShapeSize actually fixes artShapeSize.
49+
50+ [ Mirco Müller ]
51+ * Added the frontend-part of sound-hint support for notifications with
52+ updated QML-tests.
53+
54+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Mon, 23 Jun 2014 11:17:12 +0000
55+
156unity8 (7.89+14.10.20140619.3-0ubuntu1) utopic; urgency=low
257
358 * New rebuild forced
debian/control+1−1
@@ -17,7 +17,7 @@ Build-Depends: cmake,
1717 libpulse-dev,
1818 libqmenumodel-dev (>= 0.2.7),
1919 libqt5xmlpatterns5-dev,
20− libunity-api-dev (>= 7.82),
20+ libunity-api-dev (>= 7.83),
2121 libusermetricsoutput1-dev,
2222 libxcb1-dev,
2323 pkg-config,
plugins/Dash/CardCreator.js+24−14
@@ -55,8 +55,8 @@ var kBackgroundLoaderCode = 'Loader {\n\
5555// %3 is used as image height
5656var kArtShapeHolderCode = 'Item { \n\
5757 id: artShapeHolder; \n\
58− height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
59− width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width; \n\
58+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
59+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; \n\
6060 anchors { %1 } \n\
6161 Loader { \n\
6262 id: artShapeLoader; \n\
@@ -68,13 +68,18 @@ var kArtShapeHolderCode = 'Item { \n\
6868 id: artShape; \n\
6969 objectName: "artShape"; \n\
7070 radius: "medium"; \n\
71− readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
71+ visible: image.status == Image.Ready; \n\
72+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
73+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
7274 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect; \n\
7375 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } \n\
7476 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings(); \n\
75− visible: image.status == Image.Ready; \n\
77+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\
7678 function updateWidthHeightBindings() { \n\
77− if (aspectSmallerThanImageAspect) { \n\
79+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { \n\
80+ width = root.fixedArtShapeSize.width; \n\
81+ height = root.fixedArtShapeSize.height; \n\
82+ } else if (aspectSmallerThanImageAspect) { \n\
7883 width = Qt.binding(function() { return !visible ? 0 : image.width }); \n\
7984 height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect }); \n\
8085 } else { \n\
@@ -108,7 +113,7 @@ var kOverlayLoaderCode = 'Loader { \n\
108113 visible: showHeader && status == Loader.Ready; \n\
109114 sourceComponent: ShaderEffect { \n\
110115 id: overlay; \n\
111− height: fixedHeaderHeight != -1 ? fixedHeaderHeight : headerHeight; \n\
116+ height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); \n\
112117 opacity: 0.6; \n\
113118 property var source: ShaderEffectSource { \n\
114119 id: shaderSource; \n\
@@ -145,6 +150,7 @@ var kHeaderRow2Code = 'Row { \n\
145150 objectName: "outerRow"; \n\
146151 property real margins: units.gu(1); \n\
147152 spacing: margins; \n\
153+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\
148154 anchors { %1 } \n\
149155 anchors.right: parent.right; \n\
150156 anchors.margins: margins;\n\
@@ -163,6 +169,7 @@ var kHeaderRow3Code = 'Row { \n\
163169 objectName: "outerRow"; \n\
164170 property real margins: units.gu(1); \n\
165171 spacing: margins; \n\
172+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\
166173 anchors { %1 } \n\
167174 anchors.right: parent.right; \n\
168175 anchors.margins: margins;\n\
@@ -315,7 +322,7 @@ function cardString(template, components) {
315322 anchors = 'left: parent.left';
316323 if (hasMascot || hasTitle) {
317324 widthCode = 'height * artShape.aspect'
318− heightCode = 'headerHeight';
325+ heightCode = 'headerHeight + 2 * units.gu(1)';
319326 } else {
320327 // This side of the else is a bit silly, who wants an horizontal layout without mascot and title?
321328 // So we define a "random" height of the image height + 2 gu for the margins
@@ -356,23 +363,23 @@ function cardString(template, components) {
356363 }
357364 }
358365 var headerLeftAnchor;
359− var headerLeftAnchorHasMagin = false;
366+ var headerLeftAnchorHasMargin = false;
360367 if (isHorizontal && hasArt) {
361368 headerLeftAnchor = 'left: artShapeHolder.right; \n\
362369 leftMargin: units.gu(1);\n';
363− headerLeftAnchorHasMagin = true;
370+ headerLeftAnchorHasMargin = true;
364371 } else {
365372 headerLeftAnchor = 'left: parent.left;\n';
366373 }
367374
368375 if (hasHeaderRow) {
369− code += 'readonly property int headerHeight: row.height + row.margins * 2;\n'
376+ code += 'readonly property int headerHeight: row.height;\n'
370377 } else if (hasMascot) {
371− code += 'readonly property int headerHeight: mascotImage.height + units.gu(1) * 2;\n'
378+ code += 'readonly property int headerHeight: mascotImage.height;\n'
372379 } else if (hasSubtitle) {
373− code += 'readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMargin * 2 + subtitleLabel.height + subtitleLabel.anchors.topMargin;\n'
380+ code += 'readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;\n'
374381 } else if (hasTitle) {
375− code += 'readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMargin * 2;\n'
382+ code += 'readonly property int headerHeight: titleLabel.height;\n'
376383 } else {
377384 code += 'readonly property int headerHeight: 0;\n'
378385 }
@@ -385,7 +392,7 @@ function cardString(template, components) {
385392 if (!hasHeaderRow) {
386393 anchors += headerLeftAnchor;
387394 anchors += headerVerticalAnchors;
388− if (!headerLeftAnchorHasMagin) {
395+ if (!headerLeftAnchorHasMargin) {
389396 anchors += 'leftMargin: units.gu(1);\n'
390397 }
391398 } else {
@@ -437,6 +444,9 @@ function cardString(template, components) {
437444 titleAnchors = "right: parent.right;";
438445 titleAnchors += headerLeftAnchor;
439446 titleAnchors += headerVerticalAnchors;
447+ if (!headerLeftAnchorHasMargin) {
448+ titleAnchors += 'leftMargin: units.gu(1);\n'
449+ }
440450 }
441451 subtitleAnchors = 'left: titleLabel.left; \n\
442452 leftMargin: titleLabel.leftMargin; \n\
plugins/Powerd/Powerd.cpp+16−16
@@ -19,35 +19,35 @@
1919#include "Powerd.h"
2020#include <QDBusPendingCall>
2121
22−void autoBrightnessChanged(GSettings *settings, const gchar *key, QDBusInterface *powerd)
22+void autoBrightnessChanged(GSettings *settings, const gchar *key, QDBusInterface *unityScreen)
2323{
2424 bool value = g_settings_get_boolean(settings, key);
25− powerd->asyncCall("userAutobrightnessEnable", QVariant(value));
25+ unityScreen->asyncCall("userAutobrightnessEnable", QVariant(value));
2626}
2727
2828Powerd::Powerd(QObject* parent)
2929 : QObject(parent),
30− powerd(NULL)
30+ unityScreen(NULL)
3131{
32− powerd = new QDBusInterface("com.canonical.powerd",
33− "/com/canonical/powerd",
34− "com.canonical.powerd",
35− QDBusConnection::SM_BUSNAME(), this);
32+ unityScreen = new QDBusInterface("com.canonical.Unity.Screen",
33+ "/com/canonical/Unity/Screen",
34+ "com.canonical.Unity.Screen",
35+ QDBusConnection::SM_BUSNAME(), this);
3636
37− powerd->connection().connect("com.canonical.powerd",
38− "/com/canonical/powerd",
39− "com.canonical.powerd",
40− "DisplayPowerStateChange",
41− this,
42− SIGNAL(displayPowerStateChange(int, unsigned int)));
37+ unityScreen->connection().connect("com.canonical.Unity.Screen",
38+ "/com/canonical/Unity/Screen",
39+ "com.canonical.Unity.Screen",
40+ "DisplayPowerStateChange",
41+ this,
42+ SIGNAL(displayPowerStateChange(int, int)));
4343
4444 systemSettings = g_settings_new("com.ubuntu.touch.system");
45− g_signal_connect(systemSettings, "changed::auto-brightness", G_CALLBACK(autoBrightnessChanged), powerd);
46− autoBrightnessChanged(systemSettings, "auto-brightness", powerd);
45+ g_signal_connect(systemSettings, "changed::auto-brightness", G_CALLBACK(autoBrightnessChanged), unityScreen);
46+ autoBrightnessChanged(systemSettings, "auto-brightness", unityScreen);
4747}
4848
4949Powerd::~Powerd()
5050{
51− g_signal_handlers_disconnect_by_data(systemSettings, powerd);
51+ g_signal_handlers_disconnect_by_data(systemSettings, unityScreen);
5252 g_object_unref(systemSettings);
5353}
plugins/Powerd/Powerd.h+8−8
@@ -28,15 +28,15 @@ class Powerd: public QObject
2828{
2929 Q_OBJECT
3030 Q_ENUMS(Status)
31− Q_FLAGS(DisplayFlag DisplayFlags)
31+ Q_ENUMS(DisplayStateChangeReason)
3232
3333public:
34− enum DisplayFlag {
35− UseProximity = 1, // Use proximity sensor to override screen state
36− DisableAutoBrightness = 2, // Force autobrightness to be disabled
37− Bright = 4, // Request the screen to stay bright
34+ enum DisplayStateChangeReason {
35+ Unknown = 0,
36+ Inactivity = 1, // Display changed state due to inactivity
37+ PowerKey = 2, // Display changed state due to user pressing power key
38+ Proximity = 3, // Display changed state due to proximity events
3839 };
39− Q_DECLARE_FLAGS(DisplayFlags, DisplayFlag)
4040
4141 enum Status {
4242 Off,
@@ -47,10 +47,10 @@ public:
4747 ~Powerd();
4848
4949Q_SIGNALS:
50− void displayPowerStateChange(int status, unsigned int flags);
50+ void displayPowerStateChange(int status, int reason);
5151
5252private:
53− QDBusInterface *powerd;
53+ QDBusInterface *unityScreen;
5454 GSettings *systemSettings;
5555};
5656
plugins/Unity/CMakeLists.txt+1
@@ -1,3 +1,4 @@
11add_subdirectory(Indicators)
22add_subdirectory(Launcher)
3+add_subdirectory(Session)
34add_subdirectory(Shell)
plugins/Unity/Session/CMakeLists.txtnew file+17
@@ -0,0 +1,17 @@
1+include_directories(
2+ ${CMAKE_CURRENT_SOURCE_DIR}
3+)
4+
5+set(QMLSESSIONPLUGIN_SRC
6+ plugin.cpp
7+ dbusunitysessionservice.cpp
8+ )
9+
10+add_library(UnitySession-qml MODULE
11+ ${QMLSESSIONPLUGIN_SRC}
12+ )
13+
14+qt5_use_modules(UnitySession-qml DBus Qml)
15+
16+# export the qmldir and qmltypes files
17+add_unity8_plugin(Unity.Session 0.1 Unity/Session TARGETS UnitySession-qml)
plugins/Unity/Session/dbusunitysessionservice.cppnew file+46
@@ -0,0 +1,46 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it under
5+ * the terms of the GNU Lesser General Public License version 3, as published by
6+ * the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but WITHOUT
9+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+ * 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+
17+// local
18+#include "dbusunitysessionservice.h"
19+
20+// Qt
21+#include <QDBusConnection>
22+
23+DBusUnitySessionService::DBusUnitySessionService() : QObject()
24+{
25+ QDBusConnection connection = QDBusConnection::sessionBus();
26+
27+ connection.registerService("com.canonical.Unity");
28+ connection.registerObject("/com/canonical/Unity/Session", this,
29+ QDBusConnection::ExportScriptableSignals
30+ | QDBusConnection::ExportScriptableSlots
31+ | QDBusConnection::ExportScriptableInvokables);
32+}
33+
34+DBusUnitySessionService::~DBusUnitySessionService()
35+{
36+}
37+
38+void DBusUnitySessionService::Logout()
39+{
40+ Q_EMIT logoutReady();
41+}
42+
43+void DBusUnitySessionService::RequestLogout()
44+{
45+ Q_EMIT logoutRequested(false);
46+}
plugins/Unity/Session/dbusunitysessionservice.hnew file+82
@@ -0,0 +1,82 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it under
5+ * the terms of the GNU Lesser General Public License version 3, as published by
6+ * the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but WITHOUT
9+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+ * 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+
17+#ifndef DBUSUNITYSESSIONSERVICE_H
18+#define DBUSUNITYSESSIONSERVICE_H
19+
20+#include <QObject>
21+
22+/**
23+ * DBusUnitySessionService provides com.canonical.Unity.Session dbus
24+ * interface.
25+ *
26+ * com.canonical.Unity.Session interface provides public methods
27+ * and signals to handle Logout/Reboot/Shutdown.
28+ */
29+class DBusUnitySessionService : public QObject
30+{
31+ Q_OBJECT
32+ Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity.Session")
33+
34+public:
35+ DBusUnitySessionService();
36+ ~DBusUnitySessionService();
37+
38+Q_SIGNALS:
39+ /**
40+ * logoutRequested signal
41+ *
42+ * This signal is emitted when some applications request the system to
43+ * logout.
44+ * @param have_inhibitors if there are any special running applications
45+ * which inhibit the logout.
46+ */
47+ void logoutRequested(bool have_inhibitors);
48+
49+ /**
50+ * logoutReady signal
51+ *
52+ * This signal is emitted when all the apps are closed. And the system
53+ * is safe to logout.
54+ */
55+ void logoutReady();
56+
57+public Q_SLOTS:
58+ /**
59+ * Logout the system.
60+ *
61+ * This method directly logout the system without user's confirmation.
62+ * Ordinary applications should avoid calling this method. Please call
63+ * RequestLogout() to ask the user to decide logout or not.
64+ * This method will stop all the running applications and then signal
65+ * logoutReady when all the apps stopped.
66+ */
67+ Q_SCRIPTABLE void Logout();
68+
69+ /**
70+ * Issue a logout request.
71+ *
72+ * This method emit the logoutRequested signal to the shell with a boolean
73+ * which indicates if there's any inhibitors. The shell should receive
74+ * this signal and display a dialog to ask the user to confirm the logout
75+ * action. If confirmed, shell can call Logout() method to kill the apps
76+ * and then logout
77+ */
78+ Q_SCRIPTABLE void RequestLogout();
79+
80+};
81+
82+#endif // DBUSUNITYSESSIONSERVICE_H
plugins/Unity/Session/plugin.cppnew file+40
@@ -0,0 +1,40 @@
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+ * Authors: Ying-Chun Liu (PaulLiu) <paul.liu@canonical.com>
17+ */
18+
19+#include "plugin.h"
20+#include "dbusunitysessionservice.h"
21+
22+#include <QAbstractItemModel>
23+#include <QDBusConnection>
24+#include <QtQml/qqml.h>
25+
26+static QObject *dbusunitysessionservice_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
27+{
28+ Q_UNUSED(engine)
29+ Q_UNUSED(scriptEngine)
30+
31+ return new DBusUnitySessionService();
32+}
33+
34+void SessionPlugin::registerTypes(const char *uri)
35+{
36+ qmlRegisterType<QAbstractItemModel>();
37+
38+ Q_ASSERT(uri == QLatin1String("Unity.Session"));
39+ qmlRegisterSingletonType<DBusUnitySessionService>(uri, 0, 1, "DBusUnitySessionService", dbusunitysessionservice_provider);
40+}
plugins/Unity/Session/plugin.hnew file+34
@@ -0,0 +1,34 @@
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+ * Authors: Ying-Chun Liu (PaulLiu) <paul.liu@canonical.com>
17+ */
18+
19+#ifndef SESSION_PLUGIN_H
20+#define SESSION_PLUGIN_H
21+
22+#include <QtQml/QQmlEngine>
23+#include <QtQml/QQmlExtensionPlugin>
24+
25+class SessionPlugin : public QQmlExtensionPlugin
26+{
27+ Q_OBJECT
28+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
29+
30+public:
31+ void registerTypes(const char *uri);
32+};
33+
34+#endif
plugins/Unity/Session/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module Unity.Session
2+plugin UnitySession-qml
3+typeinfo UnitySession.qmltypes
po/es.po+7−7
@@ -8,14 +8,14 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2014-06-13 09:55+0200\n"
11−"PO-Revision-Date: 2014-06-02 06:28+0000\n"
12−"Last-Translator: benjisp94 <benjisp94@gmail.com>\n"
11+"PO-Revision-Date: 2014-06-26 03:08+0000\n"
12+"Last-Translator: Adolfo Jayme <fitoschido@gmail.com>\n"
1313"Language-Team: Spanish <es@li.org>\n"
1414"MIME-Version: 1.0\n"
1515"Content-Type: text/plain; charset=UTF-8\n"
1616"Content-Transfer-Encoding: 8bit\n"
17−"X-Launchpad-Export-Date: 2014-06-17 06:51+0000\n"
18−"X-Generator: Launchpad (build 17045)\n"
17+"X-Launchpad-Export-Date: 2014-06-27 07:13+0000\n"
18+"X-Generator: Launchpad (build 17077)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -83,7 +83,7 @@ msgstr "Llamada de emergencia"
8383
8484#: qml/Components/Lockscreen.qml:231
8585msgid "OK"
86−msgstr ""
86+msgstr "Aceptar"
8787
8888#: qml/Components/PageHeader.qml:365
8989msgid "Recent searches"
@@ -100,11 +100,11 @@ msgstr "Hola"
100100
101101#: qml/Components/PinLockscreen.qml:198
102102msgid "CANCEL"
103−msgstr ""
103+msgstr "CANCELAR"
104104
105105#: qml/Components/PinLockscreen.qml:216
106106msgid "DONE"
107−msgstr ""
107+msgstr "HECHO"
108108
109109#: qml/Components/SeeMore.qml:35
110110msgid "See more"
po/sl.po+6−6
@@ -8,14 +8,14 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2014-06-13 09:55+0200\n"
11−"PO-Revision-Date: 2014-05-22 14:07+0000\n"
11+"PO-Revision-Date: 2014-06-23 09:29+0000\n"
1212"Last-Translator: Damir Jerovšek <Unknown>\n"
1313"Language-Team: Slovenian <sl@li.org>\n"
1414"MIME-Version: 1.0\n"
1515"Content-Type: text/plain; charset=UTF-8\n"
1616"Content-Transfer-Encoding: 8bit\n"
17−"X-Launchpad-Export-Date: 2014-06-17 06:51+0000\n"
18−"X-Generator: Launchpad (build 17045)\n"
17+"X-Launchpad-Export-Date: 2014-06-24 06:33+0000\n"
18+"X-Generator: Launchpad (build 17065)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -82,7 +82,7 @@ msgstr "Klic v sili"
8282
8383#: qml/Components/Lockscreen.qml:231
8484msgid "OK"
85−msgstr ""
85+msgstr "V REDU"
8686
8787#: qml/Components/PageHeader.qml:365
8888msgid "Recent searches"
@@ -99,11 +99,11 @@ msgstr "Pozdravljeni"
9999
100100#: qml/Components/PinLockscreen.qml:198
101101msgid "CANCEL"
102−msgstr ""
102+msgstr "PREKLIČI"
103103
104104#: qml/Components/PinLockscreen.qml:216
105105msgid "DONE"
106−msgstr ""
106+msgstr "KONČANO"
107107
108108#: qml/Components/SeeMore.qml:35
109109msgid "See more"
qml/Components/ResponsiveVerticalJournal.qmlnew file+74
@@ -0,0 +1,74 @@
1+/*
2+ * Copyright (C) 2013-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+import QtQuick 2.0
18+import Ubuntu.Components 0.1
19+import "../Components"
20+import Dash 0.1
21+
22+/*!
23+ \brief A responsive wrapper around VerticalJournal.
24+
25+ Based on defined column width, delegates are laid out in columns following
26+ a top-left most position rule.
27+
28+ Example:
29+ +-----+ +-----+ +-----+
30+ | | | 2 | | |
31+ | | | | | |
32+ | 1 | +-----+ | 3 |
33+ | | +-----+ | |
34+ | | | | +-----+
35+ +-----+ | 4 | +-----+
36+ +-----+ | | | 5 |
37+ | 6 | +-----+ | |
38+ | | +-----+
39+ +-----+
40+*/
41+Item {
42+ property real minimumColumnSpacing: units.gu(1)
43+
44+ property alias columnWidth: verticalJournalView.columnWidth
45+ property alias rowSpacing: verticalJournalView.rowSpacing
46+ property alias model: verticalJournalView.model
47+ property alias delegate: verticalJournalView.delegate
48+ property alias displayMarginBeginning: verticalJournalView.displayMarginBeginning
49+ property alias displayMarginEnd: verticalJournalView.displayMarginEnd
50+ implicitHeight: verticalJournalView.implicitHeight
51+
52+ VerticalJournal {
53+ id: verticalJournalView
54+ objectName: "responsiveVerticalJournalView"
55+ anchors {
56+ fill: parent
57+ leftMargin: columnSpacing / 2
58+ rightMargin: columnSpacing / 2
59+ topMargin: rowSpacing / 2
60+ bottomMargin: rowSpacing / 2
61+ }
62+ clip: parent.height != implicitHeight
63+
64+ function px2gu(pixels) {
65+ return Math.floor(pixels / units.gu(1))
66+ }
67+
68+ columnSpacing: {
69+ // parent.width = columns * columnWidth + (columns-1) * spacing + spacing(margins)
70+ var expectedColumns = Math.max(1, Math.floor(parent.width / (columnWidth + minimumColumnSpacing)));
71+ Math.floor((parent.width - expectedColumns * columnWidth) / expectedColumns);
72+ }
73+ }
74+}
qml/Dash/CardCarousel.qml−2
@@ -27,9 +27,7 @@ DashRenderer {
2727 property alias selectedItemScaleFactor: carousel.selectedItemScaleFactor
2828 property alias tileAspectRatio: carousel.tileAspectRatio
2929
30− currentItem: carousel.currentItem
3130 height: carousel.implicitHeight + units.gu(6)
32− verticalSpacing: units.gu(3)
3331
3432 Carousel {
3533 id: carousel
qml/Dash/CardFilterGrid.qml+1−4
@@ -22,11 +22,8 @@ DashRenderer {
2222
2323 expandable: filterGrid.expandable
2424 collapsedHeight: filterGrid.collapsedHeight
25− margins: filterGrid.margins
2625 uncollapsedHeight: filterGrid.uncollapsedHeight
2726 originY: filterGrid.originY
28− verticalSpacing: units.gu(1)
29− currentItem: filterGrid.currentItem
3027 height: filterGrid.height
3128 filtered: filterGrid.filtered
3229
@@ -40,7 +37,7 @@ DashRenderer {
4037 minimumHorizontalSpacing: units.gu(1)
4138 delegateWidth: cardTool.cardWidth
4239 delegateHeight: cardTool.cardHeight
43− verticalSpacing: genericFilterGrid.verticalSpacing
40+ verticalSpacing: units.gu(1)
4441 model: genericFilterGrid.model
4542 collapsedRowCount: Math.min(2, cardTool && cardTool.template && cardTool.template["collapsed-rows"] || 2)
4643 displayMarginBeginning: genericFilterGrid.displayMarginBeginning
qml/Dash/CardVerticalJournal.qmlnew file+86
@@ -0,0 +1,86 @@
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+import QtQuick 2.0
18+import Ubuntu.Components 0.1
19+import "../Components"
20+
21+DashRenderer {
22+ id: root
23+
24+ readonly property double collapseLimit: units.gu(35)
25+
26+ uncollapsedHeight: cardVerticalJournal.implicitHeight
27+ collapsedHeight: Math.min(collapseLimit, cardVerticalJournal.implicitHeight)
28+ expandable: uncollapsedHeight > collapseLimit
29+
30+ // This minHeight is used as bootstrapper for the height. Vertical Journal
31+ // is special by the fact that it doesn't know how to calculate its implicit height unless we give it
32+ // enough height that it can start creating its children so we make sure it has enough height for that
33+ // in case the model is non empty
34+ readonly property double minHeight: root.model.count > 1 ? cardVerticalJournal.rowSpacing + 1 : 0
35+ height: filtered ? Math.max(collapsedHeight, minHeight) : uncollapsedHeight
36+
37+ Behavior on height {
38+ id: heightBehaviour
39+ enabled: false
40+ animation: UbuntuNumberAnimation {
41+ onRunningChanged: {
42+ if (!running) {
43+ heightBehaviour.enabled = false
44+ }
45+ }
46+ }
47+ }
48+
49+ function setFilter(filter, animate) {
50+ heightBehaviour.enabled = animate;
51+ filtered = filter;
52+ }
53+
54+ ResponsiveVerticalJournal {
55+ id: cardVerticalJournal
56+
57+ model: root.model
58+
59+ anchors.fill: parent
60+ rowSpacing: minimumColumnSpacing
61+ columnWidth: cardTool.cardWidth
62+
63+ displayMarginBeginning: root.displayMarginBeginning
64+ displayMarginEnd: root.displayMarginEnd
65+
66+ delegate: Loader {
67+ id: loader
68+ sourceComponent: cardTool.cardComponent
69+ width: cardTool.cardWidth
70+ onLoaded: {
71+ item.objectName = "delegate" + index;
72+ item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
73+ item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
74+ item.cardData = Qt.binding(function() { return model; });
75+ item.template = Qt.binding(function() { return cardTool.template; });
76+ item.components = Qt.binding(function() { return cardTool.components; });
77+ item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
78+ }
79+ Connections {
80+ target: loader.item
81+ onClicked: root.clicked(index, result)
82+ onPressAndHold: root.pressAndHold(index)
83+ }
84+ }
85+ }
86+}
qml/Dash/DashRenderer.qml−7
@@ -25,8 +25,6 @@ Item {
2525
2626 property int collapsedHeight: height
2727
28− property int margins: 0
29−
3028 property int uncollapsedHeight: height
3129
3230 property int displayMarginBeginning: 0
@@ -35,11 +33,6 @@ Item {
3533
3634 property real originY: 0
3735
38− property real verticalSpacing: 0
39−
40− // The current item of the renderer
41− property var currentItem
42−
4336 // The model to renderer
4437 property var model
4538
qml/Dash/GenericScopeView.qml+10−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2013-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
@@ -147,6 +147,7 @@ FocusScope {
147147 source: {
148148 switch (cardTool.categoryLayout) {
149149 case "carousel": return "CardCarousel.qml";
150+ case "vertical-journal": return "CardVerticalJournal.qml";
150151 case "running-apps": return "Apps/RunningApplicationsGrid.qml";
151152 case "grid":
152153 default: return "CardFilterGrid.qml";
@@ -203,6 +204,14 @@ FocusScope {
203204 previewListView.currentIndex = index;
204205 previewListView.open = true
205206 }
207+ onExpandableChanged: {
208+ // This can happen with the VJ that doesn't know how height it will be on creation
209+ // so doesn't set expandable until a bit too late for onLoaded
210+ if (rendererLoader.item.expandable) {
211+ var shouldFilter = baseItem.category != categoryView.expandedCategoryId;
212+ rendererLoader.item.setFilter(shouldFilter, false /*animate*/);
213+ }
214+ }
206215 }
207216 Connections {
208217 target: categoryView
qml/Greeter/LoginList.qml+4−4
@@ -257,13 +257,13 @@ Item {
257257
258258 onShowMessage: {
259259 // inefficient, but we only rarely deal with messages
260− text = text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>");
260+ var html = text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>")
261261 if (isError)
262− text = "<font color=\"#df382c\">" + text + "</font>"
262+ html = "<font color=\"#df382c\">" + html + "</font>"
263263 if (infoLabel.text == "")
264− infoLabel.text = text;
264+ infoLabel.text = html
265265 else
266− infoLabel.text = infoLabel.text + "<br>" + text;
266+ infoLabel.text = infoLabel.text + "<br>" + html
267267 }
268268
269269 onShowPrompt: {
qml/Notifications/Notification.qml+13
@@ -15,6 +15,7 @@
1515 */
1616
1717import QtQuick 2.0
18+import QtMultimedia 5.0
1819import Ubuntu.Components 0.1
1920import Unity.Notifications 1.0
2021import QMenuModel 0.1
@@ -66,6 +67,18 @@ Item {
6667 return result;
6768 }
6869
70+ Audio {
71+ id: sound
72+ objectName: "sound"
73+ source: hints["suppress-sound"] != "" ? hints["sound-file"] : undefined
74+ }
75+
76+ onOpacityChanged: {
77+ if (opacity == 1.0 && hints["suppress-sound"] != "true" && sound.source) {
78+ sound.play();
79+ }
80+ }
81+
6982 Behavior on height {
7083 id: normalHeightBehavior
7184
qml/Shell.qml+26−1
@@ -32,6 +32,7 @@ import "Components"
3232import "Notifications"
3333import "Stages"
3434import Unity.Notifications 1.0 as NotificationBackend
35+import Unity.Session 0.1
3536
3637FocusScope {
3738 id: shell
@@ -234,6 +235,30 @@ FocusScope {
234235 }
235236 }
236237
238+ Connections {
239+ target: DBusUnitySessionService
240+
241+ function closeAllApps() {
242+ while (true) {
243+ var app = ApplicationManager.get(0);
244+ if (app === null) {
245+ break;
246+ }
247+ ApplicationManager.stopApplication(app.appId);
248+ }
249+ }
250+
251+ onLogoutRequested: {
252+ // TODO: Display a dialog to ask the user to confirm.
253+ DBusUnitySessionService.Logout();
254+ }
255+
256+ onLogoutReady: {
257+ closeAllApps();
258+ Qt.quit();
259+ }
260+ }
261+
237262 Loader {
238263 id: applicationsDisplayLoader
239264 anchors.fill: parent
@@ -411,7 +436,7 @@ FocusScope {
411436 onDisplayPowerStateChange: {
412437 // We ignore any display-off signals when the proximity sensor
413438 // is active. This usually indicates something like a phone call.
414− if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
439+ if (status == Powerd.Off && reason != Powerd.Proximity) {
415440 greeter.showNow();
416441 }
417442
src/main.cpp+1
@@ -143,6 +143,7 @@ Load the testability driver");
143143 appendImportPaths(view->engine(), ::fallbackImportPaths());
144144
145145 view->setSource(source);
146+ QObject::connect(view->engine(), SIGNAL(quit()), application, SLOT(quit()));
146147
147148 if (isMirServer || parser.isSet(fullscreenOption)) {
148149 view->showFullScreen();
tests/mocks/AccountsService/AccountsService.cpp+3−1
@@ -18,9 +18,11 @@
1818
1919#include "AccountsService.h"
2020
21+#include <paths.h>
22+
2123AccountsService::AccountsService(QObject* parent)
2224 : QObject(parent),
23− m_backgroundFile(TOP_SRCDIR "/qml/graphics/phone_background.jpg"),
25+ m_backgroundFile(qmlDirectory() + "graphics/phone_background.jpg"),
2426 m_statsWelcomeScreen(true)
2527{
2628}
tests/mocks/AccountsService/CMakeLists.txt−2
@@ -1,5 +1,3 @@
1−add_definitions(-DTOP_SRCDIR="${CMAKE_SOURCE_DIR}")
2−
31add_library(MockAccountsService-qml MODULE
42 AccountsService.cpp
53 plugin.cpp
tests/mocks/Powerd/Powerd.h+7−7
@@ -25,15 +25,15 @@ class Powerd: public QObject
2525{
2626 Q_OBJECT
2727 Q_ENUMS(Status)
28− Q_FLAGS(DisplayFlag DisplayFlags)
28+ Q_ENUMS(DisplayStateChangeReason)
2929
3030public:
31− enum DisplayFlag {
32− UseProximity = 1, // Use proximity sensor to override screen state
33− DisableAutoBrightness = 2, // Force autobrightness to be disabled
34− Bright = 4, // Request the screen to stay bright
31+ enum DisplayStateChangeReason {
32+ Unknown = 0,
33+ Inactivity = 1, // Display changed state due to inactivity
34+ PowerKey = 2, // Display changed state due to user pressing power key
35+ Proximity = 3, // Display changed state due to proximity events
3536 };
36− Q_DECLARE_FLAGS(DisplayFlags, DisplayFlag)
3737
3838 enum Status {
3939 Off,
@@ -43,7 +43,7 @@ public:
4343 explicit Powerd(QObject *parent = 0);
4444
4545Q_SIGNALS:
46− void displayPowerStateChange(int status, unsigned int flags);
46+ void displayPowerStateChange(int status, int reason);
4747};
4848
4949#endif
tests/mocks/Unity/Launcher/CMakeLists.txt−2
@@ -1,7 +1,5 @@
11pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=3)
22
3−add_definitions(-DTOP_SRCDIR="${CMAKE_SOURCE_DIR}")
4−
53include_directories(
64 ${CMAKE_CURRENT_SOURCE_DIR}
75)
tests/mocks/Unity/Launcher/MockLauncherItem.cpp+3−1
@@ -20,6 +20,8 @@
2020#include "MockLauncherItem.h"
2121#include "MockQuickListModel.h"
2222
23+#include <paths.h>
24+
2325using namespace unity::shell::launcher;
2426
2527MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopFile, const QString& name, const QString& icon, QObject* parent):
@@ -27,7 +29,7 @@ MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopF
2729 m_appId(appId),
2830 m_desktopFile(desktopFile),
2931 m_name(name),
30− m_icon(TOP_SRCDIR "/graphics/applicationIcons/" + icon + ".png"),
32+ m_icon(qmlDirectory() + "graphics/applicationIcons/" + icon + ".png"),
3133 m_pinned(false),
3234 m_running(false),
3335 m_recent(false),
tests/mocks/Unity/fake_categories.cpp+1−1
@@ -50,7 +50,7 @@ void Categories::addSpecialCategory(QString const& categoryId, QString const& na
5050 }
5151}
5252
53−bool Categories::overrideCategoryJson(QString const& categoryId, QString const& json)
53+bool Categories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */)
5454{
5555 qFatal("Using un-implemented Categories::overrideCategoryJson");
5656}
tests/mocks/Unity/fake_scope.cpp+5
@@ -155,6 +155,11 @@ bool Scope::hasDepartments() const
155155 return true;
156156}
157157
158+QVariantMap Scope::customizations() const
159+{
160+ return QVariantMap();
161+}
162+
158163unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
159164{
160165 if (id.isEmpty())
tests/mocks/Unity/fake_scope.h+2
@@ -64,6 +64,8 @@ public:
6464 Q_INVOKABLE unity::shell::scopes::DepartmentInterface* getDepartment(const QString& id) override;
6565 Q_INVOKABLE void loadDepartment(const QString& id) override;
6666
67+ QVariantMap customizations() const override;
68+
6769protected:
6870
6971 QString m_id;
tests/plugins/Dash/cardcreator/1.res+15−9
@@ -16,8 +16,8 @@ onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artSh
1616readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1717Item {
1818 id: artShapeHolder;
19− height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height;
20− width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width;
19+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
20+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
2121 anchors { horizontalCenter: parent.horizontalCenter; }
2222 Loader {
2323 id: artShapeLoader;
@@ -28,14 +28,19 @@ Item {
2828 sourceComponent: UbuntuShape {
2929 id: artShape;
3030 objectName: "artShape";
31− radius: "medium";
32− readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1;
33− readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
34− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
35− onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
31+ radius: "medium";
3632 visible: image.status == Image.Ready;
33+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
34+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
35+ readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
36+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
37+ onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
38+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
3739 function updateWidthHeightBindings() {
38− if (aspectSmallerThanImageAspect) {
40+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
41+ width = root.fixedArtShapeSize.width;
42+ height = root.fixedArtShapeSize.height;
43+ } else if (aspectSmallerThanImageAspect) {
3944 width = Qt.binding(function() { return !visible ? 0 : image.width });
4045 height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
4146 } else {
@@ -56,13 +61,14 @@ Item {
5661 }
5762 }
5863 }
59−readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMargin * 2;
64+readonly property int headerHeight: titleLabel.height;
6065Label {
6166 id: titleLabel;
6267 objectName: "titleLabel";
6368 anchors { right: parent.right;left: parent.left;
6469top: artShapeHolder.bottom;
6570 topMargin: units.gu(1);
71+leftMargin: units.gu(1);
6672 }
6773 elide: Text.ElideRight;
6874 fontSize: "small";
tests/plugins/Dash/cardcreator/2.res+2−1
@@ -46,12 +46,13 @@ Loader {
4646 }
4747 }
4848readonly property size artShapeSize: Qt.size(-1, -1);
49−readonly property int headerHeight: row.height + row.margins * 2;
49+readonly property int headerHeight: row.height;
5050Row {
5151 id: row;
5252 objectName: "outerRow";
5353 property real margins: units.gu(1);
5454 spacing: margins;
55+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
5556 anchors { top: parent.top;
5657 topMargin: units.gu(1);
5758 left: parent.left;
tests/plugins/Dash/cardcreator/3.res+21−15
@@ -16,8 +16,8 @@ onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artSh
1616readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1717Item {
1818 id: artShapeHolder;
19− height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height;
20− width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width;
19+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
20+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
2121 anchors { horizontalCenter: parent.horizontalCenter; }
2222 Loader {
2323 id: artShapeLoader;
@@ -29,19 +29,24 @@ Item {
2929 id: artShape;
3030 objectName: "artShape";
3131 radius: "medium";
32− readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1;
33− readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
34− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
35− onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
3632 visible: image.status == Image.Ready;
37− function updateWidthHeightBindings() {
38− if (aspectSmallerThanImageAspect) {
39− width = Qt.binding(function() { return !visible ? 0 : image.width });
40− height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
41− } else {
42− width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
43− height = Qt.binding(function() { return !visible ? 0 : image.height });
44− }
33+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
34+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
35+ readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
36+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
37+ onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
38+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
39+ function updateWidthHeightBindings() {
40+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
41+ width = root.fixedArtShapeSize.width;
42+ height = root.fixedArtShapeSize.height;
43+ } else if (aspectSmallerThanImageAspect) {
44+ width = Qt.binding(function() { return !visible ? 0 : image.width });
45+ height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
46+ } else {
47+ width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
48+ height = Qt.binding(function() { return !visible ? 0 : image.height });
49+ }
4550 }
4651 image: Image {
4752 objectName: "artImage";
@@ -56,13 +61,14 @@ Item {
5661 }
5762 }
5863 }
59−readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMargin * 2 + subtitleLabel.height + subtitleLabel.anchors.topMargin;
64+readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
6065Label {
6166 id: titleLabel;
6267 objectName: "titleLabel";
6368 anchors { right: parent.right;left: parent.left;
6469top: artShapeHolder.bottom;
6570 topMargin: units.gu(1);
71+leftMargin: units.gu(1);
6672}
6773 elide: Text.ElideRight;
6874 fontSize: "small";
tests/plugins/Dash/cardcreator/4.res+2−1
@@ -13,12 +13,13 @@ AbstractButton {
1313 property bool showHeader: true;
1414 implicitWidth: childrenRect.width;
1515readonly property size artShapeSize: Qt.size(-1, -1);
16−readonly property int headerHeight: row.height + row.margins * 2;
16+readonly property int headerHeight: row.height;
1717Row {
1818 id: row;
1919 objectName: "outerRow";
2020 property real margins: units.gu(1);
2121 spacing: margins;
22+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
2223 anchors { top: parent.top;
2324 topMargin: units.gu(1);
2425 left: parent.left;
tests/plugins/Dash/cardcreator/5.res+21−16
@@ -16,8 +16,8 @@ onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artSh
1616readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1717Item {
1818 id: artShapeHolder;
19− height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height;
20− width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width;
19+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
20+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
2121 anchors { horizontalCenter: parent.horizontalCenter; }
2222 Loader {
2323 id: artShapeLoader;
@@ -29,19 +29,24 @@ Item {
2929 id: artShape;
3030 objectName: "artShape";
3131 radius: "medium";
32− readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1;
33− readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
34− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
35− onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
3632 visible: image.status == Image.Ready;
37− function updateWidthHeightBindings() {
38− if (aspectSmallerThanImageAspect) {
39− width = Qt.binding(function() { return !visible ? 0 : image.width });
40− height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
41− } else {
42− width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
43− height = Qt.binding(function() { return !visible ? 0 : image.height });
44− }
33+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
34+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
35+ readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
36+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
37+ onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
38+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
39+ function updateWidthHeightBindings() {
40+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
41+ width = root.fixedArtShapeSize.width;
42+ height = root.fixedArtShapeSize.height;
43+ } else if (aspectSmallerThanImageAspect) {
44+ width = Qt.binding(function() { return !visible ? 0 : image.width });
45+ height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
46+ } else {
47+ width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
48+ height = Qt.binding(function() { return !visible ? 0 : image.height });
49+ }
4550 }
4651 image: Image {
4752 objectName: "artImage";
@@ -68,7 +73,7 @@ Loader {
6873 visible: showHeader && status == Loader.Ready;
6974 sourceComponent: ShaderEffect {
7075 id: overlay;
71− height: fixedHeaderHeight != -1 ? fixedHeaderHeight : headerHeight;
76+ height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
7277 opacity: 0.6;
7378 property var source: ShaderEffectSource {
7479 id: shaderSource;
@@ -96,7 +101,7 @@ Loader {
96101 }";
97102 }
98103 }
99−readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMargin * 2 + subtitleLabel.height + subtitleLabel.anchors.topMargin;
104+readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
100105Label {
101106 id: titleLabel;
102107 objectName: "titleLabel";
tests/plugins/Unity/CMakeLists.txt+1
@@ -1,2 +1,3 @@
11add_subdirectory(Indicators)
22add_subdirectory(Launcher)
3+add_subdirectory(Session)
tests/plugins/Unity/Session/CMakeLists.txtnew file+20
@@ -0,0 +1,20 @@
1+include_directories(
2+ ${CMAKE_CURRENT_BINARY_DIR}
3+ ${CMAKE_SOURCE_DIR}/plugins/Unity/Session
4+)
5+
6+add_definitions(-DSM_BUSNAME=sessionBus)
7+add_definitions(-DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}")
8+add_definitions(-DSESSION_TESTING)
9+
10+### SessionBackendTest
11+set(testBackendCommand dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/sessionbackendtestExec
12+ --parameter -o --parameter ${CMAKE_BINARY_DIR}/sessionbackendtest.xml,xunitxml
13+ --parameter -o --parameter -,txt)
14+add_test(NAME sessionbackendtest COMMAND ${testBackendCommand})
15+add_custom_target(sessionbackendtest ${testBackendCommand})
16+add_executable(sessionbackendtestExec
17+ sessionbackendtest.cpp
18+ ${CMAKE_SOURCE_DIR}/plugins/Unity/Session/dbusunitysessionservice.cpp
19+)
20+qt5_use_modules(sessionbackendtestExec Test Core Qml DBus)
tests/plugins/Unity/Session/sessionbackendtest.cppnew file+64
@@ -0,0 +1,64 @@
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+ * Ying-Chun Liu (PaulLiu) <paul.liu@canonical.com>
18+ */
19+
20+#include <QtTest>
21+#include <QDBusConnection>
22+#include <QDBusMessage>
23+#include <QDBusInterface>
24+#include <QDBusReply>
25+#include <QDBusVariant>
26+
27+#include "dbusunitysessionservice.h"
28+
29+class SessionBackendTest : public QObject
30+{
31+ Q_OBJECT
32+
33+private Q_SLOTS:
34+
35+ void initTestCase() {
36+ }
37+
38+ void testDbusIfaceMethods_data() {
39+ QTest::addColumn<QString>("method");
40+
41+ QTest::newRow("Logout") << "RequestLogout";
42+ }
43+
44+ void testDbusIfaceMethods() {
45+ QFETCH(QString, method);
46+
47+ DBusUnitySessionService dbusUnitySessionService;
48+
49+ QDBusConnection con = QDBusConnection::sessionBus();
50+ QDBusInterface interface ("com.canonical.Unity",
51+ "/com/canonical/Unity/Session",
52+ "com.canonical.Unity.Session",
53+ con);
54+ QDBusReply<void> reply;
55+
56+ QCOMPARE(interface.isValid(), true);
57+ reply = interface.call(method);
58+ QCOMPARE(reply.isValid(), true);
59+
60+ }
61+};
62+
63+QTEST_GUILESS_MAIN(SessionBackendTest)
64+#include "sessionbackendtest.moc"
tests/qmltests/CMakeLists.txt+1
@@ -29,6 +29,7 @@ add_qml_test(Components LazyImage)
2929add_qml_test(Components Rating)
3030add_qml_test(Components ResponsiveFlowView)
3131add_qml_test(Components ResponsiveGridView)
32+add_qml_test(Components ResponsiveVerticalJournal IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins)
3233add_qml_test(Components SeeMore)
3334add_qml_test(Components Showable)
3435add_qml_test(Components PageHeaderLabel)
tests/qmltests/Components/tst_LazyImage.qml−1
@@ -152,7 +152,6 @@ Rectangle {
152152
153153 function test_lazyimage(data) {
154154 data.func();
155− waitForRendering(baseRect);
156155
157156 if (data.transition) {
158157 // wait for the transition to complete
tests/qmltests/Components/tst_ResponsiveVerticalJournal.qmlnew file+183
@@ -0,0 +1,183 @@
1+/*
2+ * Copyright 2013-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+import QtQuick 2.0
18+import QtTest 1.0
19+import ".."
20+import "../../../qml/Components"
21+import Ubuntu.Components.ListItems 0.1 as ListItem
22+import Ubuntu.Components 0.1
23+import Utils 0.1
24+import Unity.Test 0.1 as UT
25+
26+Item {
27+ width: units.gu(80) + controls.width
28+ height: units.gu(80)
29+
30+ Column {
31+ id: controls
32+ width: units.gu(40)
33+ height: parent.height
34+ anchors.top: parent.top
35+ anchors.right: parent.right
36+ ListItem.ValueSelector {
37+ id: cardSizeSelector
38+ text: "card-size"
39+ // small, medium, large card sizes
40+ values: [units.gu(12), units.gu(18.5), units.gu(38)]
41+ selectedIndex: 0
42+ }
43+ ListItem.ValueSelector {
44+ id: minColumnSpacingSelector
45+ text: "minColumnSpacing"
46+ values: [0, units.gu(2), units.gu(8), units.gu(25)]
47+ selectedIndex: 0
48+ }
49+ ListItem.ValueSelector {
50+ id: rowSpacingSelector
51+ text: "rowSpacing"
52+ values: [units.gu(1), units.gu(2), units.gu(4), units.gu(8)]
53+ selectedIndex: 1
54+ }
55+ }
56+
57+ ListModel {
58+ id: fakeModel
59+ ListElement { name: "A" }
60+ ListElement { name: "B" }
61+ ListElement { name: "C" }
62+ ListElement { name: "D" }
63+ ListElement { name: "E" }
64+ ListElement { name: "F" }
65+ ListElement { name: "G" }
66+ ListElement { name: "H" }
67+ ListElement { name: "I" }
68+ ListElement { name: "J" }
69+ ListElement { name: "K" }
70+ ListElement { name: "L" }
71+ ListElement { name: "M" }
72+ ListElement { name: "N" }
73+ ListElement { name: "O" }
74+ ListElement { name: "P" }
75+ ListElement { name: "Q" }
76+ ListElement { name: "R" }
77+ ListElement { name: "S" }
78+ ListElement { name: "T" }
79+ ListElement { name: "U" }
80+ }
81+
82+ SortFilterProxyModel {
83+ id: wrappedFakeModel
84+ model: fakeModel
85+ }
86+
87+ Rectangle {
88+ id: journalRect
89+ height: parent.height
90+ color: "grey"
91+ anchors.top: parent.top
92+ anchors.left: parent.left
93+ anchors.right: controls.left
94+
95+ ResponsiveVerticalJournal {
96+ id: journal
97+ anchors.fill: parent
98+ model: wrappedFakeModel
99+ minimumColumnSpacing: minColumnSpacingSelector.values[minColumnSpacingSelector.selectedIndex]
100+ rowSpacing: rowSpacingSelector.values[rowSpacingSelector.selectedIndex]
101+ columnWidth: cardSizeSelector.values[cardSizeSelector.selectedIndex]
102+
103+ delegate: Rectangle {
104+ id: delegateItem
105+ // So that it can be identified by test code
106+ property bool isJournalDelegate: true
107+ objectName: "delegate" + index
108+ color: "grey"
109+ border.color: "red"
110+ border.width: 1
111+
112+ // width derived from Card's template['card-size']
113+ width: cardSizeSelector.values[cardSizeSelector.selectedIndex]
114+ height: Math.max(units.gu(8), Math.floor(Math.random() * 300))
115+
116+ Rectangle {
117+ color: "green"
118+ anchors.centerIn: parent
119+ width: units.gu(6)
120+ height: units.gu(6)
121+ Text {
122+ anchors.centerIn: parent
123+ text: name
124+ }
125+ }
126+
127+ Text { x:0; y:0; text:"(" + parent.x + ", " + parent.y + ")"}
128+ }
129+ }
130+ }
131+
132+ UT.UnityTestCase {
133+ name: "ResponsiveVerticalJournal"
134+ when: windowShown
135+
136+ function test_minimumColumnSpacing_data() {
137+ return [{minColumnSpacingIndex: 0, expectedColumns: 2},
138+ {minColumnSpacingIndex: 1, expectedColumns: 2},
139+ {minColumnSpacingIndex: 2, expectedColumns: 1}]
140+ }
141+
142+ // Test how minimumColumnSpacing affects column count.
143+ function test_minimumColumnSpacing(data) {
144+ cardSizeSelector.selectedIndex = 2 // large card
145+
146+ minColumnSpacingSelector.selectedIndex = data.minColumnSpacingIndex
147+
148+ tryCompareFunction(countJournalDelegatesOnFirstRow, data.expectedColumns)
149+ }
150+
151+ function test_maximumNumberOfColumns_data() {
152+ return [{cardSizeIndex: 0, expectedColumns: 6},
153+ {cardSizeIndex: 1, expectedColumns: 4},
154+ {cardSizeIndex: 2, expectedColumns: 2}]
155+ }
156+
157+ // Test how maximumNumberOfColumns and columnWidth affect column count.
158+ function test_maximumNumberOfColumns(data) {
159+ minColumnSpacingSelector.selectedIndex = 0 // no spacing
160+
161+ cardSizeSelector.selectedIndex = data.cardSizeIndex // columnWidth
162+
163+ tryCompareFunction(countJournalDelegatesOnFirstRow, data.expectedColumns)
164+ }
165+
166+ function countJournalDelegatesOnFirstRow() {
167+ return __countJournalDelegatesOnFirstRow(journal.visibleChildren, 0)
168+ }
169+
170+ function __countJournalDelegatesOnFirstRow(objList, total) {
171+ for (var i = 0; i < objList.length; ++i) {
172+ var child = objList[i];
173+ if (child.isJournalDelegate !== undefined && child.y === 0) {
174+ ++total;
175+ } else {
176+ total = __countJournalDelegatesOnFirstRow(
177+ child.visibleChildren, total)
178+ }
179+ }
180+ return total
181+ }
182+ }
183+}
tests/qmltests/Dash/tst_Card.qml+9
@@ -305,6 +305,15 @@ Rectangle {
305305 }
306306 }
307307
308+ function test_art_shape_fixed_size() {
309+ selector.selectedIndex = 6;
310+ card.fixedArtShapeSize = Qt.size( units.gu(8), units.gu(4) );
311+ waitForRendering(card);
312+ tryCompare(art, "width", units.gu(8));
313+ tryCompare(art, "height", units.gu(4));
314+ tryCompare(art, "fixedArtShapeSizeAspect", 2);
315+ }
316+
308317 function test_art_layout_data() {
309318 return [
310319 { tag: "Vertical", left: function() { return units.gu(1); }, index: 0},
tests/qmltests/Notifications/tst_Notifications.qml+29−12
@@ -21,6 +21,7 @@ import "../../../qml/Notifications"
2121import Ubuntu.Components 0.1
2222import Unity.Test 0.1
2323import Unity.Notifications 1.0
24+import QtMultimedia 5.0
2425
2526Row {
2627 id: rootRow
@@ -245,7 +246,8 @@ Row {
245246 nonShapedIcon: false,
246247 secondaryIconVisible: true,
247248 buttonRowVisible: true,
248− buttonTinted: true
249+ buttonTinted: true,
250+ hasSound: false
249251 },
250252 {
251253 tag: "Ephemeral notification - icon-summary layout",
@@ -263,12 +265,15 @@ Row {
263265 nonShapedIcon: false,
264266 secondaryIconVisible: true,
265267 buttonRowVisible: false,
266− buttonTinted: false
268+ buttonTinted: false,
269+ hasSound: false
267270 },
268271 {
269272 tag: "Ephemeral notification - check suppression of secondary icon for icon-summary layout",
270273 type: Notification.Ephemeral,
271− hints: {"x-canonical-private-button-tint": "false"},
274+ hints: {"x-canonical-private-button-tint": "false",
275+ "sound-file": "dummy.ogg",
276+ "suppress-sound": "true"},
272277 summary: "New comment successfully published",
273278 body: "",
274279 icon: "",
@@ -282,12 +287,14 @@ Row {
282287 nonShapedIcon: false,
283288 secondaryIconVisible: true,
284289 buttonRowVisible: false,
285− buttonTinted: false
290+ buttonTinted: false,
291+ hasSound: false
286292 },
287293 {
288294 tag: "Interactive notification",
289295 type: Notification.Interactive,
290− hints: {"x-canonical-private-button-tint": "false"},
296+ hints: {"x-canonical-private-button-tint": "false",
297+ "sound-file": "dummy.ogg"},
291298 summary: "Interactive notification",
292299 body: "This is a notification that can be clicked",
293300 icon: "../graphics/avatars/amanda.png",
@@ -300,12 +307,14 @@ Row {
300307 nonShapedIcon: false,
301308 secondaryIconVisible: false,
302309 buttonRowVisible: false,
303− buttonTinted: false
310+ buttonTinted: false,
311+ hasSound: true
304312 },
305313 {
306314 tag: "Snap Decision without secondary icon and no button-tint",
307315 type: Notification.SnapDecision,
308− hints: {"x-canonical-private-button-tint": "false"},
316+ hints: {"x-canonical-private-button-tint": "false",
317+ "sound-file": "dummy.ogg"},
309318 summary: "Bro Coly",
310319 body: "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
311320 icon: "../graphics/avatars/anna_olsson.png",
@@ -319,12 +328,14 @@ Row {
319328 nonShapedIcon: false,
320329 secondaryIconVisible: false,
321330 buttonRowVisible: true,
322− buttonTinted: false
331+ buttonTinted: false,
332+ hasSound: true
323333 },
324334 {
325335 tag: "Ephemeral notification",
326336 type: Notification.Ephemeral,
327− hints: {"x-canonical-private-button-tint": "false"},
337+ hints: {"x-canonical-private-button-tint": "false",
338+ "sound-file": "dummy.ogg"},
328339 summary: "Cole Raby",
329340 body: "I did not expect it to be that late.",
330341 icon: "../graphics/avatars/funky.png",
@@ -337,13 +348,15 @@ Row {
337348 nonShapedIcon: false,
338349 secondaryIconVisible: true,
339350 buttonRowVisible: false,
340− buttonTinted: false
351+ buttonTinted: false,
352+ hasSound: true
341353 },
342354 {
343355 tag: "Ephemeral notification with non-shaped icon",
344356 type: Notification.Ephemeral,
345357 hints: {"x-canonical-private-button-tint": "false",
346− "x-canonical-non-shaped-icon": "true"},
358+ "x-canonical-non-shaped-icon": "true",
359+ "sound-file": "dummy.ogg"},
347360 summary: "Contacts",
348361 body: "Synchronised contacts-database with cloud-storage.",
349362 icon: "../graphics/applicationIcons/contacts-app.png",
@@ -356,7 +369,8 @@ Row {
356369 nonShapedIcon: true,
357370 secondaryIconVisible: false,
358371 buttonRowVisible: false,
359− buttonTinted: false
372+ buttonTinted: false,
373+ hasSound: true
360374 }
361375 ]
362376 }
@@ -419,6 +433,9 @@ Row {
419433 compare(bodyLabel.visible, data.bodyVisible, "body-text visibility is incorrect")
420434 compare(buttonRow.visible, data.buttonRowVisible, "button visibility is incorrect")
421435
436+ var audioItem = findInvisibleChild(notification, "sound")
437+ tryCompare(audioItem, "playbackState", data.hasSound ? Audio.PlayingState : Audio.StoppedState)
438+
422439 if(data.buttonRowVisible) {
423440 var buttonCancel = findChild(buttonRow, "button1")
424441 var buttonAccept = findChild(buttonRow, "button0")
tests/qmltests/tst_Shell.qml+1−1
@@ -195,7 +195,7 @@ Item {
195195 tryCompare(mainApp, "state", ApplicationInfo.Running);
196196
197197 // Try to suspend while proximity is engaged...
198− Powerd.displayPowerStateChange(Powerd.Off, Powerd.UseProximity);
198+ Powerd.displayPowerStateChange(Powerd.Off, Powerd.Proximity);
199199 tryCompare(greeter, "showProgress", 0);
200200
201201 // Now really suspend