~pete-woods/hud/tweak-search-parameters

« back to all changes in this revision

Viewing changes to tests/unit/service/TestQuery.cpp

  • Committer: Pete Woods
  • Date: 2014-02-18 13:35:12 UTC
  • Revision ID: pete.woods@canonical.com-20140218133512-bnrkd5sbd2jr6fpo
Make legacy queries return no results with an empty search string

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
 
114
114
        EXPECT_CALL(*window, activate()).WillOnce(Return(windowToken));
115
115
 
116
 
        EXPECT_CALL(*windowToken, search(queryString, _)).WillOnce(
117
 
                        Invoke([&expectedResults](const QString &, QList<Result> &results) {
 
116
        EXPECT_CALL(*windowToken, search(queryString, Query::EmptyBehaviour::SHOW_SUGGESTIONS, _)).WillOnce(
 
117
                        Invoke(
 
118
                                        [&expectedResults](const QString &, Query::EmptyBehaviour, QList<Result> &results) {
118
119
                                results.append(expectedResults);
119
120
                        }));
120
121
 
121
 
        QueryImpl query(0, queryString, "keep.alive", *hudService, applicationList,
122
 
                        voice, dbus.sessionConnection());
 
122
        QueryImpl query(0, queryString, "keep.alive",
 
123
                        Query::EmptyBehaviour::SHOW_SUGGESTIONS, *hudService,
 
124
                        applicationList, voice, dbus.sessionConnection());
123
125
 
124
126
        const QList<Result> results(query.results());
125
127
        ASSERT_EQ(expectedResults.size(), results.size());
129
131
}
130
132
 
131
133
TEST_F(TestQuery, ExecuteCommand) {
132
 
        QueryImpl query(0, "query", "keep.alive", *hudService, applicationList,
133
 
                        voice, dbus.sessionConnection());
 
134
        QueryImpl query(0, "query", "keep.alive",
 
135
                        Query::EmptyBehaviour::SHOW_SUGGESTIONS, *hudService,
 
136
                        applicationList, voice, dbus.sessionConnection());
134
137
 
135
138
        EXPECT_CALL(*windowToken, execute(123));
136
139
        query.ExecuteCommand(QDBusVariant(123), 12345);
144
147
        keepAliveService->start(dbus.sessionConnection());
145
148
 
146
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
152
                                        applicationList, voice, dbus.sessionConnection()));
149
153
 
150
154
        EXPECT_CALL(*hudService, closeQuery(query->path())).WillOnce(
169
173
}
170
174
 
171
175
TEST_F(TestQuery, VoiceQuery) {
172
 
        QueryImpl query(0, "query", "keep.alive", *hudService, applicationList,
173
 
                        voice, dbus.sessionConnection());
 
176
        QueryImpl query(0, "query", "keep.alive",
 
177
                        Query::EmptyBehaviour::SHOW_SUGGESTIONS, *hudService,
 
178
                        applicationList, voice, dbus.sessionConnection());
174
179
 
175
180
        EXPECT_CALL(*voice, listen(QList<QStringList>()
176
181
                                        << (QStringList() << "command1" << "command2"))).WillOnce(