Merge lp:~mir-team/mir/allow-lock-surf-orientation into lp:mir
- allow-lock-surf-orientation
- Merge into development-branch
Status: | Merged |
---|---|
Merged at revision: | 2127 |
Proposed branch: | lp:~mir-team/mir/allow-lock-surf-orientation |
Merge into: | lp:mir |
Diff against target: |
326 lines (+140/-7) 14 files modified
client-ABI-sha1sums (+2/-2) common-ABI-sha1sums (+1/-1) include/client/mir_toolkit/mir_surface.h (+17/-0) include/common/mir_toolkit/common.h (+15/-0) platform-ABI-sha1sums (+1/-1) server-ABI-sha1sums (+1/-1) src/client/mir_surface.cpp (+7/-0) src/client/mir_surface.h (+2/-1) src/client/mir_surface_api.cpp (+33/-0) src/server/scene/basic_surface.cpp (+23/-0) src/server/scene/basic_surface.h (+2/-0) tests/acceptance-tests/test_client_surface_events.cpp (+16/-0) tests/unit-tests/client/test_client_mir_surface.cpp (+2/-1) tests/unit-tests/scene/test_surface_impl.cpp (+18/-0) |
To merge this branch: | bzr merge lp:~mir-team/mir/allow-lock-surf-orientation |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alan Griffiths | Approve | ||
Gerry Boland (community) | Approve | ||
Kevin DuBois (community) | Approve | ||
Alexandros Frantzis (community) | Approve | ||
Robert Carr (community) | Approve | ||
Andreas Pokorny (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+242984@code.launchpad.net |
Commit message
Add client API to set the preferred orientation of a surface.
Description of the change
This is now basically a big setter/getter MP.
The shell can reject the preference request through SurfaceConfigur
Mir does not do anything with this value currently. It's up to each shell implementation to deal with device orientation changes; such implementations may query the preferred orientation for each surface and decide to ignore or honour the preference, calling surface-
PS Jenkins bot (ps-jenkins) wrote : | # |
Alexandros Frantzis (afrantzis) wrote : | # |
Too bad MirOrientation values are not bit flags. Would it be preferable to change the MirOrientation values instead of introducing a new enum?
Needs discussion
Gerry Boland (gerboland) wrote : | # |
I think it should be up to the shell to decide whether to honour an client orientation restrictions. There are many cases in our converged world where the client's request cannot be honoured - one example is tablet in landscape, so it has a landscape main stage application open, and a sidestage app. If that sidestage app wants to be landscape too - shell cannot let it, it must remain portrait.
I'm a little worried about adding this feature to the mir client API if it's not something we were planning to support as a platform. E.g. we're adding orientation support to shell where it sets the preferred orientations in the desktop file, and these cannot be altered at runtime - design and the UITK guys were happy enough with this.
Sure I can see advantages to runtime alterations, but could we check with design & uitk to see if they really want this?
Alan Griffiths (alan-griffiths) wrote : | # |
I think that we ought to either change the MirOrientation values to bitflags or abstract out the necessary conversions.
*Needs Discussion*
I agree with Gerry that setting the "allowed orientations" is a request, not a requirement and that the shell could refuse.
I also wonder if this is something that should be set on the surface spec and applied at creation (or mutation) time rather than being an attribute on the surface that can be set at arbitrary times.
Gerry Boland (gerboland) wrote : | # |
I'm just out of a meeting with UITK folk, and they could find use-cases to justify runtime changing of preferred orientations. A Netflix would be a big user of this feature - on phone list of video would ideally be in portrait, but playback would be best in landscape. So yeah this is good.
Still needs to be a request shell can deny if necessary though.
Alberto Aguirre (albaguirre) wrote : | # |
I introduced the new enum to avoid breaking client ABI. If the team is ok breaking ABI for this, then no problem changing it.
The shell/server is given a change to reject the setting with SurfaceConfigur
Robert Carr (robertcarr) wrote : | # |
As discussed in the stand-up I think I am ok with breaking ABI.
If we don't break ABI, maybe lets think of a better name? I think "permit" misphrases the balance
of power here, rather the client declares it's "Supported" orientations.
Diff looks fine though and name is reasonable enough so +1 if you end up deciding to land it this way.
Nit:
40 + * set the orientations a surface is allowed to change into.
41 + * The server may reject the request so you may have to wait on the function
42 + * and check the result using mir_surface_
This reads weird imo, I think the object is unclear and the first sentence, and the second one becomes run on due to repetition of a clause
"Request to set the orientations which a surface supports. This request may be rejected by the server, so it is necessary to wait on the result and check the applied value using mir_surface_
Rest of diff looks fine
Chris Halse Rogers (raof) wrote : | # |
+1 for mir_surface_
Nit:
178 +MirPermittedOr
...
184 + if (surf)
185 + {
Incorrect precondition check. If you're going to do a precondition check it should be mir_surface_
Chris Halse Rogers (raof) wrote : | # |
Also - what is the expectation if you call mir_surface_
It's technically possible to change MirOrientation to a bitfield without changing ABI by the magic of symbol versioning - since mir_surface_
I guess I'm suggesting that MirPermittedOri
Alan Griffiths (alan-griffiths) wrote : | # |
Do we have the right "orientation" here?
I would guess (with insufficient data) that most apps that restrict supported orientations care more about landscape/portrait than they do about the angle from the "natural" display orientation. Forcing them to discover screen metrics before requesting orientation restrictions seems perverse.
Gerry Boland (gerboland) wrote : | # |
> Also - what is the expectation if you call
> mir_surface_
> orientation in the set of supported orientations?
That's the apps way to ask for shell to change orientation to suit it. Usecase: youtube app, list of videos portrait, but playing video should be landscape. So app would change its preferred orientations from [portrait] to [landscape].
Of course shell may not respect that immediately (e.g. user interacting with Indicators at the time), or at all (tablet side stage)
> It's technically possible to change MirOrientation to a bitfield without
> changing ABI by the magic of symbol versioning - since
> mir_surface_
> you'd just need to provide a translation shim for that one function.
>
> I guess I'm suggesting that MirPermittedOri
/me didn't follow
Alberto Aguirre (albaguirre) wrote : | # |
> Also - what is the expectation if you call
> mir_surface_
> orientation in the set of supported orientations?
>
> It's technically possible to change MirOrientation to a bitfield without
> changing ABI by the magic of symbol versioning - since
> mir_surface_
> you'd just need to provide a translation shim for that one function.
One also needs to translate the orientation values for the event handler during orientation events.
>
> I guess I'm suggesting that MirPermittedOri
Right the options were break the ABI and change the existing MirOrientation enum, introduce a new enum and avoid symbol magic or use symbol magic and maintain backwards compatibility.
I've done the latter locally (symbol magic) but the results in oddness in testing and because of the event handler, MirSurface then needs to know whether to translate the values or not depending on the client symbol version that setup the handler.
Alberto Aguirre (albaguirre) wrote : | # |
> Do we have the right "orientation" here?
>
> I would guess (with insufficient data) that most apps that restrict supported
> orientations care more about landscape/portrait than they do about the angle
> from the "natural" display orientation. Forcing them to discover screen
> metrics before requesting orientation restrictions seems perverse.
One use case I was thinking about was a client may want to keep a surface in a specific orientation relative to a sensor location - say for example a flute app that requires you to blow into the mic, but perhaps if an application already has a list of sensor locations per phone model, then they should know the "natural" orientation of the screen - so portrait/landscape make sense.
So perhaps they SHOULD be separate - leave MirOrientation as is and introduce:
MirOrientationMode
{
mir_
mir_
mir_
mir_
mir_
mir_
mir_
}
MirWaitHandle* mir_surface_
MirOrientationMode mir_surface_
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
Awaiting final version for review. For now I have the following nits :
It'd make sense to base this MP on ~vanvugt/
-------
82 + mir_permitted_
83 + mir_permitted_
84 + mir_permitted_
85 + mir_permitted_
Would make more sense if mir_permitted_
-------
180 + MirPermittedOri
Would it not make more sense to restrict the client to something like mir_permitted_
Alberto Aguirre (albaguirre) wrote : | # |
> +1 for mir_surface_
>
> Nit:
> 178 +MirPermittedOr
> mir_surface_
> ...
> 184 + if (surf)
> 185 + {
>
> Incorrect precondition check. If you're going to do a precondition check it
> should be mir_surface_
> precondition fails.
OK, I guess we ought to fix all the other function preconditions checks as well as this was copy/pasta.
Alexandros Frantzis (afrantzis) wrote : | # |
Looks good.
67 + MirOrientationMode mode = mir_orientation
I'd slightly prefer we had a mir_orientation
Alan Griffiths (alan-griffiths) wrote : | # |
Trunk has changed
<<<<<<< TREE
=======
void ms::BasicSurfac
{
std:
attrib_
attrib_
attrib_
attrib_
attrib_
attrib_
attrib_
}
>>>>>>> MERGE-SOURCE
Kevin DuBois (kdub) wrote : | # |
lgtm, apart from the needed update.
Gerry Boland (gerboland) : | # |
Laurie Bradshaw (lauriebradshaw) wrote : | # |
I've been trying to integrate with the system rotation instead of doing it myself for neverball, neverputt and tuxracer.
mir_surface_
Preview Diff
1 | === modified file 'client-ABI-sha1sums' |
2 | --- client-ABI-sha1sums 2014-12-05 03:26:03 +0000 |
3 | +++ client-ABI-sha1sums 2014-12-05 22:17:20 +0000 |
4 | @@ -5,11 +5,11 @@ |
5 | 1ef8f51a3e3f8d1559266c5af58fbfde7cfabf0a include/client/mir_toolkit/mir_cursor_configuration.h |
6 | 9d50df5a141ca03ee8a79f7e844ed4b8b3b7d5d3 include/client/mir_toolkit/mir_prompt_session.h |
7 | 21d07e655e85eeec8a3523e1c6f9c2252176ec01 include/client/mir_toolkit/mir_screencast.h |
8 | -b9a11709737d6178c4bf30d067922ca823957045 include/client/mir_toolkit/mir_surface.h |
9 | +42bcad3a72b47f4d904e6b7033b0001b89cb9779 include/client/mir_toolkit/mir_surface.h |
10 | b141c4d79802ad626d969249c0004744e5c2a525 include/client/mir_toolkit/mir_wait.h |
11 | c367f5c9285936820fbd50961827d6ce58fb7ff4 include/client/mir_toolkit/version.h |
12 | 1863a7fe3a382061f2752c0236cc971e7e68f93f include/common/mir_toolkit/client_types.h |
13 | -2100c0674d9d882c1845550847357f6a5de5af66 include/common/mir_toolkit/common.h |
14 | +3e85c6d9dd1dca9767ea8bdf13ea6bbd1cb11c30 include/common/mir_toolkit/common.h |
15 | fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h |
16 | bccde9cdbc2f0d07e186c2950ef88d3a7d5f0d3b include/common/mir_toolkit/event.h |
17 | 4975998aa1056ed0d39dcc538127453e516ad8e9 include/common/mir_toolkit/mesa/native_display.h |
18 | |
19 | === modified file 'common-ABI-sha1sums' |
20 | --- common-ABI-sha1sums 2014-12-05 03:26:03 +0000 |
21 | +++ common-ABI-sha1sums 2014-12-05 22:17:20 +0000 |
22 | @@ -15,7 +15,7 @@ |
23 | 2fd7274766a92f22e8784cb64af91947ba03d0de include/common/mir/logging/logger.h |
24 | 9ae8473df05dd9e048a73797f01a2f34f7447554 include/common/mir/time/types.h |
25 | 1863a7fe3a382061f2752c0236cc971e7e68f93f include/common/mir_toolkit/client_types.h |
26 | -2100c0674d9d882c1845550847357f6a5de5af66 include/common/mir_toolkit/common.h |
27 | +3e85c6d9dd1dca9767ea8bdf13ea6bbd1cb11c30 include/common/mir_toolkit/common.h |
28 | fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h |
29 | bccde9cdbc2f0d07e186c2950ef88d3a7d5f0d3b include/common/mir_toolkit/event.h |
30 | 4975998aa1056ed0d39dcc538127453e516ad8e9 include/common/mir_toolkit/mesa/native_display.h |
31 | |
32 | === modified file 'include/client/mir_toolkit/mir_surface.h' |
33 | --- include/client/mir_toolkit/mir_surface.h 2014-12-05 03:26:03 +0000 |
34 | +++ include/client/mir_toolkit/mir_surface.h 2014-12-05 22:17:20 +0000 |
35 | @@ -408,6 +408,23 @@ |
36 | */ |
37 | MirOrientation mir_surface_get_orientation(MirSurface *surface); |
38 | |
39 | +/** |
40 | + * Request to set the preferred orientations of a surface. |
41 | + * The request may be rejected by the server; to check wait on the |
42 | + * result and check the applied value using mir_surface_get_preferred_orientation |
43 | + * \param [in] surface The surface to operate on |
44 | + * \param [in] orientation The preferred orientation modes |
45 | + * \return A wait handle that can be passed to mir_wait_for |
46 | + */ |
47 | +MirWaitHandle* mir_surface_set_preferred_orientation(MirSurface *surface, MirOrientationMode orientation); |
48 | + |
49 | +/** |
50 | + * Get the preferred orientation modes of a surface. |
51 | + * \param [in] surface The surface to query |
52 | + * \return The preferred orientation modes |
53 | + */ |
54 | +MirOrientationMode mir_surface_get_preferred_orientation(MirSurface *surface); |
55 | + |
56 | #ifdef __cplusplus |
57 | } |
58 | /**@}*/ |
59 | |
60 | === modified file 'include/common/mir_toolkit/common.h' |
61 | --- include/common/mir_toolkit/common.h 2014-12-05 03:26:03 +0000 |
62 | +++ include/common/mir_toolkit/common.h 2014-12-05 22:17:20 +0000 |
63 | @@ -42,6 +42,7 @@ |
64 | mir_surface_attrib_focus, |
65 | mir_surface_attrib_dpi, |
66 | mir_surface_attrib_visibility, |
67 | + mir_surface_attrib_preferred_orientation, |
68 | /* Must be last */ |
69 | mir_surface_attribs |
70 | } MirSurfaceAttrib; |
71 | @@ -143,6 +144,20 @@ |
72 | mir_orientation_right = 270 |
73 | } MirOrientation; |
74 | |
75 | +typedef enum MirOrientationMode |
76 | +{ |
77 | + mir_orientation_mode_portrait = 1 << 0, |
78 | + mir_orientation_mode_landscape = 1 << 1, |
79 | + mir_orientation_mode_portrait_inverted = 1 << 2, |
80 | + mir_orientation_mode_landscape_inverted = 1 << 3, |
81 | + mir_orientation_mode_portrait_any = mir_orientation_mode_portrait | |
82 | + mir_orientation_mode_portrait_inverted, |
83 | + mir_orientation_mode_landscape_any = mir_orientation_mode_landscape | |
84 | + mir_orientation_mode_landscape_inverted, |
85 | + mir_orientation_mode_any = mir_orientation_mode_portrait_any | |
86 | + mir_orientation_mode_landscape_any |
87 | +} MirOrientationMode; |
88 | + |
89 | /**@}*/ |
90 | |
91 | #endif |
92 | |
93 | === modified file 'platform-ABI-sha1sums' |
94 | --- platform-ABI-sha1sums 2014-12-05 03:26:03 +0000 |
95 | +++ platform-ABI-sha1sums 2014-12-05 22:17:20 +0000 |
96 | @@ -15,7 +15,7 @@ |
97 | 2fd7274766a92f22e8784cb64af91947ba03d0de include/common/mir/logging/logger.h |
98 | 9ae8473df05dd9e048a73797f01a2f34f7447554 include/common/mir/time/types.h |
99 | 1863a7fe3a382061f2752c0236cc971e7e68f93f include/common/mir_toolkit/client_types.h |
100 | -2100c0674d9d882c1845550847357f6a5de5af66 include/common/mir_toolkit/common.h |
101 | +3e85c6d9dd1dca9767ea8bdf13ea6bbd1cb11c30 include/common/mir_toolkit/common.h |
102 | fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h |
103 | bccde9cdbc2f0d07e186c2950ef88d3a7d5f0d3b include/common/mir_toolkit/event.h |
104 | 4975998aa1056ed0d39dcc538127453e516ad8e9 include/common/mir_toolkit/mesa/native_display.h |
105 | |
106 | === modified file 'server-ABI-sha1sums' |
107 | --- server-ABI-sha1sums 2014-12-05 03:26:03 +0000 |
108 | +++ server-ABI-sha1sums 2014-12-05 22:17:20 +0000 |
109 | @@ -15,7 +15,7 @@ |
110 | 2fd7274766a92f22e8784cb64af91947ba03d0de include/common/mir/logging/logger.h |
111 | 9ae8473df05dd9e048a73797f01a2f34f7447554 include/common/mir/time/types.h |
112 | 1863a7fe3a382061f2752c0236cc971e7e68f93f include/common/mir_toolkit/client_types.h |
113 | -2100c0674d9d882c1845550847357f6a5de5af66 include/common/mir_toolkit/common.h |
114 | +3e85c6d9dd1dca9767ea8bdf13ea6bbd1cb11c30 include/common/mir_toolkit/common.h |
115 | fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h |
116 | bccde9cdbc2f0d07e186c2950ef88d3a7d5f0d3b include/common/mir_toolkit/event.h |
117 | 4975998aa1056ed0d39dcc538127453e516ad8e9 include/common/mir_toolkit/mesa/native_display.h |
118 | |
119 | === modified file 'src/client/mir_surface.cpp' |
120 | --- src/client/mir_surface.cpp 2014-12-05 03:26:03 +0000 |
121 | +++ src/client/mir_surface.cpp 2014-12-05 22:17:20 +0000 |
122 | @@ -501,6 +501,7 @@ |
123 | case mir_surface_attrib_focus: |
124 | case mir_surface_attrib_swapinterval: |
125 | case mir_surface_attrib_dpi: |
126 | + case mir_surface_attrib_preferred_orientation: |
127 | if (configure_result.has_ivalue()) |
128 | attrib_cache[a] = configure_result.ivalue(); |
129 | else |
130 | @@ -607,3 +608,9 @@ |
131 | |
132 | return orientation; |
133 | } |
134 | + |
135 | +MirWaitHandle* MirSurface::set_preferred_orientation(MirOrientationMode mode) |
136 | +{ |
137 | + return configure(mir_surface_attrib_preferred_orientation, mode); |
138 | +} |
139 | + |
140 | |
141 | === modified file 'src/client/mir_surface.h' |
142 | --- src/client/mir_surface.h 2014-12-05 03:26:03 +0000 |
143 | +++ src/client/mir_surface.h 2014-12-05 22:17:20 +0000 |
144 | @@ -121,7 +121,8 @@ |
145 | int attrib(MirSurfaceAttrib a) const; |
146 | |
147 | MirOrientation get_orientation() const; |
148 | - |
149 | + MirWaitHandle* set_preferred_orientation(MirOrientationMode mode); |
150 | + |
151 | MirWaitHandle* configure_cursor(MirCursorConfiguration const* cursor); |
152 | |
153 | void set_event_handler(MirEventDelegate const* delegate); |
154 | |
155 | === modified file 'src/client/mir_surface_api.cpp' |
156 | --- src/client/mir_surface_api.cpp 2014-12-05 03:26:03 +0000 |
157 | +++ src/client/mir_surface_api.cpp 2014-12-05 22:17:20 +0000 |
158 | @@ -435,3 +435,36 @@ |
159 | |
160 | return result; |
161 | } |
162 | + |
163 | +MirOrientationMode mir_surface_get_preferred_orientation(MirSurface *surf) |
164 | +{ |
165 | + if (!mir_surface_is_valid(surf)) abort(); |
166 | + |
167 | + MirOrientationMode mode = mir_orientation_mode_any; |
168 | + |
169 | + try |
170 | + { |
171 | + mode = static_cast<MirOrientationMode>(surf->attrib(mir_surface_attrib_preferred_orientation)); |
172 | + } |
173 | + catch (...) |
174 | + { |
175 | + } |
176 | + |
177 | + return mode; |
178 | +} |
179 | + |
180 | +MirWaitHandle* mir_surface_set_preferred_orientation(MirSurface *surf, MirOrientationMode mode) |
181 | +{ |
182 | + if (!mir_surface_is_valid(surf)) abort(); |
183 | + |
184 | + MirWaitHandle *result{nullptr}; |
185 | + try |
186 | + { |
187 | + result = surf->set_preferred_orientation(mode); |
188 | + } |
189 | + catch (...) |
190 | + { |
191 | + } |
192 | + |
193 | + return result; |
194 | +} |
195 | |
196 | === modified file 'src/server/scene/basic_surface.cpp' |
197 | --- src/server/scene/basic_surface.cpp 2014-12-05 03:26:03 +0000 |
198 | +++ src/server/scene/basic_surface.cpp 2014-12-05 22:17:20 +0000 |
199 | @@ -465,6 +465,25 @@ |
200 | return new_state; |
201 | } |
202 | |
203 | +MirOrientationMode ms::BasicSurface::set_preferred_orientation(MirOrientationMode new_orientation_mode) |
204 | +{ |
205 | + if ((new_orientation_mode & mir_orientation_mode_any) == 0) |
206 | + { |
207 | + BOOST_THROW_EXCEPTION(std::logic_error("Invalid orientation mode")); |
208 | + } |
209 | + |
210 | + std::unique_lock<std::mutex> lg(guard); |
211 | + if (pref_orientation_mode != new_orientation_mode) |
212 | + { |
213 | + pref_orientation_mode = new_orientation_mode; |
214 | + lg.unlock(); |
215 | + |
216 | + observers.attrib_changed(mir_surface_attrib_preferred_orientation, new_orientation_mode); |
217 | + } |
218 | + |
219 | + return new_orientation_mode; |
220 | +} |
221 | + |
222 | void ms::BasicSurface::take_input_focus(std::shared_ptr<msh::InputTargeter> const& targeter) |
223 | { |
224 | targeter->focus_changed(input_channel()); |
225 | @@ -493,6 +512,9 @@ |
226 | case mir_surface_attrib_visibility: |
227 | result = set_visibility(static_cast<MirSurfaceVisibility>(result)); |
228 | break; |
229 | + case mir_surface_attrib_preferred_orientation: |
230 | + result = set_preferred_orientation(static_cast<MirOrientationMode>(result)); |
231 | + break; |
232 | default: |
233 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid surface " |
234 | "attribute.")); |
235 | @@ -515,6 +537,7 @@ |
236 | case mir_surface_attrib_focus: return focus_; |
237 | case mir_surface_attrib_dpi: return dpi_; |
238 | case mir_surface_attrib_visibility: return visibility_; |
239 | + case mir_surface_attrib_preferred_orientation: return pref_orientation_mode; |
240 | default: BOOST_THROW_EXCEPTION(std::logic_error("Invalid surface " |
241 | "attribute.")); |
242 | } |
243 | |
244 | === modified file 'src/server/scene/basic_surface.h' |
245 | --- src/server/scene/basic_surface.h 2014-12-05 03:26:03 +0000 |
246 | +++ src/server/scene/basic_surface.h 2014-12-05 22:17:20 +0000 |
247 | @@ -158,6 +158,7 @@ |
248 | MirSurfaceVisibility set_visibility(MirSurfaceVisibility v); |
249 | int set_swap_interval(int); |
250 | MirSurfaceFocusState set_focus_state(MirSurfaceFocusState f); |
251 | + MirOrientationMode set_preferred_orientation(MirOrientationMode mode); |
252 | |
253 | SurfaceObservers observers; |
254 | std::mutex mutable guard; |
255 | @@ -184,6 +185,7 @@ |
256 | MirSurfaceFocusState focus_ = mir_surface_unfocused; |
257 | int dpi_ = 0; |
258 | MirSurfaceVisibility visibility_ = mir_surface_visibility_exposed; |
259 | + MirOrientationMode pref_orientation_mode = mir_orientation_mode_any; |
260 | }; |
261 | |
262 | } |
263 | |
264 | === modified file 'tests/acceptance-tests/test_client_surface_events.cpp' |
265 | --- tests/acceptance-tests/test_client_surface_events.cpp 2014-12-05 03:26:03 +0000 |
266 | +++ tests/acceptance-tests/test_client_surface_events.cpp 2014-12-05 22:17:20 +0000 |
267 | @@ -270,3 +270,19 @@ |
268 | EXPECT_THAT(last_event_surface, Eq(surface)); |
269 | EXPECT_THAT(last_event.type, Eq(mir_event_type_close_surface)); |
270 | } |
271 | + |
272 | +TEST_F(ClientSurfaceEvents, client_can_query_preferred_orientation) |
273 | +{ |
274 | + |
275 | + for (auto const mode: |
276 | + {mir_orientation_mode_portrait, mir_orientation_mode_portrait_inverted, |
277 | + mir_orientation_mode_landscape, mir_orientation_mode_landscape_inverted, |
278 | + mir_orientation_mode_portrait_any, mir_orientation_mode_landscape_any, |
279 | + mir_orientation_mode_any}) |
280 | + { |
281 | + reset_last_event(); |
282 | + |
283 | + mir_wait_for(mir_surface_set_preferred_orientation(surface, mode)); |
284 | + EXPECT_THAT(mir_surface_get_preferred_orientation(surface), Eq(mode)); |
285 | + } |
286 | +} |
287 | |
288 | === modified file 'tests/unit-tests/client/test_client_mir_surface.cpp' |
289 | --- tests/unit-tests/client/test_client_mir_surface.cpp 2014-12-05 03:26:03 +0000 |
290 | +++ tests/unit-tests/client/test_client_mir_surface.cpp 2014-12-05 22:17:20 +0000 |
291 | @@ -188,7 +188,8 @@ |
292 | { mir_surface_attrib_swapinterval, 1 }, |
293 | { mir_surface_attrib_focus, mir_surface_focused }, |
294 | { mir_surface_attrib_dpi, 19 }, |
295 | - { mir_surface_attrib_visibility, mir_surface_visibility_exposed } |
296 | + { mir_surface_attrib_visibility, mir_surface_visibility_exposed }, |
297 | + { mir_surface_attrib_preferred_orientation, mir_orientation_mode_any } |
298 | }; |
299 | |
300 | struct MockBuffer : public mcl::ClientBuffer |
301 | |
302 | === modified file 'tests/unit-tests/scene/test_surface_impl.cpp' |
303 | --- tests/unit-tests/scene/test_surface_impl.cpp 2014-12-05 03:26:03 +0000 |
304 | +++ tests/unit-tests/scene/test_surface_impl.cpp 2014-12-05 22:17:20 +0000 |
305 | @@ -460,3 +460,21 @@ |
306 | |
307 | surf.request_client_surface_close(); |
308 | } |
309 | + |
310 | +TEST_F(Surface, preferred_orientation_mode_defaults_to_any) |
311 | +{ |
312 | + using namespace testing; |
313 | + |
314 | + ms::BasicSurface surf( |
315 | + std::string("stub"), |
316 | + geom::Rectangle{{},{}}, |
317 | + false, |
318 | + buffer_stream, |
319 | + std::shared_ptr<mi::InputChannel>(), |
320 | + stub_input_sender, |
321 | + null_configurator, |
322 | + std::shared_ptr<mg::CursorImage>(), |
323 | + report); |
324 | + |
325 | + EXPECT_EQ(mir_orientation_mode_any, surf.query(mir_surface_attrib_preferred_orientation)); |
326 | +} |
PASSED: Continuous integration, rev:2098 jenkins. qa.ubuntu. com/job/ mir-ci/ 2274/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/367 jenkins. qa.ubuntu. com/job/ mir-clang- vivid-amd64- build/367 jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/341 jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 263 jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 263/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 341 jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 341/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -runner- mako/3584 s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 16293
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: s-jenkins. ubuntu- ci:8080/ job/mir- ci/2274/ rebuild
http://