@@ -0,0 +1,238 @@
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 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.1
18+import QtQuick.Layouts 1.1
19+import QtTest 1.0
20+import ".."
21+import "../../../../qml/Panel/New"
22+import Ubuntu.Components 0.1
23+import Unity.Test 0.1 as UT
24+import Unity.Indicators 0.1 as Indicators
25+
26+Rectangle {
27+ width: units.gu(100)
28+ height: units.gu(30)
29+ color: "white"
30+
31+ Component.onCompleted: {
32+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake1",
33+ "/com/canonical/indicators/fake1",
34+ "/com/canonical/indicators/fake1",
35+ {
36+ "title": "Bluetooth",
37+ "icons": [ "image://theme/bluetooth-active" ],
38+ });
39+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake2",
40+ "/com/canonical/indicators/fake2",
41+ "/com/canonical/indicators/fake2",
42+ {
43+ "title": "Network",
44+ "icons": [ "image://theme/simcard-error", "image://theme/wifi-high" ],
45+ });
46+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake3",
47+ "/com/canonical/indicators/fake3",
48+ "/com/canonical/indicators/fake3",
49+ {
50+ "title": "Sound",
51+ "icons": [ "image://theme/audio-volume-high" ],
52+ });
53+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake4",
54+ "/com/canonical/indicators/fake4",
55+ "/com/canonical/indicators/fake4",
56+ {
57+ "title": "Battery",
58+ "icons": [ "image://theme/battery-020" ],
59+ });
60+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake5",
61+ "/com/canonical/indicators/fake5",
62+ "/com/canonical/indicators/fake5",
63+ {
64+ "title": "Location",
65+ "icons": [ "image://theme/gps" ],
66+ });
67+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake6",
68+ "/com/canonical/indicators/fake6",
69+ "/com/canonical/indicators/fake6",
70+ {
71+ "title": "Notifications",
72+ "icons": [ "image://theme/messages-new" ],
73+ });
74+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake7",
75+ "/com/canonical/indicators/fake7",
76+ "/com/canonical/indicators/fake7",
77+ {
78+ "title": "Upcoming Events",
79+ "label": "12:04",
80+ });
81+ }
82+
83+ Indicators.FakeIndicatorsModel {
84+ id: indicatorsModel
85+
86+ indicatorData: [
87+ {
88+ "identifier": "indicator-fake1",
89+ "indicatorProperties": {
90+ "enabled": true,
91+ "busName": "com.canonical.indicators.fake1",
92+ "menuObjectPath": "/com/canonical/indicators/fake1",
93+ "actionsObjectPath": "/com/canonical/indicators/fake1"
94+ }
95+ },
96+ {
97+ "identifier": "indicator-fake2",
98+ "indicatorProperties": {
99+ "enabled": true,
100+ "busName": "com.canonical.indicators.fake2",
101+ "menuObjectPath": "/com/canonical/indicators/fake2",
102+ "actionsObjectPath": "/com/canonical/indicators/fake2"
103+ }
104+ },
105+ {
106+ "identifier": "indicator-fake3",
107+ "indicatorProperties": {
108+ "enabled": true,
109+ "busName": "com.canonical.indicators.fake3",
110+ "menuObjectPath": "/com/canonical/indicators/fake3",
111+ "actionsObjectPath": "/com/canonical/indicators/fake3"
112+ }
113+ },
114+ {
115+ "identifier": "indicator-fake4",
116+ "indicatorProperties": {
117+ "enabled": true,
118+ "busName": "com.canonical.indicators.fake4",
119+ "menuObjectPath": "/com/canonical/indicators/fake4",
120+ "actionsObjectPath": "/com/canonical/indicators/fake4"
121+ }
122+ },
123+ {
124+ "identifier": "indicator-fake5",
125+ "indicatorProperties": {
126+ "enabled": true,
127+ "busName": "com.canonical.indicators.fake5",
128+ "menuObjectPath": "/com/canonical/indicators/fake5",
129+ "actionsObjectPath": "/com/canonical/indicators/fake5"
130+ }
131+ },
132+ {
133+ "identifier": "indicator-fake6",
134+ "indicatorProperties": {
135+ "enabled": true,
136+ "busName": "com.canonical.indicators.fake6",
137+ "menuObjectPath": "/com/canonical/indicators/fake6",
138+ "actionsObjectPath": "/com/canonical/indicators/fake6"
139+ }
140+ },
141+ {
142+ "identifier": "indicator-fake7",
143+ "indicatorProperties": {
144+ "enabled": true,
145+ "busName": "com.canonical.indicators.fake7",
146+ "menuObjectPath": "/com/canonical/indicators/fake7",
147+ "actionsObjectPath": "/com/canonical/indicators/fake7"
148+ }
149+ },
150+ {
151+ "identifier": "indicator-fake8",
152+ "indicatorProperties": {
153+ "enabled": true,
154+ "busName": "com.canonical.indicators.fake1",
155+ "menuObjectPath": "/com/canonical/indicators/fake1",
156+ "actionsObjectPath": "/com/canonical/indicators/fake1"
157+ }
158+ },
159+ {
160+ "identifier": "indicator-fake9",
161+ "indicatorProperties": {
162+ "enabled": true,
163+ "busName": "com.canonical.indicators.fake1",
164+ "menuObjectPath": "/com/canonical/indicators/fake1",
165+ "actionsObjectPath": "/com/canonical/indicators/fake1"
166+ }
167+ },
168+ {
169+ "identifier": "indicator-fake10",
170+ "indicatorProperties": {
171+ "enabled": true,
172+ "busName": "com.canonical.indicators.fake1",
173+ "menuObjectPath": "/com/canonical/indicators/fake1",
174+ "actionsObjectPath": "/com/canonical/indicators/fake1"
175+ }
176+ },
177+ ]
178+ }
179+
180+ Rectangle {
181+ id: itemArea
182+ color: "blue"
183+ anchors {
184+ top: parent.top
185+ bottom: parent.bottom
186+ }
187+ width: units.gu(50)
188+
189+ Rectangle {
190+ color: "black"
191+ anchors.fill: indicatorsBar
192+ }
193+
194+ IndicatorsBar {
195+ id: indicatorsBar
196+ height: expanded ? units.gu(7) : units.gu(3)
197+ width: units.gu(30)
198+ anchors.centerIn: parent
199+ indicatorsModel: indicatorsModel
200+
201+ Behavior on height { NumberAnimation { duration: 1000; easing: UbuntuAnimation.StandardEasing } }
202+
203+ MouseArea {
204+ anchors.fill: parent
205+ enabled: !indicatorsBar.expanded
206+ onPressed: {
207+ console.log("click")
208+ indicatorsBar.selectItemAt(mouse.x);
209+ indicatorsBar.expanded = true
210+ }
211+ }
212+ }
213+ }
214+
215+ ColumnLayout {
216+ anchors {
217+ top: parent.top
218+ bottom: button.top
219+ left: itemArea.right
220+ right: parent.right
221+ }
222+ }
223+
224+ Button {
225+ id: button
226+ anchors {
227+ left: parent.left
228+ right: parent.right
229+ bottom: parent.bottom
230+ }
231+ text: indicatorsBar.expanded ? "Collapse" : "Expand"
232+ onClicked: indicatorsBar.expanded = !indicatorsBar.expanded
233+ }
234+
235+ UT.UnityTestCase {
236+ name: "IndicatorsRow"
237+ }
238+}