@@ -0,0 +1,85 @@
2+ * Copyright 2014 Canonical Ltd.
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.
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.
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/>.
19+import "../../../../qml/Dash/Previews"
20+import Unity.Test 0.1 as UT
21+import Ubuntu.Components 0.1
28+ property var progressjson: {
30+ "source": { "dbus-name" : "somename", "dbus-object": "somestring" }
33+ property var progressjsonFinish: {
35+ "source": { "dbus-name" : "somename", "dbus-object": "finish" }
38+ property var progressjsonError: {
40+ "source": { "dbus-name" : "somename", "dbus-object": "error" }
45+ signalName: "triggered"
50+ widgetId: "previewProgress"
51+ widgetData: progressjson
62+ name: "PreviewHeaderTest"
65+ function test_json() {
66+ spy.target = previewProgress
68+ // The mock DownloadTracker triggers its signals when you pass
69+ // finish/error as dbus-object to it. Exercise it here
70+ previewProgress.widgetData = progressjsonFinish;
71+ compare(spy.count, 1);
72+ var args = spy.signalArguments[0];
73+ compare(args[0], "previewProgress");
74+ compare(args[1], "finished");
75+ compare(args[2], progressjsonFinish);
77+ previewProgress.widgetData = progressjsonError;
78+ compare(spy.count, 2);
79+ var args = spy.signalArguments[1];
80+ compare(args[0], "previewProgress");
81+ compare(args[1], "failed");
82+ compare(args[2], progressjsonError);