Merge lp:~pete-woods/hud/no-suggestions-for-legacy-queries into lp:hud/14.04
- no-suggestions-for-legacy-queries
- Merge into trunk.14.04
Status: | Merged |
---|---|
Approved by: | Antti Kaijanmäki |
Approved revision: | 377 |
Merged at revision: | 377 |
Proposed branch: | lp:~pete-woods/hud/no-suggestions-for-legacy-queries |
Merge into: | lp:hud/14.04 |
Prerequisite: | lp:~pete-woods/hud/gtkdoc-fix-behaviour-change |
Diff against target: |
500 lines (+122/-49) 17 files modified
debian/changelog (+8/-0) service/Factory.cpp (+3/-2) service/Factory.h (+2/-1) service/HudServiceImpl.cpp (+7/-4) service/HudServiceImpl.h (+2/-1) service/ItemStore.cpp (+6/-1) service/ItemStore.h (+3/-1) service/Query.h (+5/-0) service/QueryImpl.cpp (+7/-6) service/QueryImpl.h (+5/-3) service/Window.h (+3/-1) service/WindowImpl.cpp (+3/-2) service/WindowImpl.h (+2/-1) tests/unit/service/Mocks.h (+3/-2) tests/unit/service/TestHudService.cpp (+17/-13) tests/unit/service/TestItemStore.cpp (+32/-2) tests/unit/service/TestQuery.cpp (+14/-9) |
To merge this branch: | bzr merge lp:~pete-woods/hud/no-suggestions-for-legacy-queries |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Antti Kaijanmäki (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Review via email: mp+207949@code.launchpad.net |
This proposal supersedes a proposal from 2014-02-18.
Commit message
Make legacy queries return no results with an empty search string
Description of the change
* Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
* Yes
* Did you build your software in a clean sbuild/pbuilder chroot or ppa?
* Yes
* Did you build your software in a clean sbuild/pbuilder armhf chroot or ppa?
* Yes
* Has your component "TestPlan” been executed successfully on emulator, N4?
* Yes
* Has a 5 minute exploratory testing run been executed on N4?
* Yes
* If you changed the packaging (debian), did you subscribe a core-dev to this MP?
* N/A
* If you changed the UI, did you subscribe the design-reviewers to this MP?
* No change
* What components might get impacted by your changes?
* Unity7
* Unity8
* Have you requested review by the teams of these owning components?
* Yes
Check List:
https:/
Test Plan:
https:/
Silo:
https:/
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:375
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:376
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 375. By Pete Woods
-
Change GTK documentation so that it builds with the new glib version Fixes: 1287580
- 376. By PS Jenkins bot
-
Releasing 13.10.1+
14.04.20140304- 0ubuntu1
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:377
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Antti Kaijanmäki (kaijanmaki) wrote : | # |
LGTM.
Waiting for silo.
Antti Kaijanmäki (kaijanmaki) wrote : | # |
* Are any changes against your component pending/needed to land the MP under review in a functional state and are those called out explicitly by the submitter?
Yes.
* Did you do exploratory testing related to the component you own with the MP changeset included?
Yes.
* Has the submitter requested review by all the relevant teams/reviewres?
Yes.
* If you are the reviewer owning the component the MP is against, have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes.
Preview Diff
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2014-02-18 14:29:31 +0000 | |||
3 | +++ debian/changelog 2014-03-14 14:07:05 +0000 | |||
4 | @@ -1,3 +1,11 @@ | |||
5 | 1 | hud (13.10.1+14.04.20140304-0ubuntu1) trusty; urgency=low | ||
6 | 2 | |||
7 | 3 | [ Pete Woods ] | ||
8 | 4 | * Change GTK documentation so that it builds with the new glib version | ||
9 | 5 | (LP: #1287580) | ||
10 | 6 | |||
11 | 7 | -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 04 Mar 2014 09:58:04 +0000 | ||
12 | 8 | |||
13 | 1 | hud (13.10.1+14.04.20140218.2-0ubuntu1) trusty; urgency=low | 9 | hud (13.10.1+14.04.20140218.2-0ubuntu1) trusty; urgency=low |
14 | 2 | 10 | ||
15 | 3 | [ Pete Woods ] | 11 | [ Pete Woods ] |
16 | 4 | 12 | ||
17 | === modified file 'service/Factory.cpp' | |||
18 | --- service/Factory.cpp 2014-02-15 10:23:45 +0000 | |||
19 | +++ service/Factory.cpp 2014-03-14 14:07:05 +0000 | |||
20 | @@ -88,9 +88,10 @@ | |||
21 | 88 | return m_sessionBus; | 88 | return m_sessionBus; |
22 | 89 | } | 89 | } |
23 | 90 | 90 | ||
25 | 91 | Query::Ptr Factory::newQuery(const QString &query, const QString &sender) { | 91 | Query::Ptr Factory::newQuery(const QString &query, const QString &sender, |
26 | 92 | Query::EmptyBehaviour emptyBehaviour) { | ||
27 | 92 | return Query::Ptr( | 93 | return Query::Ptr( |
29 | 93 | new QueryImpl(m_queryCounter++, query, sender, | 94 | new QueryImpl(m_queryCounter++, query, sender, emptyBehaviour, |
30 | 94 | *singletonHudService(), singletonApplicationList(), | 95 | *singletonHudService(), singletonApplicationList(), |
31 | 95 | singletonVoice(), sessionBus())); | 96 | singletonVoice(), sessionBus())); |
32 | 96 | } | 97 | } |
33 | 97 | 98 | ||
34 | === modified file 'service/Factory.h' | |||
35 | --- service/Factory.h 2014-02-15 10:23:45 +0000 | |||
36 | +++ service/Factory.h 2014-03-14 14:07:05 +0000 | |||
37 | @@ -60,7 +60,8 @@ | |||
38 | 60 | 60 | ||
39 | 61 | virtual QSharedPointer<ComCanonicalAppMenuRegistrarInterface> singletonAppmenu(); | 61 | virtual QSharedPointer<ComCanonicalAppMenuRegistrarInterface> singletonAppmenu(); |
40 | 62 | 62 | ||
42 | 63 | virtual Query::Ptr newQuery(const QString &query, const QString &sender); | 63 | virtual Query::Ptr newQuery(const QString &query, const QString &sender, |
43 | 64 | Query::EmptyBehaviour emptyBehaviour); | ||
44 | 64 | 65 | ||
45 | 65 | virtual ApplicationList::Ptr singletonApplicationList(); | 66 | virtual ApplicationList::Ptr singletonApplicationList(); |
46 | 66 | 67 | ||
47 | 67 | 68 | ||
48 | === modified file 'service/HudServiceImpl.cpp' | |||
49 | --- service/HudServiceImpl.cpp 2013-12-17 16:37:55 +0000 | |||
50 | +++ service/HudServiceImpl.cpp 2014-03-14 14:07:05 +0000 | |||
51 | @@ -62,8 +62,8 @@ | |||
52 | 62 | } | 62 | } |
53 | 63 | 63 | ||
54 | 64 | Query::Ptr HudServiceImpl::createQuery(const QString &query, | 64 | Query::Ptr HudServiceImpl::createQuery(const QString &query, |
57 | 65 | const QString &sender) { | 65 | const QString &sender, Query::EmptyBehaviour emptyBehaviour) { |
58 | 66 | Query::Ptr hudQuery(m_factory.newQuery(query, sender)); | 66 | Query::Ptr hudQuery(m_factory.newQuery(query, sender, emptyBehaviour)); |
59 | 67 | m_queries[hudQuery->path()] = hudQuery; | 67 | m_queries[hudQuery->path()] = hudQuery; |
60 | 68 | 68 | ||
61 | 69 | return hudQuery; | 69 | return hudQuery; |
62 | @@ -73,7 +73,9 @@ | |||
63 | 73 | QString &resultsName, QString &appstackName, int &modelRevision) { | 73 | QString &resultsName, QString &appstackName, int &modelRevision) { |
64 | 74 | QString sender(messageSender()); | 74 | QString sender(messageSender()); |
65 | 75 | 75 | ||
67 | 76 | Query::Ptr hudQuery(createQuery(query, sender)); | 76 | Query::Ptr hudQuery( |
68 | 77 | createQuery(query, sender, | ||
69 | 78 | Query::EmptyBehaviour::SHOW_SUGGESTIONS)); | ||
70 | 77 | 79 | ||
71 | 78 | resultsName = hudQuery->resultsModel(); | 80 | resultsName = hudQuery->resultsModel(); |
72 | 79 | appstackName = hudQuery->appstackModel(); | 81 | appstackName = hudQuery->appstackModel(); |
73 | @@ -104,7 +106,8 @@ | |||
74 | 104 | 106 | ||
75 | 105 | Query::Ptr query(m_legacyQueries[sender]); | 107 | Query::Ptr query(m_legacyQueries[sender]); |
76 | 106 | if (query.isNull()) { | 108 | if (query.isNull()) { |
78 | 107 | query = createQuery(queryString, sender); | 109 | query = createQuery(queryString, sender, |
79 | 110 | Query::EmptyBehaviour::NO_SUGGESTIONS); | ||
80 | 108 | m_legacyQueries[sender] = query; | 111 | m_legacyQueries[sender] = query; |
81 | 109 | } else { | 112 | } else { |
82 | 110 | query->UpdateQuery(queryString); | 113 | query->UpdateQuery(queryString); |
83 | 111 | 114 | ||
84 | === modified file 'service/HudServiceImpl.h' | |||
85 | --- service/HudServiceImpl.h 2013-12-17 16:37:55 +0000 | |||
86 | +++ service/HudServiceImpl.h 2014-03-14 14:07:05 +0000 | |||
87 | @@ -74,7 +74,8 @@ | |||
88 | 74 | void CloseQuery(const QDBusVariant &querykey); | 74 | void CloseQuery(const QDBusVariant &querykey); |
89 | 75 | 75 | ||
90 | 76 | protected: | 76 | protected: |
92 | 77 | Query::Ptr createQuery(const QString &query, const QString &service); | 77 | Query::Ptr createQuery(const QString &query, const QString &service, |
93 | 78 | Query::EmptyBehaviour emptyBehaviour); | ||
94 | 78 | 79 | ||
95 | 79 | QScopedPointer<HudAdaptor> m_adaptor; | 80 | QScopedPointer<HudAdaptor> m_adaptor; |
96 | 80 | 81 | ||
97 | 81 | 82 | ||
98 | === modified file 'service/ItemStore.cpp' | |||
99 | --- service/ItemStore.cpp 2014-02-15 10:23:45 +0000 | |||
100 | +++ service/ItemStore.cpp 2014-03-14 14:07:05 +0000 | |||
101 | @@ -150,10 +150,15 @@ | |||
102 | 150 | return result; | 150 | return result; |
103 | 151 | } | 151 | } |
104 | 152 | 152 | ||
106 | 153 | void ItemStore::search(const QString &query, QList<Result> &results) { | 153 | void ItemStore::search(const QString &query, |
107 | 154 | Query::EmptyBehaviour emptyBehaviour, QList<Result> &results) { | ||
108 | 154 | QStringMatcher stringMatcher(query, Qt::CaseInsensitive); | 155 | QStringMatcher stringMatcher(query, Qt::CaseInsensitive); |
109 | 155 | 156 | ||
110 | 156 | if (query.isEmpty()) { | 157 | if (query.isEmpty()) { |
111 | 158 | if (emptyBehaviour == Query::EmptyBehaviour::NO_SUGGESTIONS) { | ||
112 | 159 | return; | ||
113 | 160 | } | ||
114 | 161 | |||
115 | 157 | QMap<unsigned int, DocumentID> tempResults; | 162 | QMap<unsigned int, DocumentID> tempResults; |
116 | 158 | 163 | ||
117 | 159 | for (auto it(m_items.constBegin()); it != m_items.constEnd(); ++it) { | 164 | for (auto it(m_items.constBegin()); it != m_items.constEnd(); ++it) { |
118 | 160 | 165 | ||
119 | === modified file 'service/ItemStore.h' | |||
120 | --- service/ItemStore.h 2014-02-15 10:23:45 +0000 | |||
121 | +++ service/ItemStore.h 2014-03-14 14:07:05 +0000 | |||
122 | @@ -20,6 +20,7 @@ | |||
123 | 20 | #define HUD_SERVICE_ITEMSTORE_H_ | 20 | #define HUD_SERVICE_ITEMSTORE_H_ |
124 | 21 | 21 | ||
125 | 22 | #include <service/Item.h> | 22 | #include <service/Item.h> |
126 | 23 | #include <service/Query.h> | ||
127 | 23 | #include <service/Result.h> | 24 | #include <service/Result.h> |
128 | 24 | #include <service/SearchSettings.h> | 25 | #include <service/SearchSettings.h> |
129 | 25 | #include <service/UsageTracker.h> | 26 | #include <service/UsageTracker.h> |
130 | @@ -50,7 +51,8 @@ | |||
131 | 50 | 51 | ||
132 | 51 | void indexMenu(const QMenu *menu); | 52 | void indexMenu(const QMenu *menu); |
133 | 52 | 53 | ||
135 | 53 | void search(const QString &query, QList<Result> &results); | 54 | void search(const QString &query, Query::EmptyBehaviour emptyBehaviour, |
136 | 55 | QList<Result> &results); | ||
137 | 54 | 56 | ||
138 | 55 | void execute(unsigned long long commandId); | 57 | void execute(unsigned long long commandId); |
139 | 56 | 58 | ||
140 | 57 | 59 | ||
141 | === modified file 'service/Query.h' | |||
142 | --- service/Query.h 2013-11-18 09:37:43 +0000 | |||
143 | +++ service/Query.h 2014-03-14 14:07:05 +0000 | |||
144 | @@ -39,6 +39,11 @@ | |||
145 | 39 | public: | 39 | public: |
146 | 40 | typedef QSharedPointer<Query> Ptr; | 40 | typedef QSharedPointer<Query> Ptr; |
147 | 41 | 41 | ||
148 | 42 | enum class EmptyBehaviour { | ||
149 | 43 | SHOW_SUGGESTIONS, | ||
150 | 44 | NO_SUGGESTIONS, | ||
151 | 45 | }; | ||
152 | 46 | |||
153 | 42 | explicit Query(QObject *parent = 0); | 47 | explicit Query(QObject *parent = 0); |
154 | 43 | 48 | ||
155 | 44 | virtual ~Query(); | 49 | virtual ~Query(); |
156 | 45 | 50 | ||
157 | === modified file 'service/QueryImpl.cpp' | |||
158 | --- service/QueryImpl.cpp 2013-12-20 14:44:11 +0000 | |||
159 | +++ service/QueryImpl.cpp 2014-03-14 14:07:05 +0000 | |||
160 | @@ -30,13 +30,14 @@ | |||
161 | 30 | using namespace hud::service; | 30 | using namespace hud::service; |
162 | 31 | 31 | ||
163 | 32 | QueryImpl::QueryImpl(unsigned int id, const QString &query, | 32 | QueryImpl::QueryImpl(unsigned int id, const QString &query, |
167 | 33 | const QString &sender, HudService &service, | 33 | const QString &sender, EmptyBehaviour emptyBehaviour, |
168 | 34 | ApplicationList::Ptr applicationList, Voice::Ptr voice, | 34 | HudService &service, ApplicationList::Ptr applicationList, |
169 | 35 | const QDBusConnection &connection, QObject *parent) : | 35 | Voice::Ptr voice, const QDBusConnection &connection, QObject *parent) : |
170 | 36 | Query(parent), m_adaptor(new QueryAdaptor(this)), m_connection( | 36 | Query(parent), m_adaptor(new QueryAdaptor(this)), m_connection( |
171 | 37 | connection), m_path(DBusTypes::queryPath(id)), m_service( | 37 | connection), m_path(DBusTypes::queryPath(id)), m_service( |
174 | 38 | service), m_applicationList(applicationList), m_voice(voice), m_query( | 38 | service), m_emptyBehaviour(emptyBehaviour), m_applicationList( |
175 | 39 | query), m_serviceWatcher(sender, m_connection, | 39 | applicationList), m_voice(voice), m_query(query), m_serviceWatcher( |
176 | 40 | sender, m_connection, | ||
177 | 40 | QDBusServiceWatcher::WatchForUnregistration) { | 41 | QDBusServiceWatcher::WatchForUnregistration) { |
178 | 41 | 42 | ||
179 | 42 | connect(&m_serviceWatcher, SIGNAL(serviceUnregistered(const QString &)), | 43 | connect(&m_serviceWatcher, SIGNAL(serviceUnregistered(const QString &)), |
180 | @@ -202,7 +203,7 @@ | |||
181 | 202 | // Hold onto a token for the active window | 203 | // Hold onto a token for the active window |
182 | 203 | updateToken(window); | 204 | updateToken(window); |
183 | 204 | 205 | ||
185 | 205 | m_windowToken->search(m_query, m_results); | 206 | m_windowToken->search(m_query, m_emptyBehaviour, m_results); |
186 | 206 | 207 | ||
187 | 207 | notifyPropertyChanged("com.canonical.hud.query", "ToolbarItems"); | 208 | notifyPropertyChanged("com.canonical.hud.query", "ToolbarItems"); |
188 | 208 | } | 209 | } |
189 | 209 | 210 | ||
190 | === modified file 'service/QueryImpl.h' | |||
191 | --- service/QueryImpl.h 2013-12-17 16:37:55 +0000 | |||
192 | +++ service/QueryImpl.h 2014-03-14 14:07:05 +0000 | |||
193 | @@ -43,9 +43,9 @@ | |||
194 | 43 | Q_OBJECT | 43 | Q_OBJECT |
195 | 44 | public: | 44 | public: |
196 | 45 | QueryImpl(unsigned int id, const QString &query, const QString &sender, | 45 | QueryImpl(unsigned int id, const QString &query, const QString &sender, |
200 | 46 | HudService &service, ApplicationList::Ptr applicationList, | 46 | EmptyBehaviour emptyBehaviour, HudService &service, |
201 | 47 | Voice::Ptr voice, const QDBusConnection &connection, | 47 | ApplicationList::Ptr applicationList, Voice::Ptr voice, |
202 | 48 | QObject *parent = 0); | 48 | const QDBusConnection &connection, QObject *parent = 0); |
203 | 49 | 49 | ||
204 | 50 | virtual ~QueryImpl(); | 50 | virtual ~QueryImpl(); |
205 | 51 | 51 | ||
206 | @@ -98,6 +98,8 @@ | |||
207 | 98 | 98 | ||
208 | 99 | HudService &m_service; | 99 | HudService &m_service; |
209 | 100 | 100 | ||
210 | 101 | EmptyBehaviour m_emptyBehaviour; | ||
211 | 102 | |||
212 | 101 | ApplicationList::Ptr m_applicationList; | 103 | ApplicationList::Ptr m_applicationList; |
213 | 102 | 104 | ||
214 | 103 | Voice::Ptr m_voice; | 105 | Voice::Ptr m_voice; |
215 | 104 | 106 | ||
216 | === modified file 'service/Window.h' | |||
217 | --- service/Window.h 2013-12-09 10:53:01 +0000 | |||
218 | +++ service/Window.h 2014-03-14 14:07:05 +0000 | |||
219 | @@ -19,6 +19,7 @@ | |||
220 | 19 | #ifndef HUD_SERVICE_WINDOW_H_ | 19 | #ifndef HUD_SERVICE_WINDOW_H_ |
221 | 20 | #define HUD_SERVICE_WINDOW_H_ | 20 | #define HUD_SERVICE_WINDOW_H_ |
222 | 21 | 21 | ||
223 | 22 | #include <service/Query.h> | ||
224 | 22 | #include <service/Result.h> | 23 | #include <service/Result.h> |
225 | 23 | #include <service/WindowContext.h> | 24 | #include <service/WindowContext.h> |
226 | 24 | 25 | ||
227 | @@ -35,7 +36,8 @@ | |||
228 | 35 | 36 | ||
229 | 36 | virtual ~WindowToken(); | 37 | virtual ~WindowToken(); |
230 | 37 | 38 | ||
232 | 38 | virtual void search(const QString &query, QList<Result> &results) = 0; | 39 | virtual void search(const QString &query, |
233 | 40 | Query::EmptyBehaviour emptyBehaviour, QList<Result> &results) = 0; | ||
234 | 39 | 41 | ||
235 | 40 | virtual void execute(unsigned long long commandId) = 0; | 42 | virtual void execute(unsigned long long commandId) = 0; |
236 | 41 | 43 | ||
237 | 42 | 44 | ||
238 | === modified file 'service/WindowImpl.cpp' | |||
239 | --- service/WindowImpl.cpp 2014-02-05 16:51:38 +0000 | |||
240 | +++ service/WindowImpl.cpp 2014-03-14 14:07:05 +0000 | |||
241 | @@ -45,8 +45,9 @@ | |||
242 | 45 | return m_tokens; | 45 | return m_tokens; |
243 | 46 | } | 46 | } |
244 | 47 | 47 | ||
247 | 48 | void WindowTokenImpl::search(const QString &query, QList<Result> &results) { | 48 | void WindowTokenImpl::search(const QString &query, |
248 | 49 | m_items->search(query, results); | 49 | Query::EmptyBehaviour emptyBehaviour, QList<Result> &results) { |
249 | 50 | m_items->search(query, emptyBehaviour, results); | ||
250 | 50 | } | 51 | } |
251 | 51 | 52 | ||
252 | 52 | void WindowTokenImpl::execute(unsigned long long commandId) { | 53 | void WindowTokenImpl::execute(unsigned long long commandId) { |
253 | 53 | 54 | ||
254 | === modified file 'service/WindowImpl.h' | |||
255 | --- service/WindowImpl.h 2013-12-20 13:19:01 +0000 | |||
256 | +++ service/WindowImpl.h 2014-03-14 14:07:05 +0000 | |||
257 | @@ -44,7 +44,8 @@ | |||
258 | 44 | 44 | ||
259 | 45 | virtual ~WindowTokenImpl(); | 45 | virtual ~WindowTokenImpl(); |
260 | 46 | 46 | ||
262 | 47 | void search(const QString &query, QList<Result> &results) override; | 47 | void search(const QString &query, Query::EmptyBehaviour emptyBehaviour, |
263 | 48 | QList<Result> &results) override; | ||
264 | 48 | 49 | ||
265 | 49 | void execute(unsigned long long commandId) override; | 50 | void execute(unsigned long long commandId) override; |
266 | 50 | 51 | ||
267 | 51 | 52 | ||
268 | === modified file 'tests/unit/service/Mocks.h' | |||
269 | --- tests/unit/service/Mocks.h 2013-12-19 12:58:11 +0000 | |||
270 | +++ tests/unit/service/Mocks.h 2014-03-14 14:07:05 +0000 | |||
271 | @@ -34,7 +34,7 @@ | |||
272 | 34 | 34 | ||
273 | 35 | MOCK_METHOD0(sessionBus, QDBusConnection()); | 35 | MOCK_METHOD0(sessionBus, QDBusConnection()); |
274 | 36 | 36 | ||
276 | 37 | MOCK_METHOD2(newQuery, Query::Ptr( const QString &, const QString &)); | 37 | MOCK_METHOD3(newQuery, Query::Ptr( const QString &, const QString &, Query::EmptyBehaviour)); |
277 | 38 | 38 | ||
278 | 39 | MOCK_METHOD1(newApplication, Application::Ptr(const QString &)); | 39 | MOCK_METHOD1(newApplication, Application::Ptr(const QString &)); |
279 | 40 | 40 | ||
280 | @@ -106,7 +106,8 @@ | |||
281 | 106 | 106 | ||
282 | 107 | class MockWindowToken: public WindowToken { | 107 | class MockWindowToken: public WindowToken { |
283 | 108 | public: | 108 | public: |
285 | 109 | MOCK_METHOD2(search, void(const QString &, QList<Result> &)); | 109 | MOCK_METHOD3(search, void(const QString &, |
286 | 110 | Query::EmptyBehaviour emptyBehaviour, QList<Result> &)); | ||
287 | 110 | 111 | ||
288 | 111 | MOCK_METHOD1(execute, void(unsigned long long)); | 112 | MOCK_METHOD1(execute, void(unsigned long long)); |
289 | 112 | 113 | ||
290 | 113 | 114 | ||
291 | === modified file 'tests/unit/service/TestHudService.cpp' | |||
292 | --- tests/unit/service/TestHudService.cpp 2013-11-21 09:20:54 +0000 | |||
293 | +++ tests/unit/service/TestHudService.cpp 2014-03-14 14:07:05 +0000 | |||
294 | @@ -53,7 +53,8 @@ | |||
295 | 53 | }; | 53 | }; |
296 | 54 | 54 | ||
297 | 55 | TEST_F(TestHudService, OpenCloseQuery) { | 55 | TEST_F(TestHudService, OpenCloseQuery) { |
299 | 56 | HudServiceImpl hudService(factory, applicationList, dbus.sessionConnection()); | 56 | HudServiceImpl hudService(factory, applicationList, |
300 | 57 | dbus.sessionConnection()); | ||
301 | 57 | 58 | ||
302 | 58 | QDBusObjectPath queryPath("/path/query0"); | 59 | QDBusObjectPath queryPath("/path/query0"); |
303 | 59 | QString resultsModel("com.canonical.hud.results0"); | 60 | QString resultsModel("com.canonical.hud.results0"); |
304 | @@ -63,7 +64,7 @@ | |||
305 | 63 | ON_CALL(*query, resultsModel()).WillByDefault(Return(resultsModel)); | 64 | ON_CALL(*query, resultsModel()).WillByDefault(Return(resultsModel)); |
306 | 64 | ON_CALL(*query, appstackModel()).WillByDefault(Return(appstackModel)); | 65 | ON_CALL(*query, appstackModel()).WillByDefault(Return(appstackModel)); |
307 | 65 | 66 | ||
309 | 66 | EXPECT_CALL(factory, newQuery(QString("query text"), QString("local"))).Times( | 67 | EXPECT_CALL(factory, newQuery(QString("query text"), QString("local"), Query::EmptyBehaviour::SHOW_SUGGESTIONS)).Times( |
310 | 67 | 1).WillOnce(Return(query)); | 68 | 1).WillOnce(Return(query)); |
311 | 68 | 69 | ||
312 | 69 | QString resultsName; | 70 | QString resultsName; |
313 | @@ -83,7 +84,8 @@ | |||
314 | 83 | } | 84 | } |
315 | 84 | 85 | ||
316 | 85 | TEST_F(TestHudService, CloseUnknownQuery) { | 86 | TEST_F(TestHudService, CloseUnknownQuery) { |
318 | 86 | HudServiceImpl hudService(factory, applicationList, dbus.sessionConnection()); | 87 | HudServiceImpl hudService(factory, applicationList, |
319 | 88 | dbus.sessionConnection()); | ||
320 | 87 | 89 | ||
321 | 88 | QDBusObjectPath queryPath("/path/query0"); | 90 | QDBusObjectPath queryPath("/path/query0"); |
322 | 89 | 91 | ||
323 | @@ -93,7 +95,8 @@ | |||
324 | 93 | } | 95 | } |
325 | 94 | 96 | ||
326 | 95 | TEST_F(TestHudService, CreateMultipleQueries) { | 97 | TEST_F(TestHudService, CreateMultipleQueries) { |
328 | 96 | HudServiceImpl hudService(factory, applicationList, dbus.sessionConnection()); | 98 | HudServiceImpl hudService(factory, applicationList, |
329 | 99 | dbus.sessionConnection()); | ||
330 | 97 | 100 | ||
331 | 98 | QDBusObjectPath queryPath0("/path/query0"); | 101 | QDBusObjectPath queryPath0("/path/query0"); |
332 | 99 | QString resultsModel0("com.canonical.hud.results0"); | 102 | QString resultsModel0("com.canonical.hud.results0"); |
333 | @@ -111,10 +114,10 @@ | |||
334 | 111 | ON_CALL(*query1, resultsModel()).WillByDefault(Return(resultsModel1)); | 114 | ON_CALL(*query1, resultsModel()).WillByDefault(Return(resultsModel1)); |
335 | 112 | ON_CALL(*query1, appstackModel()).WillByDefault(Return(appstackModel1)); | 115 | ON_CALL(*query1, appstackModel()).WillByDefault(Return(appstackModel1)); |
336 | 113 | 116 | ||
341 | 114 | EXPECT_CALL(factory, newQuery(QString("query0"), QString("local"))).Times(1).WillOnce( | 117 | EXPECT_CALL(factory, newQuery(QString("query0"), QString("local"), Query::EmptyBehaviour::SHOW_SUGGESTIONS)).Times( |
342 | 115 | Return(query0)); | 118 | 1).WillOnce(Return(query0)); |
343 | 116 | EXPECT_CALL(factory, newQuery(QString("query1"), QString("local"))).Times(1).WillOnce( | 119 | EXPECT_CALL(factory, newQuery(QString("query1"), QString("local"), Query::EmptyBehaviour::SHOW_SUGGESTIONS)).Times( |
344 | 117 | Return(query1)); | 120 | 1).WillOnce(Return(query1)); |
345 | 118 | 121 | ||
346 | 119 | int modelRevision; | 122 | int modelRevision; |
347 | 120 | QString resultsName; | 123 | QString resultsName; |
348 | @@ -153,7 +156,8 @@ | |||
349 | 153 | ON_CALL(*applicationList, focusedApplication()).WillByDefault( | 156 | ON_CALL(*applicationList, focusedApplication()).WillByDefault( |
350 | 154 | Return(application)); | 157 | Return(application)); |
351 | 155 | 158 | ||
353 | 156 | HudServiceImpl hudService(factory, applicationList, dbus.sessionConnection()); | 159 | HudServiceImpl hudService(factory, applicationList, |
354 | 160 | dbus.sessionConnection()); | ||
355 | 157 | 161 | ||
356 | 158 | QDBusObjectPath queryPath("/path/query0"); | 162 | QDBusObjectPath queryPath("/path/query0"); |
357 | 159 | QList<Result> results; | 163 | QList<Result> results; |
358 | @@ -172,7 +176,7 @@ | |||
359 | 172 | ON_CALL(*query, path()).WillByDefault(ReturnRef(queryPath)); | 176 | ON_CALL(*query, path()).WillByDefault(ReturnRef(queryPath)); |
360 | 173 | ON_CALL(*query, results()).WillByDefault(ReturnRef(results)); | 177 | ON_CALL(*query, results()).WillByDefault(ReturnRef(results)); |
361 | 174 | 178 | ||
363 | 175 | EXPECT_CALL(factory, newQuery(QString("query text"), QString("local"))).Times( | 179 | EXPECT_CALL(factory, newQuery(QString("query text"), QString("local"), Query::EmptyBehaviour::NO_SUGGESTIONS)).Times( |
364 | 176 | 1).WillOnce(Return(query)); | 180 | 1).WillOnce(Return(query)); |
365 | 177 | 181 | ||
366 | 178 | QList<Suggestion> suggestions; | 182 | QList<Suggestion> suggestions; |
367 | @@ -213,13 +217,13 @@ | |||
368 | 213 | 217 | ||
369 | 214 | QSharedPointer<MockApplication> application( | 218 | QSharedPointer<MockApplication> application( |
370 | 215 | new NiceMock<MockApplication>()); | 219 | new NiceMock<MockApplication>()); |
373 | 216 | ON_CALL(*application, path()).WillByDefault( | 220 | ON_CALL(*application, path()).WillByDefault(ReturnRef(path)); |
372 | 217 | ReturnRef(path)); | ||
374 | 218 | 221 | ||
375 | 219 | EXPECT_CALL(*applicationList, ensureApplication(QString("app-id"))).WillOnce( | 222 | EXPECT_CALL(*applicationList, ensureApplication(QString("app-id"))).WillOnce( |
376 | 220 | Return(application)); | 223 | Return(application)); |
377 | 221 | 224 | ||
379 | 222 | HudServiceImpl hudService(factory, applicationList, dbus.sessionConnection()); | 225 | HudServiceImpl hudService(factory, applicationList, |
380 | 226 | dbus.sessionConnection()); | ||
381 | 223 | 227 | ||
382 | 224 | EXPECT_EQ(path, hudService.RegisterApplication("app-id")); | 228 | EXPECT_EQ(path, hudService.RegisterApplication("app-id")); |
383 | 225 | } | 229 | } |
384 | 226 | 230 | ||
385 | === modified file 'tests/unit/service/TestItemStore.cpp' | |||
386 | --- tests/unit/service/TestItemStore.cpp 2014-02-17 09:58:27 +0000 | |||
387 | +++ tests/unit/service/TestItemStore.cpp 2014-03-14 14:07:05 +0000 | |||
388 | @@ -44,7 +44,7 @@ | |||
389 | 44 | /* Test a set of strings */ | 44 | /* Test a set of strings */ |
390 | 45 | string search(const QString &query) { | 45 | string search(const QString &query) { |
391 | 46 | QList<Result> results; | 46 | QList<Result> results; |
393 | 47 | store->search(query, results); | 47 | store->search(query, Query::EmptyBehaviour::SHOW_SUGGESTIONS, results); |
394 | 48 | 48 | ||
395 | 49 | QString result; | 49 | QString result; |
396 | 50 | 50 | ||
397 | @@ -257,7 +257,7 @@ | |||
398 | 257 | Return(3)); | 257 | Return(3)); |
399 | 258 | 258 | ||
400 | 259 | QList<Result> results; | 259 | QList<Result> results; |
402 | 260 | store->search("", results); | 260 | store->search("", Query::EmptyBehaviour::SHOW_SUGGESTIONS, results); |
403 | 261 | ASSERT_EQ(4, results.size()); | 261 | ASSERT_EQ(4, results.size()); |
404 | 262 | EXPECT_EQ(QString("Three"), results.at(0).commandName()); | 262 | EXPECT_EQ(QString("Three"), results.at(0).commandName()); |
405 | 263 | EXPECT_EQ(QString("Four"), results.at(1).commandName()); | 263 | EXPECT_EQ(QString("Four"), results.at(1).commandName()); |
406 | @@ -265,6 +265,36 @@ | |||
407 | 265 | EXPECT_EQ(QString("Two"), results.at(3).commandName()); | 265 | EXPECT_EQ(QString("Two"), results.at(3).commandName()); |
408 | 266 | } | 266 | } |
409 | 267 | 267 | ||
410 | 268 | TEST_F(TestItemStore, BlankSearchNoSuggestions) { | ||
411 | 269 | QMenu root; | ||
412 | 270 | |||
413 | 271 | QMenu file("&File"); | ||
414 | 272 | file.addAction("&One"); | ||
415 | 273 | file.addAction("&Two"); | ||
416 | 274 | file.addAction("T&hree"); | ||
417 | 275 | file.addAction("Fou&r"); | ||
418 | 276 | root.addMenu(&file); | ||
419 | 277 | |||
420 | 278 | store->indexMenu(&root); | ||
421 | 279 | |||
422 | 280 | ON_CALL(*usageTracker, | ||
423 | 281 | usage(QString("app-id"), QString("File||One"))).WillByDefault( | ||
424 | 282 | Return(2)); | ||
425 | 283 | ON_CALL(*usageTracker, | ||
426 | 284 | usage(QString("app-id"), QString("File||Two"))).WillByDefault( | ||
427 | 285 | Return(0)); | ||
428 | 286 | ON_CALL(*usageTracker, | ||
429 | 287 | usage(QString("app-id"), QString("File||Three"))).WillByDefault( | ||
430 | 288 | Return(4)); | ||
431 | 289 | ON_CALL(*usageTracker, | ||
432 | 290 | usage(QString("app-id"), QString("File||Four"))).WillByDefault( | ||
433 | 291 | Return(3)); | ||
434 | 292 | |||
435 | 293 | QList<Result> results; | ||
436 | 294 | store->search("", Query::EmptyBehaviour::NO_SUGGESTIONS, results); | ||
437 | 295 | ASSERT_TRUE(results.empty()); | ||
438 | 296 | } | ||
439 | 297 | |||
440 | 268 | TEST_F(TestItemStore, ExecuteMarksHistory) { | 298 | TEST_F(TestItemStore, ExecuteMarksHistory) { |
441 | 269 | QMenu root; | 299 | QMenu root; |
442 | 270 | 300 | ||
443 | 271 | 301 | ||
444 | === modified file 'tests/unit/service/TestQuery.cpp' | |||
445 | --- tests/unit/service/TestQuery.cpp 2013-12-09 11:11:18 +0000 | |||
446 | +++ tests/unit/service/TestQuery.cpp 2014-03-14 14:07:05 +0000 | |||
447 | @@ -113,13 +113,15 @@ | |||
448 | 113 | 113 | ||
449 | 114 | EXPECT_CALL(*window, activate()).WillOnce(Return(windowToken)); | 114 | EXPECT_CALL(*window, activate()).WillOnce(Return(windowToken)); |
450 | 115 | 115 | ||
453 | 116 | EXPECT_CALL(*windowToken, search(queryString, _)).WillOnce( | 116 | EXPECT_CALL(*windowToken, search(queryString, Query::EmptyBehaviour::SHOW_SUGGESTIONS, _)).WillOnce( |
454 | 117 | Invoke([&expectedResults](const QString &, QList<Result> &results) { | 117 | Invoke( |
455 | 118 | [&expectedResults](const QString &, Query::EmptyBehaviour, QList<Result> &results) { | ||
456 | 118 | results.append(expectedResults); | 119 | results.append(expectedResults); |
457 | 119 | })); | 120 | })); |
458 | 120 | 121 | ||
461 | 121 | QueryImpl query(0, queryString, "keep.alive", *hudService, applicationList, | 122 | QueryImpl query(0, queryString, "keep.alive", |
462 | 122 | voice, dbus.sessionConnection()); | 123 | Query::EmptyBehaviour::SHOW_SUGGESTIONS, *hudService, |
463 | 124 | applicationList, voice, dbus.sessionConnection()); | ||
464 | 123 | 125 | ||
465 | 124 | const QList<Result> results(query.results()); | 126 | const QList<Result> results(query.results()); |
466 | 125 | ASSERT_EQ(expectedResults.size(), results.size()); | 127 | ASSERT_EQ(expectedResults.size(), results.size()); |
467 | @@ -129,8 +131,9 @@ | |||
468 | 129 | } | 131 | } |
469 | 130 | 132 | ||
470 | 131 | TEST_F(TestQuery, ExecuteCommand) { | 133 | TEST_F(TestQuery, ExecuteCommand) { |
473 | 132 | QueryImpl query(0, "query", "keep.alive", *hudService, applicationList, | 134 | QueryImpl query(0, "query", "keep.alive", |
474 | 133 | voice, dbus.sessionConnection()); | 135 | Query::EmptyBehaviour::SHOW_SUGGESTIONS, *hudService, |
475 | 136 | applicationList, voice, dbus.sessionConnection()); | ||
476 | 134 | 137 | ||
477 | 135 | EXPECT_CALL(*windowToken, execute(123)); | 138 | EXPECT_CALL(*windowToken, execute(123)); |
478 | 136 | query.ExecuteCommand(QDBusVariant(123), 12345); | 139 | query.ExecuteCommand(QDBusVariant(123), 12345); |
479 | @@ -144,7 +147,8 @@ | |||
480 | 144 | keepAliveService->start(dbus.sessionConnection()); | 147 | keepAliveService->start(dbus.sessionConnection()); |
481 | 145 | 148 | ||
482 | 146 | Query::Ptr query( | 149 | Query::Ptr query( |
484 | 147 | new QueryImpl(0, "query", "keep.alive", *hudService, | 150 | new QueryImpl(0, "query", "keep.alive", |
485 | 151 | Query::EmptyBehaviour::SHOW_SUGGESTIONS, *hudService, | ||
486 | 148 | applicationList, voice, dbus.sessionConnection())); | 152 | applicationList, voice, dbus.sessionConnection())); |
487 | 149 | 153 | ||
488 | 150 | EXPECT_CALL(*hudService, closeQuery(query->path())).WillOnce( | 154 | EXPECT_CALL(*hudService, closeQuery(query->path())).WillOnce( |
489 | @@ -169,8 +173,9 @@ | |||
490 | 169 | } | 173 | } |
491 | 170 | 174 | ||
492 | 171 | TEST_F(TestQuery, VoiceQuery) { | 175 | TEST_F(TestQuery, VoiceQuery) { |
495 | 172 | QueryImpl query(0, "query", "keep.alive", *hudService, applicationList, | 176 | QueryImpl query(0, "query", "keep.alive", |
496 | 173 | voice, dbus.sessionConnection()); | 177 | Query::EmptyBehaviour::SHOW_SUGGESTIONS, *hudService, |
497 | 178 | applicationList, voice, dbus.sessionConnection()); | ||
498 | 174 | 179 | ||
499 | 175 | EXPECT_CALL(*voice, listen(QList<QStringList>() | 180 | EXPECT_CALL(*voice, listen(QList<QStringList>() |
500 | 176 | << (QStringList() << "command1" << "command2"))).WillOnce( | 181 | << (QStringList() << "command1" << "command2"))).WillOnce( |
PASSED: Continuous integration, rev:374 jenkins. qa.ubuntu. com/job/ hud-ci/ 233/ jenkins. qa.ubuntu. com/job/ hud-trusty- amd64-ci/ 84 jenkins. qa.ubuntu. com/job/ hud-trusty- armhf-ci/ 83 jenkins. qa.ubuntu. com/job/ hud-trusty- i386-ci/ 83
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/hud- ci/233/ rebuild
http://