on xenial help sign in
Merge from trunk
a4777e4Michael Terry
Components/BasicShell.qml+2−1
@@ -33,7 +33,8 @@ FocusScope {
33 property url defaultBackground: shell.width >= units.gu(60) ? "../graphics/tablet_background.jpg" : "../graphics/phone_background.jpg"
33 property url defaultBackground: shell.width >= units.gu(60) ? "../graphics/tablet_background.jpg" : "../graphics/phone_background.jpg"
34 property url background
34 property url background
35 property url backgroundSource
35 property url backgroundSource
36+ property url backgroundFallbackSource
36− property url backgroundFinal: backgroundSource != undefined && backgroundSource != "" ? backgroundSource : shell.defaultBackground
37+ property url backgroundFinal: (backgroundSource != undefined && backgroundSource != "") ? backgroundSource : (backgroundFallbackSource != undefined && backgroundFallbackSource != "") ? backgroundFallbackSource : shell.defaultBackground
37 onBackgroundFinalChanged: shell.background = backgroundFinal
38 onBackgroundFinalChanged: shell.background = backgroundFinal
38
39
39 // This is a dummy image that is needed to determine if the picture url
40 // This is a dummy image that is needed to determine if the picture url
Greeter/Greeter.qml+1
@@ -59,6 +59,7 @@ Showable {
59
59
60 CrossFadeImage {
60 CrossFadeImage {
61 id: backgroundImage
61 id: backgroundImage
62+ objectName: "backgroundImage"
62 anchors.fill: parent
63 anchors.fill: parent
63 fadeInFirst: false
64 fadeInFirst: false
64 source: greeter.background
65 source: greeter.background
GreeterShell.qml+6
@@ -15,6 +15,7 @@
15 */
15 */
16
16
17import AccountsService 0.1
17import AccountsService 0.1
18+import GSettings 1.0
18import LightDM 0.1 as LightDM
19import LightDM 0.1 as LightDM
19import Powerd 0.1
20import Powerd 0.1
20import QtQuick 2.0
21import QtQuick 2.0
@@ -35,6 +36,11 @@ BasicShell {
35 greeter.hide()
36 greeter.hide()
36 }
37 }
37
38
39+ GSettings {
40+ id: backgroundSettings
41+ schema.id: "org.gnome.desktop.background"
42+ }
43+ backgroundFallbackSource: backgroundSettings.pictureUri // for ease of customization by system builders
38 backgroundSource: AccountsService.backgroundFile
44 backgroundSource: AccountsService.backgroundFile
39
45
40 Lockscreen {
46 Lockscreen {
plugins/Unity/Launcher/backend/launcherbackend.cpp+8−9
@@ -132,11 +132,7 @@ QString LauncherBackend::icon(const QString &appId) const
132 }
132 }
133 }
133 }
134
134
135− QFileInfo info(iconName);
136− if (info.exists()) {
137− return info.absoluteFilePath();
138− }
139− return "image://theme/" + iconName;
135+ return iconName;
140}
136}
141
137
142bool LauncherBackend::isPinned(const QString &appId) const
138bool LauncherBackend::isPinned(const QString &appId) const
@@ -296,15 +292,18 @@ LauncherBackendItem* LauncherBackend::parseDesktopFile(const QString &desktopFil
296{
292{
297 QSettings settings(desktopFile, QSettings::IniFormat);
293 QSettings settings(desktopFile, QSettings::IniFormat);
298
294
299−
300 LauncherBackendItem* item = new LauncherBackendItem();
295 LauncherBackendItem* item = new LauncherBackendItem();
301 item->desktopFile = desktopFile;
296 item->desktopFile = desktopFile;
302 item->displayName = settings.value("Desktop Entry/Name").toString();
297 item->displayName = settings.value("Desktop Entry/Name").toString();
303
298
304− if (settings.contains("Desktop Entry/Path")) {
305− item->icon = settings.value("Desktop Entry/Path").toString() + "/" + settings.value("Desktop Entry/Icon").toString();
299+ QString iconString = settings.value("Desktop Entry/Icon").toString();
300+ QString pathString = settings.value("Desktop Entry/Path").toString();
301+ if (QFileInfo(iconString).exists()) {
302+ item->icon = QFileInfo(iconString).absoluteFilePath();
303+ } else if (QFileInfo(pathString + '/' + iconString).exists()) {
304+ item->icon = pathString + '/' + iconString;
306 } else {
305 } else {
307− item->icon = settings.value("Desktop Entry/Icon").toString();
306+ item->icon = "image://theme/" + iconString;
308 }
307 }
309 item->pinned = false;
308 item->pinned = false;
310 return item;
309 return item;
run_on_device+2−1
@@ -65,8 +65,9 @@ setup_adb_forwarding() {
65}
65}
66
66
67install_dependencies() {
67install_dependencies() {
68+ exec_with_adb rm /etc/init/ssh.override
69+ exec_with_adb service ssh start
68 exec_with_adb apt-get update
70 exec_with_adb apt-get update
69− exec_with_adb apt-get -y install openssh-server
70 exec_with_ssh $SUDO apt-get -y install build-essential rsync bzr ccache gdb ninja-build devscripts equivs
71 exec_with_ssh $SUDO apt-get -y install build-essential rsync bzr ccache gdb ninja-build devscripts equivs
71}
72}
72
73
tests/mocks/AccountsService/AccountsService.cpp+9−2
@@ -19,7 +19,8 @@
19#include "AccountsService.h"
19#include "AccountsService.h"
20
20
21AccountsService::AccountsService(QObject* parent)
21AccountsService::AccountsService(QObject* parent)
22− : QObject(parent)
22+ : QObject(parent),
23+ m_backgroundFile(TOP_SRCDIR "/graphics/phone_background.jpg")
23{
24{
24}
25}
25
26
@@ -54,5 +55,11 @@ void AccountsService::setDemoEdgesForCurrentUser(bool)
54
55
55QString AccountsService::getBackgroundFile()
56QString AccountsService::getBackgroundFile()
56{
57{
57− return TOP_SRCDIR "/graphics/phone_background.jpg";
58+ return m_backgroundFile;
59+}
60+
61+void AccountsService::setBackgroundFile(const QString &backgroundFile)
62+{
63+ m_backgroundFile = backgroundFile;
64+ backgroundFileChanged();
58}
65}
tests/mocks/AccountsService/AccountsService.h+5
@@ -41,6 +41,7 @@ class AccountsService: public QObject
41 NOTIFY demoEdgesForCurrentUserChanged)
41 NOTIFY demoEdgesForCurrentUserChanged)
42 Q_PROPERTY (QString backgroundFile
42 Q_PROPERTY (QString backgroundFile
43 READ getBackgroundFile
43 READ getBackgroundFile
44+ WRITE setBackgroundFile // only available in mock
44 NOTIFY backgroundFileChanged)
45 NOTIFY backgroundFileChanged)
45
46
46public:
47public:
@@ -53,12 +54,16 @@ public:
53 bool getDemoEdgesForCurrentUser();
54 bool getDemoEdgesForCurrentUser();
54 void setDemoEdgesForCurrentUser(bool demoEdgesForCurrentUser);
55 void setDemoEdgesForCurrentUser(bool demoEdgesForCurrentUser);
55 QString getBackgroundFile();
56 QString getBackgroundFile();
57+ void setBackgroundFile(const QString &backgroundFile);
56
58
57Q_SIGNALS:
59Q_SIGNALS:
58 void userChanged();
60 void userChanged();
59 void demoEdgesChanged();
61 void demoEdgesChanged();
60 void demoEdgesForCurrentUserChanged();
62 void demoEdgesForCurrentUserChanged();
61 void backgroundFileChanged();
63 void backgroundFileChanged();
64+
65+private:
66+ QString m_backgroundFile;
62};
67};
63
68
64#endif
69#endif
tests/plugins/Unity/Launcher/click-icon.svgnew file

No changes to the content.

tests/plugins/Unity/Launcher/launcherbackendtest.cpp+10−2
@@ -26,6 +26,15 @@ class LauncherBackendTest : public QObject
26 Q_OBJECT
26 Q_OBJECT
27
27
28private Q_SLOTS:
28private Q_SLOTS:
29+
30+ void initTestCase()
31+ {
32+ // As we want to test absolute file paths in the .desktop file, we need to modify the
33+ // sample file and replace the path in there with the current build dir.
34+ QSettings settings(QDir::currentPath() + "/click-icon.desktop", QSettings::IniFormat);
35+ settings.setValue("Desktop Entry/Path", QDir::currentPath());
36+ }
37+
29 void testFileNames()
38 void testFileNames()
30 {
39 {
31 LauncherBackend backend(false);
40 LauncherBackend backend(false);
@@ -66,8 +75,7 @@ private Q_SLOTS:
66 QTest::newRow("fallback on theme") << "abs-icon" << "image://theme//path/to/icon.png";
75 QTest::newRow("fallback on theme") << "abs-icon" << "image://theme//path/to/icon.png";
67
76
68 // Click packages have a relative icon path but an absolute path as a separate entry
77 // Click packages have a relative icon path but an absolute path as a separate entry
69− // As we don't want to rely on a click app being installed for the test, accept it with the image://theme fallback
70− QTest::newRow("click package icon") << "click-icon" << "image://theme//path/to/some/click/app/click-icon.svg";
78+ QTest::newRow("click package icon") << "click-icon" << QDir::currentPath() + "/click-icon.svg";
71 }
79 }
72
80
73 void testIcon() {
81 void testIcon() {
tests/qmltests/CMakeLists.txt+2−2
@@ -27,8 +27,8 @@ set(qmltest_DEFAULT_TARGETS qmluitests)
27set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
27set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
28set(qmltest_DEFAULT_PROPERTIES "")
28set(qmltest_DEFAULT_PROPERTIES "")
29
29
30−add_qml_test(. Shell IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS}
30+add_qml_test(. Shell)
31− ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/liblightdm/single")
31+add_qml_test(. GreeterShell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/liblightdm/single")
32add_manual_qml_test(Components DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
32add_manual_qml_test(Components DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
33add_qml_test(Components DraggingArea)
33add_qml_test(Components DraggingArea)
34add_qml_test(Components EdgeDemoOverlay)
34add_qml_test(Components EdgeDemoOverlay)
tests/qmltests/Greeter/tst_Phone.qml−1
@@ -19,7 +19,6 @@ import QtTest 1.0
19import ".."
19import ".."
20import "../../../Greeter"
20import "../../../Greeter"
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22−import LightDM 0.1 as LightDM
23import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
24
23
25Item {
24Item {
tests/qmltests/tst_GreeterShell.qmlnew file+78
@@ -0,0 +1,78 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * Authors:
5+ * Michael Terry <michael.terry@canonical.com>
6+ *
7+ * This program is free software; you can redistribute it and/or modify
8+ * it under the terms of the GNU General Public License as published by
9+ * the Free Software Foundation; version 3.
10+ *
11+ * This program is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ * GNU General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU General Public License
17+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+ */
19+
20+import QtQuick 2.0
21+import QtTest 1.0
22+import AccountsService 0.1
23+import GSettings 1.0
24+import Unity.Application 0.1
25+import Unity.Test 0.1 as UT
26+import Powerd 0.1
27+
28+import "../.."
29+
30+Item {
31+ width: shell.width
32+ height: shell.height
33+
34+ QtObject {
35+ id: applicationArguments
36+
37+ function hasGeometry() {
38+ return false;
39+ }
40+
41+ function width() {
42+ return 0;
43+ }
44+
45+ function height() {
46+ return 0;
47+ }
48+ }
49+
50+ GreeterShell {
51+ id: shell
52+ }
53+
54+ UT.UnityTestCase {
55+ name: "GreeterShell"
56+ when: windowShown
57+
58+ function test_wallpaper_data() {
59+ return [
60+ {tag: "both", accounts: "tests/data/unity/backgrounds/blue.png", gsettings: "tests/data/unity/backgrounds/red.png", expected: "blue.png"},
61+ {tag: "accounts", accounts: "tests/data/unity/backgrounds/blue.png", gsettings: "", expected: "blue.png"},
62+ {tag: "gsettings", accounts: "", gsettings: "tests/data/unity/backgrounds/red.png", expected: "red.png"},
63+ {tag: "none", accounts: "", gsettings: "", expected: shell.defaultBackground},
64+ {tag: "invalid-both", accounts: "invalid", gsettings: "invalid", expected: shell.defaultBackground},
65+ {tag: "invalid-accounts", accounts: "invalid", gsettings: "tests/data/unity/backgrounds/red.png", expected: shell.defaultBackground},
66+ {tag: "invalid-gsettings", accounts: "tests/data/unity/backgrounds/blue.png", gsettings: "invalid", expected: "blue.png"},
67+ ]
68+ }
69+
70+ function test_wallpaper(data) {
71+ var backgroundImage = findChild(shell, "backgroundImage")
72+ GSettingsController.setPictureUri(data.gsettings)
73+ AccountsService.backgroundFile = data.accounts
74+ tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.expected) !== -1; }, true)
75+ tryCompare(backgroundImage, "status", Image.Ready)
76+ }
77+ }
78+}
tests/qmltests/tst_Shell.qml+3−3
@@ -135,7 +135,7 @@ Item {
135
135
136 // Try to suspend while proximity is engaged...
136 // Try to suspend while proximity is engaged...
137 Powerd.displayPowerStateChange(Powerd.Off, Powerd.UseProximity);
137 Powerd.displayPowerStateChange(Powerd.Off, Powerd.UseProximity);
138− tryCompare(ApplicationManager, "mainStageFocusedApplication", mainApp);
138+ tryCompare(ApplicationManager, "focusedApplicationId", mainApp);
139
139
140 // Now really suspend
140 // Now really suspend
141 Powerd.displayPowerStateChange(Powerd.Off, 0);
141 Powerd.displayPowerStateChange(Powerd.Off, 0);
@@ -321,8 +321,8 @@ Item {
321
321
322 function test_wallpaper_data() {
322 function test_wallpaper_data() {
323 return [
323 return [
324− {tag: "red", url: "../tests/data/unity/backgrounds/red.png", expectedUrl: "tests/data/unity/backgrounds/red.png"},
324+ {tag: "red", url: "tests/data/unity/backgrounds/red.png", expectedUrl: "tests/data/unity/backgrounds/red.png"},
325− {tag: "blue", url: "../tests/data/unity/backgrounds/blue.png", expectedUrl: "tests/data/unity/backgrounds/blue.png"},
325+ {tag: "blue", url: "tests/data/unity/backgrounds/blue.png", expectedUrl: "tests/data/unity/backgrounds/blue.png"},
326 {tag: "invalid", url: "invalid", expectedUrl: shell.defaultBackground},
326 {tag: "invalid", url: "invalid", expectedUrl: shell.defaultBackground},
327 {tag: "empty", url: "", expectedUrl: shell.defaultBackground}
327 {tag: "empty", url: "", expectedUrl: shell.defaultBackground}
328 ]
328 ]