Merge lp:~albaguirre/mir/dialogs_and_tooltips into lp:mir
- dialogs_and_tooltips
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Alan Griffiths |
Approved revision: | 2239 |
Merged at revision: | 2249 |
Proposed branch: | lp:~albaguirre/mir/dialogs_and_tooltips |
Merge into: | lp:mir |
Diff against target: |
520 lines (+290/-41) 13 files modified
client-ABI-sha1sums (+1/-1) include/client/mir_toolkit/mir_surface.h (+87/-4) include/server/mir/scene/surface_creation_parameters.h (+2/-2) server-ABI-sha1sums (+1/-1) src/client/mir_surface.cpp (+5/-6) src/client/mir_surface.h (+1/-1) src/client/mir_surface_api.cpp (+50/-8) src/client/symbols.map (+3/-1) src/protobuf/mir_protobuf.proto (+1/-1) src/server/frontend/session_mediator.cpp (+4/-4) src/server/scene/surface_creation_parameters.cpp (+2/-2) tests/acceptance-tests/test_client_surfaces.cpp (+52/-1) tests/integration-tests/client/test_mirsurface.cpp (+81/-9) |
To merge this branch: | bzr merge lp:~albaguirre/mir/dialogs_and_tooltips |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alan Griffiths | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Robert Carr (community) | Approve | ||
Chris Halse Rogers | Needs Fixing | ||
Review via email:
|
Commit message
Add API to create dialog and tooltip surfaces.
Description of the change
Add API to create dialog and tooltip surfaces.

PS Jenkins bot (ps-jenkins) wrote : | # |

PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2232
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://

PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2232
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://

Chris Halse Rogers (raof) wrote : | # |
Firstly, spec questions:
*) Huh. Why do the docs allow the client to specify the location of a dialog‽ That's surely an error.
*) Relatedly, the spec is inconsistent on whether or not dialogs can have dialog children.
Again, we need to specify input behaviour of tooltips.
And maybe something about the input behaviour of modal dialogs, but that's less complicated.
I lean towards having two spec creation functions; _spec_for_
Relatedly, I wonder if we should drop the “_surface” from mir_connection_

Alberto Aguirre (albaguirre) wrote : | # |
> Firstly, spec questions:
> *) Huh. Why do the docs allow the client to specify the location of a dialog‽
> That's surely an error.
It actually mentions a client specifying an optional initial position for more than dialogs so yeah doesn't belong in this dialog API.
> *) Relatedly, the spec is inconsistent on whether or not dialogs can have
> dialog children.
I could only find one sentence where it's inconsistent. However there's a full paragraph with motivation for avoiding trees of dialogs
> Again, we need to specify input behaviour of tooltips.
>
> And maybe something about the input behaviour of modal dialogs, but that's
> less complicated.
>
I added a bit of info there.
> I lean towards having two spec creation functions; _spec_for_
> and _spec_for_
> allow client-specified positioning of modal dialogs. _spec_for_
> has half the parameters of _spec_for_
I think it makes sense to split them, done.
> Relatedly, I wonder if we should drop the “_surface” from
> mir_connection_
Dropped.

Robert Carr (robertcarr) wrote : | # |
LGTM.
Had the strange thought that maybe create_

PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2235
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://

PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2235
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://

Alan Griffiths (alan-griffiths) wrote : | # |
Mostly OK but...
49 + * \param [in] rect A target zone relative to parent where the tooltip
50 + * will
...will what?
- 2236. By Alberto Aguirre
-
merge lp:mir, fix conflicts
- 2237. By Alberto Aguirre
-
Fix doc
- 2238. By Alberto Aguirre
-
update sha1sum

PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2238
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://

PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2238
http://
Executed test runs:
FAILURE: http://
None: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 2239. By Alberto Aguirre
-
merge lp:mir, fix sha1sum conflict

PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2238
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://

PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2239
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://

Alan Griffiths (alan-griffiths) wrote : | # |
OK (and I think Chris's "Needs Fixing" is addressed too)
Preview Diff
1 | === modified file 'client-ABI-sha1sums' |
2 | --- client-ABI-sha1sums 2015-01-21 22:27:07 +0000 |
3 | +++ client-ABI-sha1sums 2015-01-22 00:48:27 +0000 |
4 | @@ -6,7 +6,7 @@ |
5 | d739af6e64db6b314a727b5fb00be662b98ccd57 include/client/mir_toolkit/mir_platform_message.h |
6 | 9d50df5a141ca03ee8a79f7e844ed4b8b3b7d5d3 include/client/mir_toolkit/mir_prompt_session.h |
7 | 21d07e655e85eeec8a3523e1c6f9c2252176ec01 include/client/mir_toolkit/mir_screencast.h |
8 | -84dc4ff6dcceb507153578fbaa8e0c1a74b1c570 include/client/mir_toolkit/mir_surface.h |
9 | +232664cab86958838946ab051e845be5fbd485ca include/client/mir_toolkit/mir_surface.h |
10 | b141c4d79802ad626d969249c0004744e5c2a525 include/client/mir_toolkit/mir_wait.h |
11 | 6f7b4ecc22afba923806ed2bd7d8244be90b0cfd include/client/mir_toolkit/version.h |
12 | 3350dac884d6006753de2a955bc7a05663cd9449 include/common/mir_toolkit/client_types.h |
13 | |
14 | === modified file 'include/client/mir_toolkit/mir_surface.h' |
15 | --- include/client/mir_toolkit/mir_surface.h 2015-01-20 23:07:45 +0000 |
16 | +++ include/client/mir_toolkit/mir_surface.h 2015-01-22 00:48:27 +0000 |
17 | @@ -76,13 +76,96 @@ |
18 | * to complete construction. |
19 | */ |
20 | MirSurfaceSpec* |
21 | -mir_connection_create_spec_for_menu_surface(MirConnection* connection, |
22 | +mir_connection_create_spec_for_menu(MirConnection* connection, |
23 | + int width, |
24 | + int height, |
25 | + MirPixelFormat format, |
26 | + MirSurface* parent, |
27 | + MirRectangle* rect, |
28 | + MirEdgeAttachment edge); |
29 | + |
30 | +/** |
31 | + * Create a surface specification for a tooltip surface. |
32 | + * |
33 | + * A tooltip surface becomes visible when the pointer hovers the specified |
34 | + * target zone. A tooltip surface has no input focus and will be closed when |
35 | + * the pointer moves out of the target zone or the parent closes, moves or hides |
36 | + * |
37 | + * The tooltip parent cannot be another tooltip surface. |
38 | + * |
39 | + * The tooltip position is decided by the server but typically it will appear |
40 | + * near the pointer. |
41 | + * |
42 | + * \param [in] connection Connection the surface will be created on |
43 | + * \param [in] width Requested width. The server is not guaranteed to |
44 | + * return a surface of this width. |
45 | + * \param [in] height Requested height. The server is not guaranteed to |
46 | + * return a surface of this height. |
47 | + * \param [in] format Pixel format for the surface. |
48 | + * \param [in] parent A valid parent surface for this tooltip. |
49 | + * \param [in] rect A target zone relative to parent. |
50 | + * \return A handle that can be passed to mir_surface_create() |
51 | + * to complete construction. |
52 | + */ |
53 | +MirSurfaceSpec* |
54 | +mir_connection_create_spec_for_tooltip(MirConnection* connection, |
55 | + int width, |
56 | + int height, |
57 | + MirPixelFormat format, |
58 | + MirSurface* parent, |
59 | + MirRectangle* zone); |
60 | + |
61 | +/** |
62 | + * Create a surface specification for a modal dialog surface. |
63 | + * |
64 | + * The dialog surface will have input focus; the parent can still be moved, |
65 | + * resized or hidden/minimized but no interaction is possible until the dialog |
66 | + * is dismissed. |
67 | + * |
68 | + * A dialog will typically have no close/maximize button decorations. |
69 | + * |
70 | + * During surface creation, if the specified parent is another dialog surface |
71 | + * the server may choose to close the specified parent in order to show this |
72 | + * new dialog surface. |
73 | + * |
74 | + * \param [in] connection Connection the surface will be created on |
75 | + * \param [in] width Requested width. The server is not guaranteed to |
76 | + * return a surface of this width. |
77 | + * \param [in] height Requested height. The server is not guaranteed to |
78 | + * return a surface of this height. |
79 | + * \param [in] format Pixel format for the surface. |
80 | + * \param [in] parent A valid parent surface. |
81 | + * |
82 | + */ |
83 | +MirSurfaceSpec* |
84 | +mir_connection_create_spec_for_modal_dialog(MirConnection* connection, |
85 | int width, |
86 | int height, |
87 | MirPixelFormat format, |
88 | - MirSurface* parent, |
89 | - MirRectangle* rect, |
90 | - MirEdgeAttachment edge); |
91 | + MirSurface* parent); |
92 | + |
93 | +/** |
94 | + * Create a surface specification for a parentless dialog surface. |
95 | + * |
96 | + * A parentless dialog surface is similar to a normal surface, but it cannot |
97 | + * be fullscreen and typically won't have any maximize/close button decorations. |
98 | + * |
99 | + * A parentless dialog is not allowed to have other dialog children. The server |
100 | + * may decide to close the parent and show the child dialog only. |
101 | + * |
102 | + * \param [in] connection Connection the surface will be created on |
103 | + * \param [in] width Requested width. The server is not guaranteed to |
104 | + * return a surface of this width. |
105 | + * \param [in] height Requested height. The server is not guaranteed to |
106 | + * return a surface of this height. |
107 | + * \param [in] format Pixel format for the surface. |
108 | + * |
109 | + */ |
110 | +MirSurfaceSpec* |
111 | +mir_connection_create_spec_for_dialog(MirConnection* connection, |
112 | + int width, |
113 | + int height, |
114 | + MirPixelFormat format); |
115 | |
116 | /** |
117 | * Create a surface from a given specification |
118 | |
119 | === modified file 'include/server/mir/scene/surface_creation_parameters.h' |
120 | --- include/server/mir/scene/surface_creation_parameters.h 2015-01-21 15:47:25 +0000 |
121 | +++ include/server/mir/scene/surface_creation_parameters.h 2015-01-22 00:48:27 +0000 |
122 | @@ -68,7 +68,7 @@ |
123 | |
124 | SurfaceCreationParameters& with_parent_id(frontend::SurfaceId const& id); |
125 | |
126 | - SurfaceCreationParameters& with_attachment_rect(geometry::Rectangle const& rect); |
127 | + SurfaceCreationParameters& with_aux_rect(geometry::Rectangle const& rect); |
128 | |
129 | SurfaceCreationParameters& with_edge_attachment(MirEdgeAttachment edge); |
130 | |
131 | @@ -85,7 +85,7 @@ |
132 | mir::optional_value<MirSurfaceType> type; |
133 | mir::optional_value<MirOrientationMode> preferred_orientation; |
134 | mir::optional_value<frontend::SurfaceId> parent_id; |
135 | - mir::optional_value<geometry::Rectangle> attachment_rect; |
136 | + mir::optional_value<geometry::Rectangle> aux_rect; |
137 | mir::optional_value<MirEdgeAttachment> edge_attachment; |
138 | |
139 | std::weak_ptr<Surface> parent; |
140 | |
141 | === modified file 'server-ABI-sha1sums' |
142 | --- server-ABI-sha1sums 2015-01-21 15:47:25 +0000 |
143 | +++ server-ABI-sha1sums 2015-01-22 00:48:27 +0000 |
144 | @@ -97,7 +97,7 @@ |
145 | 5bab4dc0a6488b8b9d47e958c6bab94f1dcf2c57 include/server/mir/scene/surface_buffer_access.h |
146 | bbc9e2e2bb71634cd6f1c5c0430093e10e74fa23 include/server/mir/scene/surface_configurator.h |
147 | e5e4dd7bcaf186810043fa0f05be42d7e49b0843 include/server/mir/scene/surface_coordinator.h |
148 | -308d886cae96072a87ec1119fc31a66031727893 include/server/mir/scene/surface_creation_parameters.h |
149 | +da52304237a348a90fcb56729293d628ceaa351c include/server/mir/scene/surface_creation_parameters.h |
150 | aceccc0bdeea5c90d6c5ea17ed4ce6b5dc1b0ed4 include/server/mir/scene/surface.h |
151 | 587e22d751656ce2d9536afdf5659276ff9bbc46 include/server/mir/scene/surface_observer.h |
152 | 7ef3e99901168cda296d74d05a979f47bf9c3ff1 include/server/mir/server_action_queue.h |
153 | |
154 | === modified file 'src/client/mir_surface.cpp' |
155 | --- src/client/mir_surface.cpp 2015-01-19 04:52:47 +0000 |
156 | +++ src/client/mir_surface.cpp 2015-01-22 00:48:27 +0000 |
157 | @@ -89,15 +89,14 @@ |
158 | SERIALIZE_OPTION_IF_SET(pref_orientation, message); |
159 | if (parent.is_set() && parent.value() != nullptr) |
160 | message.set_parent_id(parent.value()->id()); |
161 | - if (attachment_rect.is_set()) |
162 | + if (aux_rect.is_set()) |
163 | { |
164 | - message.mutable_attachment_rect()->set_left(attachment_rect.value().left); |
165 | - message.mutable_attachment_rect()->set_top(attachment_rect.value().top); |
166 | - message.mutable_attachment_rect()->set_width(attachment_rect.value().width); |
167 | - message.mutable_attachment_rect()->set_height(attachment_rect.value().height); |
168 | + message.mutable_aux_rect()->set_left(aux_rect.value().left); |
169 | + message.mutable_aux_rect()->set_top(aux_rect.value().top); |
170 | + message.mutable_aux_rect()->set_width(aux_rect.value().width); |
171 | + message.mutable_aux_rect()->set_height(aux_rect.value().height); |
172 | } |
173 | SERIALIZE_OPTION_IF_SET(edge_attachment, message); |
174 | - |
175 | return message; |
176 | } |
177 | |
178 | |
179 | === modified file 'src/client/mir_surface.h' |
180 | --- src/client/mir_surface.h 2015-01-19 04:52:47 +0000 |
181 | +++ src/client/mir_surface.h 2015-01-22 00:48:27 +0000 |
182 | @@ -78,7 +78,7 @@ |
183 | mir::optional_value<MirOrientationMode> pref_orientation; |
184 | |
185 | mir::optional_value<MirSurface*> parent; |
186 | - mir::optional_value<MirRectangle> attachment_rect; |
187 | + mir::optional_value<MirRectangle> aux_rect; |
188 | mir::optional_value<MirEdgeAttachment> edge_attachment; |
189 | }; |
190 | |
191 | |
192 | === modified file 'src/client/mir_surface_api.cpp' |
193 | --- src/client/mir_surface_api.cpp 2015-01-20 23:07:45 +0000 |
194 | +++ src/client/mir_surface_api.cpp 2015-01-22 00:48:27 +0000 |
195 | @@ -51,13 +51,13 @@ |
196 | return new MirSurfaceSpec{connection, width, height, format}; |
197 | } |
198 | |
199 | -MirSurfaceSpec* mir_connection_create_spec_for_menu_surface(MirConnection* connection, |
200 | - int width, |
201 | - int height, |
202 | - MirPixelFormat format, |
203 | - MirSurface* parent, |
204 | - MirRectangle* rect, |
205 | - MirEdgeAttachment edge) |
206 | +MirSurfaceSpec* mir_connection_create_spec_for_menu(MirConnection* connection, |
207 | + int width, |
208 | + int height, |
209 | + MirPixelFormat format, |
210 | + MirSurface* parent, |
211 | + MirRectangle* rect, |
212 | + MirEdgeAttachment edge) |
213 | { |
214 | mir::require(mir_surface_is_valid(parent)); |
215 | mir::require(rect != nullptr); |
216 | @@ -65,11 +65,53 @@ |
217 | auto spec = new MirSurfaceSpec{connection, width, height, format}; |
218 | spec->type = mir_surface_type_menu; |
219 | spec->parent = parent; |
220 | - spec->attachment_rect = *rect; |
221 | + spec->aux_rect = *rect; |
222 | spec->edge_attachment = edge; |
223 | return spec; |
224 | } |
225 | |
226 | +MirSurfaceSpec* mir_connection_create_spec_for_tooltip(MirConnection* connection, |
227 | + int width, |
228 | + int height, |
229 | + MirPixelFormat format, |
230 | + MirSurface* parent, |
231 | + MirRectangle* rect) |
232 | +{ |
233 | + mir::require(mir_surface_is_valid(parent)); |
234 | + mir::require(rect != nullptr); |
235 | + |
236 | + auto spec = new MirSurfaceSpec{connection, width, height, format}; |
237 | + spec->type = mir_surface_type_tip; |
238 | + spec->parent = parent; |
239 | + spec->aux_rect = *rect; |
240 | + return spec; |
241 | +} |
242 | + |
243 | +MirSurfaceSpec* mir_connection_create_spec_for_dialog(MirConnection* connection, |
244 | + int width, |
245 | + int height, |
246 | + MirPixelFormat format) |
247 | +{ |
248 | + auto spec = new MirSurfaceSpec{connection, width, height, format}; |
249 | + spec->type = mir_surface_type_dialog; |
250 | + return spec; |
251 | +} |
252 | + |
253 | +MirSurfaceSpec* mir_connection_create_spec_for_modal_dialog(MirConnection* connection, |
254 | + int width, |
255 | + int height, |
256 | + MirPixelFormat format, |
257 | + MirSurface* parent) |
258 | +{ |
259 | + mir::require(mir_surface_is_valid(parent)); |
260 | + |
261 | + auto spec = new MirSurfaceSpec{connection, width, height, format}; |
262 | + spec->type = mir_surface_type_dialog; |
263 | + spec->parent = parent; |
264 | + |
265 | + return spec; |
266 | +} |
267 | + |
268 | MirSurface* mir_surface_create_sync(MirSurfaceSpec* requested_specification) |
269 | { |
270 | MirSurface* surface = nullptr; |
271 | |
272 | === modified file 'src/client/symbols.map' |
273 | --- src/client/symbols.map 2015-01-16 02:57:31 +0000 |
274 | +++ src/client/symbols.map 2015-01-22 00:48:27 +0000 |
275 | @@ -42,5 +42,7 @@ |
276 | mir_pointer_input_event_get_action; |
277 | mir_pointer_input_event_get_button_state; |
278 | mir_pointer_input_event_get_axis_value; |
279 | - mir_connection_create_spec_for_menu_surface; |
280 | + mir_connection_create_spec_for_menu; |
281 | + mir_connection_create_spec_for_tooltip; |
282 | + mir_connection_create_spec_for_dialog; |
283 | } MIR_CLIENT_8.2; |
284 | \ No newline at end of file |
285 | |
286 | === modified file 'src/protobuf/mir_protobuf.proto' |
287 | --- src/protobuf/mir_protobuf.proto 2015-01-14 06:39:13 +0000 |
288 | +++ src/protobuf/mir_protobuf.proto 2015-01-22 00:48:27 +0000 |
289 | @@ -25,7 +25,7 @@ |
290 | optional int32 pref_orientation = 9; |
291 | optional int32 parent_id = 10; |
292 | |
293 | - optional Rectangle attachment_rect = 11; |
294 | + optional Rectangle aux_rect = 11; |
295 | optional int32 edge_attachment = 12; |
296 | } |
297 | |
298 | |
299 | === modified file 'src/server/frontend/session_mediator.cpp' |
300 | --- src/server/frontend/session_mediator.cpp 2015-01-19 11:36:40 +0000 |
301 | +++ src/server/frontend/session_mediator.cpp 2015-01-22 00:48:27 +0000 |
302 | @@ -198,11 +198,11 @@ |
303 | if (request->has_parent_id()) |
304 | params.with_parent_id(SurfaceId{request->parent_id()}); |
305 | |
306 | - if (request->has_attachment_rect()) |
307 | + if (request->has_aux_rect()) |
308 | { |
309 | - params.with_attachment_rect(geom::Rectangle{ |
310 | - {request->attachment_rect().left(), request->attachment_rect().top()}, |
311 | - {request->attachment_rect().width(), request->attachment_rect().height()} |
312 | + params.with_aux_rect(geom::Rectangle{ |
313 | + {request->aux_rect().left(), request->aux_rect().top()}, |
314 | + {request->aux_rect().width(), request->aux_rect().height()} |
315 | }); |
316 | } |
317 | |
318 | |
319 | === modified file 'src/server/scene/surface_creation_parameters.cpp' |
320 | --- src/server/scene/surface_creation_parameters.cpp 2015-01-14 06:39:13 +0000 |
321 | +++ src/server/scene/surface_creation_parameters.cpp 2015-01-22 00:48:27 +0000 |
322 | @@ -124,9 +124,9 @@ |
323 | return *this; |
324 | } |
325 | |
326 | -ms::SurfaceCreationParameters& ms::SurfaceCreationParameters::with_attachment_rect(geometry::Rectangle const& rect) |
327 | +ms::SurfaceCreationParameters& ms::SurfaceCreationParameters::with_aux_rect(geometry::Rectangle const& rect) |
328 | { |
329 | - attachment_rect = rect; |
330 | + aux_rect = rect; |
331 | return *this; |
332 | } |
333 | |
334 | |
335 | === modified file 'tests/acceptance-tests/test_client_surfaces.cpp' |
336 | --- tests/acceptance-tests/test_client_surfaces.cpp 2015-01-14 06:39:13 +0000 |
337 | +++ tests/acceptance-tests/test_client_surfaces.cpp 2015-01-22 00:48:27 +0000 |
338 | @@ -217,7 +217,7 @@ |
339 | auto parent = mtf::make_any_surface(connection); |
340 | MirRectangle attachment_rect{100, 200, 100, 100}; |
341 | |
342 | - auto spec = mir_connection_create_spec_for_menu_surface(connection, 640, 480, |
343 | + auto spec = mir_connection_create_spec_for_menu(connection, 640, 480, |
344 | mir_pixel_format_abgr_8888, parent, &attachment_rect, mir_edge_attachment_vertical); |
345 | ASSERT_THAT(spec, NotNull()); |
346 | |
347 | @@ -231,3 +231,54 @@ |
348 | mir_surface_release_sync(menu); |
349 | } |
350 | |
351 | +TEST_F(ClientSurfaces, can_be_tooltips) |
352 | +{ |
353 | + auto parent = mtf::make_any_surface(connection); |
354 | + MirRectangle zone_rect{100, 200, 100, 100}; |
355 | + |
356 | + auto spec = mir_connection_create_spec_for_tooltip(connection, 640, 480, |
357 | + mir_pixel_format_abgr_8888, parent, &zone_rect); |
358 | + ASSERT_THAT(spec, NotNull()); |
359 | + |
360 | + auto tooltip = mir_surface_create_sync(spec); |
361 | + mir_surface_spec_release(spec); |
362 | + |
363 | + ASSERT_THAT(tooltip, IsValid()); |
364 | + EXPECT_EQ(mir_surface_get_type(tooltip), mir_surface_type_tip); |
365 | + |
366 | + mir_surface_release_sync(parent); |
367 | + mir_surface_release_sync(tooltip); |
368 | +} |
369 | + |
370 | +TEST_F(ClientSurfaces, can_be_dialogs) |
371 | +{ |
372 | + auto spec = mir_connection_create_spec_for_dialog(connection, 640, 480, |
373 | + mir_pixel_format_abgr_8888); |
374 | + ASSERT_THAT(spec, NotNull()); |
375 | + |
376 | + auto dialog = mir_surface_create_sync(spec); |
377 | + mir_surface_spec_release(spec); |
378 | + |
379 | + ASSERT_THAT(dialog, IsValid()); |
380 | + EXPECT_EQ(mir_surface_get_type(dialog), mir_surface_type_dialog); |
381 | + |
382 | + mir_surface_release_sync(dialog); |
383 | +} |
384 | + |
385 | +TEST_F(ClientSurfaces, can_be_modal_dialogs) |
386 | +{ |
387 | + auto parent = mtf::make_any_surface(connection); |
388 | + auto spec = mir_connection_create_spec_for_modal_dialog(connection, 640, 480, |
389 | + mir_pixel_format_abgr_8888, parent); |
390 | + ASSERT_THAT(spec, NotNull()); |
391 | + |
392 | + auto dialog = mir_surface_create_sync(spec); |
393 | + mir_surface_spec_release(spec); |
394 | + |
395 | + ASSERT_THAT(dialog, IsValid()); |
396 | + EXPECT_EQ(mir_surface_get_type(dialog), mir_surface_type_dialog); |
397 | + |
398 | + mir_surface_release_sync(parent); |
399 | + mir_surface_release_sync(dialog); |
400 | +} |
401 | + |
402 | |
403 | === modified file 'tests/integration-tests/client/test_mirsurface.cpp' |
404 | --- tests/integration-tests/client/test_mirsurface.cpp 2015-01-14 06:39:13 +0000 |
405 | +++ tests/integration-tests/client/test_mirsurface.cpp 2015-01-22 00:48:27 +0000 |
406 | @@ -79,18 +79,33 @@ |
407 | return arg.type == mir_surface_type_menu; |
408 | } |
409 | |
410 | +MATCHER(IsATooltip, "") |
411 | +{ |
412 | + return arg.type == mir_surface_type_tip; |
413 | +} |
414 | + |
415 | +MATCHER(IsADialog, "") |
416 | +{ |
417 | + return arg.type == mir_surface_type_dialog; |
418 | +} |
419 | + |
420 | MATCHER_P(HasParent, parent, "") |
421 | { |
422 | return arg.parent_id.is_set() && arg.parent_id.value().as_value() == parent->id(); |
423 | } |
424 | |
425 | -MATCHER_P(MatchesAttachment, rect, "") |
426 | -{ |
427 | - return arg.attachment_rect.is_set() && |
428 | - arg.attachment_rect.value().top_left.x.as_int() == rect.left && |
429 | - arg.attachment_rect.value().top_left.y.as_int() == rect.top && |
430 | - arg.attachment_rect.value().size.width.as_uint32_t() == rect.width && |
431 | - arg.attachment_rect.value().size.height.as_uint32_t() == rect.height; |
432 | +MATCHER(NoParentSet, "") |
433 | +{ |
434 | + return arg.parent_id.is_set() == false; |
435 | +} |
436 | + |
437 | +MATCHER_P(MatchesAuxRect, rect, "") |
438 | +{ |
439 | + return arg.aux_rect.is_set() && |
440 | + arg.aux_rect.value().top_left.x.as_int() == rect.left && |
441 | + arg.aux_rect.value().top_left.y.as_int() == rect.top && |
442 | + arg.aux_rect.value().size.width.as_uint32_t() == rect.width && |
443 | + arg.aux_rect.value().size.height.as_uint32_t() == rect.height; |
444 | } |
445 | |
446 | MATCHER_P(MatchesEdge, edge, "") |
447 | @@ -170,7 +185,7 @@ |
448 | |
449 | auto spec_deleter = [](MirSurfaceSpec* spec) {mir_surface_spec_release(spec);}; |
450 | std::unique_ptr<MirSurfaceSpec, decltype(spec_deleter)> menu_spec{ |
451 | - mir_connection_create_spec_for_menu_surface(connection, 640, 480, |
452 | + mir_connection_create_spec_for_menu(connection, 640, 480, |
453 | mir_pixel_format_abgr_8888, parent.get(), &attachment_rect, |
454 | edge), |
455 | spec_deleter |
456 | @@ -179,6 +194,63 @@ |
457 | ASSERT_THAT(menu_spec, NotNull()); |
458 | |
459 | EXPECT_CALL(*mock_surface_coordinator, add_surface(AllOf(IsAMenu(), |
460 | - HasParent(parent.get()), MatchesAttachment(attachment_rect), MatchesEdge(edge)),_)); |
461 | + HasParent(parent.get()), MatchesAuxRect(attachment_rect), MatchesEdge(edge)),_)); |
462 | create_surface(menu_spec.get()); |
463 | } |
464 | + |
465 | +TEST_F(ClientMirSurface, as_tooltip_sends_correct_params) |
466 | +{ |
467 | + EXPECT_CALL(*mock_surface_coordinator, add_surface(_,_)); |
468 | + auto parent = create_surface(&spec); |
469 | + ASSERT_THAT(parent.get(), IsValid()); |
470 | + |
471 | + MirRectangle target_zone_rect{100, 200, 300, 400}; |
472 | + |
473 | + auto spec_deleter = [](MirSurfaceSpec* spec) {mir_surface_spec_release(spec);}; |
474 | + std::unique_ptr<MirSurfaceSpec, decltype(spec_deleter)> tooltip_spec{ |
475 | + mir_connection_create_spec_for_tooltip(connection, 640, 480, |
476 | + mir_pixel_format_abgr_8888, parent.get(), &target_zone_rect), |
477 | + spec_deleter |
478 | + }; |
479 | + |
480 | + ASSERT_THAT(tooltip_spec, NotNull()); |
481 | + |
482 | + EXPECT_CALL(*mock_surface_coordinator, add_surface(AllOf(IsATooltip(), |
483 | + HasParent(parent.get()), MatchesAuxRect(target_zone_rect)),_)); |
484 | + create_surface(tooltip_spec.get()); |
485 | +} |
486 | + |
487 | +TEST_F(ClientMirSurface, as_dialog_sends_correct_params) |
488 | +{ |
489 | + auto spec_deleter = [](MirSurfaceSpec* spec) {mir_surface_spec_release(spec);}; |
490 | + std::unique_ptr<MirSurfaceSpec, decltype(spec_deleter)> dialog_spec{ |
491 | + mir_connection_create_spec_for_dialog(connection, 640, 480, mir_pixel_format_abgr_8888), |
492 | + spec_deleter |
493 | + }; |
494 | + |
495 | + ASSERT_THAT(dialog_spec, NotNull()); |
496 | + |
497 | + EXPECT_CALL(*mock_surface_coordinator, add_surface(AllOf(IsADialog(), |
498 | + NoParentSet()),_)); |
499 | + create_surface(dialog_spec.get()); |
500 | +} |
501 | + |
502 | +TEST_F(ClientMirSurface, as_modal_dialog_sends_correct_params) |
503 | +{ |
504 | + EXPECT_CALL(*mock_surface_coordinator, add_surface(_,_)); |
505 | + auto parent = create_surface(&spec); |
506 | + ASSERT_THAT(parent.get(), IsValid()); |
507 | + |
508 | + auto spec_deleter = [](MirSurfaceSpec* spec) {mir_surface_spec_release(spec);}; |
509 | + std::unique_ptr<MirSurfaceSpec, decltype(spec_deleter)> dialog_spec{ |
510 | + mir_connection_create_spec_for_modal_dialog(connection, 640, 480, |
511 | + mir_pixel_format_abgr_8888, parent.get()), |
512 | + spec_deleter |
513 | + }; |
514 | + |
515 | + ASSERT_THAT(dialog_spec, NotNull()); |
516 | + |
517 | + EXPECT_CALL(*mock_surface_coordinator, add_surface(AllOf(IsADialog(), |
518 | + HasParent(parent.get())),_)); |
519 | + create_surface(dialog_spec.get()); |
520 | +} |
FAILED: Continuous integration, rev:2231 jenkins. qa.ubuntu. com/job/ mir-ci/ 2666/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/879 jenkins. qa.ubuntu. com/job/ mir-clang- vivid-amd64- build/879 jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/841/ console jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 663 jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 663/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 841 jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 841/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -runner- mako/3956/ console
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/2666/ rebuild
http://