Merge lp:~pete-woods/hud/no-suggestions-for-legacy-queries into lp:hud/14.04

Proposed by Pete Woods
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
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://wiki.ubuntu.com/Process/Merges/Checklists/hud

Test Plan:
https://wiki.ubuntu.com/Process/Merges/TestPlan/hud

Silo:
https://launchpad.net/~ci-train-ppa-service/+archive/landing-002/

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

LGTM.

Waiting for silo.

Revision history for this message
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.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2014-02-18 14:29:31 +0000
+++ debian/changelog 2014-03-14 14:07:05 +0000
@@ -1,3 +1,11 @@
1hud (13.10.1+14.04.20140304-0ubuntu1) trusty; urgency=low
2
3 [ Pete Woods ]
4 * Change GTK documentation so that it builds with the new glib version
5 (LP: #1287580)
6
7 -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 04 Mar 2014 09:58:04 +0000
8
1hud (13.10.1+14.04.20140218.2-0ubuntu1) trusty; urgency=low9hud (13.10.1+14.04.20140218.2-0ubuntu1) trusty; urgency=low
210
3 [ Pete Woods ]11 [ Pete Woods ]
412
=== modified file 'service/Factory.cpp'
--- service/Factory.cpp 2014-02-15 10:23:45 +0000
+++ service/Factory.cpp 2014-03-14 14:07:05 +0000
@@ -88,9 +88,10 @@
88 return m_sessionBus;88 return m_sessionBus;
89}89}
9090
91Query::Ptr Factory::newQuery(const QString &query, const QString &sender) {91Query::Ptr Factory::newQuery(const QString &query, const QString &sender,
92 Query::EmptyBehaviour emptyBehaviour) {
92 return Query::Ptr(93 return Query::Ptr(
93 new QueryImpl(m_queryCounter++, query, sender,94 new QueryImpl(m_queryCounter++, query, sender, emptyBehaviour,
94 *singletonHudService(), singletonApplicationList(),95 *singletonHudService(), singletonApplicationList(),
95 singletonVoice(), sessionBus()));96 singletonVoice(), sessionBus()));
96}97}
9798
=== modified file 'service/Factory.h'
--- service/Factory.h 2014-02-15 10:23:45 +0000
+++ service/Factory.h 2014-03-14 14:07:05 +0000
@@ -60,7 +60,8 @@
6060
61 virtual QSharedPointer<ComCanonicalAppMenuRegistrarInterface> singletonAppmenu();61 virtual QSharedPointer<ComCanonicalAppMenuRegistrarInterface> singletonAppmenu();
6262
63 virtual Query::Ptr newQuery(const QString &query, const QString &sender);63 virtual Query::Ptr newQuery(const QString &query, const QString &sender,
64 Query::EmptyBehaviour emptyBehaviour);
6465
65 virtual ApplicationList::Ptr singletonApplicationList();66 virtual ApplicationList::Ptr singletonApplicationList();
6667
6768
=== modified file 'service/HudServiceImpl.cpp'
--- service/HudServiceImpl.cpp 2013-12-17 16:37:55 +0000
+++ service/HudServiceImpl.cpp 2014-03-14 14:07:05 +0000
@@ -62,8 +62,8 @@
62}62}
6363
64Query::Ptr HudServiceImpl::createQuery(const QString &query,64Query::Ptr HudServiceImpl::createQuery(const QString &query,
65 const QString &sender) {65 const QString &sender, Query::EmptyBehaviour emptyBehaviour) {
66 Query::Ptr hudQuery(m_factory.newQuery(query, sender));66 Query::Ptr hudQuery(m_factory.newQuery(query, sender, emptyBehaviour));
67 m_queries[hudQuery->path()] = hudQuery;67 m_queries[hudQuery->path()] = hudQuery;
6868
69 return hudQuery;69 return hudQuery;
@@ -73,7 +73,9 @@
73 QString &resultsName, QString &appstackName, int &modelRevision) {73 QString &resultsName, QString &appstackName, int &modelRevision) {
74 QString sender(messageSender());74 QString sender(messageSender());
7575
76 Query::Ptr hudQuery(createQuery(query, sender));76 Query::Ptr hudQuery(
77 createQuery(query, sender,
78 Query::EmptyBehaviour::SHOW_SUGGESTIONS));
7779
78 resultsName = hudQuery->resultsModel();80 resultsName = hudQuery->resultsModel();
79 appstackName = hudQuery->appstackModel();81 appstackName = hudQuery->appstackModel();
@@ -104,7 +106,8 @@
104106
105 Query::Ptr query(m_legacyQueries[sender]);107 Query::Ptr query(m_legacyQueries[sender]);
106 if (query.isNull()) {108 if (query.isNull()) {
107 query = createQuery(queryString, sender);109 query = createQuery(queryString, sender,
110 Query::EmptyBehaviour::NO_SUGGESTIONS);
108 m_legacyQueries[sender] = query;111 m_legacyQueries[sender] = query;
109 } else {112 } else {
110 query->UpdateQuery(queryString);113 query->UpdateQuery(queryString);
111114
=== modified file 'service/HudServiceImpl.h'
--- service/HudServiceImpl.h 2013-12-17 16:37:55 +0000
+++ service/HudServiceImpl.h 2014-03-14 14:07:05 +0000
@@ -74,7 +74,8 @@
74 void CloseQuery(const QDBusVariant &querykey);74 void CloseQuery(const QDBusVariant &querykey);
7575
76protected:76protected:
77 Query::Ptr createQuery(const QString &query, const QString &service);77 Query::Ptr createQuery(const QString &query, const QString &service,
78 Query::EmptyBehaviour emptyBehaviour);
7879
79 QScopedPointer<HudAdaptor> m_adaptor;80 QScopedPointer<HudAdaptor> m_adaptor;
8081
8182
=== modified file 'service/ItemStore.cpp'
--- service/ItemStore.cpp 2014-02-15 10:23:45 +0000
+++ service/ItemStore.cpp 2014-03-14 14:07:05 +0000
@@ -150,10 +150,15 @@
150 return result;150 return result;
151}151}
152152
153void ItemStore::search(const QString &query, QList<Result> &results) {153void ItemStore::search(const QString &query,
154 Query::EmptyBehaviour emptyBehaviour, QList<Result> &results) {
154 QStringMatcher stringMatcher(query, Qt::CaseInsensitive);155 QStringMatcher stringMatcher(query, Qt::CaseInsensitive);
155156
156 if (query.isEmpty()) {157 if (query.isEmpty()) {
158 if (emptyBehaviour == Query::EmptyBehaviour::NO_SUGGESTIONS) {
159 return;
160 }
161
157 QMap<unsigned int, DocumentID> tempResults;162 QMap<unsigned int, DocumentID> tempResults;
158163
159 for (auto it(m_items.constBegin()); it != m_items.constEnd(); ++it) {164 for (auto it(m_items.constBegin()); it != m_items.constEnd(); ++it) {
160165
=== modified file 'service/ItemStore.h'
--- service/ItemStore.h 2014-02-15 10:23:45 +0000
+++ service/ItemStore.h 2014-03-14 14:07:05 +0000
@@ -20,6 +20,7 @@
20#define HUD_SERVICE_ITEMSTORE_H_20#define HUD_SERVICE_ITEMSTORE_H_
2121
22#include <service/Item.h>22#include <service/Item.h>
23#include <service/Query.h>
23#include <service/Result.h>24#include <service/Result.h>
24#include <service/SearchSettings.h>25#include <service/SearchSettings.h>
25#include <service/UsageTracker.h>26#include <service/UsageTracker.h>
@@ -50,7 +51,8 @@
5051
51 void indexMenu(const QMenu *menu);52 void indexMenu(const QMenu *menu);
5253
53 void search(const QString &query, QList<Result> &results);54 void search(const QString &query, Query::EmptyBehaviour emptyBehaviour,
55 QList<Result> &results);
5456
55 void execute(unsigned long long commandId);57 void execute(unsigned long long commandId);
5658
5759
=== modified file 'service/Query.h'
--- service/Query.h 2013-11-18 09:37:43 +0000
+++ service/Query.h 2014-03-14 14:07:05 +0000
@@ -39,6 +39,11 @@
39public:39public:
40 typedef QSharedPointer<Query> Ptr;40 typedef QSharedPointer<Query> Ptr;
4141
42 enum class EmptyBehaviour {
43 SHOW_SUGGESTIONS,
44 NO_SUGGESTIONS,
45 };
46
42 explicit Query(QObject *parent = 0);47 explicit Query(QObject *parent = 0);
4348
44 virtual ~Query();49 virtual ~Query();
4550
=== modified file 'service/QueryImpl.cpp'
--- service/QueryImpl.cpp 2013-12-20 14:44:11 +0000
+++ service/QueryImpl.cpp 2014-03-14 14:07:05 +0000
@@ -30,13 +30,14 @@
30using namespace hud::service;30using namespace hud::service;
3131
32QueryImpl::QueryImpl(unsigned int id, const QString &query,32QueryImpl::QueryImpl(unsigned int id, const QString &query,
33 const QString &sender, HudService &service,33 const QString &sender, EmptyBehaviour emptyBehaviour,
34 ApplicationList::Ptr applicationList, Voice::Ptr voice,34 HudService &service, ApplicationList::Ptr applicationList,
35 const QDBusConnection &connection, QObject *parent) :35 Voice::Ptr voice, const QDBusConnection &connection, QObject *parent) :
36 Query(parent), m_adaptor(new QueryAdaptor(this)), m_connection(36 Query(parent), m_adaptor(new QueryAdaptor(this)), m_connection(
37 connection), m_path(DBusTypes::queryPath(id)), m_service(37 connection), m_path(DBusTypes::queryPath(id)), m_service(
38 service), m_applicationList(applicationList), m_voice(voice), m_query(38 service), m_emptyBehaviour(emptyBehaviour), m_applicationList(
39 query), m_serviceWatcher(sender, m_connection,39 applicationList), m_voice(voice), m_query(query), m_serviceWatcher(
40 sender, m_connection,
40 QDBusServiceWatcher::WatchForUnregistration) {41 QDBusServiceWatcher::WatchForUnregistration) {
4142
42 connect(&m_serviceWatcher, SIGNAL(serviceUnregistered(const QString &)),43 connect(&m_serviceWatcher, SIGNAL(serviceUnregistered(const QString &)),
@@ -202,7 +203,7 @@
202 // Hold onto a token for the active window203 // Hold onto a token for the active window
203 updateToken(window);204 updateToken(window);
204205
205 m_windowToken->search(m_query, m_results);206 m_windowToken->search(m_query, m_emptyBehaviour, m_results);
206207
207 notifyPropertyChanged("com.canonical.hud.query", "ToolbarItems");208 notifyPropertyChanged("com.canonical.hud.query", "ToolbarItems");
208 }209 }
209210
=== modified file 'service/QueryImpl.h'
--- service/QueryImpl.h 2013-12-17 16:37:55 +0000
+++ service/QueryImpl.h 2014-03-14 14:07:05 +0000
@@ -43,9 +43,9 @@
43Q_OBJECT43Q_OBJECT
44public:44public:
45 QueryImpl(unsigned int id, const QString &query, const QString &sender,45 QueryImpl(unsigned int id, const QString &query, const QString &sender,
46 HudService &service, ApplicationList::Ptr applicationList,46 EmptyBehaviour emptyBehaviour, HudService &service,
47 Voice::Ptr voice, const QDBusConnection &connection,47 ApplicationList::Ptr applicationList, Voice::Ptr voice,
48 QObject *parent = 0);48 const QDBusConnection &connection, QObject *parent = 0);
4949
50 virtual ~QueryImpl();50 virtual ~QueryImpl();
5151
@@ -98,6 +98,8 @@
9898
99 HudService &m_service;99 HudService &m_service;
100100
101 EmptyBehaviour m_emptyBehaviour;
102
101 ApplicationList::Ptr m_applicationList;103 ApplicationList::Ptr m_applicationList;
102104
103 Voice::Ptr m_voice;105 Voice::Ptr m_voice;
104106
=== modified file 'service/Window.h'
--- service/Window.h 2013-12-09 10:53:01 +0000
+++ service/Window.h 2014-03-14 14:07:05 +0000
@@ -19,6 +19,7 @@
19#ifndef HUD_SERVICE_WINDOW_H_19#ifndef HUD_SERVICE_WINDOW_H_
20#define HUD_SERVICE_WINDOW_H_20#define HUD_SERVICE_WINDOW_H_
2121
22#include <service/Query.h>
22#include <service/Result.h>23#include <service/Result.h>
23#include <service/WindowContext.h>24#include <service/WindowContext.h>
2425
@@ -35,7 +36,8 @@
3536
36 virtual ~WindowToken();37 virtual ~WindowToken();
3738
38 virtual void search(const QString &query, QList<Result> &results) = 0;39 virtual void search(const QString &query,
40 Query::EmptyBehaviour emptyBehaviour, QList<Result> &results) = 0;
3941
40 virtual void execute(unsigned long long commandId) = 0;42 virtual void execute(unsigned long long commandId) = 0;
4143
4244
=== modified file 'service/WindowImpl.cpp'
--- service/WindowImpl.cpp 2014-02-05 16:51:38 +0000
+++ service/WindowImpl.cpp 2014-03-14 14:07:05 +0000
@@ -45,8 +45,9 @@
45 return m_tokens;45 return m_tokens;
46}46}
4747
48void WindowTokenImpl::search(const QString &query, QList<Result> &results) {48void WindowTokenImpl::search(const QString &query,
49 m_items->search(query, results);49 Query::EmptyBehaviour emptyBehaviour, QList<Result> &results) {
50 m_items->search(query, emptyBehaviour, results);
50}51}
5152
52void WindowTokenImpl::execute(unsigned long long commandId) {53void WindowTokenImpl::execute(unsigned long long commandId) {
5354
=== modified file 'service/WindowImpl.h'
--- service/WindowImpl.h 2013-12-20 13:19:01 +0000
+++ service/WindowImpl.h 2014-03-14 14:07:05 +0000
@@ -44,7 +44,8 @@
4444
45 virtual ~WindowTokenImpl();45 virtual ~WindowTokenImpl();
4646
47 void search(const QString &query, QList<Result> &results) override;47 void search(const QString &query, Query::EmptyBehaviour emptyBehaviour,
48 QList<Result> &results) override;
4849
49 void execute(unsigned long long commandId) override;50 void execute(unsigned long long commandId) override;
5051
5152
=== modified file 'tests/unit/service/Mocks.h'
--- tests/unit/service/Mocks.h 2013-12-19 12:58:11 +0000
+++ tests/unit/service/Mocks.h 2014-03-14 14:07:05 +0000
@@ -34,7 +34,7 @@
3434
35 MOCK_METHOD0(sessionBus, QDBusConnection());35 MOCK_METHOD0(sessionBus, QDBusConnection());
3636
37 MOCK_METHOD2(newQuery, Query::Ptr( const QString &, const QString &));37 MOCK_METHOD3(newQuery, Query::Ptr( const QString &, const QString &, Query::EmptyBehaviour));
3838
39 MOCK_METHOD1(newApplication, Application::Ptr(const QString &));39 MOCK_METHOD1(newApplication, Application::Ptr(const QString &));
4040
@@ -106,7 +106,8 @@
106106
107class MockWindowToken: public WindowToken {107class MockWindowToken: public WindowToken {
108public:108public:
109 MOCK_METHOD2(search, void(const QString &, QList<Result> &));109 MOCK_METHOD3(search, void(const QString &,
110 Query::EmptyBehaviour emptyBehaviour, QList<Result> &));
110111
111 MOCK_METHOD1(execute, void(unsigned long long));112 MOCK_METHOD1(execute, void(unsigned long long));
112113
113114
=== modified file 'tests/unit/service/TestHudService.cpp'
--- tests/unit/service/TestHudService.cpp 2013-11-21 09:20:54 +0000
+++ tests/unit/service/TestHudService.cpp 2014-03-14 14:07:05 +0000
@@ -53,7 +53,8 @@
53};53};
5454
55TEST_F(TestHudService, OpenCloseQuery) {55TEST_F(TestHudService, OpenCloseQuery) {
56 HudServiceImpl hudService(factory, applicationList, dbus.sessionConnection());56 HudServiceImpl hudService(factory, applicationList,
57 dbus.sessionConnection());
5758
58 QDBusObjectPath queryPath("/path/query0");59 QDBusObjectPath queryPath("/path/query0");
59 QString resultsModel("com.canonical.hud.results0");60 QString resultsModel("com.canonical.hud.results0");
@@ -63,7 +64,7 @@
63 ON_CALL(*query, resultsModel()).WillByDefault(Return(resultsModel));64 ON_CALL(*query, resultsModel()).WillByDefault(Return(resultsModel));
64 ON_CALL(*query, appstackModel()).WillByDefault(Return(appstackModel));65 ON_CALL(*query, appstackModel()).WillByDefault(Return(appstackModel));
6566
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(
67 1).WillOnce(Return(query));68 1).WillOnce(Return(query));
6869
69 QString resultsName;70 QString resultsName;
@@ -83,7 +84,8 @@
83}84}
8485
85TEST_F(TestHudService, CloseUnknownQuery) {86TEST_F(TestHudService, CloseUnknownQuery) {
86 HudServiceImpl hudService(factory, applicationList, dbus.sessionConnection());87 HudServiceImpl hudService(factory, applicationList,
88 dbus.sessionConnection());
8789
88 QDBusObjectPath queryPath("/path/query0");90 QDBusObjectPath queryPath("/path/query0");
8991
@@ -93,7 +95,8 @@
93}95}
9496
95TEST_F(TestHudService, CreateMultipleQueries) {97TEST_F(TestHudService, CreateMultipleQueries) {
96 HudServiceImpl hudService(factory, applicationList, dbus.sessionConnection());98 HudServiceImpl hudService(factory, applicationList,
99 dbus.sessionConnection());
97100
98 QDBusObjectPath queryPath0("/path/query0");101 QDBusObjectPath queryPath0("/path/query0");
99 QString resultsModel0("com.canonical.hud.results0");102 QString resultsModel0("com.canonical.hud.results0");
@@ -111,10 +114,10 @@
111 ON_CALL(*query1, resultsModel()).WillByDefault(Return(resultsModel1));114 ON_CALL(*query1, resultsModel()).WillByDefault(Return(resultsModel1));
112 ON_CALL(*query1, appstackModel()).WillByDefault(Return(appstackModel1));115 ON_CALL(*query1, appstackModel()).WillByDefault(Return(appstackModel1));
113116
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(
115 Return(query0));118 1).WillOnce(Return(query0));
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(
117 Return(query1));120 1).WillOnce(Return(query1));
118121
119 int modelRevision;122 int modelRevision;
120 QString resultsName;123 QString resultsName;
@@ -153,7 +156,8 @@
153 ON_CALL(*applicationList, focusedApplication()).WillByDefault(156 ON_CALL(*applicationList, focusedApplication()).WillByDefault(
154 Return(application));157 Return(application));
155158
156 HudServiceImpl hudService(factory, applicationList, dbus.sessionConnection());159 HudServiceImpl hudService(factory, applicationList,
160 dbus.sessionConnection());
157161
158 QDBusObjectPath queryPath("/path/query0");162 QDBusObjectPath queryPath("/path/query0");
159 QList<Result> results;163 QList<Result> results;
@@ -172,7 +176,7 @@
172 ON_CALL(*query, path()).WillByDefault(ReturnRef(queryPath));176 ON_CALL(*query, path()).WillByDefault(ReturnRef(queryPath));
173 ON_CALL(*query, results()).WillByDefault(ReturnRef(results));177 ON_CALL(*query, results()).WillByDefault(ReturnRef(results));
174178
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(
176 1).WillOnce(Return(query));180 1).WillOnce(Return(query));
177181
178 QList<Suggestion> suggestions;182 QList<Suggestion> suggestions;
@@ -213,13 +217,13 @@
213217
214 QSharedPointer<MockApplication> application(218 QSharedPointer<MockApplication> application(
215 new NiceMock<MockApplication>());219 new NiceMock<MockApplication>());
216 ON_CALL(*application, path()).WillByDefault(220 ON_CALL(*application, path()).WillByDefault(ReturnRef(path));
217 ReturnRef(path));
218221
219 EXPECT_CALL(*applicationList, ensureApplication(QString("app-id"))).WillOnce(222 EXPECT_CALL(*applicationList, ensureApplication(QString("app-id"))).WillOnce(
220 Return(application));223 Return(application));
221224
222 HudServiceImpl hudService(factory, applicationList, dbus.sessionConnection());225 HudServiceImpl hudService(factory, applicationList,
226 dbus.sessionConnection());
223227
224 EXPECT_EQ(path, hudService.RegisterApplication("app-id"));228 EXPECT_EQ(path, hudService.RegisterApplication("app-id"));
225}229}
226230
=== modified file 'tests/unit/service/TestItemStore.cpp'
--- tests/unit/service/TestItemStore.cpp 2014-02-17 09:58:27 +0000
+++ tests/unit/service/TestItemStore.cpp 2014-03-14 14:07:05 +0000
@@ -44,7 +44,7 @@
44 /* Test a set of strings */44 /* Test a set of strings */
45 string search(const QString &query) {45 string search(const QString &query) {
46 QList<Result> results;46 QList<Result> results;
47 store->search(query, results);47 store->search(query, Query::EmptyBehaviour::SHOW_SUGGESTIONS, results);
4848
49 QString result;49 QString result;
5050
@@ -257,7 +257,7 @@
257 Return(3));257 Return(3));
258258
259 QList<Result> results;259 QList<Result> results;
260 store->search("", results);260 store->search("", Query::EmptyBehaviour::SHOW_SUGGESTIONS, results);
261 ASSERT_EQ(4, results.size());261 ASSERT_EQ(4, results.size());
262 EXPECT_EQ(QString("Three"), results.at(0).commandName());262 EXPECT_EQ(QString("Three"), results.at(0).commandName());
263 EXPECT_EQ(QString("Four"), results.at(1).commandName());263 EXPECT_EQ(QString("Four"), results.at(1).commandName());
@@ -265,6 +265,36 @@
265 EXPECT_EQ(QString("Two"), results.at(3).commandName());265 EXPECT_EQ(QString("Two"), results.at(3).commandName());
266}266}
267267
268TEST_F(TestItemStore, BlankSearchNoSuggestions) {
269 QMenu root;
270
271 QMenu file("&File");
272 file.addAction("&One");
273 file.addAction("&Two");
274 file.addAction("T&hree");
275 file.addAction("Fou&r");
276 root.addMenu(&file);
277
278 store->indexMenu(&root);
279
280 ON_CALL(*usageTracker,
281 usage(QString("app-id"), QString("File||One"))).WillByDefault(
282 Return(2));
283 ON_CALL(*usageTracker,
284 usage(QString("app-id"), QString("File||Two"))).WillByDefault(
285 Return(0));
286 ON_CALL(*usageTracker,
287 usage(QString("app-id"), QString("File||Three"))).WillByDefault(
288 Return(4));
289 ON_CALL(*usageTracker,
290 usage(QString("app-id"), QString("File||Four"))).WillByDefault(
291 Return(3));
292
293 QList<Result> results;
294 store->search("", Query::EmptyBehaviour::NO_SUGGESTIONS, results);
295 ASSERT_TRUE(results.empty());
296}
297
268TEST_F(TestItemStore, ExecuteMarksHistory) {298TEST_F(TestItemStore, ExecuteMarksHistory) {
269 QMenu root;299 QMenu root;
270300
271301
=== modified file 'tests/unit/service/TestQuery.cpp'
--- tests/unit/service/TestQuery.cpp 2013-12-09 11:11:18 +0000
+++ tests/unit/service/TestQuery.cpp 2014-03-14 14:07:05 +0000
@@ -113,13 +113,15 @@
113113
114 EXPECT_CALL(*window, activate()).WillOnce(Return(windowToken));114 EXPECT_CALL(*window, activate()).WillOnce(Return(windowToken));
115115
116 EXPECT_CALL(*windowToken, search(queryString, _)).WillOnce(116 EXPECT_CALL(*windowToken, search(queryString, Query::EmptyBehaviour::SHOW_SUGGESTIONS, _)).WillOnce(
117 Invoke([&expectedResults](const QString &, QList<Result> &results) {117 Invoke(
118 [&expectedResults](const QString &, Query::EmptyBehaviour, QList<Result> &results) {
118 results.append(expectedResults);119 results.append(expectedResults);
119 }));120 }));
120121
121 QueryImpl query(0, queryString, "keep.alive", *hudService, applicationList,122 QueryImpl query(0, queryString, "keep.alive",
122 voice, dbus.sessionConnection());123 Query::EmptyBehaviour::SHOW_SUGGESTIONS, *hudService,
124 applicationList, voice, dbus.sessionConnection());
123125
124 const QList<Result> results(query.results());126 const QList<Result> results(query.results());
125 ASSERT_EQ(expectedResults.size(), results.size());127 ASSERT_EQ(expectedResults.size(), results.size());
@@ -129,8 +131,9 @@
129}131}
130132
131TEST_F(TestQuery, ExecuteCommand) {133TEST_F(TestQuery, ExecuteCommand) {
132 QueryImpl query(0, "query", "keep.alive", *hudService, applicationList,134 QueryImpl query(0, "query", "keep.alive",
133 voice, dbus.sessionConnection());135 Query::EmptyBehaviour::SHOW_SUGGESTIONS, *hudService,
136 applicationList, voice, dbus.sessionConnection());
134137
135 EXPECT_CALL(*windowToken, execute(123));138 EXPECT_CALL(*windowToken, execute(123));
136 query.ExecuteCommand(QDBusVariant(123), 12345);139 query.ExecuteCommand(QDBusVariant(123), 12345);
@@ -144,7 +147,8 @@
144 keepAliveService->start(dbus.sessionConnection());147 keepAliveService->start(dbus.sessionConnection());
145148
146 Query::Ptr query(149 Query::Ptr query(
147 new QueryImpl(0, "query", "keep.alive", *hudService,150 new QueryImpl(0, "query", "keep.alive",
151 Query::EmptyBehaviour::SHOW_SUGGESTIONS, *hudService,
148 applicationList, voice, dbus.sessionConnection()));152 applicationList, voice, dbus.sessionConnection()));
149153
150 EXPECT_CALL(*hudService, closeQuery(query->path())).WillOnce(154 EXPECT_CALL(*hudService, closeQuery(query->path())).WillOnce(
@@ -169,8 +173,9 @@
169}173}
170174
171TEST_F(TestQuery, VoiceQuery) {175TEST_F(TestQuery, VoiceQuery) {
172 QueryImpl query(0, "query", "keep.alive", *hudService, applicationList,176 QueryImpl query(0, "query", "keep.alive",
173 voice, dbus.sessionConnection());177 Query::EmptyBehaviour::SHOW_SUGGESTIONS, *hudService,
178 applicationList, voice, dbus.sessionConnection());
174179
175 EXPECT_CALL(*voice, listen(QList<QStringList>()180 EXPECT_CALL(*voice, listen(QList<QStringList>()
176 << (QStringList() << "command1" << "command2"))).WillOnce(181 << (QStringList() << "command1" << "command2"))).WillOnce(

Subscribers

People subscribed via source and target branches