Mir

Merge lp:~alan-griffiths/mir/fix-1603922 into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 3604
Proposed branch: lp:~alan-griffiths/mir/fix-1603922
Merge into: lp:mir
Diff against target: 192 lines (+91/-9)
6 files modified
examples/tooltip.c (+2/-2)
include/client/mir_toolkit/mir_surface.h (+38/-2)
src/client/mir_surface_api.cpp (+18/-0)
src/client/symbols.map (+6/-0)
tests/acceptance-tests/test_client_surfaces.cpp (+22/-0)
tests/integration-tests/client/test_mirsurface.cpp (+5/-5)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-1603922
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Alan Griffiths Abstain
Kevin DuBois (community) Approve
Daniel van Vugt Abstain
Cemil Azizoglu (community) Approve
Review via email: mp+300304@code.launchpad.net

Commit message

Deprecate useless mir_connection_create_spec_for_tooltip() and add mir_connection_create_spec_for_tip()

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3597
https://mir-jenkins.ubuntu.com/job/mir-ci/1305/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1531
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1584
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1575
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1575
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1575
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1546
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1546/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1546
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1546/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1546
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1546/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1546
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1546/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1546
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1546/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1305/rebuild

review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It's regrettable that the new function name is hard to understand, because the old good name is already taken.

Can we think of a better name? mir_connection_create_spec_for_tooltip2 ?

review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

mir_connection_create_spec_for_tooltip_edge ?
mir_connection_create_spec_for_tooltip_with_edge ?

Revision history for this message
Daniel van Vugt (vanvugt) :
review: Needs Fixing
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> It's regrettable that the new function name is hard to understand, because the
> old good name is already taken.
>
> Can we think of a better name? mir_connection_create_spec_for_tooltip2 ?

1. the corresponding surface type is: mir_surface_type_tip

2. From the (internal) discussion that led to this MP:

    On 17/07/16 13:17, Matthew Paul Thomas wrote:
    > Maybe that would be a good time to start calling the type “tip”, to
    > avoid the impression that it’s just for tooltips.

Revision history for this message
Gerry Boland (gerboland) wrote :

"tip" is what we're calling this surface type in the Mir surface spec. Makes sense to use that terminology IMO.

Revision history for this message
Kevin DuBois (kdub) wrote :

seems the naming discussion has a lot more context behind it, but my 2cents is that tooltip and tip are synonyms. (abstain on that point)

small needs fixing
+ int width,
+ int height,
we should check that its a positive number. (or use unsigned int and check that its not 0x0)

review: Needs Fixing
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> small needs fixing
> + int width,
> + int height,
> we should check that its a positive number. (or use unsigned int and check
> that its not 0x0)

Curiously, we don't do that for mir_connection_create_spec_for_menu()

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

LGTM (modulo the width/height being positive).

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I know our design docs use the word 'tip' but that doesn't make it ideal. I'm aiming for something that existing toolkit developers will understand. They will grep for 'tooltip' and never find it.

Remember the Mir API should be a superset of the Unity design in order to support other shells and existing desktop concepts that are omitted from the Unity design.

We should not be betting on Unity8 being the winning shell. Because if it doesn't get sufficient traction and Mir is not more flexible than the Unity design, then Mir too will suffer as a platform that can't support other shells.

review: Abstain
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, too much tangential explanation. But you understand my concerns I hope. Abstain so we can make progress.

review: Abstain
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> > small needs fixing
> > + int width,
> > + int height,
> > we should check that its a positive number. (or use unsigned int and check
> > that its not 0x0)
>
> Curiously, we don't do that for mir_connection_create_spec_for_menu()

We don't check this for *any* of the existing mir_connection_create_spec_for_XXX() APIs and they all use "int" too. It is unclear what you believe the client side should do for nonpositive values:

1. consider it a precondition violation and:
1.1 check and abort() or
1.2 don't check as its the caller's responsibility.

2. make the "contract" wide and return an error object

As things stand the window manager isn't constrained by the requested and does something sensible with it.

Note also that these attributes of the spec can be updated before calling the server.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Should I rebase on lp:~alan-griffiths/mir/add-mir_surface_spec_attach and use MirPlacement?

review: Needs Information
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3598
https://mir-jenkins.ubuntu.com/job/mir-ci/1328/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1566
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1619
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1610
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1610
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1610
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1581
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1581/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1581
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1581/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1581
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1581/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1581
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1581/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1581
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1581/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1328/rebuild

review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

re checking for 0x0, its just a concern that the user will hit #1597717-like bugs (where we can get stuck in surface creation. We should be doing this for all surfaces. Here seems like a good place to start, although if we want to fix all the surface creation stuff at once, I don't mind a followup MP.

rewriting to 0x0 to be 1x1 seems like the solution we've been using in the past, although 2) from the menu of options seems like the right way.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Personally I'm happy with the existing approach: it's a precondition & we don't need to check.

Agreed, the server should withstand such values if they are ever sent (in a way that applies to all surfaces). I *think* I've seen code that handles this for all surface types, but am not sure where it is.

Maybe a test is in order that goes through all the surface create functions with bad sizes?

If, hypothetically, we adopt your suggestion and client updates a valid spec with mir_surface_spec_set_width()/mir_surface_spec_set_height() - how would you handle bad values here? Turning the existing spec into an error object?

Revision history for this message
Kevin DuBois (kdub) wrote :

filed LP: #1604874, so no need to fix in this MP

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Should I rebase on lp:~alan-griffiths/mir/add-mir_surface_spec_attach and use
> MirPlacement?

I'll withdraw the question as we can handle this API along with other placement functions

review: Abstain
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/414/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1569/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/444/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1622
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1613
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1613
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1613
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1584
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1584/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1584
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1584/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1584/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1584/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1584/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1584/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Network problems but also a few of these (?!):
17:06:09 /home/phablet/mir-testrunner/mir-smoke-test-runner.sh: line 24: 11321 Segmentation fault (core dumped) ${root}mir_demo_server --test-timeout=$timeout --test-client $root$client

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/415/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1576/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/445/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1629
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1620
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1620
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1620
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1591
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1591/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1591
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1591/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1591/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1591/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1591
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1591/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1591
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1591/artifact/output/*zip*/output.zip

review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Unrelated failure...

05:14:50 /home/phablet/mir-testrunner/mir-smoke-test-runner.sh: line 24: 10647 Segmentation fault (core dumped) ${root}mir_demo_server --test-timeout=$timeout --test-client $root$client
05:14:50 I: [FAILED] mir_demo_client_input_shapes

...but worrying

Revision history for this message
Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'examples/tooltip.c'
--- examples/tooltip.c 2015-06-17 05:20:42 +0000
+++ examples/tooltip.c 2016-07-20 10:29:25 +0000
@@ -102,8 +102,8 @@
102 MirRectangle zone = { 0, 0, 10, 10 };102 MirRectangle zone = { 0, 0, 10, 10 };
103 int const width = 50;103 int const width = 50;
104 int const height = 20;104 int const height = 20;
105 MirSurfaceSpec* const spec = mir_connection_create_spec_for_tooltip(105 MirSurfaceSpec* const spec = mir_connection_create_spec_for_tip(
106 connection, width, height, format, parent, &zone);106 connection, width, height, format, parent, &zone, mir_edge_attachment_vertical);
107107
108 mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_software);108 mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_software);
109 mir_surface_spec_set_name(spec, "tooltip");109 mir_surface_spec_set_name(spec, "tooltip");
110110
=== modified file 'include/client/mir_toolkit/mir_surface.h'
--- include/client/mir_toolkit/mir_surface.h 2016-06-09 00:38:26 +0000
+++ include/client/mir_toolkit/mir_surface.h 2016-07-20 10:29:25 +0000
@@ -103,9 +103,10 @@
103 * return a surface of this height.103 * return a surface of this height.
104 * \param [in] format Pixel format for the surface.104 * \param [in] format Pixel format for the surface.
105 * \param [in] parent A valid parent surface for this tooltip.105 * \param [in] parent A valid parent surface for this tooltip.
106 * \param [in] rect A target zone relative to parent.106 * \param [in] zone A target zone relative to parent.
107 * \return A handle that can be passed to mir_surface_create()107 * \return A handle that can be passed to mir_surface_create()
108 * to complete construction.108 * to complete construction.
109 *\deprecated use mir_connection_create_spec_for_tip() instead
109 */110 */
110MirSurfaceSpec*111MirSurfaceSpec*
111mir_connection_create_spec_for_tooltip(MirConnection* connection,112mir_connection_create_spec_for_tooltip(MirConnection* connection,
@@ -113,7 +114,42 @@
113 int height,114 int height,
114 MirPixelFormat format,115 MirPixelFormat format,
115 MirSurface* parent,116 MirSurface* parent,
116 MirRectangle* zone);117 MirRectangle* zone)
118 __attribute__((deprecated));
119
120/**
121 * Create a surface specification for a tip surface.
122 *
123 * Positioning of the surface is specified with respect to the parent surface
124 * via an adjacency rectangle. The server will attempt to choose an edge of the
125 * adjacency rectangle on which to place the surface taking in to account
126 * screen-edge proximity or similar constraints. In addition, the server can use
127 * the edge affinity hint to consider only horizontal or only vertical adjacency
128 * edges in the given rectangle.
129 *
130 * \param [in] connection Connection the surface will be created on
131 * \param [in] width Requested width. The server is not guaranteed to
132 * return a surface of this width.
133 * \param [in] height Requested height. The server is not guaranteed to
134 * return a surface of this height.
135 * \param [in] format Pixel format for the surface.
136 * \param [in] parent A valid parent surface for this tip.
137 * \param [in] rect The adjacency rectangle. The server is not
138 * guaranteed to create a surface at the requested
139 * location.
140 * \param [in] edge The preferred edge direction to attach to. Use
141 * mir_edge_attachment_any for no preference.
142 * \return A handle that can be passed to mir_surface_create()
143 * to complete construction.
144 */
145MirSurfaceSpec*
146mir_connection_create_spec_for_tip(MirConnection* connection,
147 int width,
148 int height,
149 MirPixelFormat format,
150 MirSurface* parent,
151 MirRectangle* rect,
152 MirEdgeAttachment edge);
117153
118/**154/**
119 * Create a surface specification for a modal dialog surface.155 * Create a surface specification for a modal dialog surface.
120156
=== modified file 'src/client/mir_surface_api.cpp'
--- src/client/mir_surface_api.cpp 2016-06-08 13:49:11 +0000
+++ src/client/mir_surface_api.cpp 2016-07-20 10:29:25 +0000
@@ -88,7 +88,25 @@
88 auto spec = new MirSurfaceSpec{connection, width, height, format};88 auto spec = new MirSurfaceSpec{connection, width, height, format};
89 spec->type = mir_surface_type_tip;89 spec->type = mir_surface_type_tip;
90 spec->parent = parent;90 spec->parent = parent;
91 return spec;
92}
93
94MirSurfaceSpec* mir_connection_create_spec_for_tip(MirConnection* connection,
95 int width,
96 int height,
97 MirPixelFormat format,
98 MirSurface* parent,
99 MirRectangle* rect,
100 MirEdgeAttachment edge)
101{
102 mir::require(mir_surface_is_valid(parent));
103 mir::require(rect != nullptr);
104
105 auto spec = new MirSurfaceSpec{connection, width, height, format};
106 spec->type = mir_surface_type_tip;
107 spec->parent = parent;
91 spec->aux_rect = *rect;108 spec->aux_rect = *rect;
109 spec->edge_attachment = edge;
92 return spec;110 return spec;
93}111}
94112
95113
=== modified file 'src/client/symbols.map'
--- src/client/symbols.map 2016-07-07 09:54:02 +0000
+++ src/client/symbols.map 2016-07-20 10:29:25 +0000
@@ -415,3 +415,9 @@
415 mir_input_device_state_event_device_pointer_buttons;415 mir_input_device_state_event_device_pointer_buttons;
416 mir_surface_spec_set_pointer_confinement;416 mir_surface_spec_set_pointer_confinement;
417} MIR_CLIENT_0.22;417} MIR_CLIENT_0.22;
418
419MIR_CLIENT_0.25 { # New functions in Mir 0.25
420 global:
421 mir_connection_create_spec_for_tip;
422} MIR_CLIENT_0.24;
423
418424
=== modified file 'tests/acceptance-tests/test_client_surfaces.cpp'
--- tests/acceptance-tests/test_client_surfaces.cpp 2016-05-03 06:55:25 +0000
+++ tests/acceptance-tests/test_client_surfaces.cpp 2016-07-20 10:29:25 +0000
@@ -244,6 +244,8 @@
244 mir_surface_release_sync(menu);244 mir_surface_release_sync(menu);
245}245}
246246
247#pragma GCC diagnostic push
248#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
247TEST_F(ClientSurfaces, can_be_tooltips)249TEST_F(ClientSurfaces, can_be_tooltips)
248{250{
249 auto parent = mtf::make_any_surface(connection);251 auto parent = mtf::make_any_surface(connection);
@@ -262,6 +264,26 @@
262 mir_surface_release_sync(parent);264 mir_surface_release_sync(parent);
263 mir_surface_release_sync(tooltip);265 mir_surface_release_sync(tooltip);
264}266}
267#pragma GCC diagnostic pop
268
269TEST_F(ClientSurfaces, can_be_tips)
270{
271 auto parent = mtf::make_any_surface(connection);
272 MirRectangle rect{100, 200, 100, 100};
273
274 auto spec = mir_connection_create_spec_for_tip(connection, 640, 480,
275 mir_pixel_format_abgr_8888, parent, &rect, mir_edge_attachment_any);
276 ASSERT_THAT(spec, NotNull());
277
278 auto tooltip = mir_surface_create_sync(spec);
279 mir_surface_spec_release(spec);
280
281 ASSERT_THAT(tooltip, IsValid());
282 EXPECT_EQ(mir_surface_get_type(tooltip), mir_surface_type_tip);
283
284 mir_surface_release_sync(parent);
285 mir_surface_release_sync(tooltip);
286}
265287
266TEST_F(ClientSurfaces, can_be_dialogs)288TEST_F(ClientSurfaces, can_be_dialogs)
267{289{
268290
=== modified file 'tests/integration-tests/client/test_mirsurface.cpp'
--- tests/integration-tests/client/test_mirsurface.cpp 2016-01-29 08:18:22 +0000
+++ tests/integration-tests/client/test_mirsurface.cpp 2016-07-20 10:29:25 +0000
@@ -196,25 +196,25 @@
196 create_surface(menu_spec.get());196 create_surface(menu_spec.get());
197}197}
198198
199TEST_F(ClientMirSurface, as_tooltip_sends_correct_params)199TEST_F(ClientMirSurface, as_tip_sends_correct_params)
200{200{
201 EXPECT_CALL(*mock_shell, create_surface(_,_,_));201 EXPECT_CALL(*mock_shell, create_surface(_,_,_));
202 auto parent = create_surface(&spec);202 auto parent = create_surface(&spec);
203 ASSERT_THAT(parent.get(), IsValid());203 ASSERT_THAT(parent.get(), IsValid());
204204
205 MirRectangle target_zone_rect{100, 200, 300, 400};205 MirRectangle placement_hint{100, 200, 300, 400};
206206
207 auto spec_deleter = [](MirSurfaceSpec* spec) {mir_surface_spec_release(spec);};207 auto spec_deleter = [](MirSurfaceSpec* spec) {mir_surface_spec_release(spec);};
208 std::unique_ptr<MirSurfaceSpec, decltype(spec_deleter)> tooltip_spec{208 std::unique_ptr<MirSurfaceSpec, decltype(spec_deleter)> tooltip_spec{
209 mir_connection_create_spec_for_tooltip(connection, 640, 480,209 mir_connection_create_spec_for_tip(connection, 640, 480,
210 mir_pixel_format_abgr_8888, parent.get(), &target_zone_rect),210 mir_pixel_format_abgr_8888, parent.get(), &placement_hint, mir_edge_attachment_vertical),
211 spec_deleter211 spec_deleter
212 };212 };
213213
214 ASSERT_THAT(tooltip_spec, NotNull());214 ASSERT_THAT(tooltip_spec, NotNull());
215215
216 EXPECT_CALL(*mock_shell, create_surface(_, AllOf(IsATooltip(),216 EXPECT_CALL(*mock_shell, create_surface(_, AllOf(IsATooltip(),
217 HasParent(parent.get()), MatchesAuxRect(target_zone_rect)),_));217 HasParent(parent.get()), MatchesAuxRect(placement_hint)),_));
218 create_surface(tooltip_spec.get());218 create_surface(tooltip_spec.get());
219}219}
220220

Subscribers

People subscribed via source and target branches