on xenial help sign in
Actually commit the test file ^_^
commit01796090248472ed32ed9ccc1fa54d872fcdccec authorAlbert Astals <albert.astals@canonical.com> dateWed 12 Feb 2014, 12:55 (13 years ago) parentcc25a33
1 file changed+84
tests/qmltests/Dash/Previews/tst_PreviewProgress.qml+84
tests/qmltests/Dash/Previews/tst_PreviewProgress.qmlnew file+84
@@ -0,0 +1,84 @@
1+/*
2+ * Copyright 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 "../../../../qml/Dash/Previews"
20+import Unity.Test 0.1 as UT
21+import Ubuntu.Components 0.1
22+
23+Rectangle {
24+ id: root
25+ width: units.gu(60)
26+ height: units.gu(80)
27+
28+ property var progressjson: {
29+ "type": "progress",
30+ "source": { "dbus-name" : "somename", "dbus-object": "somestring" }
31+ }
32+
33+ property var progressjsonFinish: {
34+ "type": "progress",
35+ "source": { "dbus-name" : "somename", "dbus-object": "finish" }
36+ }
37+
38+ property var progressjsonError: {
39+ "type": "progress",
40+ "source": { "dbus-name" : "somename", "dbus-object": "error" }
41+ }
42+
43+ SignalSpy {
44+ id: spy
45+ signalName: "triggered"
46+ }
47+
48+
49+ PreviewProgress {
50+ id: previewProgress
51+ widgetId: "previewProgress"
52+ widgetData: progressjson
53+ width: units.gu(30)
54+
55+ Rectangle {
56+ anchors.fill: parent
57+ color: "red"
58+ opacity: 0.1
59+ }
60+ }
61+
62+ UT.UnityTestCase {
63+ name: "PreviewHeaderTest"
64+ when: windowShown
65+
66+ function test_json() {
67+ spy.target = previewProgress
68+
69+ previewProgress.widgetData = progressjsonFinish;
70+ compare(spy.count, 1);
71+ var args = spy.signalArguments[0];
72+ compare(args[0], "previewProgress");
73+ compare(args[1], "finished");
74+ compare(args[2], progressjsonFinish);
75+
76+ previewProgress.widgetData = progressjsonError;
77+ compare(spy.count, 2);
78+ var args = spy.signalArguments[1];
79+ compare(args[0], "previewProgress");
80+ compare(args[1], "failed");
81+ compare(args[2], progressjsonError);
82+ }
83+ }
84+}