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
1=== modified file 'libhud-client/HudToolbarModel.cpp'
2--- libhud-client/HudToolbarModel.cpp 2013-11-13 11:22:36 +0000
3+++ libhud-client/HudToolbarModel.cpp 2014-01-24 14:25:48 +0000
4@@ -26,6 +26,8 @@
5
6 static QString iconForAction(int action) {
7 switch (action) {
8+ case HUD_CLIENT_QUERY_TOOLBAR_QUIT:
9+ return "graphics/close.png";
10 case HUD_CLIENT_QUERY_TOOLBAR_UNDO:
11 return "graphics/undo.png";
12 case HUD_CLIENT_QUERY_TOOLBAR_HELP:
13@@ -48,7 +50,8 @@
14 HudToolBarModel::HudToolBarModel(HudClientQuery *query) :
15 p(new Priv()) {
16 p->m_query = query;
17- p->m_actions << HUD_CLIENT_QUERY_TOOLBAR_UNDO
18+ p->m_actions << HUD_CLIENT_QUERY_TOOLBAR_QUIT
19+ << HUD_CLIENT_QUERY_TOOLBAR_UNDO
20 << HUD_CLIENT_QUERY_TOOLBAR_HELP
21 << HUD_CLIENT_QUERY_TOOLBAR_FULLSCREEN
22 << HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES;
23
24=== modified file 'libhud-client/toolbar-items.h'
25--- libhud-client/toolbar-items.h 2013-12-17 16:37:55 +0000
26+++ libhud-client/toolbar-items.h 2014-01-24 14:25:48 +0000
27@@ -25,6 +25,7 @@
28 * @HUD_CLIENT_QUERY_TOOLBAR_HELP: Help the user use the application
29 * @HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES: Configure the application
30 * @HUD_CLIENT_QUERY_TOOLBAR_UNDO: Revert the last user action
31+ * @HUD_CLIENT_QUERY_TOOLBAR_QUIT: Quit the application
32 *
33 * @short_description: Preconfigured toolbar items for the application
34 *
35@@ -37,6 +38,7 @@
36 HUD_CLIENT_QUERY_TOOLBAR_HELP,
37 HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES,
38 HUD_CLIENT_QUERY_TOOLBAR_UNDO,
39+ HUD_CLIENT_QUERY_TOOLBAR_QUIT,
40 } HudClientQueryToolbarItems;
41
42 #endif /* LIBHUD_CLIENT_TOOLBAR_ITEMS_H_ */
43
44=== modified file 'tests/integration/TestHud.cpp'
45--- tests/integration/TestHud.cpp 2013-12-17 11:20:24 +0000
46+++ tests/integration/TestHud.cpp 2014-01-24 14:25:48 +0000
47@@ -183,6 +183,9 @@
48 countChangedSpy.wait();
49
50 QAbstractListModel &results(*client.results());
51+ if(results.rowCount() != 3) {
52+ countChangedSpy.wait();
53+ }
54 ASSERT_EQ(3, results.rowCount());
55 EXPECT_EQ(ResultPair("swift sad", "piece hook"), result(results, 0));
56 EXPECT_EQ(ResultPair("stray slash", "piece hook"), result(results, 1));
57@@ -215,6 +218,9 @@
58 countChangedSpy.wait();
59
60 QAbstractListModel &results(*client.results());
61+ if(results.rowCount() == 0) {
62+ countChangedSpy.wait();
63+ }
64 ASSERT_EQ(1, results.rowCount());
65 EXPECT_EQ(ResultPair("Quiter", ""), result(results, 0));
66 }
67@@ -251,9 +257,11 @@
68 QSignalSpy countChangedSpy(client.results(), SIGNAL(countChanged()));
69 client.setQuery("closr");
70 countChangedSpy.wait();
71- countChangedSpy.wait();
72
73 QAbstractListModel &results(*client.results());
74+ if(results.rowCount() == 0) {
75+ countChangedSpy.wait();
76+ }
77 ASSERT_EQ(1, results.rowCount());
78 EXPECT_EQ(ResultPair("Close", ""), result(results, 0));
79 }
80@@ -286,22 +294,26 @@
81
82 client.setQuery("quitter");
83 countChangedSpy.wait();
84- countChangedSpy.wait();
85
86 QAbstractListModel &results(*client.results());
87+ if(results.rowCount() == 0) {
88+ countChangedSpy.wait();
89+ }
90 ASSERT_EQ(1, results.rowCount());
91 EXPECT_EQ(ResultPair("quiter", ""), result(results, 0));
92
93 const QAbstractListModel &toolbarModel(*client.toolBarModel());
94- ASSERT_EQ(4, toolbarModel.rowCount());
95+ ASSERT_EQ(5, toolbarModel.rowCount());
96
97- EXPECT_TOOLBAR(toolbarModel, 0, "graphics/undo.png",
98+ EXPECT_TOOLBAR(toolbarModel, 0, "graphics/close.png",
99+ HUD_CLIENT_QUERY_TOOLBAR_QUIT, false);
100+ EXPECT_TOOLBAR(toolbarModel, 1, "graphics/undo.png",
101 HUD_CLIENT_QUERY_TOOLBAR_UNDO, true);
102- EXPECT_TOOLBAR(toolbarModel, 1, "graphics/help.png",
103+ EXPECT_TOOLBAR(toolbarModel, 2, "graphics/help.png",
104 HUD_CLIENT_QUERY_TOOLBAR_HELP, true);
105- EXPECT_TOOLBAR(toolbarModel, 2, "graphics/view-fullscreen.png",
106+ EXPECT_TOOLBAR(toolbarModel, 3, "graphics/view-fullscreen.png",
107 HUD_CLIENT_QUERY_TOOLBAR_FULLSCREEN, false);
108- EXPECT_TOOLBAR(toolbarModel, 3, "graphics/settings.png",
109+ EXPECT_TOOLBAR(toolbarModel, 4, "graphics/settings.png",
110 HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES, false);
111
112 QSignalSpy actionInvokedSpy(&libhudTestInterface,
113@@ -345,9 +357,11 @@
114 QSignalSpy countChangedSpy(client.results(), SIGNAL(countChanged()));
115 client.setQuery("closr");
116 countChangedSpy.wait();
117- countChangedSpy.wait();
118
119 QAbstractListModel &results(*client.results());
120+ if(results.rowCount() == 0) {
121+ countChangedSpy.wait();
122+ }
123 ASSERT_EQ(1, results.rowCount());
124 EXPECT_EQ(ResultPair("Close", ""), result(results, 0));
125
126@@ -393,9 +407,11 @@
127 QSignalSpy countChangedSpy(client.results(), SIGNAL(countChanged()));
128 client.setQuery("fruiy");
129 countChangedSpy.wait();
130- countChangedSpy.wait();
131
132 QAbstractListModel &results(*client.results());
133+ if(results.rowCount() == 0) {
134+ countChangedSpy.wait();
135+ }
136 ASSERT_EQ(1, results.rowCount());
137 ASSERT_EQ(ResultPair("fruit", ""), result(results, 0));
138

Subscribers

People subscribed via source and target branches