@@ -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+}