Merge lp:~cimi/unity8/scope-settings into lp:unity8
- scope-settings
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~cimi/unity8/scope-settings |
Merge into: | lp:unity8 |
Prerequisite: | lp:~aacid/unity8/dash_overview |
Diff against target: |
1674 lines (+1093/-75) 28 files modified
qml/Dash/Dash.qml (+1/-1) qml/Dash/DashContent.qml (+4/-4) qml/Dash/GenericScopeView.qml (+68/-27) qml/Dash/PageHeader.qml (+9/-3) qml/Dash/PreviewListView.qml (+11/-1) qml/Dash/ScopeSettings/ScopeSetting.qml (+37/-0) qml/Dash/ScopeSettings/ScopeSettingBoolean.qml (+61/-0) qml/Dash/ScopeSettings/ScopeSettingList.qml (+50/-0) qml/Dash/ScopeSettings/ScopeSettingNumber.qml (+21/-0) qml/Dash/ScopeSettings/ScopeSettingString.qml (+83/-0) qml/Dash/ScopeSettings/ScopeSettingsWidgetFactory.qml (+57/-0) qml/Dash/ScopeSettingsPage.qml (+62/-0) qml/Dash/ScopesOverview.qml (+2/-0) tests/autopilot/unity8/shell/emulators/dash.py (+5/-5) tests/mocks/Unity/CMakeLists.txt (+2/-0) tests/mocks/Unity/fake_scope.cpp (+3/-1) tests/mocks/Unity/fake_scope.h (+1/-0) tests/mocks/Unity/fake_settingsmodel.cpp (+95/-0) tests/mocks/Unity/fake_settingsmodel.h (+54/-0) tests/mocks/Unity/fake_unity_plugin.cpp (+2/-0) tests/qmltests/CMakeLists.txt (+5/-0) tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml (+1/-1) tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingBoolean.qml (+62/-0) tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingList.qml (+83/-0) tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingNumber.qml (+98/-0) tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingString.qml (+88/-0) tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingsWidgetFactory.qml (+65/-0) tests/qmltests/Dash/tst_GenericScopeView.qml (+63/-32) |
To merge this branch: | bzr merge lp:~cimi/unity8/scope-settings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Michał Sawicz | Needs Fixing | ||
Review via email: mp+230182@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-08-26.
Commit message
Add scope settings UI
Accessible through the page header in scope pages on supported scopes.
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
No
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* Did you make sure that your branch does not contain spurious tags?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
n/a
* If you changed the UI, has there been a design review?
There are no final designs yet, but this is consistent with the rest of the UI
PS Jenkins bot (ps-jenkins) wrote : | # |
- 1114. By Andrea Cimitan
-
Whitespaces
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1114
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1115. By Andrea Cimitan
-
Add small tests
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1115
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1116. By Andrea Cimitan
-
Added more tests
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1116
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) wrote : | # |
Please delete tag 7.85+14.
- 1117. By Andrea Cimitan
-
Merge trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1117
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 1118. By Andrea Cimitan
-
Added fake settings
- 1119. By Andrea Cimitan
-
Moar fixes
- 1120. By Andrea Cimitan
-
Added tests for settings open close
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1120
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1121. By Andrea Cimitan
-
Update ScopeSettingBoolean
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1121
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1122. By Andrea Cimitan
-
Merge el trunko
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1122
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) wrote : | # |
You need to disable dash overview when in settings.
Fields don't get focus when tapped on list item.
I assume there's no way to override the color of:
- labels in ItemSelector
- checkbox? should it?
Previews are always opened starting at the first one, not the one clicked. Rebase on lp:~saviq/unity8/fix-horizontal-list-activation and add tests to ensure which item is opened. Doesn't even conflict (but you do need to replace previewListView with subPageLoader).
More to come.
- 1123. By Andrea Cimitan
-
Force focus properly
Michał Sawicz (saviq) wrote : | # |
See inline.
Didn't review tests yet, will review after other review comments are addressed.
- 1124. By Andrea Cimitan
-
Merged horizontal list
- 1125. By Andrea Cimitan
-
Fix issue with initial count for preview
- 1126. By Andrea Cimitan
-
Should not feature overview in settings page
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1123
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1126
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1127. By Andrea Cimitan
-
Workaround test
- 1128. By Andrea Cimitan
-
Properly fix tests
- 1129. By Andrea Cimitan
-
Better the string test too
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1127
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1129
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1129
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1129
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Andrea Cimitan (cimi) : | # |
- 1130. By Andrea Cimitan
-
Fix issue with preview in scope overview
- 1131. By Andrea Cimitan
-
[ CI bot ]
* Resync trunk
[ Michał Sawicz ]
* Fix dash overview test and prevent crash in mock ApplicationInfo's
d'tor. tryCompareFunction didn't work because .item threw.
[ Michael Terry ]
* Bring dialer to front on incoming call even when device is locked
(LP: #1354532)
[ CI bot ]
* Resync trunk
[ Michał Sawicz ]
* Use palette's baseText for text colour in dash.
* Update qmltypes definitions
* Move PageHeader out of qml/Components into qml/Dash
* Reshuffle and update dependencies
* Fix cardtool test and make card creator output debugging info on
errors.
* Support previews for scopes in overview and hook up preview
processing to activity indicator.
* Fix notifications indicator title
* Fix horizontal list activation and add test for it.
[ Ying-Chun Liu ]
* Add button colors and i18n for power off dialog. (LP: #1354506)
[ Mirco Müller ]
* Force plain-text rendering for summary- and body-text. (LP:
#1335787) - 1132. By Andrea Cimitan
-
More stuff addressed
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1132
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1133
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1134
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1133. By Andrea Cimitan
-
Fixed tests
- 1134. By Andrea Cimitan
-
[ CI bot ]
* Resync trunk
[ Nick Dedekind ]
* Fixed CachedUnityMenuModel destruction unhinging indicators. (LP:
#1328646)
[ Mirco Müller ]
* Temporarily disable any opacity-animation for notifications to
unblock the train due to LP: 1354406. (LP: #1354406)
Michał Sawicz (saviq) wrote : | # |
See inline. There's a bunch of unanswered comments in the previous review, please answer them too.
Re: shown split or separate, I'd rather merge them unless there's a real reason why not to.
- 1135. By Andrea Cimitan
-
Removed previewShown and settingsShown properties
- 1136. By Andrea Cimitan
-
More changes requested
- 1137. By Andrea Cimitan
-
More fixes
- 1138. By Andrea Cimitan
-
More changes, still doesn't work
- 1139. By Andrea Cimitan
-
More changes to review
- 1140. By Andrea Cimitan
-
Fix tests with refactor
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1136
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1140
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1141. By Andrea Cimitan
-
Another thing addressed
Andrea Cimitan (cimi) : | # |
Michał Sawicz (saviq) wrote : | # |
Do we really only want to show this once the loader is ready? There will be a delay between user tapping and the page going in on screen? OTOH that gives us protection from a broken subpage, so maybe that's fine...
Otherwise see inline.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1141
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1142. By Andrea Cimitan
-
Changes according to review
- 1143. By Andrea Cimitan
-
merged trunk
- 1144. By Andrea Cimitan
-
More changes
- 1145. By Andrea Cimitan
-
Fixed tests
- 1146. By Andrea Cimitan
-
Test initialValue
- 1147. By Andrea Cimitan
-
Other approach to test
Michał Sawicz (saviq) : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1144
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1148. By Andrea Cimitan
-
New approach to test
- 1149. By Andrea Cimitan
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1147
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
Preview Diff
1 | === modified file 'qml/Dash/Dash.qml' |
2 | --- qml/Dash/Dash.qml 2014-08-08 09:41:13 +0000 |
3 | +++ qml/Dash/Dash.qml 2014-08-26 18:23:42 +0000 |
4 | @@ -341,7 +341,7 @@ |
5 | objectName: "overviewDragHandle" |
6 | z: 1 |
7 | direction: Direction.Upwards |
8 | - enabled: !dashContent.previewShown && |
9 | + enabled: !dashContent.subPageShown && |
10 | dashContent.currentScope && |
11 | dashContent.currentScope.searchQuery == "" && |
12 | (overviewController.progress == 0 || dragging) |
13 | |
14 | === modified file 'qml/Dash/DashContent.qml' |
15 | --- qml/Dash/DashContent.qml 2014-08-08 08:47:36 +0000 |
16 | +++ qml/Dash/DashContent.qml 2014-08-26 18:23:42 +0000 |
17 | @@ -27,8 +27,8 @@ |
18 | readonly property alias currentIndex: dashContentList.currentIndex |
19 | readonly property string currentScopeId: dashContentList.currentItem ? dashContentList.currentItem.scopeId : "" |
20 | readonly property var currentScope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null |
21 | - readonly property bool previewShown: dashContentList.currentItem && dashContentList.currentItem.item ? |
22 | - dashContentList.currentItem.item.previewShown : false |
23 | + readonly property bool subPageShown: dashContentList.currentItem && dashContentList.currentItem.item ? |
24 | + dashContentList.currentItem.item.subPageShown : false |
25 | readonly property bool processing: dashContentList.currentItem && dashContentList.currentItem.item |
26 | && dashContentList.currentItem.item.processing || false |
27 | readonly property bool pageHeaderTotallyVisible: dashContentList.currentItem && dashContentList.currentItem.item |
28 | @@ -96,8 +96,7 @@ |
29 | id: dashContentList |
30 | objectName: "dashContentList" |
31 | |
32 | - interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving && !currentItem.navigationShown |
33 | - |
34 | + interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving && !currentItem.navigationShown && !currentItem.subPageShown |
35 | anchors.fill: parent |
36 | orientation: ListView.Horizontal |
37 | boundsBehavior: Flickable.DragAndOvershootBounds |
38 | @@ -137,6 +136,7 @@ |
39 | |
40 | readonly property bool moving: item ? item.moving : false |
41 | readonly property bool navigationShown: item ? item.navigationShown : false |
42 | + readonly property bool subPageShown: item ? item.subPageShown : false |
43 | readonly property var categoryView: item ? item.categoryView : null |
44 | readonly property var theScope: scope |
45 | |
46 | |
47 | === modified file 'qml/Dash/GenericScopeView.qml' |
48 | --- qml/Dash/GenericScopeView.qml 2014-08-14 11:33:42 +0000 |
49 | +++ qml/Dash/GenericScopeView.qml 2014-08-26 18:23:42 +0000 |
50 | @@ -34,7 +34,7 @@ |
51 | property bool enableHeightBehaviorOnNextCreation: false |
52 | property var categoryView: categoryView |
53 | property bool showPageHeader: true |
54 | - readonly property alias previewShown: previewListView.open |
55 | + readonly property alias subPageShown: subPageLoader.subPageShown |
56 | property int paginationCount: 0 |
57 | property int paginationIndex: 0 |
58 | property alias pageHeaderTotallyVisible: categoryView.pageHeaderTotallyVisible |
59 | @@ -43,7 +43,7 @@ |
60 | style: scope ? scope.customizations : {} |
61 | } |
62 | |
63 | - readonly property bool processing: scope ? scope.searchInProgress || previewListView.processing : false |
64 | + readonly property bool processing: scope ? scope.searchInProgress || subPageLoader.processing : false |
65 | |
66 | signal backClicked() |
67 | |
68 | @@ -56,7 +56,7 @@ |
69 | } |
70 | |
71 | function closePreview() { |
72 | - previewListView.open = false; |
73 | + subPageLoader.closeSubPage() |
74 | } |
75 | |
76 | function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) { |
77 | @@ -80,19 +80,19 @@ |
78 | if (limitedCategoryItemCount > 0) { |
79 | previewLimitModel.model = resultsModel; |
80 | previewLimitModel.limit = limitedCategoryItemCount; |
81 | - previewListView.model = previewLimitModel; |
82 | + subPageLoader.model = previewLimitModel; |
83 | } else { |
84 | - previewListView.model = resultsModel; |
85 | + subPageLoader.model = resultsModel; |
86 | } |
87 | - previewListView.currentIndex = -1; |
88 | - previewListView.currentIndex = index; |
89 | - previewListView.open = true; |
90 | + subPageLoader.initialIndex = -1; |
91 | + subPageLoader.initialIndex = index; |
92 | + subPageLoader.openSubPage("preview"); |
93 | } |
94 | |
95 | Binding { |
96 | target: scope |
97 | property: "isActive" |
98 | - value: isCurrent && !previewListView.open |
99 | + value: isCurrent && !subPageLoader.open |
100 | } |
101 | |
102 | SortFilterProxyModel { |
103 | @@ -105,10 +105,10 @@ |
104 | } |
105 | |
106 | onIsCurrentChanged: { |
107 | - if (showPageHeader) { |
108 | - pageHeaderLoader.item.resetSearch(); |
109 | + if (pageHeaderLoader.item && showPageHeader) { |
110 | + pageHeaderLoader.item.resetSearch(); |
111 | } |
112 | - previewListView.open = false; |
113 | + subPageLoader.closeSubPage(); |
114 | } |
115 | |
116 | Binding { |
117 | @@ -127,8 +127,8 @@ |
118 | |
119 | Connections { |
120 | target: scopeView.scope |
121 | - onShowDash: previewListView.open = false; |
122 | - onHideDash: previewListView.open = false; |
123 | + onShowDash: subPageLoader.closeSubPage() |
124 | + onHideDash: subPageLoader.closeSubPage() |
125 | } |
126 | |
127 | Rectangle { |
128 | @@ -141,13 +141,13 @@ |
129 | id: categoryView |
130 | objectName: "categoryListView" |
131 | |
132 | - x: previewListView.open ? -width : 0 |
133 | + x: subPageLoader.open ? -width : 0 |
134 | Behavior on x { UbuntuNumberAnimation { } } |
135 | width: parent.width |
136 | height: parent.height |
137 | |
138 | model: scopeView.categories |
139 | - forceNoClip: previewListView.open |
140 | + forceNoClip: subPageLoader.open |
141 | pixelAligned: true |
142 | interactive: !navigationShown |
143 | |
144 | @@ -290,10 +290,10 @@ |
145 | // If the filter animation will be seen start it, otherwise, just flip the switch |
146 | var shrinkingVisible = !shouldExpand && y + item.collapsedHeight + seeAll.height < categoryView.height; |
147 | var growingVisible = shouldExpand && y + height < categoryView.height; |
148 | - if (!previewListView.open || shouldExpand) { |
149 | + if (!subPageLoader.open || shouldExpand) { |
150 | var animate = shrinkingVisible || growingVisible; |
151 | baseItem.expand(shouldExpand, animate) |
152 | - if (shouldExpand && !previewListView.open) { |
153 | + if (shouldExpand && !subPageLoader.open) { |
154 | categoryView.maximizeVisibleArea(index, item.expandedHeight + seeAll.height); |
155 | } |
156 | } |
157 | @@ -424,6 +424,7 @@ |
158 | searchHint: scopeView.scope && scopeView.scope.searchHint || i18n.tr("Search") |
159 | showBackButton: scopeView.hasBackAction |
160 | searchEntryEnabled: true |
161 | + settingsEnabled: scopeView.scope && scopeView.scope.settings && scopeView.scope.settings.count > 0 || false |
162 | scopeStyle: scopeView.scopeStyle |
163 | paginationCount: scopeView.paginationCount |
164 | paginationIndex: scopeView.paginationIndex |
165 | @@ -438,6 +439,7 @@ |
166 | } |
167 | |
168 | onBackClicked: scopeView.backClicked() |
169 | + onSettingsClicked: subPageLoader.openSubPage("settings") |
170 | } |
171 | } |
172 | } |
173 | @@ -447,21 +449,60 @@ |
174 | id: previewLimitModel |
175 | } |
176 | |
177 | - PreviewListView { |
178 | - id: previewListView |
179 | - objectName: "previewListView" |
180 | + Loader { |
181 | + id: subPageLoader |
182 | + objectName: "subPageLoader" |
183 | visible: x != width |
184 | - scope: scopeView.scope |
185 | - scopeStyle: scopeView.scopeStyle |
186 | width: parent.width |
187 | height: parent.height |
188 | anchors.left: categoryView.right |
189 | |
190 | - onOpenChanged: { |
191 | - if (showPageHeader) { |
192 | - pageHeaderLoader.item.unfocus(); |
193 | + property bool open: false |
194 | + property var scope: scopeView.scope |
195 | + property var scopeStyle: scopeView.scopeStyle |
196 | + property int initialIndex: -1 |
197 | + property var model: null |
198 | + |
199 | + readonly property bool processing: item && item.processing || false |
200 | + readonly property int count: item && item.count || 0 |
201 | + readonly property int currentIndex: item && item.currentIndex || 0 |
202 | + readonly property var currentItem: item && item.currentItem || null |
203 | + |
204 | + property string subPage: "" |
205 | + readonly property bool subPageShown: visible && status === Loader.Ready |
206 | + |
207 | + function openSubPage(page) { |
208 | + subPage = page; |
209 | + } |
210 | + |
211 | + function closeSubPage() { |
212 | + open = false; |
213 | + } |
214 | + |
215 | + source: switch(subPage) { |
216 | + case "preview": return "PreviewListView.qml"; |
217 | + case "settings": return "ScopeSettingsPage.qml"; |
218 | + default: return ""; |
219 | + } |
220 | + |
221 | + onLoaded: { |
222 | + item.scope = Qt.binding(function() { return subPageLoader.scope; } ) |
223 | + item.scopeStyle = Qt.binding(function() { return subPageLoader.scopeStyle; } ) |
224 | + if (subPage == "preview") { |
225 | + item.open = Qt.binding(function() { return subPageLoader.open; } ) |
226 | + item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex; } ) |
227 | + item.model = Qt.binding(function() { return subPageLoader.model; } ) |
228 | } |
229 | + open = true; |
230 | + } |
231 | + |
232 | + onOpenChanged: pageHeaderLoader.item.unfocus() |
233 | + |
234 | + onVisibleChanged: if (!visible) subPage = "" |
235 | + |
236 | + Connections { |
237 | + target: subPageLoader.item |
238 | + onBackClicked: subPageLoader.closeSubPage() |
239 | } |
240 | } |
241 | - |
242 | } |
243 | |
244 | === modified file 'qml/Dash/PageHeader.qml' |
245 | --- qml/Dash/PageHeader.qml 2014-08-13 11:56:16 +0000 |
246 | +++ qml/Dash/PageHeader.qml 2014-08-26 18:23:42 +0000 |
247 | @@ -31,6 +31,7 @@ |
248 | property string title |
249 | |
250 | property bool searchEntryEnabled: false |
251 | + property bool settingsEnabled: false |
252 | property ListModel searchHistory: SearchHistoryModel |
253 | property alias searchQuery: searchTextField.text |
254 | property alias searchHint: searchTextField.placeholderText |
255 | @@ -46,6 +47,7 @@ |
256 | property var scopeStyle: null |
257 | |
258 | signal backClicked() |
259 | + signal settingsClicked() |
260 | |
261 | onScopeStyleChanged: refreshLogo() |
262 | onSearchQueryChanged: { |
263 | @@ -247,9 +249,7 @@ |
264 | backAction: Action { |
265 | iconName: "back" |
266 | visible: root.showBackButton |
267 | - onTriggered: { |
268 | - root.backClicked(); |
269 | - } |
270 | + onTriggered: root.backClicked() |
271 | } |
272 | |
273 | actions: [ |
274 | @@ -261,6 +261,12 @@ |
275 | headerContainer.showSearch = true; |
276 | searchTextField.forceActiveFocus(); |
277 | } |
278 | + }, |
279 | + Action { |
280 | + objectName: "settings" |
281 | + iconName: "settings" |
282 | + visible: root.settingsEnabled |
283 | + onTriggered: root.settingsClicked() |
284 | } |
285 | ] |
286 | } |
287 | |
288 | === modified file 'qml/Dash/PreviewListView.qml' |
289 | --- qml/Dash/PreviewListView.qml 2014-08-19 13:53:13 +0000 |
290 | +++ qml/Dash/PreviewListView.qml 2014-08-26 18:23:42 +0000 |
291 | @@ -23,6 +23,7 @@ |
292 | Item { |
293 | id: root |
294 | |
295 | + property int initialIndex: -1 |
296 | property var scope: null |
297 | property var scopeStyle: null |
298 | |
299 | @@ -35,6 +36,8 @@ |
300 | readonly property bool processing: currentItem && (!currentItem.previewModel.loaded |
301 | || currentItem.previewModel.processingAction) |
302 | |
303 | + signal backClicked() |
304 | + |
305 | PageHeader { |
306 | id: header |
307 | objectName: "pageHeader" |
308 | @@ -44,7 +47,7 @@ |
309 | searchEntryEnabled: false |
310 | scopeStyle: root.scopeStyle |
311 | |
312 | - onBackClicked: root.open = false |
313 | + onBackClicked: root.backClicked() |
314 | } |
315 | |
316 | ListView { |
317 | @@ -78,6 +81,13 @@ |
318 | } |
319 | } |
320 | |
321 | + onCountChanged: { |
322 | + if (count > 0 && initialIndex >= 0) { |
323 | + currentIndex = initialIndex; |
324 | + initialIndex = -1; |
325 | + } |
326 | + } |
327 | + |
328 | delegate: Previews.Preview { |
329 | id: preview |
330 | objectName: "preview" + index |
331 | |
332 | === added directory 'qml/Dash/ScopeSettings' |
333 | === added file 'qml/Dash/ScopeSettings/ScopeSetting.qml' |
334 | --- qml/Dash/ScopeSettings/ScopeSetting.qml 1970-01-01 00:00:00 +0000 |
335 | +++ qml/Dash/ScopeSettings/ScopeSetting.qml 2014-08-26 18:23:42 +0000 |
336 | @@ -0,0 +1,37 @@ |
337 | +/* |
338 | + * Copyright (C) 2014 Canonical, Ltd. |
339 | + * |
340 | + * This program is free software; you can redistribute it and/or modify |
341 | + * it under the terms of the GNU General Public License as published by |
342 | + * the Free Software Foundation; version 3. |
343 | + * |
344 | + * This program is distributed in the hope that it will be useful, |
345 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
346 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
347 | + * GNU General Public License for more details. |
348 | + * |
349 | + * You should have received a copy of the GNU General Public License |
350 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
351 | + */ |
352 | + |
353 | +import QtQuick 2.2 |
354 | +import Ubuntu.Components 1.1 |
355 | + |
356 | +/*! Interface for settings widgets. */ |
357 | + |
358 | +Item { |
359 | + //! The ScopeStyle component. |
360 | + property var scopeStyle: null |
361 | + |
362 | + //! Variable used to contain widget's data |
363 | + property var widgetData: null |
364 | + |
365 | + /*! \brief This signal should be emitted when a setting action was updated. |
366 | + * |
367 | + * \param value the new setting value. |
368 | + */ |
369 | + signal updated(var value) |
370 | + |
371 | + //! \internal |
372 | + readonly property real settingMargins: units.gu(2) |
373 | +} |
374 | |
375 | === added file 'qml/Dash/ScopeSettings/ScopeSettingBoolean.qml' |
376 | --- qml/Dash/ScopeSettings/ScopeSettingBoolean.qml 1970-01-01 00:00:00 +0000 |
377 | +++ qml/Dash/ScopeSettings/ScopeSettingBoolean.qml 2014-08-26 18:23:42 +0000 |
378 | @@ -0,0 +1,61 @@ |
379 | +/* |
380 | + * Copyright (C) 2014 Canonical, Ltd. |
381 | + * |
382 | + * This program is free software; you can redistribute it and/or modify |
383 | + * it under the terms of the GNU General Public License as published by |
384 | + * the Free Software Foundation; version 3. |
385 | + * |
386 | + * This program is distributed in the hope that it will be useful, |
387 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
388 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
389 | + * GNU General Public License for more details. |
390 | + * |
391 | + * You should have received a copy of the GNU General Public License |
392 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
393 | + */ |
394 | + |
395 | +import QtQuick 2.2 |
396 | +import Ubuntu.Components 1.1 |
397 | +import Ubuntu.Components.ListItems 1.0 as ListItem |
398 | + |
399 | +ScopeSetting { |
400 | + id: root |
401 | + height: listItem.height |
402 | + |
403 | + ListItem.Empty { |
404 | + id: listItem |
405 | + |
406 | + onClicked: { |
407 | + control.checked = !control.checked; |
408 | + updated(control.checked); |
409 | + } |
410 | + |
411 | + Label { |
412 | + anchors { |
413 | + left: parent.left |
414 | + leftMargin: settingMargins |
415 | + right: control.left |
416 | + rightMargin: units.gu(1) |
417 | + verticalCenter: parent.verticalCenter |
418 | + } |
419 | + text: widgetData.displayName |
420 | + elide: Text.ElideMiddle |
421 | + maximumLineCount: 2 |
422 | + wrapMode: Text.Wrap |
423 | + color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText |
424 | + } |
425 | + |
426 | + CheckBox { |
427 | + id: control |
428 | + objectName: "control" |
429 | + anchors { |
430 | + right: parent.right |
431 | + rightMargin: settingMargins |
432 | + verticalCenter: parent.verticalCenter |
433 | + } |
434 | + checked: widgetData.value |
435 | + |
436 | + onTriggered: root.updated(checked) |
437 | + } |
438 | + } |
439 | +} |
440 | |
441 | === added file 'qml/Dash/ScopeSettings/ScopeSettingList.qml' |
442 | --- qml/Dash/ScopeSettings/ScopeSettingList.qml 1970-01-01 00:00:00 +0000 |
443 | +++ qml/Dash/ScopeSettings/ScopeSettingList.qml 2014-08-26 18:23:42 +0000 |
444 | @@ -0,0 +1,50 @@ |
445 | +/* |
446 | + * Copyright (C) 2014 Canonical, Ltd. |
447 | + * |
448 | + * This program is free software; you can redistribute it and/or modify |
449 | + * it under the terms of the GNU General Public License as published by |
450 | + * the Free Software Foundation; version 3. |
451 | + * |
452 | + * This program is distributed in the hope that it will be useful, |
453 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
454 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
455 | + * GNU General Public License for more details. |
456 | + * |
457 | + * You should have received a copy of the GNU General Public License |
458 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
459 | + */ |
460 | + |
461 | +import QtQuick 2.2 |
462 | +import Ubuntu.Components 1.1 |
463 | +import Ubuntu.Components.ListItems 1.0 as ListItem |
464 | + |
465 | +ScopeSetting { |
466 | + id: root |
467 | + |
468 | + // FIXME workaround for: https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1355830 |
469 | + height: listItem.currentlyExpanded ? listItem.itemHeight * widgetData.properties["values"].length + units.gu(6) : listItem.height |
470 | + |
471 | + property int initialValue: -1 |
472 | + |
473 | + ListItem.ItemSelector { |
474 | + id: listItem |
475 | + objectName: "control" |
476 | + anchors { |
477 | + left: parent.left |
478 | + right: parent.right |
479 | + } |
480 | + text: widgetData.displayName |
481 | + model: widgetData.properties["values"] |
482 | + |
483 | + onSelectedIndexChanged: { |
484 | + if (root.initialValue >= 0) { |
485 | + var tmpValue = root.initialValue; |
486 | + root.initialValue = -1; |
487 | + selectedIndex = tmpValue; |
488 | + return; |
489 | + } |
490 | + |
491 | + root.updated(selectedIndex); |
492 | + } |
493 | + } |
494 | +} |
495 | |
496 | === added file 'qml/Dash/ScopeSettings/ScopeSettingNumber.qml' |
497 | --- qml/Dash/ScopeSettings/ScopeSettingNumber.qml 1970-01-01 00:00:00 +0000 |
498 | +++ qml/Dash/ScopeSettings/ScopeSettingNumber.qml 2014-08-26 18:23:42 +0000 |
499 | @@ -0,0 +1,21 @@ |
500 | +/* |
501 | + * Copyright (C) 2014 Canonical, Ltd. |
502 | + * |
503 | + * This program is free software; you can redistribute it and/or modify |
504 | + * it under the terms of the GNU General Public License as published by |
505 | + * the Free Software Foundation; version 3. |
506 | + * |
507 | + * This program is distributed in the hope that it will be useful, |
508 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
509 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
510 | + * GNU General Public License for more details. |
511 | + * |
512 | + * You should have received a copy of the GNU General Public License |
513 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
514 | + */ |
515 | + |
516 | +import QtQuick 2.2 |
517 | + |
518 | +ScopeSettingString { |
519 | + mode: "number" |
520 | +} |
521 | |
522 | === added file 'qml/Dash/ScopeSettings/ScopeSettingString.qml' |
523 | --- qml/Dash/ScopeSettings/ScopeSettingString.qml 1970-01-01 00:00:00 +0000 |
524 | +++ qml/Dash/ScopeSettings/ScopeSettingString.qml 2014-08-26 18:23:42 +0000 |
525 | @@ -0,0 +1,83 @@ |
526 | +/* |
527 | + * Copyright (C) 2014 Canonical, Ltd. |
528 | + * |
529 | + * This program is free software; you can redistribute it and/or modify |
530 | + * it under the terms of the GNU General Public License as published by |
531 | + * the Free Software Foundation; version 3. |
532 | + * |
533 | + * This program is distributed in the hope that it will be useful, |
534 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
535 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
536 | + * GNU General Public License for more details. |
537 | + * |
538 | + * You should have received a copy of the GNU General Public License |
539 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
540 | + */ |
541 | + |
542 | +import QtQuick 2.2 |
543 | +import Ubuntu.Components 1.1 |
544 | +import Ubuntu.Components.ListItems 1.0 as ListItem |
545 | + |
546 | +ScopeSetting { |
547 | + id: root |
548 | + height: listItem.height |
549 | + |
550 | + property string mode: "string" |
551 | + |
552 | + ListItem.Empty { |
553 | + id: listItem |
554 | + onClicked: { |
555 | + control.forceActiveFocus(); |
556 | + control.selectAll(); |
557 | + } |
558 | + |
559 | + Label { |
560 | + id: label |
561 | + anchors { |
562 | + left: parent.left |
563 | + leftMargin: settingMargins |
564 | + right: control.left |
565 | + rightMargin: units.gu(1) |
566 | + verticalCenter: parent.verticalCenter |
567 | + } |
568 | + text: widgetData.displayName |
569 | + elide: Text.ElideMiddle |
570 | + maximumLineCount: 2 |
571 | + wrapMode: Text.Wrap |
572 | + color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText |
573 | + } |
574 | + |
575 | + TextField { |
576 | + id: control |
577 | + objectName: "control" |
578 | + anchors { |
579 | + right: parent.right |
580 | + rightMargin: settingMargins |
581 | + verticalCenter: parent.verticalCenter |
582 | + } |
583 | + width: root.mode == "number" ? units.gu(8) : units.gu(12) |
584 | + text: widgetData.value |
585 | + color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.fieldText |
586 | + validator: root.mode == "number" ? doubleValidator : null |
587 | + hasClearButton: root.mode == "number" ? false : true |
588 | + |
589 | + DoubleValidator { |
590 | + id: doubleValidator |
591 | + } |
592 | + |
593 | + function updateText() { |
594 | + if (acceptableInput) { |
595 | + text = displayText; |
596 | + root.updated(text); |
597 | + } |
598 | + } |
599 | + |
600 | + onAccepted: updateText() |
601 | + onActiveFocusChanged: { |
602 | + if (!activeFocus) { |
603 | + updateText(); |
604 | + } |
605 | + } |
606 | + } |
607 | + } |
608 | +} |
609 | |
610 | === added file 'qml/Dash/ScopeSettings/ScopeSettingsWidgetFactory.qml' |
611 | --- qml/Dash/ScopeSettings/ScopeSettingsWidgetFactory.qml 1970-01-01 00:00:00 +0000 |
612 | +++ qml/Dash/ScopeSettings/ScopeSettingsWidgetFactory.qml 2014-08-26 18:23:42 +0000 |
613 | @@ -0,0 +1,57 @@ |
614 | +/* |
615 | + * Copyright (C) 2014 Canonical, Ltd. |
616 | + * |
617 | + * This program is free software; you can redistribute it and/or modify |
618 | + * it under the terms of the GNU General Public License as published by |
619 | + * the Free Software Foundation; version 3. |
620 | + * |
621 | + * This program is distributed in the hope that it will be useful, |
622 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
623 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
624 | + * GNU General Public License for more details. |
625 | + * |
626 | + * You should have received a copy of the GNU General Public License |
627 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
628 | + */ |
629 | + |
630 | +import QtQuick 2.2 |
631 | + |
632 | +//! \brief This component loads the widgets based on type. |
633 | + |
634 | +Loader { |
635 | + id: root |
636 | + |
637 | + //! The ScopeStyle component. |
638 | + property var scopeStyle: null |
639 | + |
640 | + //! Variable used to contain widget's data |
641 | + property var widgetData: null |
642 | + |
643 | + //! Triggered signal forwarded from the widgets. |
644 | + signal updated(var value) |
645 | + |
646 | + source: widgetSource |
647 | + |
648 | + //! \cond private |
649 | + property url widgetSource: { |
650 | + switch (widgetData.type) { |
651 | + case "boolean": return "ScopeSettingBoolean.qml"; |
652 | + case "list": return "ScopeSettingList.qml"; |
653 | + case "number": return "ScopeSettingNumber.qml"; |
654 | + case "string": return "ScopeSettingString.qml"; |
655 | + default: return ""; |
656 | + } |
657 | + } |
658 | + //! \endcond |
659 | + |
660 | + onLoaded: { |
661 | + if (item.hasOwnProperty("initialValue")) item.initialValue = root.widgetData.value; |
662 | + item.widgetData = Qt.binding(function() { return root.widgetData; } ) |
663 | + item.scopeStyle = Qt.binding(function() { return root.scopeStyle; } ) |
664 | + } |
665 | + |
666 | + Connections { |
667 | + target: root.item |
668 | + onUpdated: if (value !== widgetData.value) root.updated(value) |
669 | + } |
670 | +} |
671 | |
672 | === added file 'qml/Dash/ScopeSettingsPage.qml' |
673 | --- qml/Dash/ScopeSettingsPage.qml 1970-01-01 00:00:00 +0000 |
674 | +++ qml/Dash/ScopeSettingsPage.qml 2014-08-26 18:23:42 +0000 |
675 | @@ -0,0 +1,62 @@ |
676 | +/* |
677 | + * Copyright (C) 2014 Canonical, Ltd. |
678 | + * |
679 | + * This program is free software; you can redistribute it and/or modify |
680 | + * it under the terms of the GNU General Public License as published by |
681 | + * the Free Software Foundation; version 3. |
682 | + * |
683 | + * This program is distributed in the hope that it will be useful, |
684 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
685 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
686 | + * GNU General Public License for more details. |
687 | + * |
688 | + * You should have received a copy of the GNU General Public License |
689 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
690 | + */ |
691 | + |
692 | +import QtQuick 2.2 |
693 | +import Ubuntu.Components 1.1 |
694 | +import Unity 0.2 |
695 | +import "../Components" |
696 | +import "ScopeSettings" |
697 | + |
698 | +Item { |
699 | + id: root |
700 | + |
701 | + property var scope: null |
702 | + property var scopeStyle: null |
703 | + |
704 | + signal backClicked() |
705 | + |
706 | + PageHeader { |
707 | + id: header |
708 | + objectName: "pageHeader" |
709 | + width: parent.width |
710 | + title: scope ? scope.name : "" |
711 | + showBackButton: true |
712 | + scopeStyle: root.scopeStyle |
713 | + |
714 | + onBackClicked: root.backClicked() |
715 | + } |
716 | + |
717 | + ListView { |
718 | + id: scopeSettings |
719 | + objectName: "scopeSettings" |
720 | + anchors { |
721 | + top: header.bottom |
722 | + bottom: parent.bottom |
723 | + left: parent.left |
724 | + right: parent.right |
725 | + } |
726 | + model: root.scope ? root.scope.settings : null |
727 | + |
728 | + delegate: ScopeSettingsWidgetFactory { |
729 | + objectName: "scopeSettingItem" + index |
730 | + width: root.width |
731 | + widgetData: model |
732 | + scopeStyle: root.scopeStyle |
733 | + |
734 | + onUpdated: model.value = value; |
735 | + } |
736 | + } |
737 | +} |
738 | |
739 | === modified file 'qml/Dash/ScopesOverview.qml' |
740 | --- qml/Dash/ScopesOverview.qml 2014-08-15 17:37:28 +0000 |
741 | +++ qml/Dash/ScopesOverview.qml 2014-08-26 18:23:42 +0000 |
742 | @@ -462,6 +462,8 @@ |
743 | width: parent.width |
744 | height: parent.height |
745 | anchors.left: scopesOverviewContent.right |
746 | + |
747 | + onBackClicked: open = false |
748 | } |
749 | |
750 | Item { |
751 | |
752 | === modified file 'tests/autopilot/unity8/shell/emulators/dash.py' |
753 | --- tests/autopilot/unity8/shell/emulators/dash.py 2014-08-14 01:29:20 +0000 |
754 | +++ tests/autopilot/unity8/shell/emulators/dash.py 2014-08-26 18:23:42 +0000 |
755 | @@ -140,10 +140,9 @@ |
756 | |
757 | def enter_search_query(self, query): |
758 | current_header = self._get_current_page_header() |
759 | - self.pointing_device.move(current_header.globalRect.x + |
760 | - current_header.width - current_header.height / 4, |
761 | - current_header.globalRect.y + |
762 | - current_header.height / 4) |
763 | + search_button = current_header.select_single(objectName="search_header_button") |
764 | + self.pointing_device.move(search_button.globalRect.x + search_button.width / 2, |
765 | + search_button.globalRect.y + search_button.height / 2) |
766 | self.pointing_device.click() |
767 | headerContainer = current_header.select_single( |
768 | objectName="headerContainer") |
769 | @@ -186,7 +185,8 @@ |
770 | # --elopio - 2014-1-14 |
771 | self.click_scope_item(category, app_name) |
772 | preview_list = self.wait_select_single( |
773 | - 'PreviewListView', objectName='previewListView') |
774 | + 'QQuickLoader', objectName='subPageLoader') |
775 | + preview_list.subPageShown.wait_for(True) |
776 | preview_list.x.wait_for(0) |
777 | return preview_list.select_single( |
778 | Preview, objectName='preview{}'.format(preview_list.currentIndex)) |
779 | |
780 | === modified file 'tests/mocks/Unity/CMakeLists.txt' |
781 | --- tests/mocks/Unity/CMakeLists.txt 2014-08-25 10:05:13 +0000 |
782 | +++ tests/mocks/Unity/CMakeLists.txt 2014-08-26 18:23:42 +0000 |
783 | @@ -24,6 +24,7 @@ |
784 | fake_scope.cpp |
785 | fake_scopes.cpp |
786 | fake_scopesoverview.cpp |
787 | + fake_settingsmodel.cpp |
788 | fake_categories.cpp |
789 | fake_navigation.cpp |
790 | fake_resultsmodel.cpp |
791 | @@ -39,6 +40,7 @@ |
792 | ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ResultsModelInterface.h |
793 | ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ScopeInterface.h |
794 | ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ScopesInterface.h |
795 | + ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/SettingsModelInterface.h |
796 | ) |
797 | |
798 | add_library(FakeUnityQml MODULE ${UnityQML_SOURCES}) |
799 | |
800 | === modified file 'tests/mocks/Unity/fake_scope.cpp' |
801 | --- tests/mocks/Unity/fake_scope.cpp 2014-08-14 11:31:40 +0000 |
802 | +++ tests/mocks/Unity/fake_scope.cpp 2014-08-26 18:23:42 +0000 |
803 | @@ -22,6 +22,7 @@ |
804 | #include "fake_navigation.h" |
805 | #include "fake_resultsmodel.h" |
806 | #include "fake_scopes.h" |
807 | +#include "fake_settingsmodel.h" |
808 | |
809 | Scope::Scope(Scopes* parent) : Scope(QString(), QString(), false, parent) |
810 | { |
811 | @@ -39,6 +40,7 @@ |
812 | , m_previewRendererName("preview-generic") |
813 | , m_categories(new Categories(categories, this)) |
814 | , m_openScope(nullptr) |
815 | + , m_settings(new SettingsModel(this)) |
816 | { |
817 | } |
818 | |
819 | @@ -94,7 +96,7 @@ |
820 | |
821 | unity::shell::scopes::SettingsModelInterface* Scope::settings() const |
822 | { |
823 | - return nullptr; |
824 | + return m_settings; |
825 | } |
826 | |
827 | QString Scope::noResultsHint() const |
828 | |
829 | === modified file 'tests/mocks/Unity/fake_scope.h' |
830 | --- tests/mocks/Unity/fake_scope.h 2014-08-07 08:52:59 +0000 |
831 | +++ tests/mocks/Unity/fake_scope.h 2014-08-26 18:23:42 +0000 |
832 | @@ -96,6 +96,7 @@ |
833 | |
834 | unity::shell::scopes::CategoriesInterface* m_categories; |
835 | unity::shell::scopes::ScopeInterface* m_openScope; |
836 | + unity::shell::scopes::SettingsModelInterface* m_settings; |
837 | }; |
838 | |
839 | #endif // FAKE_SCOPE_H |
840 | |
841 | === added file 'tests/mocks/Unity/fake_settingsmodel.cpp' |
842 | --- tests/mocks/Unity/fake_settingsmodel.cpp 1970-01-01 00:00:00 +0000 |
843 | +++ tests/mocks/Unity/fake_settingsmodel.cpp 2014-08-26 18:23:42 +0000 |
844 | @@ -0,0 +1,95 @@ |
845 | +/* |
846 | + * Copyright (C) 2014 Canonical, Ltd. |
847 | + * |
848 | + * This program is free software; you can redistribute it and/or modify |
849 | + * it under the terms of the GNU General Public License as published by |
850 | + * the Free Software Foundation; version 3. |
851 | + * |
852 | + * This program is distributed in the hope that it will be useful, |
853 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
854 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
855 | + * GNU General Public License for more details. |
856 | + * |
857 | + * You should have received a copy of the GNU General Public License |
858 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
859 | + */ |
860 | + |
861 | +#include "fake_settingsmodel.h" |
862 | + |
863 | +SettingsModel::SettingsModel(QObject* parent) : |
864 | + SettingsModelInterface(parent) { |
865 | + { |
866 | + QVariantMap parameters; |
867 | + m_data << QSharedPointer<Data>(new Data("boolean-setting", "Boolean Setting", "boolean", parameters, true)); |
868 | + } |
869 | + { |
870 | + QVariantMap parameters; |
871 | + parameters["values"] = QVariantList() << "First" << "Second" << "Third"; |
872 | + m_data << QSharedPointer<Data>(new Data("list-setting", "List Setting", "list", parameters, 1)); |
873 | + } |
874 | + { |
875 | + QVariantMap parameters; |
876 | + m_data << QSharedPointer<Data>(new Data("number-setting", "Number Setting", "number", parameters, 1.23)); |
877 | + } |
878 | + { |
879 | + QVariantMap parameters; |
880 | + m_data << QSharedPointer<Data>(new Data("string-setting", "String Setting", "string", parameters, "flibble")); |
881 | + } |
882 | +} |
883 | + |
884 | +QVariant SettingsModel::data(const QModelIndex& index, int role) const { |
885 | + int row = index.row(); |
886 | + QVariant result; |
887 | + |
888 | + if (row < m_data.size()) { |
889 | + auto data = m_data[row]; |
890 | + |
891 | + switch (role) { |
892 | + case Roles::RoleSettingId: |
893 | + result = data->id; |
894 | + break; |
895 | + case Roles::RoleDisplayName: |
896 | + result = data->displayName; |
897 | + break; |
898 | + case Roles::RoleType: |
899 | + result = data->type; |
900 | + break; |
901 | + case Roles::RoleProperties: |
902 | + result = data->properties; |
903 | + break; |
904 | + case Roles::RoleValue: { |
905 | + result = data->value; |
906 | + break; |
907 | + } |
908 | + default: |
909 | + break; |
910 | + } |
911 | + } |
912 | + |
913 | + return result; |
914 | +} |
915 | + |
916 | +bool SettingsModel::setData(const QModelIndex &index, const QVariant &value, int role) { |
917 | + int row = index.row(); |
918 | + if (row < m_data.size()) { |
919 | + switch (role) { |
920 | + case SettingsModelInterface::RoleValue: { |
921 | + auto data = m_data[row]; |
922 | + data->value = value; |
923 | + return true; |
924 | + } |
925 | + default: |
926 | + break; |
927 | + } |
928 | + } |
929 | + |
930 | + return false; |
931 | +} |
932 | + |
933 | +int SettingsModel::rowCount(const QModelIndex&) const { |
934 | + return count(); |
935 | +} |
936 | + |
937 | +int SettingsModel::count() const { |
938 | + return m_data.size(); |
939 | +} |
940 | |
941 | === added file 'tests/mocks/Unity/fake_settingsmodel.h' |
942 | --- tests/mocks/Unity/fake_settingsmodel.h 1970-01-01 00:00:00 +0000 |
943 | +++ tests/mocks/Unity/fake_settingsmodel.h 2014-08-26 18:23:42 +0000 |
944 | @@ -0,0 +1,54 @@ |
945 | +/* |
946 | + * Copyright (C) 2014 Canonical, Ltd. |
947 | + * |
948 | + * This program is free software; you can redistribute it and/or modify |
949 | + * it under the terms of the GNU General Public License as published by |
950 | + * the Free Software Foundation; version 3. |
951 | + * |
952 | + * This program is distributed in the hope that it will be useful, |
953 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
954 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
955 | + * GNU General Public License for more details. |
956 | + * |
957 | + * You should have received a copy of the GNU General Public License |
958 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
959 | + */ |
960 | + |
961 | +#ifndef FAKE_SETTINGSMODEL_H |
962 | +#define FAKE_SETTINGSMODEL_H |
963 | + |
964 | +#include <unity/shell/scopes/SettingsModelInterface.h> |
965 | + |
966 | +#include <QList> |
967 | +#include <QSharedPointer> |
968 | + |
969 | +class SettingsModel: public unity::shell::scopes::SettingsModelInterface { |
970 | +Q_OBJECT |
971 | + |
972 | + struct Data { |
973 | + QString id; |
974 | + QString displayName; |
975 | + QString type; |
976 | + QVariant properties; |
977 | + QVariant value; |
978 | + |
979 | + Data(QString const& id_, QString const& displayName_, |
980 | + QString const& type_, QVariant const& properties_, |
981 | + QVariant const& value_) : |
982 | + id(id_), displayName(displayName_), type(type_), |
983 | + properties(properties_), value(value_) {} |
984 | + }; |
985 | + |
986 | +public: |
987 | + explicit SettingsModel(QObject* parent = 0); |
988 | + ~SettingsModel() = default; |
989 | + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; |
990 | + bool setData(const QModelIndex&index, const QVariant& value, int role = Qt::EditRole) override; |
991 | + int rowCount(const QModelIndex& parent = QModelIndex()) const override; |
992 | + int count() const override; |
993 | + |
994 | +protected: |
995 | + QList<QSharedPointer<Data>> m_data; |
996 | +}; |
997 | + |
998 | +#endif // FAKE_SETTINGSMODEL_H |
999 | |
1000 | === modified file 'tests/mocks/Unity/fake_unity_plugin.cpp' |
1001 | --- tests/mocks/Unity/fake_unity_plugin.cpp 2014-08-11 09:57:29 +0000 |
1002 | +++ tests/mocks/Unity/fake_unity_plugin.cpp 2014-08-26 18:23:42 +0000 |
1003 | @@ -26,6 +26,7 @@ |
1004 | #include "fake_previewmodel.h" |
1005 | #include "fake_previewwidgetmodel.h" |
1006 | #include "fake_resultsmodel.h" |
1007 | +#include "fake_settingsmodel.h" |
1008 | |
1009 | // External |
1010 | #include <glib-object.h> |
1011 | @@ -43,6 +44,7 @@ |
1012 | qmlRegisterType<Scopes>(uri, 0, 2, "Scopes"); |
1013 | qmlRegisterType<Scope>(uri, 0, 2, "MockScope"); |
1014 | qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Scope object in QML."); |
1015 | + qmlRegisterUncreatableType<unity::shell::scopes::SettingsModelInterface>(uri, 0, 2, "SettingsModel", "Can't create SettingsModel object in QML."); |
1016 | qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML."); |
1017 | qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML."); |
1018 | qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance."); |
1019 | |
1020 | === modified file 'tests/qmltests/CMakeLists.txt' |
1021 | --- tests/qmltests/CMakeLists.txt 2014-08-25 13:10:28 +0000 |
1022 | +++ tests/qmltests/CMakeLists.txt 2014-08-26 18:23:42 +0000 |
1023 | @@ -54,6 +54,11 @@ |
1024 | add_qml_test(Dash/Previews PreviewVideoPlayback) |
1025 | add_qml_test(Dash/Previews PreviewWidgetFactory) |
1026 | add_qml_test(Dash/Previews PreviewZoomableImage) |
1027 | +add_qml_test(Dash/ScopeSettings ScopeSettingBoolean) |
1028 | +add_qml_test(Dash/ScopeSettings ScopeSettingList) |
1029 | +add_qml_test(Dash/ScopeSettings ScopeSettingNumber) |
1030 | +add_qml_test(Dash/ScopeSettings ScopeSettingString) |
1031 | +add_qml_test(Dash/ScopeSettings ScopeSettingsWidgetFactory) |
1032 | add_qml_test(Greeter Lockscreen ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full") |
1033 | add_qml_test(Greeter MultiGreeter ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full") |
1034 | add_qml_test(Greeter SingleGreeter ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single") |
1035 | |
1036 | === modified file 'tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml' |
1037 | --- tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml 2014-07-30 14:08:29 +0000 |
1038 | +++ tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml 2014-08-26 18:23:42 +0000 |
1039 | @@ -93,7 +93,7 @@ |
1040 | factory.widgetData = { type: data.type }; |
1041 | factory.widgetType = data.type; |
1042 | |
1043 | - verify(("" + factory.source).indexOf(data.source) != -1); |
1044 | + verify((String(factory.source)).indexOf(data.source) != -1); |
1045 | } |
1046 | } |
1047 | } |
1048 | |
1049 | === added directory 'tests/qmltests/Dash/ScopeSettings' |
1050 | === added file 'tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingBoolean.qml' |
1051 | --- tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingBoolean.qml 1970-01-01 00:00:00 +0000 |
1052 | +++ tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingBoolean.qml 2014-08-26 18:23:42 +0000 |
1053 | @@ -0,0 +1,62 @@ |
1054 | +/* |
1055 | + * Copyright 2014 Canonical Ltd. |
1056 | + * |
1057 | + * This program is free software; you can redistribute it and/or modify |
1058 | + * it under the terms of the GNU General Public License as published by |
1059 | + * the Free Software Foundation; version 3. |
1060 | + * |
1061 | + * This program is distributed in the hope that it will be useful, |
1062 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1063 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1064 | + * GNU General Public License for more details. |
1065 | + * |
1066 | + * You should have received a copy of the GNU General Public License |
1067 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1068 | + */ |
1069 | + |
1070 | +import QtQuick 2.0 |
1071 | +import Ubuntu.Components 1.1 |
1072 | +import QtTest 1.0 |
1073 | +import "../../../../qml/Dash/ScopeSettings" |
1074 | +import Unity.Test 0.1 as UT |
1075 | + |
1076 | +Rectangle { |
1077 | + id: root |
1078 | + width: units.gu(40) |
1079 | + height: units.gu(80) |
1080 | + |
1081 | + property var settingData: { |
1082 | + "displayName" : "Mock boolean setting", |
1083 | + "value": true |
1084 | + } |
1085 | + |
1086 | + ScopeSettingBoolean { |
1087 | + id: scopeSetting |
1088 | + widgetData: settingData |
1089 | + width: parent.width |
1090 | + } |
1091 | + |
1092 | + SignalSpy { |
1093 | + id: spy |
1094 | + target: scopeSetting |
1095 | + signalName: "updated" |
1096 | + } |
1097 | + |
1098 | + UT.UnityTestCase { |
1099 | + id: testCase |
1100 | + name: "ScopeSettingBoolean" |
1101 | + when: windowShown |
1102 | + |
1103 | + function test_updated() { |
1104 | + var control = findChild(scopeSetting, "control"); |
1105 | + mouseClick(control, control.width / 2, control.height / 2); |
1106 | + spy.wait(); |
1107 | + compare(spy.signalArguments[0][0], false); |
1108 | + |
1109 | + spy.clear(); |
1110 | + mouseClick(scopeSetting, scopeSetting.width / 2, scopeSetting.height / 2); |
1111 | + spy.wait(); |
1112 | + compare(spy.signalArguments[0][0], true); |
1113 | + } |
1114 | + } |
1115 | +} |
1116 | |
1117 | === added file 'tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingList.qml' |
1118 | --- tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingList.qml 1970-01-01 00:00:00 +0000 |
1119 | +++ tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingList.qml 2014-08-26 18:23:42 +0000 |
1120 | @@ -0,0 +1,83 @@ |
1121 | +/* |
1122 | + * Copyright 2014 Canonical Ltd. |
1123 | + * |
1124 | + * This program is free software; you can redistribute it and/or modify |
1125 | + * it under the terms of the GNU General Public License as published by |
1126 | + * the Free Software Foundation; version 3. |
1127 | + * |
1128 | + * This program is distributed in the hope that it will be useful, |
1129 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1130 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1131 | + * GNU General Public License for more details. |
1132 | + * |
1133 | + * You should have received a copy of the GNU General Public License |
1134 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1135 | + */ |
1136 | + |
1137 | +import QtQuick 2.0 |
1138 | +import Ubuntu.Components 1.1 |
1139 | +import QtTest 1.0 |
1140 | +import "../../../../qml/Dash/ScopeSettings" |
1141 | +import Unity.Test 0.1 as UT |
1142 | + |
1143 | +Rectangle { |
1144 | + id: root |
1145 | + width: units.gu(40) |
1146 | + height: units.gu(80) |
1147 | + |
1148 | + property var settingData: { |
1149 | + "displayName" : "Mock list setting", |
1150 | + "properties": { "values" : [ "first", "second", "third" ] } |
1151 | + } |
1152 | + |
1153 | + ScopeSettingList { |
1154 | + id: scopeSetting |
1155 | + width: parent.width |
1156 | + widgetData: settingData |
1157 | + } |
1158 | + |
1159 | + SignalSpy { |
1160 | + id: spy |
1161 | + target: scopeSetting |
1162 | + signalName: "updated" |
1163 | + } |
1164 | + |
1165 | + UT.UnityTestCase { |
1166 | + id: testCase |
1167 | + name: "ScopeSettingList" |
1168 | + when: windowShown |
1169 | + |
1170 | + property var control: findChild(scopeSetting, "control") |
1171 | + |
1172 | + function cleanup() { |
1173 | + control.selectedIndex = 0; |
1174 | + spy.clear(); |
1175 | + } |
1176 | + |
1177 | + function test_initialValue() { |
1178 | + var newObject = Qt.createQmlObject('import "../../../../qml/Dash/ScopeSettings" \n\ |
1179 | + ScopeSettingList { initialValue: 2; }', root, "dynamicScopeSettingList"); |
1180 | + newObject.widgetData = settingData; |
1181 | + var controlDynamic = findChild(newObject, "control"); |
1182 | + tryCompare(controlDynamic, "selectedIndex", 2); |
1183 | + } |
1184 | + |
1185 | + function test_updated_data() { |
1186 | + return [ |
1187 | + { tag: "current", index: 0, updated: false }, |
1188 | + { tag: "second", index: 1, updated: true }, |
1189 | + { tag: "third", index: 2, updated: true } |
1190 | + ] |
1191 | + } |
1192 | + |
1193 | + function test_updated(data) { |
1194 | + control.selectedIndex = data.index; |
1195 | + if (data.updated) { |
1196 | + spy.wait(); |
1197 | + compare(spy.signalArguments[0][0], data.index); |
1198 | + } else { |
1199 | + compare(spy.count, 0); |
1200 | + } |
1201 | + } |
1202 | + } |
1203 | +} |
1204 | |
1205 | === added file 'tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingNumber.qml' |
1206 | --- tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingNumber.qml 1970-01-01 00:00:00 +0000 |
1207 | +++ tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingNumber.qml 2014-08-26 18:23:42 +0000 |
1208 | @@ -0,0 +1,98 @@ |
1209 | +/* |
1210 | + * Copyright 2014 Canonical Ltd. |
1211 | + * |
1212 | + * This program is free software; you can redistribute it and/or modify |
1213 | + * it under the terms of the GNU General Public License as published by |
1214 | + * the Free Software Foundation; version 3. |
1215 | + * |
1216 | + * This program is distributed in the hope that it will be useful, |
1217 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1218 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1219 | + * GNU General Public License for more details. |
1220 | + * |
1221 | + * You should have received a copy of the GNU General Public License |
1222 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1223 | + */ |
1224 | + |
1225 | +import QtQuick 2.0 |
1226 | +import Ubuntu.Components 1.1 |
1227 | +import QtTest 1.0 |
1228 | +import "../../../../qml/Dash/ScopeSettings" |
1229 | +import Unity.Test 0.1 as UT |
1230 | + |
1231 | +Rectangle { |
1232 | + id: root |
1233 | + width: units.gu(40) |
1234 | + height: units.gu(80) |
1235 | + |
1236 | + property var settingData: { |
1237 | + "displayName" : "Mock number setting", |
1238 | + "value": 0.2 |
1239 | + } |
1240 | + |
1241 | + ScopeSettingNumber { |
1242 | + id: scopeSetting |
1243 | + widgetData: settingData |
1244 | + width: parent.width |
1245 | + } |
1246 | + |
1247 | + SignalSpy { |
1248 | + id: spy |
1249 | + target: scopeSetting |
1250 | + signalName: "updated" |
1251 | + } |
1252 | + |
1253 | + UT.UnityTestCase { |
1254 | + id: testCase |
1255 | + name: "ScopeSettingNumber" |
1256 | + when: windowShown |
1257 | + |
1258 | + property var control: findChild(scopeSetting, "control") |
1259 | + property real newNumber: 11.7 |
1260 | + |
1261 | + function cleanup() { |
1262 | + control.focus = false; |
1263 | + control.text = settingData.value; |
1264 | + spy.clear(); |
1265 | + } |
1266 | + |
1267 | + function test_updated_on_unfocus() { |
1268 | + mouseClick(control, control.width / 2, control.height / 2); |
1269 | + control.selectAll(); |
1270 | + control.cut(); |
1271 | + control.insert(0, newNumber); |
1272 | + control.focus = false; |
1273 | + spy.wait(); |
1274 | + verify(spy.signalArguments[0][0] == newNumber); |
1275 | + } |
1276 | + |
1277 | + function test_updated_on_accepted() { |
1278 | + mouseClick(control, control.width / 2, control.height / 2); |
1279 | + control.selectAll(); |
1280 | + control.cut(); |
1281 | + control.insert(0, newNumber); |
1282 | + control.accepted(); |
1283 | + spy.wait(); |
1284 | + verify(spy.signalArguments[0][0] == newNumber); |
1285 | + } |
1286 | + |
1287 | + function test_selection_on_listitem_click() { |
1288 | + mouseClick(scopeSetting, 0, scopeSetting.height / 2); |
1289 | + compare(control.focus, true); |
1290 | + // we're checking that selectAll() is being called by omitting it here |
1291 | + control.cut(); |
1292 | + control.insert(0, newNumber); |
1293 | + verify(control.displayText == newNumber); |
1294 | + } |
1295 | + |
1296 | + function test_unacceptable_input() { |
1297 | + mouseClick(control, control.width / 2, control.height / 2); |
1298 | + control.selectAll(); |
1299 | + control.cut(); |
1300 | + control.insert(0, "not valid"); |
1301 | + control.accepted(); |
1302 | + compare(spy.count, 0); |
1303 | + compare(control.displayText, ""); |
1304 | + } |
1305 | + } |
1306 | +} |
1307 | |
1308 | === added file 'tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingString.qml' |
1309 | --- tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingString.qml 1970-01-01 00:00:00 +0000 |
1310 | +++ tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingString.qml 2014-08-26 18:23:42 +0000 |
1311 | @@ -0,0 +1,88 @@ |
1312 | +/* |
1313 | + * Copyright 2014 Canonical Ltd. |
1314 | + * |
1315 | + * This program is free software; you can redistribute it and/or modify |
1316 | + * it under the terms of the GNU General Public License as published by |
1317 | + * the Free Software Foundation; version 3. |
1318 | + * |
1319 | + * This program is distributed in the hope that it will be useful, |
1320 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1321 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1322 | + * GNU General Public License for more details. |
1323 | + * |
1324 | + * You should have received a copy of the GNU General Public License |
1325 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1326 | + */ |
1327 | + |
1328 | +import QtQuick 2.0 |
1329 | +import Ubuntu.Components 1.1 |
1330 | +import QtTest 1.0 |
1331 | +import "../../../../qml/Dash/ScopeSettings" |
1332 | +import Unity.Test 0.1 as UT |
1333 | + |
1334 | +Rectangle { |
1335 | + id: root |
1336 | + width: units.gu(40) |
1337 | + height: units.gu(80) |
1338 | + |
1339 | + property var settingData: { |
1340 | + "displayName" : "Mock string setting", |
1341 | + "value": "mock string" |
1342 | + } |
1343 | + |
1344 | + ScopeSettingString { |
1345 | + id: scopeSetting |
1346 | + widgetData: settingData |
1347 | + width: parent.width |
1348 | + } |
1349 | + |
1350 | + SignalSpy { |
1351 | + id: spy |
1352 | + target: scopeSetting |
1353 | + signalName: "updated" |
1354 | + } |
1355 | + |
1356 | + UT.UnityTestCase { |
1357 | + id: testCase |
1358 | + name: "ScopeSettingString" |
1359 | + when: windowShown |
1360 | + |
1361 | + property var control: findChild(scopeSetting, "control") |
1362 | + property string newText: "new text to compare" |
1363 | + |
1364 | + function cleanup() { |
1365 | + control.focus = false; |
1366 | + control.text = settingData.value; |
1367 | + spy.clear(); |
1368 | + } |
1369 | + |
1370 | + function test_updated_on_unfocus() { |
1371 | + mouseClick(control, control.width / 2, control.height / 2); |
1372 | + control.selectAll(); |
1373 | + control.cut(); |
1374 | + control.insert(0, newText); |
1375 | + control.focus = false; |
1376 | + spy.wait(); |
1377 | + compare(spy.signalArguments[0][0], newText); |
1378 | + } |
1379 | + |
1380 | + function test_updated_on_accepted() { |
1381 | + mouseClick(control, control.width / 2, control.height / 2); |
1382 | + control.selectAll(); |
1383 | + control.cut(); |
1384 | + control.insert(0, newText); |
1385 | + control.accepted(); |
1386 | + spy.wait(); |
1387 | + compare(spy.signalArguments[0][0], newText); |
1388 | + } |
1389 | + |
1390 | + function test_selection_on_listitem_click() { |
1391 | + mouseClick(scopeSetting, 0, scopeSetting.height / 2); |
1392 | + compare(control.focus, true); |
1393 | + // we're checking that selectAll() is being called by omitting it here |
1394 | + control.cut(); |
1395 | + control.insert(0, newText); |
1396 | + compare(control.displayText, newText); |
1397 | + } |
1398 | + } |
1399 | +} |
1400 | |
1401 | === added file 'tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingsWidgetFactory.qml' |
1402 | --- tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingsWidgetFactory.qml 1970-01-01 00:00:00 +0000 |
1403 | +++ tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingsWidgetFactory.qml 2014-08-26 18:23:42 +0000 |
1404 | @@ -0,0 +1,65 @@ |
1405 | +/* |
1406 | + * Copyright 2014 Canonical Ltd. |
1407 | + * |
1408 | + * This program is free software; you can redistribute it and/or modify |
1409 | + * it under the terms of the GNU General Public License as published by |
1410 | + * the Free Software Foundation; version 3. |
1411 | + * |
1412 | + * This program is distributed in the hope that it will be useful, |
1413 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1414 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1415 | + * GNU General Public License for more details. |
1416 | + * |
1417 | + * You should have received a copy of the GNU General Public License |
1418 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1419 | + */ |
1420 | + |
1421 | +import QtQuick 2.0 |
1422 | +import Ubuntu.Components 1.1 |
1423 | +import QtTest 1.0 |
1424 | +import "../../../../qml/Dash/ScopeSettings" |
1425 | +import Unity.Test 0.1 as UT |
1426 | + |
1427 | +Rectangle { |
1428 | + id: root |
1429 | + width: units.gu(40) |
1430 | + height: units.gu(80) |
1431 | + |
1432 | + property var settingData: { |
1433 | + "type": "", |
1434 | + "displayName" : "Mock setting", |
1435 | + "value": "1", |
1436 | + "properties": { "values" : [ "first", "second", "third" ] } |
1437 | + } |
1438 | + |
1439 | + ScopeSettingsWidgetFactory { |
1440 | + id: scopeSettingsWidgetFactory |
1441 | + anchors { |
1442 | + left: parent.left |
1443 | + right: parent.right |
1444 | + } |
1445 | + } |
1446 | + |
1447 | + UT.UnityTestCase { |
1448 | + id: testCase |
1449 | + name: "ScopeSettingWidgetFactory" |
1450 | + when: windowShown |
1451 | + |
1452 | + function test_mapping_data() { |
1453 | + return [ |
1454 | + { tag: "Boolean", type: "boolean", source: "ScopeSettingBoolean.qml" }, |
1455 | + { tag: "List", type: "list", source: "ScopeSettingList.qml" }, |
1456 | + { tag: "Number", type: "number", source: "ScopeSettingNumber.qml" }, |
1457 | + { tag: "String", type: "string", source: "ScopeSettingString.qml" } |
1458 | + ]; |
1459 | + } |
1460 | + |
1461 | + function test_mapping(data) { |
1462 | + var newSettingData = settingData; |
1463 | + newSettingData.type = data.type; |
1464 | + scopeSettingsWidgetFactory.widgetData = newSettingData; |
1465 | + |
1466 | + verify((String(scopeSettingsWidgetFactory.source)).indexOf(data.source) != -1); |
1467 | + } |
1468 | + } |
1469 | +} |
1470 | |
1471 | === modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml' |
1472 | --- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-15 17:37:47 +0000 |
1473 | +++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-26 18:23:42 +0000 |
1474 | @@ -39,6 +39,8 @@ |
1475 | |
1476 | Scopes { |
1477 | id: scopes |
1478 | + // for tryGenericScopeView |
1479 | + onLoadedChanged: if (loaded) genericScopeView.scope = scopes.getScope(2); |
1480 | } |
1481 | |
1482 | SignalSpy { |
1483 | @@ -59,7 +61,7 @@ |
1484 | name: "GenericScopeView" |
1485 | when: scopes.loaded && windowShown |
1486 | |
1487 | - property Item previewListView: findChild(genericScopeView, "previewListView") |
1488 | + property Item subPageLoader: findChild(genericScopeView, "subPageLoader") |
1489 | property Item header: findChild(genericScopeView, "scopePageHeader") |
1490 | |
1491 | function init() { |
1492 | @@ -94,24 +96,24 @@ |
1493 | tryCompare(genericScopeView.scope, "isActive", false) |
1494 | genericScopeView.isCurrent = true |
1495 | tryCompare(genericScopeView.scope, "isActive", true) |
1496 | - testCase.previewListView.open = true |
1497 | + testCase.subPageLoader.open = true |
1498 | tryCompare(genericScopeView.scope, "isActive", false) |
1499 | - testCase.previewListView.open = false |
1500 | + testCase.subPageLoader.open = false |
1501 | tryCompare(genericScopeView.scope, "isActive", true) |
1502 | genericScopeView.isCurrent = false |
1503 | tryCompare(genericScopeView.scope, "isActive", false) |
1504 | } |
1505 | |
1506 | function test_showDash() { |
1507 | - testCase.previewListView.open = true; |
1508 | + testCase.subPageLoader.open = true; |
1509 | genericScopeView.scope.showDash(); |
1510 | - tryCompare(testCase.previewListView, "open", false); |
1511 | + tryCompare(testCase.subPageLoader, "open", false); |
1512 | } |
1513 | |
1514 | function test_hideDash() { |
1515 | - testCase.previewListView.open = true; |
1516 | + testCase.subPageLoader.open = true; |
1517 | genericScopeView.scope.hideDash(); |
1518 | - tryCompare(testCase.previewListView, "open", false); |
1519 | + tryCompare(testCase.subPageLoader, "open", false); |
1520 | } |
1521 | |
1522 | function test_searchQuery() { |
1523 | @@ -214,7 +216,7 @@ |
1524 | |
1525 | openPreview(4, 0); |
1526 | |
1527 | - compare(testCase.previewListView.count, 12, "There should only be 12 items in preview."); |
1528 | + compare(testCase.subPageLoader.count, 12, "There should only be 12 items in preview."); |
1529 | |
1530 | closePreview(); |
1531 | } |
1532 | @@ -272,19 +274,21 @@ |
1533 | true); |
1534 | var tile = findChild(findChild(genericScopeView, category), "delegate"+delegate); |
1535 | mouseClick(tile, tile.width / 2, tile.height / 2); |
1536 | - tryCompare(testCase.previewListView, "open", true); |
1537 | - tryCompare(testCase.previewListView, "x", 0); |
1538 | + tryCompare(testCase.subPageLoader, "open", true); |
1539 | + tryCompare(testCase.subPageLoader, "x", 0); |
1540 | } |
1541 | |
1542 | function closePreview() { |
1543 | - var closePreviewMouseArea = findChild(genericScopeView, "innerPageHeader"); |
1544 | + var closePreviewMouseArea = findChild(subPageLoader.item, "pageHeader"); |
1545 | mouseClick(closePreviewMouseArea, units.gu(2), units.gu(2)); |
1546 | |
1547 | - tryCompare(testCase.previewListView, "open", false); |
1548 | + tryCompare(testCase.subPageLoader, "open", false); |
1549 | + tryCompare(testCase.subPageLoader, "visible", false); |
1550 | } |
1551 | |
1552 | function test_previewOpenClose() { |
1553 | - tryCompare(testCase.previewListView, "open", false); |
1554 | + tryCompare(testCase.subPageLoader, "open", false); |
1555 | + tryCompare(testCase.subPageLoader, "visible", false); |
1556 | |
1557 | var categoryListView = findChild(genericScopeView, "categoryListView"); |
1558 | categoryListView.positionAtBeginning(); |
1559 | @@ -296,7 +300,7 @@ |
1560 | function test_showPreviewCarousel() { |
1561 | var category = scrollToCategory("dashCategory1"); |
1562 | |
1563 | - tryCompare(testCase.previewListView, "open", false); |
1564 | + tryCompare(testCase.subPageLoader, "open", false); |
1565 | |
1566 | var tile = findChild(category, "carouselDelegate1"); |
1567 | verify(tile, "Could not find delegate"); |
1568 | @@ -304,14 +308,14 @@ |
1569 | mouseClick(tile, tile.width / 2, tile.height / 2); |
1570 | tryCompare(tile, "explicitlyScaled", true); |
1571 | mouseClick(tile, tile.width / 2, tile.height / 2); |
1572 | - tryCompare(testCase.previewListView, "open", true); |
1573 | - tryCompare(testCase.previewListView, "x", 0); |
1574 | + tryCompare(testCase.subPageLoader, "open", true); |
1575 | + tryCompare(testCase.subPageLoader, "x", 0); |
1576 | |
1577 | closePreview(); |
1578 | |
1579 | mousePress(tile, tile.width / 2, tile.height / 2); |
1580 | - tryCompare(testCase.previewListView, "open", true); |
1581 | - tryCompare(testCase.previewListView, "x", 0); |
1582 | + tryCompare(testCase.subPageLoader, "open", true); |
1583 | + tryCompare(testCase.subPageLoader, "x", 0); |
1584 | mouseRelease(tile, tile.width / 2, tile.height / 2); |
1585 | |
1586 | closePreview(); |
1587 | @@ -320,20 +324,20 @@ |
1588 | function test_showPreviewHorizontalList() { |
1589 | var category = scrollToCategory("dashCategory18"); |
1590 | |
1591 | - tryCompare(testCase.previewListView, "open", false); |
1592 | + tryCompare(testCase.subPageLoader, "open", false); |
1593 | |
1594 | var tile = findChild(category, "delegate1"); |
1595 | verify(tile, "Could not find delegate"); |
1596 | |
1597 | mouseClick(tile, tile.width / 2, tile.height / 2); |
1598 | - tryCompare(testCase.previewListView, "open", true); |
1599 | - tryCompare(testCase.previewListView, "x", 0); |
1600 | + tryCompare(testCase.subPageLoader, "open", true); |
1601 | + tryCompare(testCase.subPageLoader, "x", 0); |
1602 | |
1603 | closePreview(); |
1604 | |
1605 | mousePress(tile, tile.width / 2, tile.height / 2); |
1606 | - tryCompare(testCase.previewListView, "open", true); |
1607 | - tryCompare(testCase.previewListView, "x", 0); |
1608 | + tryCompare(testCase.subPageLoader, "open", true); |
1609 | + tryCompare(testCase.subPageLoader, "x", 0); |
1610 | mouseRelease(tile, tile.width / 2, tile.height / 2); |
1611 | |
1612 | closePreview(); |
1613 | @@ -343,25 +347,52 @@ |
1614 | var categoryListView = findChild(genericScopeView, "categoryListView"); |
1615 | categoryListView.positionAtBeginning(); |
1616 | |
1617 | - tryCompare(testCase.previewListView, "open", false); |
1618 | - var previewListViewList = findChild(previewListView, "listView"); |
1619 | + tryCompare(testCase.subPageLoader, "open", false); |
1620 | |
1621 | openPreview(); |
1622 | + var previewListViewList = findChild(subPageLoader.item, "listView"); |
1623 | |
1624 | // flick to the next previews |
1625 | - tryCompare(testCase.previewListView, "count", 15); |
1626 | - for (var i = 1; i < testCase.previewListView.count; ++i) { |
1627 | - mouseFlick(testCase.previewListView, testCase.previewListView.width - units.gu(1), |
1628 | - testCase.previewListView.height / 2, |
1629 | + tryCompare(testCase.subPageLoader, "count", 15); |
1630 | + for (var i = 1; i < testCase.subPageLoader.count; ++i) { |
1631 | + mouseFlick(testCase.subPageLoader.item, testCase.subPageLoader.width - units.gu(1), |
1632 | + testCase.subPageLoader.height / 2, |
1633 | units.gu(2), |
1634 | - testCase.previewListView.height / 2); |
1635 | + testCase.subPageLoader.height / 2); |
1636 | tryCompare(previewListViewList, "moving", false); |
1637 | - tryCompare(testCase.previewListView.currentItem, "objectName", "preview" + i); |
1638 | - |
1639 | + tryCompare(testCase.subPageLoader.currentItem, "objectName", "preview" + i); |
1640 | } |
1641 | closePreview(); |
1642 | } |
1643 | |
1644 | + function test_settingsOpenClose() { |
1645 | + waitForRendering(genericScopeView); |
1646 | + verify(header, "Could not find the header."); |
1647 | + var innerHeader = findChild(header, "innerPageHeader"); |
1648 | + verify(innerHeader, "Could not find the inner header"); |
1649 | + |
1650 | + // open |
1651 | + tryCompare(testCase.subPageLoader, "open", false); |
1652 | + tryCompare(testCase.subPageLoader, "visible", false); |
1653 | + var settings = findChild(innerHeader, "settings_header_button"); |
1654 | + mouseClick(settings, settings.width / 2, settings.height / 2); |
1655 | + tryCompare(testCase.subPageLoader, "open", true); |
1656 | + tryCompareFunction(function() { return (String(subPageLoader.source)).indexOf("ScopeSettingsPage.qml") != -1; }, true); |
1657 | + tryCompare(genericScopeView, "subPageShown", true); |
1658 | + compare(testCase.subPageLoader.subPage, "settings"); |
1659 | + tryCompare(testCase.subPageLoader, "x", 0); |
1660 | + |
1661 | + // close |
1662 | + var settingsHeader = findChild(testCase.subPageLoader.item, "pageHeader"); |
1663 | + mouseClick(settingsHeader, units.gu(2), units.gu(2)); |
1664 | + tryCompare(testCase.subPageLoader, "open", false); |
1665 | + tryCompare(genericScopeView, "subPageShown", false); |
1666 | + var categoryListView = findChild(genericScopeView, "categoryListView"); |
1667 | + tryCompare(categoryListView, "x", 0); |
1668 | + tryCompare(testCase.subPageLoader, "visible", false); |
1669 | + tryCompare(testCase.subPageLoader, "source", ""); |
1670 | + } |
1671 | + |
1672 | function test_header_style_data() { |
1673 | return [ |
1674 | { tag: "Default", index: 0, foreground: Theme.palette.normal.baseText, background: "", logo: "" }, |
FAILED: Continuous integration, rev:1113 jenkins. qa.ubuntu. com/job/ unity8- ci/3844/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/3273/ console jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- utopic/ 846/console jenkins. qa.ubuntu. com/job/ unity8- utopic- amd64-ci/ 938/console jenkins. qa.ubuntu. com/job/ unity8- utopic- armhf-ci/ 938/console jenkins. qa.ubuntu. com/job/ unity8- utopic- i386-ci/ 938/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/4518/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity8- ci/3844/ rebuild
http://