Merge lp:~pete-woods/hud/quit-action into lp:hud/14.04

Proposed by Pete Woods
Status: Merged
Approved by: Ted Gould
Approved revision: 366
Merged at revision: 364
Proposed branch: lp:~pete-woods/hud/quit-action
Merge into: lp:hud/14.04
Diff against target: 137 lines (+31/-10)
3 files modified
libhud-client/HudToolbarModel.cpp (+4/-1)
libhud-client/toolbar-items.h (+2/-0)
tests/integration/TestHud.cpp (+25/-9)
To merge this branch: bzr merge lp:~pete-woods/hud/quit-action
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+202835@code.launchpad.net

Commit message

Re-enable quit action in HUD client library

Description of the change

Re-enable quit action in HUD client library

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~pete-woods/hud/quit-action updated
363. By Pete Woods

Fix the tests

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~pete-woods/hud/quit-action updated
364. By Pete Woods

Fix indexes in test

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~pete-woods/hud/quit-action updated
365. By Pete Woods

Fix enabled status check

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~pete-woods/hud/quit-action updated
366. By Pete Woods

Consistently give the count change a second chance

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libhud-client/HudToolbarModel.cpp'
--- libhud-client/HudToolbarModel.cpp 2013-11-13 11:22:36 +0000
+++ libhud-client/HudToolbarModel.cpp 2014-01-24 14:25:48 +0000
@@ -26,6 +26,8 @@
2626
27static QString iconForAction(int action) {27static QString iconForAction(int action) {
28 switch (action) {28 switch (action) {
29 case HUD_CLIENT_QUERY_TOOLBAR_QUIT:
30 return "graphics/close.png";
29 case HUD_CLIENT_QUERY_TOOLBAR_UNDO:31 case HUD_CLIENT_QUERY_TOOLBAR_UNDO:
30 return "graphics/undo.png";32 return "graphics/undo.png";
31 case HUD_CLIENT_QUERY_TOOLBAR_HELP:33 case HUD_CLIENT_QUERY_TOOLBAR_HELP:
@@ -48,7 +50,8 @@
48HudToolBarModel::HudToolBarModel(HudClientQuery *query) :50HudToolBarModel::HudToolBarModel(HudClientQuery *query) :
49 p(new Priv()) {51 p(new Priv()) {
50 p->m_query = query;52 p->m_query = query;
51 p->m_actions << HUD_CLIENT_QUERY_TOOLBAR_UNDO53 p->m_actions << HUD_CLIENT_QUERY_TOOLBAR_QUIT
54 << HUD_CLIENT_QUERY_TOOLBAR_UNDO
52 << HUD_CLIENT_QUERY_TOOLBAR_HELP55 << HUD_CLIENT_QUERY_TOOLBAR_HELP
53 << HUD_CLIENT_QUERY_TOOLBAR_FULLSCREEN56 << HUD_CLIENT_QUERY_TOOLBAR_FULLSCREEN
54 << HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES;57 << HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES;
5558
=== modified file 'libhud-client/toolbar-items.h'
--- libhud-client/toolbar-items.h 2013-12-17 16:37:55 +0000
+++ libhud-client/toolbar-items.h 2014-01-24 14:25:48 +0000
@@ -25,6 +25,7 @@
25 * @HUD_CLIENT_QUERY_TOOLBAR_HELP: Help the user use the application25 * @HUD_CLIENT_QUERY_TOOLBAR_HELP: Help the user use the application
26 * @HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES: Configure the application26 * @HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES: Configure the application
27 * @HUD_CLIENT_QUERY_TOOLBAR_UNDO: Revert the last user action27 * @HUD_CLIENT_QUERY_TOOLBAR_UNDO: Revert the last user action
28 * @HUD_CLIENT_QUERY_TOOLBAR_QUIT: Quit the application
28 *29 *
29 * @short_description: Preconfigured toolbar items for the application30 * @short_description: Preconfigured toolbar items for the application
30 *31 *
@@ -37,6 +38,7 @@
37 HUD_CLIENT_QUERY_TOOLBAR_HELP,38 HUD_CLIENT_QUERY_TOOLBAR_HELP,
38 HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES,39 HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES,
39 HUD_CLIENT_QUERY_TOOLBAR_UNDO,40 HUD_CLIENT_QUERY_TOOLBAR_UNDO,
41 HUD_CLIENT_QUERY_TOOLBAR_QUIT,
40} HudClientQueryToolbarItems;42} HudClientQueryToolbarItems;
4143
42#endif /* LIBHUD_CLIENT_TOOLBAR_ITEMS_H_ */44#endif /* LIBHUD_CLIENT_TOOLBAR_ITEMS_H_ */
4345
=== modified file 'tests/integration/TestHud.cpp'
--- tests/integration/TestHud.cpp 2013-12-17 11:20:24 +0000
+++ tests/integration/TestHud.cpp 2014-01-24 14:25:48 +0000
@@ -183,6 +183,9 @@
183 countChangedSpy.wait();183 countChangedSpy.wait();
184184
185 QAbstractListModel &results(*client.results());185 QAbstractListModel &results(*client.results());
186 if(results.rowCount() != 3) {
187 countChangedSpy.wait();
188 }
186 ASSERT_EQ(3, results.rowCount());189 ASSERT_EQ(3, results.rowCount());
187 EXPECT_EQ(ResultPair("swift sad", "piece hook"), result(results, 0));190 EXPECT_EQ(ResultPair("swift sad", "piece hook"), result(results, 0));
188 EXPECT_EQ(ResultPair("stray slash", "piece hook"), result(results, 1));191 EXPECT_EQ(ResultPair("stray slash", "piece hook"), result(results, 1));
@@ -215,6 +218,9 @@
215 countChangedSpy.wait();218 countChangedSpy.wait();
216219
217 QAbstractListModel &results(*client.results());220 QAbstractListModel &results(*client.results());
221 if(results.rowCount() == 0) {
222 countChangedSpy.wait();
223 }
218 ASSERT_EQ(1, results.rowCount());224 ASSERT_EQ(1, results.rowCount());
219 EXPECT_EQ(ResultPair("Quiter", ""), result(results, 0));225 EXPECT_EQ(ResultPair("Quiter", ""), result(results, 0));
220}226}
@@ -251,9 +257,11 @@
251 QSignalSpy countChangedSpy(client.results(), SIGNAL(countChanged()));257 QSignalSpy countChangedSpy(client.results(), SIGNAL(countChanged()));
252 client.setQuery("closr");258 client.setQuery("closr");
253 countChangedSpy.wait();259 countChangedSpy.wait();
254 countChangedSpy.wait();
255260
256 QAbstractListModel &results(*client.results());261 QAbstractListModel &results(*client.results());
262 if(results.rowCount() == 0) {
263 countChangedSpy.wait();
264 }
257 ASSERT_EQ(1, results.rowCount());265 ASSERT_EQ(1, results.rowCount());
258 EXPECT_EQ(ResultPair("Close", ""), result(results, 0));266 EXPECT_EQ(ResultPair("Close", ""), result(results, 0));
259}267}
@@ -286,22 +294,26 @@
286294
287 client.setQuery("quitter");295 client.setQuery("quitter");
288 countChangedSpy.wait();296 countChangedSpy.wait();
289 countChangedSpy.wait();
290297
291 QAbstractListModel &results(*client.results());298 QAbstractListModel &results(*client.results());
299 if(results.rowCount() == 0) {
300 countChangedSpy.wait();
301 }
292 ASSERT_EQ(1, results.rowCount());302 ASSERT_EQ(1, results.rowCount());
293 EXPECT_EQ(ResultPair("quiter", ""), result(results, 0));303 EXPECT_EQ(ResultPair("quiter", ""), result(results, 0));
294304
295 const QAbstractListModel &toolbarModel(*client.toolBarModel());305 const QAbstractListModel &toolbarModel(*client.toolBarModel());
296 ASSERT_EQ(4, toolbarModel.rowCount());306 ASSERT_EQ(5, toolbarModel.rowCount());
297307
298 EXPECT_TOOLBAR(toolbarModel, 0, "graphics/undo.png",308 EXPECT_TOOLBAR(toolbarModel, 0, "graphics/close.png",
309 HUD_CLIENT_QUERY_TOOLBAR_QUIT, false);
310 EXPECT_TOOLBAR(toolbarModel, 1, "graphics/undo.png",
299 HUD_CLIENT_QUERY_TOOLBAR_UNDO, true);311 HUD_CLIENT_QUERY_TOOLBAR_UNDO, true);
300 EXPECT_TOOLBAR(toolbarModel, 1, "graphics/help.png",312 EXPECT_TOOLBAR(toolbarModel, 2, "graphics/help.png",
301 HUD_CLIENT_QUERY_TOOLBAR_HELP, true);313 HUD_CLIENT_QUERY_TOOLBAR_HELP, true);
302 EXPECT_TOOLBAR(toolbarModel, 2, "graphics/view-fullscreen.png",314 EXPECT_TOOLBAR(toolbarModel, 3, "graphics/view-fullscreen.png",
303 HUD_CLIENT_QUERY_TOOLBAR_FULLSCREEN, false);315 HUD_CLIENT_QUERY_TOOLBAR_FULLSCREEN, false);
304 EXPECT_TOOLBAR(toolbarModel, 3, "graphics/settings.png",316 EXPECT_TOOLBAR(toolbarModel, 4, "graphics/settings.png",
305 HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES, false);317 HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES, false);
306318
307 QSignalSpy actionInvokedSpy(&libhudTestInterface,319 QSignalSpy actionInvokedSpy(&libhudTestInterface,
@@ -345,9 +357,11 @@
345 QSignalSpy countChangedSpy(client.results(), SIGNAL(countChanged()));357 QSignalSpy countChangedSpy(client.results(), SIGNAL(countChanged()));
346 client.setQuery("closr");358 client.setQuery("closr");
347 countChangedSpy.wait();359 countChangedSpy.wait();
348 countChangedSpy.wait();
349360
350 QAbstractListModel &results(*client.results());361 QAbstractListModel &results(*client.results());
362 if(results.rowCount() == 0) {
363 countChangedSpy.wait();
364 }
351 ASSERT_EQ(1, results.rowCount());365 ASSERT_EQ(1, results.rowCount());
352 EXPECT_EQ(ResultPair("Close", ""), result(results, 0));366 EXPECT_EQ(ResultPair("Close", ""), result(results, 0));
353367
@@ -393,9 +407,11 @@
393 QSignalSpy countChangedSpy(client.results(), SIGNAL(countChanged()));407 QSignalSpy countChangedSpy(client.results(), SIGNAL(countChanged()));
394 client.setQuery("fruiy");408 client.setQuery("fruiy");
395 countChangedSpy.wait();409 countChangedSpy.wait();
396 countChangedSpy.wait();
397410
398 QAbstractListModel &results(*client.results());411 QAbstractListModel &results(*client.results());
412 if(results.rowCount() == 0) {
413 countChangedSpy.wait();
414 }
399 ASSERT_EQ(1, results.rowCount());415 ASSERT_EQ(1, results.rowCount());
400 ASSERT_EQ(ResultPair("fruit", ""), result(results, 0));416 ASSERT_EQ(ResultPair("fruit", ""), result(results, 0));
401417

Subscribers

People subscribed via source and target branches