Merge lp:~unity-team/unity8/scope-isactive into lp:unity8
- scope-isactive
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~unity-team/unity8/scope-isactive |
Merge into: | lp:unity8 |
Diff against target: |
795 lines (+275/-31) 17 files modified
Components/PageHeader.qml (+24/-1) Dash/Dash.qml (+3/-0) Dash/DashContent.qml (+2/-2) Dash/GenericScopeView.qml (+1/-0) Dash/ScopeView.qml (+11/-3) Panel/Panel.qml (+1/-0) plugins/Unity/CMakeLists.txt (+1/-1) plugins/Unity/scope.cpp (+67/-5) plugins/Unity/scope.h (+14/-2) tests/mocks/Unity/fake_scope.cpp (+26/-0) tests/mocks/Unity/fake_scope.h (+11/-1) tests/plugins/Unity/CMakeLists.txt (+1/-1) tests/qmltests/CMakeLists.txt (+1/-1) tests/qmltests/Components/tst_PageHeader.qml (+28/-0) tests/qmltests/Dash/qml/FakeScopeView.qml (+3/-9) tests/qmltests/Dash/tst_DashContent.qml (+29/-5) tests/qmltests/tst_Shell.qml (+52/-0) |
To merge this branch: | bzr merge lp:~unity-team/unity8/scope-isactive |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Unity Team | Pending | ||
Review via email: mp+187179@code.launchpad.net |
This proposal has been superseded by a proposal from 2013-10-01.
Commit message
Add Scope::isActive property and corresponding tests.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:340
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:341
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
- 338. By Michal Hruby
-
Merge trunk
- 339. By Michal Hruby
-
Merge the scope-isactive branch
- 340. By Michal Hruby
-
Re-query scopes when results are invalidated
- 341. By Michal Hruby
-
Remove debug
- 342. By Michal Hruby
-
Merge test fix
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:342
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 343. By Michal Hruby
-
Convince cmake that we really want unity-core>=7.1.1
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:343
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Michal Hruby (mhr3) wrote : | # |
Prereq branch merged, requested rebuild...
- 344. By Michal Hruby
-
Merge trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:343
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
UNSTABLE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:344
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:344
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
- 345. By Michal Hruby
-
Merge trunk
- 346. By Michal Hruby
- 347. By Michal Hruby
-
Fix wrong conflict solution
- 348. By Michał Sawicz
-
Merge trunk.
- 349. By Michal Hruby
-
Merge trunk
- 350. By Michal Hruby
-
Revert icon theme modification
- 351. By Michał Sawicz
-
Leave isCurrent alone for autopilot tests.
- 352. By Michał Sawicz
-
Make sure termination mode is only available when Apps scope is current.
Unmerged revisions
Preview Diff
1 | === modified file 'Components/PageHeader.qml' |
2 | --- Components/PageHeader.qml 2013-07-12 16:07:42 +0000 |
3 | +++ Components/PageHeader.qml 2013-10-01 21:56:41 +0000 |
4 | @@ -18,6 +18,7 @@ |
5 | import Ubuntu.Components 0.1 |
6 | import Ubuntu.Components.Popups 0.1 |
7 | import Ubuntu.Components.ListItems 0.1 as ListItem |
8 | +import Unity 0.1 |
9 | |
10 | Item { |
11 | /*! |
12 | @@ -30,6 +31,7 @@ |
13 | property bool searchEntryEnabled: false |
14 | property alias searchQuery: searchField.text |
15 | property ListModel searchHistory: SearchHistoryModel {} |
16 | + property Scope scope |
17 | |
18 | height: units.gu(8.5) |
19 | implicitHeight: units.gu(8.5) |
20 | @@ -148,7 +150,7 @@ |
21 | hasClearButton: false |
22 | |
23 | primaryItem: AbstractButton { |
24 | - enabled: searchField.text != "" |
25 | + enabled: searchField.text != "" && !searchIndicator.running |
26 | onClicked: { |
27 | if (searchField.text != "") { |
28 | searchHistory.addQuery(searchField.text) |
29 | @@ -158,8 +160,25 @@ |
30 | height: parent.height |
31 | width: height |
32 | |
33 | + ActivityIndicator { |
34 | + id: searchIndicator |
35 | + objectName: "searchIndicator" |
36 | + |
37 | + anchors { |
38 | + verticalCenter: parent.verticalCenter |
39 | + left: parent.left |
40 | + leftMargin: units.gu(0.5) |
41 | + } |
42 | + |
43 | + running: scope.searchInProgress && searchField.text !== "" |
44 | + opacity: running ? 1 : 0 |
45 | + |
46 | + Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing.type: Easing.Linear } } |
47 | + } |
48 | + |
49 | Image { |
50 | id: primaryImage |
51 | + objectName: "primaryImage" |
52 | anchors { |
53 | verticalCenter: parent.verticalCenter |
54 | left: parent.left |
55 | @@ -167,6 +186,10 @@ |
56 | } |
57 | width: units.gu(3) |
58 | height: units.gu(3) |
59 | + visible: opacity > 0 |
60 | + opacity: searchIndicator.running ? 0 : 1 |
61 | + |
62 | + Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing.type: Easing.Linear } } |
63 | } |
64 | |
65 | Item { |
66 | |
67 | === modified file 'Dash/Dash.qml' |
68 | --- Dash/Dash.qml 2013-07-19 16:22:50 +0000 |
69 | +++ Dash/Dash.qml 2013-10-01 21:56:41 +0000 |
70 | @@ -22,6 +22,9 @@ |
71 | |
72 | Showable { |
73 | id: dash |
74 | + objectName: "dash" |
75 | + |
76 | + visible: shown |
77 | |
78 | property alias contentProgress: dashContent.contentProgress |
79 | property string showScopeOnLoaded: "home.scope" |
80 | |
81 | === modified file 'Dash/DashContent.qml' |
82 | --- Dash/DashContent.qml 2013-09-17 16:40:27 +0000 |
83 | +++ Dash/DashContent.qml 2013-10-01 21:56:41 +0000 |
84 | @@ -117,12 +117,12 @@ |
85 | |
86 | // these are needed for autopilot tests |
87 | readonly property string scopeId: scope.id |
88 | - readonly property bool isCurrent: ListView.isCurrentItem |
89 | + readonly property bool isCurrent: visible && ListView.isCurrentItem |
90 | readonly property bool isLoaded: status == Loader.Ready |
91 | |
92 | onLoaded: { |
93 | item.scope = Qt.binding(function() { return scope }) |
94 | - item.isCurrent = Qt.binding(function() { return ListView.isCurrentItem }) |
95 | + item.isCurrent = Qt.binding(function() { return isCurrent }) |
96 | item.searchHistory = Qt.binding(function() { return shell.searchHistory }) |
97 | dashContentList.movementStarted.connect(item.movementStarted) |
98 | dashContent.positionedAtBeginning.connect(item.positionedAtBeginning) |
99 | |
100 | === modified file 'Dash/GenericScopeView.qml' |
101 | --- Dash/GenericScopeView.qml 2013-09-26 15:55:15 +0000 |
102 | +++ Dash/GenericScopeView.qml 2013-10-01 21:56:41 +0000 |
103 | @@ -176,6 +176,7 @@ |
104 | width: categoryView.width |
105 | text: scopeView.scope.name |
106 | searchEntryEnabled: true |
107 | + scope: scopeView.scope |
108 | } |
109 | } |
110 | |
111 | |
112 | === modified file 'Dash/ScopeView.qml' |
113 | --- Dash/ScopeView.qml 2013-08-09 14:39:43 +0000 |
114 | +++ Dash/ScopeView.qml 2013-10-01 21:56:41 +0000 |
115 | @@ -31,14 +31,22 @@ |
116 | // FIXME delay the search so that daemons have time to settle, note that |
117 | // removing this will break ScopeView::test_changeScope |
118 | onScopeChanged: { |
119 | - timer.restart(); |
120 | - scope.activateApplication.connect(activateApp); |
121 | + if (scope) { |
122 | + timer.restart(); |
123 | + scope.activateApplication.connect(activateApp); |
124 | + } |
125 | } |
126 | |
127 | function activateApp(desktopFilePath) { |
128 | shell.activateApplication(desktopFilePath); |
129 | } |
130 | |
131 | + Binding { |
132 | + target: scope |
133 | + property: "isActive" |
134 | + value: isCurrent |
135 | + } |
136 | + |
137 | Timer { |
138 | id: timer |
139 | interval: 2000 |
140 | @@ -47,7 +55,7 @@ |
141 | |
142 | SortFilterProxyModel { |
143 | id: categoryFilter |
144 | - model: scope.categories |
145 | + model: scope ? scope.categories : null |
146 | dynamicSortFilter: true |
147 | filterRole: Categories.RoleCount |
148 | filterRegExp: /^0$/ |
149 | |
150 | === modified file 'Panel/Panel.qml' |
151 | --- Panel/Panel.qml 2013-07-25 09:33:46 +0000 |
152 | +++ Panel/Panel.qml 2013-10-01 21:56:41 +0000 |
153 | @@ -73,6 +73,7 @@ |
154 | |
155 | Indicators { |
156 | id: indicatorsMenu |
157 | + objectName: "indicators" |
158 | |
159 | anchors.right: parent.right |
160 | y: panelBackground.y |
161 | |
162 | === modified file 'plugins/Unity/CMakeLists.txt' |
163 | --- plugins/Unity/CMakeLists.txt 2013-10-01 18:17:30 +0000 |
164 | +++ plugins/Unity/CMakeLists.txt 2013-10-01 21:56:41 +0000 |
165 | @@ -6,7 +6,7 @@ |
166 | # Dependencies |
167 | include(FindPkgConfig) |
168 | pkg_check_modules(QTDEE REQUIRED libdee-qt5>=3.2) |
169 | -pkg_check_modules(UNITYCORE REQUIRED unity-core-6.0) |
170 | +pkg_check_modules(UNITYCORE REQUIRED unity-core-6.0>=7.1.1) |
171 | |
172 | include_directories( |
173 | ${CMAKE_CURRENT_SOURCE_DIR} |
174 | |
175 | === modified file 'plugins/Unity/scope.cpp' |
176 | --- plugins/Unity/scope.cpp 2013-09-27 10:08:43 +0000 |
177 | +++ plugins/Unity/scope.cpp 2013-10-01 21:56:41 +0000 |
178 | @@ -33,14 +33,18 @@ |
179 | #include <QQmlEngine> |
180 | |
181 | #include <UnityCore/Variant.h> |
182 | +#include <UnityCore/GLibWrapper.h> |
183 | |
184 | #include <libintl.h> |
185 | #include <glib.h> |
186 | |
187 | Scope::Scope(QObject *parent) : QObject(parent) |
188 | , m_formFactor("phone") |
189 | + , m_searchInProgress(false) |
190 | { |
191 | m_categories.reset(new Categories(this)); |
192 | + |
193 | + connect(this, &Scope::isActiveChanged, this, &Scope::scopeIsActiveChanged); |
194 | } |
195 | |
196 | QString Scope::id() const |
197 | @@ -68,6 +72,11 @@ |
198 | return QString::fromStdString(m_unityScope->search_hint()); |
199 | } |
200 | |
201 | +bool Scope::searchInProgress() const |
202 | +{ |
203 | + return m_searchInProgress; |
204 | +} |
205 | + |
206 | bool Scope::visible() const |
207 | { |
208 | return m_unityScope->visible(); |
209 | @@ -103,6 +112,11 @@ |
210 | return m_formFactor; |
211 | } |
212 | |
213 | +bool Scope::isActive() const |
214 | +{ |
215 | + return m_isActive; |
216 | +} |
217 | + |
218 | Filters* Scope::filters() const |
219 | { |
220 | return m_filters.get(); |
221 | @@ -115,10 +129,17 @@ |
222 | string ("") and m_searchQuery is the null string, |
223 | search_query != m_searchQuery is still true. |
224 | */ |
225 | + using namespace std::placeholders; |
226 | + |
227 | if (m_searchQuery.isNull() || search_query != m_searchQuery) { |
228 | m_searchQuery = search_query; |
229 | - m_unityScope->Search(search_query.toStdString(), sigc::mem_fun(this, &Scope::searchFinished)); |
230 | + m_cancellable.Renew(); |
231 | + m_unityScope->Search(search_query.toStdString(), std::bind(&Scope::onSearchFinished, this, _1, _2, _3), m_cancellable); |
232 | Q_EMIT searchQueryChanged(); |
233 | + if (!m_searchInProgress) { |
234 | + m_searchInProgress = true; |
235 | + Q_EMIT searchInProgressChanged(); |
236 | + } |
237 | } |
238 | } |
239 | |
240 | @@ -140,6 +161,13 @@ |
241 | } |
242 | } |
243 | |
244 | +void Scope::setActive(const bool active) { |
245 | + if (active != m_isActive) { |
246 | + m_isActive = active; |
247 | + Q_EMIT isActiveChanged(m_isActive); |
248 | + } |
249 | +} |
250 | + |
251 | unity::dash::LocalResult Scope::createLocalResult(const QVariant &uri, const QVariant &icon_hint, |
252 | const QVariant &category, const QVariant &result_type, |
253 | const QVariant &mimetype, const QVariant &title, |
254 | @@ -294,8 +322,7 @@ |
255 | m_unityScope->visible.changed.connect(sigc::mem_fun(this, &Scope::visibleChanged)); |
256 | m_unityScope->shortcut.changed.connect(sigc::mem_fun(this, &Scope::shortcutChanged)); |
257 | m_unityScope->connected.changed.connect(sigc::mem_fun(this, &Scope::connectedChanged)); |
258 | - /* Signals forwarding */ |
259 | - connect(this, SIGNAL(searchFinished(const std::string &, unity::glib::HintsMap const &, unity::glib::Error const &)), SLOT(onSearchFinished(const std::string &, unity::glib::HintsMap const &))); |
260 | + m_unityScope->results_dirty.changed.connect(sigc::mem_fun(this, &Scope::resultsDirtyToggled)); |
261 | |
262 | /* FIXME: signal should be forwarded instead of calling the handler directly */ |
263 | m_unityScope->activated.connect(sigc::mem_fun(this, &Scope::onActivated)); |
264 | @@ -316,18 +343,53 @@ |
265 | |
266 | void Scope::synchronizeStates() |
267 | { |
268 | + using namespace std::placeholders; |
269 | + |
270 | if (connected()) { |
271 | /* Forward local states to m_unityScope */ |
272 | if (!m_searchQuery.isNull()) { |
273 | - m_unityScope->Search(m_searchQuery.toStdString()); |
274 | + m_cancellable.Renew(); |
275 | + m_unityScope->Search(m_searchQuery.toStdString(), std::bind(&Scope::onSearchFinished, this, _1, _2, _3), m_cancellable); |
276 | + if (!m_searchInProgress) { |
277 | + m_searchInProgress = true; |
278 | + Q_EMIT searchInProgressChanged(); |
279 | + } |
280 | } |
281 | } |
282 | } |
283 | |
284 | -void Scope::onSearchFinished(const std::string& /* query */, unity::glib::HintsMap const &hints) |
285 | +void Scope::scopeIsActiveChanged() |
286 | +{ |
287 | + if (!isActive() || !m_unityScope || !m_unityScope->results_dirty()) return; |
288 | + |
289 | + // force new search |
290 | + synchronizeStates(); |
291 | +} |
292 | + |
293 | +void Scope::resultsDirtyToggled(bool results_dirty) |
294 | +{ |
295 | + if (!results_dirty || !isActive()) return; |
296 | + |
297 | + // force new search |
298 | + synchronizeStates(); |
299 | +} |
300 | + |
301 | +void Scope::onSearchFinished(std::string const& /* query */, unity::glib::HintsMap const& hints, unity::glib::Error const& err) |
302 | { |
303 | QString hint; |
304 | |
305 | + GError* error = const_cast<unity::glib::Error&>(err); |
306 | + |
307 | + if (!err || !g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { |
308 | + if (m_searchInProgress) { |
309 | + m_searchInProgress = false; |
310 | + Q_EMIT searchInProgressChanged(); |
311 | + } |
312 | + } else { |
313 | + // no need to check the results hint, we're still searching |
314 | + return; |
315 | + } |
316 | + |
317 | if (!m_unityScope->results()->count()) { |
318 | unity::glib::HintsMap::const_iterator it = hints.find("no-results-hint"); |
319 | if (it != hints.end()) { |
320 | |
321 | === modified file 'plugins/Unity/scope.h' |
322 | --- plugins/Unity/scope.h 2013-09-25 15:52:47 +0000 |
323 | +++ plugins/Unity/scope.h 2013-10-01 21:56:41 +0000 |
324 | @@ -28,6 +28,7 @@ |
325 | // libunity-core |
326 | #include <UnityCore/Scope.h> |
327 | #include <UnityCore/Results.h> |
328 | +#include <UnityCore/GLibWrapper.h> |
329 | |
330 | #include "categories.h" |
331 | #include "filters.h" |
332 | @@ -43,6 +44,7 @@ |
333 | Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged) |
334 | Q_PROPERTY(QString description READ description NOTIFY descriptionChanged) |
335 | Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged) |
336 | + Q_PROPERTY(bool searchInProgress READ searchInProgress NOTIFY searchInProgressChanged) |
337 | Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged) |
338 | Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged) |
339 | Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged) |
340 | @@ -52,6 +54,7 @@ |
341 | Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged) |
342 | Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged) |
343 | Q_PROPERTY(QString formFactor READ formFactor WRITE setFormFactor NOTIFY formFactorChanged) |
344 | + Q_PROPERTY(bool isActive READ isActive WRITE setActive NOTIFY isActiveChanged) |
345 | |
346 | public: |
347 | explicit Scope(QObject *parent = 0); |
348 | @@ -65,16 +68,19 @@ |
349 | bool visible() const; |
350 | QString shortcut() const; |
351 | bool connected() const; |
352 | + bool searchInProgress() const; |
353 | Categories* categories() const; |
354 | Filters* filters() const; |
355 | QString searchQuery() const; |
356 | QString noResultsHint() const; |
357 | QString formFactor() const; |
358 | + bool isActive() const; |
359 | |
360 | /* setters */ |
361 | void setSearchQuery(const QString& search_query); |
362 | void setNoResultsHint(const QString& hint); |
363 | void setFormFactor(const QString& form_factor); |
364 | + void setActive(const bool); |
365 | |
366 | Q_INVOKABLE void activate(const QVariant &uri, const QVariant &icon_hint, const QVariant &category, |
367 | const QVariant &result_type, const QVariant &mimetype, const QVariant &title, |
368 | @@ -95,14 +101,15 @@ |
369 | void iconHintChanged(const std::string&); |
370 | void descriptionChanged(const std::string&); |
371 | void searchHintChanged(const std::string&); |
372 | + void searchInProgressChanged(); |
373 | void visibleChanged(bool); |
374 | void shortcutChanged(const std::string&); |
375 | void connectedChanged(bool); |
376 | void categoriesChanged(); |
377 | - void searchFinished(const std::string&, unity::glib::HintsMap const&, unity::glib::Error const&); |
378 | void searchQueryChanged(); |
379 | void noResultsHintChanged(); |
380 | void formFactorChanged(); |
381 | + void isActiveChanged(bool); |
382 | void filtersChanged(); |
383 | |
384 | // signals triggered by activate(..) or preview(..) requests. |
385 | @@ -115,7 +122,8 @@ |
386 | |
387 | private Q_SLOTS: |
388 | void synchronizeStates(); |
389 | - void onSearchFinished(const std::string &, unity::glib::HintsMap const &); |
390 | + void scopeIsActiveChanged(); |
391 | + void onSearchFinished(std::string const &, unity::glib::HintsMap const &, unity::glib::Error const&); |
392 | |
393 | private: |
394 | unity::dash::LocalResult createLocalResult(const QVariant &uri, const QVariant &icon_hint, |
395 | @@ -126,6 +134,7 @@ |
396 | void onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const& hints); |
397 | void onPreviewReady(unity::dash::LocalResult const& result, unity::dash::Preview::Ptr const& preview); |
398 | void fallbackActivate(const QString& uri); |
399 | + void resultsDirtyToggled(bool); |
400 | |
401 | unity::dash::Scope::Ptr m_unityScope; |
402 | std::unique_ptr<Categories> m_categories; |
403 | @@ -133,6 +142,9 @@ |
404 | QString m_searchQuery; |
405 | QString m_noResultsHint; |
406 | QString m_formFactor; |
407 | + bool m_isActive; |
408 | + bool m_searchInProgress; |
409 | + unity::glib::Cancellable m_cancellable; |
410 | unity::glib::Cancellable m_previewCancellable; |
411 | }; |
412 | |
413 | |
414 | === modified file 'tests/mocks/Unity/fake_scope.cpp' |
415 | --- tests/mocks/Unity/fake_scope.cpp 2013-09-02 20:34:05 +0000 |
416 | +++ tests/mocks/Unity/fake_scope.cpp 2013-10-01 21:56:41 +0000 |
417 | @@ -30,6 +30,8 @@ |
418 | Scope::Scope(QObject* parent) |
419 | : QObject(parent) |
420 | , m_visible(false) |
421 | + , m_searching(false) |
422 | + , m_isActive(false) |
423 | , m_categories(new Categories(this)) |
424 | , m_results(new DeeListModel(this)) |
425 | { |
426 | @@ -44,6 +46,8 @@ |
427 | , m_id(id) |
428 | , m_name(name) |
429 | , m_visible(visible) |
430 | + , m_searching(false) |
431 | + , m_isActive(false) |
432 | , m_categories(new Categories(this)) |
433 | , m_results(new DeeListModel(this)) |
434 | { |
435 | @@ -85,6 +89,10 @@ |
436 | return true; |
437 | } |
438 | |
439 | +bool Scope::searchInProgress() const { |
440 | + return m_searching; |
441 | +} |
442 | + |
443 | Categories* Scope::categories() const { |
444 | return m_categories; |
445 | } |
446 | @@ -101,6 +109,10 @@ |
447 | return m_visible; |
448 | } |
449 | |
450 | +bool Scope::isActive() const { |
451 | + return m_isActive; |
452 | +} |
453 | + |
454 | void Scope::setName(const QString &str) { |
455 | if (str != m_name) { |
456 | m_name = str; |
457 | @@ -122,6 +134,20 @@ |
458 | } |
459 | } |
460 | |
461 | +void Scope::setActive(const bool active) { |
462 | + if (active != m_isActive) { |
463 | + m_isActive = active; |
464 | + Q_EMIT isActiveChanged(); |
465 | + } |
466 | +} |
467 | + |
468 | +void Scope::setSearchInProgress(const bool inProg) { |
469 | + if (inProg != m_searching) { |
470 | + m_searching = inProg; |
471 | + Q_EMIT searchInProgressChanged(); |
472 | + } |
473 | +} |
474 | + |
475 | void Scope::setNoResultsHint(const QString& str) { |
476 | if (str != m_noResultsHint) { |
477 | m_noResultsHint = str; |
478 | |
479 | === modified file 'tests/mocks/Unity/fake_scope.h' |
480 | --- tests/mocks/Unity/fake_scope.h 2013-09-26 11:48:17 +0000 |
481 | +++ tests/mocks/Unity/fake_scope.h 2013-10-01 21:56:41 +0000 |
482 | @@ -32,14 +32,17 @@ |
483 | Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged) |
484 | Q_PROPERTY(QString description READ description NOTIFY descriptionChanged) |
485 | Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged) |
486 | + Q_PROPERTY(bool searchInProgress READ searchInProgress NOTIFY searchInProgressChanged) |
487 | Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged) |
488 | Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged) |
489 | Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged) |
490 | Q_PROPERTY(Categories* categories READ categories NOTIFY categoriesChanged) |
491 | |
492 | + Q_PROPERTY(bool searchInProgress READ searchInProgress WRITE setSearchInProgress NOTIFY searchInProgressChanged) |
493 | Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged) |
494 | Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged) |
495 | Q_PROPERTY(QString formFactor READ formFactor WRITE setFormFactor NOTIFY formFactorChanged) |
496 | + Q_PROPERTY(bool isActive READ isActive WRITE setActive NOTIFY isActiveChanged) |
497 | |
498 | public: |
499 | Scope(QObject* parent = 0); |
500 | @@ -54,16 +57,20 @@ |
501 | bool visible() const; |
502 | QString shortcut() const; |
503 | bool connected() const; |
504 | + bool searchInProgress() const; |
505 | Categories* categories() const; |
506 | QString searchQuery() const; |
507 | QString noResultsHint() const; |
508 | QString formFactor() const; |
509 | + bool isActive() const; |
510 | |
511 | /* setters */ |
512 | void setName(const QString& name); |
513 | void setSearchQuery(const QString& search_query); |
514 | void setNoResultsHint(const QString& hint); |
515 | void setFormFactor(const QString& form_factor); |
516 | + void setActive(const bool); |
517 | + void setSearchInProgress(const bool inProg); |
518 | |
519 | Q_INVOKABLE void activate(const QVariant &uri, const QVariant &icon_hint, const QVariant &category, |
520 | const QVariant &result_type, const QVariant &mimetype, const QVariant &title, |
521 | @@ -78,14 +85,15 @@ |
522 | void iconHintChanged(const QString&); |
523 | void descriptionChanged(const QString&); |
524 | void searchHintChanged(const QString&); |
525 | + void searchInProgressChanged(); |
526 | void visibleChanged(bool); |
527 | void shortcutChanged(const QString&); |
528 | void connectedChanged(bool); |
529 | void categoriesChanged(); |
530 | - void searchFinished(const QString&); |
531 | void searchQueryChanged(); |
532 | void noResultsHintChanged(); |
533 | void formFactorChanged(); |
534 | + void isActiveChanged(); |
535 | |
536 | // signals triggered by activate(..) or preview(..) requests. |
537 | void previewReady(Preview *preview); |
538 | @@ -103,6 +111,8 @@ |
539 | QString m_noResultsHint; |
540 | QString m_formFactor; |
541 | bool m_visible; |
542 | + bool m_searching; |
543 | + bool m_isActive; |
544 | |
545 | Categories* m_categories; |
546 | DeeListModel* m_results; |
547 | |
548 | === modified file 'tests/plugins/Unity/CMakeLists.txt' |
549 | --- tests/plugins/Unity/CMakeLists.txt 2013-09-05 11:48:57 +0000 |
550 | +++ tests/plugins/Unity/CMakeLists.txt 2013-10-01 21:56:41 +0000 |
551 | @@ -1,7 +1,7 @@ |
552 | add_subdirectory(Indicators) |
553 | add_subdirectory(Launcher) |
554 | |
555 | -pkg_check_modules(UNITYCORE REQUIRED unity-core-6.0) |
556 | +pkg_check_modules(UNITYCORE REQUIRED unity-core-6.0>=7.1.1) |
557 | pkg_check_modules(LIBUNITYPROTO REQUIRED unity-protocol-private) |
558 | pkg_check_modules(LIBUNITY REQUIRED unity) |
559 | pkg_check_modules(LIBSIGCPP REQUIRED sigc++-2.0) |
560 | |
561 | === modified file 'tests/qmltests/CMakeLists.txt' |
562 | --- tests/qmltests/CMakeLists.txt 2013-09-25 14:13:46 +0000 |
563 | +++ tests/qmltests/CMakeLists.txt 2013-10-01 21:56:41 +0000 |
564 | @@ -43,7 +43,7 @@ |
565 | add_qml_test(Components PageHeader) |
566 | add_qml_test(Dash Dash IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS}) |
567 | add_qml_test(Dash DashBar IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS}) |
568 | -add_qml_test(Dash DashContent IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}) |
569 | +add_qml_test(Dash DashContent IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS}) |
570 | add_qml_test(Dash DashPreview) |
571 | add_qml_test(Dash GenericScopeView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS}) |
572 | add_qml_test(Dash ScopeView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS}) |
573 | |
574 | === modified file 'tests/qmltests/Components/tst_PageHeader.qml' |
575 | --- tests/qmltests/Components/tst_PageHeader.qml 2013-06-05 22:03:08 +0000 |
576 | +++ tests/qmltests/Components/tst_PageHeader.qml 2013-10-01 21:56:41 +0000 |
577 | @@ -19,12 +19,17 @@ |
578 | import ".." |
579 | import "../../../Components" |
580 | import Ubuntu.Components 0.1 |
581 | +import Unity 0.1 |
582 | import Unity.Test 0.1 as UT |
583 | |
584 | Item { |
585 | width: units.gu(110) |
586 | height: units.gu(30) |
587 | |
588 | + Scope { |
589 | + id: scopeMock |
590 | + } |
591 | + |
592 | UT.UnityTestCase { |
593 | name: "PageHeaderTest" |
594 | when: windowShown |
595 | @@ -132,6 +137,27 @@ |
596 | compare(pageHeader.searchHistory.count, 3) |
597 | compare(pageHeader.searchHistory.get(0).query, "humppa4") |
598 | } |
599 | + |
600 | + function test_search_indicator() { |
601 | + var searchIndicator = findChild(pageHeader, "searchIndicator") |
602 | + var primaryImage = findChild(pageHeader, "primaryImage") |
603 | + |
604 | + pageHeader.triggerSearch() |
605 | + |
606 | + scopeMock.searchInProgress = false |
607 | + compare(searchIndicator.running, false, "Search indicator is running.") |
608 | + tryCompare(primaryImage, "visible", true) |
609 | + |
610 | + scopeMock.searchInProgress = true |
611 | + compare(searchIndicator.running, true, "Search indicator isn't running.") |
612 | + tryCompare(primaryImage, "visible", false) |
613 | + |
614 | + pageHeader.resetSearch() |
615 | + } |
616 | + |
617 | + function cleanup() { |
618 | + scopeMock.searchInProgress = false |
619 | + } |
620 | } |
621 | |
622 | Column { |
623 | @@ -145,6 +171,8 @@ |
624 | right: parent.right |
625 | } |
626 | |
627 | + scope: scopeMock |
628 | + |
629 | searchEntryEnabled: true |
630 | text: "%^$%^%^&%^&%^$%GHR%" |
631 | } |
632 | |
633 | === modified file 'tests/qmltests/Dash/qml/FakeScopeView.qml' |
634 | --- tests/qmltests/Dash/qml/FakeScopeView.qml 2013-09-17 16:41:26 +0000 |
635 | +++ tests/qmltests/Dash/qml/FakeScopeView.qml 2013-10-01 21:56:41 +0000 |
636 | @@ -17,16 +17,10 @@ |
637 | import QtQuick 2.0 |
638 | import Unity 0.1 |
639 | |
640 | -FocusScope { |
641 | +import "../../../../Dash" |
642 | + |
643 | +ScopeView { |
644 | id: fakeScopeView |
645 | - property Scope scope : null |
646 | - property bool isCurrent : false |
647 | - |
648 | - property ListModel searchHistory |
649 | - |
650 | - signal endReached |
651 | - signal movementStarted |
652 | - signal positionedAtBeginning |
653 | |
654 | property alias backColor : back.color |
655 | |
656 | |
657 | === modified file 'tests/qmltests/Dash/tst_DashContent.qml' |
658 | --- tests/qmltests/Dash/tst_DashContent.qml 2013-09-17 16:40:27 +0000 |
659 | +++ tests/qmltests/Dash/tst_DashContent.qml 2013-10-01 21:56:41 +0000 |
660 | @@ -101,17 +101,21 @@ |
661 | when: windowShown |
662 | |
663 | function init() { |
664 | + scopesModel.load(); |
665 | + } |
666 | + |
667 | + function cleanup() { |
668 | scopeLoadedSpy.clear(); |
669 | movementStartedSpy.clear(); |
670 | - contentEndReachedSpy.clear() |
671 | + contentEndReachedSpy.clear(); |
672 | clear_scope_status(); |
673 | + dashContent.visible = true; |
674 | |
675 | - // clear, wait for dash to empty and load scopes. |
676 | - var dashContentList = findChild(dashContent, "dashContentList"); |
677 | - verify(dashContentList != undefined) |
678 | scopesModel.clear(); |
679 | + // wait for dash to empty scopes. |
680 | + var dashContentList = findChild(dashContent, "dashContentList"); |
681 | + verify(dashContentList != undefined); |
682 | tryCompare(dashContentList, "count", 0); |
683 | - scopesModel.load(); |
684 | } |
685 | |
686 | function test_movement_started_signal() { |
687 | @@ -205,5 +209,25 @@ |
688 | tryCompareFunction(get_current_item_object_name, data.objectName) |
689 | } |
690 | |
691 | + function test_is_active_data() { |
692 | + return [ |
693 | + {tag: "select 0", select: 0, visible: true, active0: true, active1: false, active2: false, active3: false}, |
694 | + {tag: "select 2", select: 2, visible: true, active0: false, active1: false, active2: true, active3: false}, |
695 | + {tag: "invisible", select: 0, visible: false, active0: false, active1: false, active2: false, active3: false}, |
696 | + ] |
697 | + } |
698 | + |
699 | + function test_is_active(data) { |
700 | + var dashContentList = findChild(dashContent, "dashContentList"); |
701 | + |
702 | + tryCompare(scopeLoadedSpy, "count", 5); |
703 | + |
704 | + dashContent.setCurrentScopeAtIndex(data.select, true, false); |
705 | + dashContent.visible = data.visible; |
706 | + |
707 | + tryCompare(scopesModel.get(0), "isActive", data.active0); |
708 | + tryCompare(scopesModel.get(1), "isActive", data.active1); |
709 | + tryCompare(scopesModel.get(2), "isActive", data.active2); |
710 | + } |
711 | } |
712 | } |
713 | |
714 | === modified file 'tests/qmltests/tst_Shell.qml' |
715 | --- tests/qmltests/tst_Shell.qml 2013-09-12 19:08:06 +0000 |
716 | +++ tests/qmltests/tst_Shell.qml 2013-10-01 21:56:41 +0000 |
717 | @@ -56,6 +56,7 @@ |
718 | |
719 | function initTestCase() { |
720 | swipeAwayGreeter(); |
721 | + waitForUIToSettle(); |
722 | } |
723 | |
724 | function cleanup() { |
725 | @@ -70,6 +71,8 @@ |
726 | |
727 | var dashHome = findChild(shell, "DashHome"); |
728 | swipeUntilScopeViewIsReached(dashHome); |
729 | + |
730 | + hideIndicators(); |
731 | } |
732 | |
733 | function killApps(apps) { |
734 | @@ -268,6 +271,19 @@ |
735 | mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2); |
736 | } |
737 | |
738 | + function showIndicators() { |
739 | + var indicators = findChild(shell, "indicators"); |
740 | + indicators.show(); |
741 | + tryCompare(indicators, "fullyOpened", true); |
742 | + } |
743 | + |
744 | + function hideIndicators() { |
745 | + var indicators = findChild(shell, "indicators"); |
746 | + if (indicators.fullyOpened) { |
747 | + indicators.hide(); |
748 | + } |
749 | + } |
750 | + |
751 | function waitUntilApplicationWindowIsFullyVisible() { |
752 | var underlay = findChild(shell, "underlay"); |
753 | tryCompare(underlay, "visible", false); |
754 | @@ -360,5 +376,41 @@ |
755 | tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.expectedUrl) !== -1; }, true) |
756 | tryCompare(backgroundImage, "status", Image.Ready) |
757 | } |
758 | + |
759 | + function test_DashShown_data() { |
760 | + return [ |
761 | + {tag: "in focus", greeter: false, app: false, launcher: false, indicators: false, expectedShown: true}, |
762 | + {tag: "under greeter", greeter: true, app: false, launcher: false, indicators: false, expectedShown: false}, |
763 | + {tag: "under app", greeter: false, app: true, launcher: false, indicators: false, expectedShown: false}, |
764 | + {tag: "under launcher", greeter: false, app: false, launcher: true, indicators: false, expectedShown: true}, |
765 | + {tag: "under indicators", greeter: false, app: false, launcher: false, indicators: true, expectedShown: true}, |
766 | + ] |
767 | + } |
768 | + |
769 | + function test_DashShown(data) { |
770 | + |
771 | + if (data.greeter) { |
772 | + // Swipe the greeter in |
773 | + var greeter = findChild(shell, "greeter"); |
774 | + Powerd.displayPowerStateChange(Powerd.Off, 0); |
775 | + tryCompare(greeter, "showProgress", 1); |
776 | + } |
777 | + |
778 | + if (data.app) { |
779 | + dragLauncherIntoView(); |
780 | + tapOnAppIconInLauncher(); |
781 | + } |
782 | + |
783 | + if (data.launcher) { |
784 | + dragLauncherIntoView(); |
785 | + } |
786 | + |
787 | + if (data.indicators) { |
788 | + showIndicators(); |
789 | + } |
790 | + |
791 | + var dash = findChild(shell, "dash"); |
792 | + tryCompare(dash, "shown", data.expectedShown); |
793 | + } |
794 | } |
795 | } |
FAILED: Continuous integration, rev:340 jenkins. qa.ubuntu. com/job/ unity8- ci/1088/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy/3909 jenkins. qa.ubuntu. com/job/ generic- mediumtests- touch/1481 jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- saucy/1827 jenkins. qa.ubuntu. com/job/ unity8- saucy-amd64- ci/112 jenkins. qa.ubuntu. com/job/ unity8- saucy-armhf- ci/1089 jenkins. qa.ubuntu. com/job/ unity8- saucy-armhf- ci/1089/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity8- saucy-i386- ci/1088 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-saucy/ 240 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-i386/ 3965 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-i386/ 3965/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 1483 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 1483/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- maguro/ 1249 jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/1260
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ unity8- ci/1088/ rebuild
http://