Merge lp:~kdub/mir/fix-1563278 into lp:mir
- fix-1563278
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Alan Griffiths |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3458 |
Proposed branch: | lp:~kdub/mir/fix-1563278 |
Merge into: | lp:mir |
Prerequisite: | lp:~kdub/mir/require-streams-when-creating-surface |
Diff against target: |
1298 lines (+188/-200) 22 files modified
examples/render_surfaces.cpp (+1/-1) include/server/mir/scene/surface_factory.h (+3/-1) playground/mir_demo_client_prerendered_frames.c (+1/-6) src/server/scene/application_session.cpp (+14/-2) src/server/scene/basic_surface.cpp (+19/-5) src/server/scene/basic_surface.h (+2/-2) src/server/scene/surface_allocator.cpp (+3/-5) src/server/scene/surface_allocator.h (+1/-1) tests/acceptance-tests/throwback/test_presentation_chain.cpp (+1/-2) tests/include/mir/test/doubles/mock_surface.h (+4/-2) tests/include/mir/test/doubles/stub_surface_factory.h (+1/-1) tests/integration-tests/surface_composition.cpp (+5/-4) tests/integration-tests/test_error_reporting.cpp (+1/-1) tests/integration-tests/test_session.cpp (+7/-6) tests/integration-tests/test_surface_stack_with_compositor.cpp (+13/-9) tests/unit-tests/scene/test_abstract_shell.cpp (+1/-2) tests/unit-tests/scene/test_application_session.cpp (+15/-14) tests/unit-tests/scene/test_basic_surface.cpp (+11/-36) tests/unit-tests/scene/test_session_manager.cpp (+1/-1) tests/unit-tests/scene/test_surface.cpp (+4/-9) tests/unit-tests/scene/test_surface_impl.cpp (+5/-4) tests/unit-tests/scene/test_surface_stack.cpp (+75/-86) |
To merge this branch: | bzr merge lp:~kdub/mir/fix-1563278 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Alan Griffiths | Approve | ||
Cemil Azizoglu (community) | Approve | ||
Review via email: mp+291647@code.launchpad.net |
Commit message
fix LP: #1563278 by allowing Surfaces to be created with non-default streams.
This allows the user of MirPresentation
Description of the change
fix LP: #1563278 by allowing Surfaces to be created with non-default streams.
This allows the user of MirPresentation
Kevin DuBois (kdub) wrote : | # |
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3450
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Alan Griffiths (alan-griffiths) wrote : | # |
Just nits:
}
-
TEST_F(
I'd like to keep that whitespace.
~~~~
+ stub_buffer_stream1 = std::make_
+ stub_buffer_stream2 = std::make_
+ stub_buffer_stream3 = std::make_
...
+ std::shared_
+ std::shared_
+ std::shared_
I think test fixtures are a great place for in-class initializers - half the lines used here and only one place to look.
~~~~
}
-
//test associated with lp:1290306, 1293896, 1294048, 1294051, 1294053
I'd like to keep that whitespace.
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3452
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Kevin DuBois (kdub) wrote : | # |
unrelated, retriggering.
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
Looks good
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3452
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Kevin DuBois (kdub) wrote : | # |
19:23:52 [0;32m[ RUN ] [mMirSurfaceVi
Kevin DuBois (kdub) wrote : | # |
LP: #1556045
Alan Griffiths (alan-griffiths) wrote : | # |
Probably a slow test environment - a generous 10s timeout and a test taking 30s to run!
18:51:00 11: [ RUN ] ApplicationNotR
18:51:00 11: [2016-04-13 18:50:59.936136] mirserver: Starting
18:51:00 11: [2016-04-13 18:51:00.526634] mirserver: Selected driver: dummy (version 0.22.0)
18:51:02 11: [2016-04-13 18:51:02.694384] mirserver: Using software cursor
18:51:03 11: [2016-04-13 18:51:03.829134] mirserver: Initial display configuration:
18:51:03 11: [2016-04-13 18:51:03.876013] mirserver: 1.1: VGA 0.0" 0x0mm
18:51:03 11: [2016-04-13 18:51:03.894852] mirserver: Current mode 1600x1600 60.00Hz
18:51:03 11: [2016-04-13 18:51:03.897768] mirserver: Preferred mode 1600x1600 60.00Hz
18:51:03 11: [2016-04-13 18:51:03.900158] mirserver: Logical position +0+0
18:51:05 11: [2016-04-13 18:51:05.590816] mirserver: Selected input driver: mir:stub-input (version: 0.22.0)
18:51:05 11: [2016-04-13 18:51:05.932306] mirserver: Mir version 0.22.0
18:51:26 11: /��BUILDDIR�
18:51:26 11: Value of: marked_
18:51:26 11: Actual: false
18:51:26 11: Expected: true
18:51:28 11: [2016-04-13 18:51:28.042141] mirserver: Stopping
18:51:30 11: [ FAILED ] ApplicationNotR
Alan Griffiths (alan-griffiths) wrote : | # |
> Probably a slow test environment - a generous 10s timeout and a test taking
> 30s to run!
Logged as lp:1570327
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3452
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) : | # |
Preview Diff
1 | === modified file 'examples/render_surfaces.cpp' | |||
2 | --- examples/render_surfaces.cpp 2016-03-23 06:39:56 +0000 | |||
3 | +++ examples/render_surfaces.cpp 2016-04-13 15:56:18 +0000 | |||
4 | @@ -377,7 +377,7 @@ | |||
5 | 377 | 377 | ||
6 | 378 | auto const stream = buffer_stream_factory->create_buffer_stream( | 378 | auto const stream = buffer_stream_factory->create_buffer_stream( |
7 | 379 | mf::BufferStreamId{}, std::make_shared<NullBufferSink>(), properties); | 379 | mf::BufferStreamId{}, std::make_shared<NullBufferSink>(), properties); |
9 | 380 | auto const surface = surface_factory->create_surface(stream, params); | 380 | auto const surface = surface_factory->create_surface({ ms::StreamInfo{ stream, {0, 0}, {} } }, params); |
10 | 381 | surface_stack->add_surface(surface, params.input_mode); | 381 | surface_stack->add_surface(surface, params.input_mode); |
11 | 382 | 382 | ||
12 | 383 | { | 383 | { |
13 | 384 | 384 | ||
14 | === modified file 'include/server/mir/scene/surface_factory.h' | |||
15 | --- include/server/mir/scene/surface_factory.h 2015-06-17 05:20:42 +0000 | |||
16 | +++ include/server/mir/scene/surface_factory.h 2016-04-13 15:56:18 +0000 | |||
17 | @@ -21,6 +21,7 @@ | |||
18 | 21 | 21 | ||
19 | 22 | #include "mir/scene/surface_creation_parameters.h" | 22 | #include "mir/scene/surface_creation_parameters.h" |
20 | 23 | #include <memory> | 23 | #include <memory> |
21 | 24 | #include <list> | ||
22 | 24 | 25 | ||
23 | 25 | namespace mir | 26 | namespace mir |
24 | 26 | { | 27 | { |
25 | @@ -28,6 +29,7 @@ | |||
26 | 28 | namespace scene | 29 | namespace scene |
27 | 29 | { | 30 | { |
28 | 30 | class Surface; | 31 | class Surface; |
29 | 32 | class StreamInfo; | ||
30 | 31 | 33 | ||
31 | 32 | class SurfaceFactory | 34 | class SurfaceFactory |
32 | 33 | { | 35 | { |
33 | @@ -36,7 +38,7 @@ | |||
34 | 36 | virtual ~SurfaceFactory() = default; | 38 | virtual ~SurfaceFactory() = default; |
35 | 37 | 39 | ||
36 | 38 | virtual std::shared_ptr<Surface> create_surface( | 40 | virtual std::shared_ptr<Surface> create_surface( |
38 | 39 | std::shared_ptr<compositor::BufferStream> const&, | 41 | std::list<scene::StreamInfo> const& streams, |
39 | 40 | SurfaceCreationParameters const& params) = 0; | 42 | SurfaceCreationParameters const& params) = 0; |
40 | 41 | 43 | ||
41 | 42 | private: | 44 | private: |
42 | 43 | 45 | ||
43 | === modified file 'playground/mir_demo_client_prerendered_frames.c' | |||
44 | --- playground/mir_demo_client_prerendered_frames.c 2016-03-23 06:39:56 +0000 | |||
45 | +++ playground/mir_demo_client_prerendered_frames.c 2016-04-13 15:56:18 +0000 | |||
46 | @@ -159,14 +159,9 @@ | |||
47 | 159 | } | 159 | } |
48 | 160 | 160 | ||
49 | 161 | MirSurfaceSpec* spec = mir_connection_create_spec_for_normal_surface(connection, width, height, format); | 161 | MirSurfaceSpec* spec = mir_connection_create_spec_for_normal_surface(connection, width, height, format); |
50 | 162 | MirSurface* surface = mir_surface_create_sync(spec); | ||
51 | 163 | mir_surface_spec_release(spec); | ||
52 | 164 | |||
53 | 165 | //reassociate for advanced control | ||
54 | 166 | spec = mir_create_surface_spec(connection); | ||
55 | 167 | mir_surface_spec_add_presentation_chain( | 162 | mir_surface_spec_add_presentation_chain( |
56 | 168 | spec, width, height, displacement_x, displacement_y, chain); | 163 | spec, width, height, displacement_x, displacement_y, chain); |
58 | 169 | mir_surface_apply_spec(surface, spec); | 164 | MirSurface* surface = mir_surface_create_sync(spec); |
59 | 170 | mir_surface_spec_release(spec); | 165 | mir_surface_spec_release(spec); |
60 | 171 | 166 | ||
61 | 172 | int num_prerendered_frames = 20; | 167 | int num_prerendered_frames = 20; |
62 | 173 | 168 | ||
63 | === modified file 'src/server/scene/application_session.cpp' | |||
64 | --- src/server/scene/application_session.cpp 2016-04-12 14:10:00 +0000 | |||
65 | +++ src/server/scene/application_session.cpp 2016-04-13 15:56:18 +0000 | |||
66 | @@ -111,11 +111,23 @@ | |||
67 | 111 | if (params.parent_id.is_set()) | 111 | if (params.parent_id.is_set()) |
68 | 112 | params.parent = checked_find(the_params.parent_id.value())->second; | 112 | params.parent = checked_find(the_params.parent_id.value())->second; |
69 | 113 | 113 | ||
71 | 114 | auto buffer_stream = checked_find(params.content_id.value())->second; | 114 | auto buffer_stream = checked_find(stream_id)->second; |
72 | 115 | if (params.size != buffer_stream->stream_size()) | 115 | if (params.size != buffer_stream->stream_size()) |
73 | 116 | buffer_stream->resize(params.size); | 116 | buffer_stream->resize(params.size); |
74 | 117 | 117 | ||
76 | 118 | auto surface = surface_factory->create_surface(buffer_stream, params); | 118 | std::list<StreamInfo> streams; |
77 | 119 | if (the_params.content_id.is_set()) | ||
78 | 120 | { | ||
79 | 121 | streams.push_back({checked_find(the_params.content_id.value())->second, {0,0}, {}}); | ||
80 | 122 | } | ||
81 | 123 | else | ||
82 | 124 | { | ||
83 | 125 | for (auto& stream : params.streams.value()) | ||
84 | 126 | streams.push_back({checked_find(stream.stream_id)->second, stream.displacement, stream.size}); | ||
85 | 127 | } | ||
86 | 128 | |||
87 | 129 | auto surface = surface_factory->create_surface(streams, params); | ||
88 | 130 | |||
89 | 119 | surface_stack->add_surface(surface, params.input_mode); | 131 | surface_stack->add_surface(surface, params.input_mode); |
90 | 120 | 132 | ||
91 | 121 | if (params.state.is_set()) | 133 | if (params.state.is_set()) |
92 | 122 | 134 | ||
93 | === modified file 'src/server/scene/basic_surface.cpp' | |||
94 | --- src/server/scene/basic_surface.cpp 2016-04-04 18:19:17 +0000 | |||
95 | +++ src/server/scene/basic_surface.cpp 2016-04-13 15:56:18 +0000 | |||
96 | @@ -199,12 +199,26 @@ | |||
97 | 199 | geom::Displacement hotspot; | 199 | geom::Displacement hotspot; |
98 | 200 | }; | 200 | }; |
99 | 201 | 201 | ||
100 | 202 | namespace | ||
101 | 203 | { | ||
102 | 204 | //TODO: the concept of default stream is going away very soon. | ||
103 | 205 | std::shared_ptr<mc::BufferStream> default_stream(std::list<ms::StreamInfo> const& layers) | ||
104 | 206 | { | ||
105 | 207 | //There's not a good reason, other than soon-to-be-deprecated api to disallow contentless surfaces | ||
106 | 208 | if (layers.empty()) | ||
107 | 209 | BOOST_THROW_EXCEPTION(std::logic_error("Surface must have content")); | ||
108 | 210 | else | ||
109 | 211 | return layers.front().stream; | ||
110 | 212 | } | ||
111 | 213 | |||
112 | 214 | } | ||
113 | 215 | |||
114 | 202 | ms::BasicSurface::BasicSurface( | 216 | ms::BasicSurface::BasicSurface( |
115 | 203 | std::string const& name, | 217 | std::string const& name, |
116 | 204 | geometry::Rectangle rect, | 218 | geometry::Rectangle rect, |
117 | 205 | std::weak_ptr<Surface> const& parent, | 219 | std::weak_ptr<Surface> const& parent, |
118 | 206 | bool nonrectangular, | 220 | bool nonrectangular, |
120 | 207 | std::shared_ptr<mc::BufferStream> const& buffer_stream, | 221 | std::list<StreamInfo> const& layers, |
121 | 208 | std::shared_ptr<mi::InputChannel> const& input_channel, | 222 | std::shared_ptr<mi::InputChannel> const& input_channel, |
122 | 209 | std::shared_ptr<input::InputSender> const& input_sender, | 223 | std::shared_ptr<input::InputSender> const& input_sender, |
123 | 210 | std::shared_ptr<mg::CursorImage> const& cursor_image, | 224 | std::shared_ptr<mg::CursorImage> const& cursor_image, |
124 | @@ -216,13 +230,13 @@ | |||
125 | 216 | input_mode(mi::InputReceptionMode::normal), | 230 | input_mode(mi::InputReceptionMode::normal), |
126 | 217 | nonrectangular(nonrectangular), | 231 | nonrectangular(nonrectangular), |
127 | 218 | custom_input_rectangles(), | 232 | custom_input_rectangles(), |
129 | 219 | surface_buffer_stream(buffer_stream), | 233 | surface_buffer_stream(default_stream(layers)), |
130 | 220 | server_input_channel(input_channel), | 234 | server_input_channel(input_channel), |
131 | 221 | input_sender(input_sender), | 235 | input_sender(input_sender), |
132 | 222 | cursor_image_(cursor_image), | 236 | cursor_image_(cursor_image), |
133 | 223 | report(report), | 237 | report(report), |
134 | 224 | parent_(parent), | 238 | parent_(parent), |
136 | 225 | layers({StreamInfo{buffer_stream, {0,0}, {}}}), | 239 | layers(layers), |
137 | 226 | cursor_stream_adapter{std::make_unique<ms::CursorStreamImageAdapter>(*this)}, | 240 | cursor_stream_adapter{std::make_unique<ms::CursorStreamImageAdapter>(*this)}, |
138 | 227 | input_validator([this](MirEvent const& ev) { this->input_sender->send_event(ev, server_input_channel); }) | 241 | input_validator([this](MirEvent const& ev) { this->input_sender->send_event(ev, server_input_channel); }) |
139 | 228 | { | 242 | { |
140 | @@ -233,12 +247,12 @@ | |||
141 | 233 | std::string const& name, | 247 | std::string const& name, |
142 | 234 | geometry::Rectangle rect, | 248 | geometry::Rectangle rect, |
143 | 235 | bool nonrectangular, | 249 | bool nonrectangular, |
145 | 236 | std::shared_ptr<mc::BufferStream> const& buffer_stream, | 250 | std::list<StreamInfo> const& layers, |
146 | 237 | std::shared_ptr<mi::InputChannel> const& input_channel, | 251 | std::shared_ptr<mi::InputChannel> const& input_channel, |
147 | 238 | std::shared_ptr<input::InputSender> const& input_sender, | 252 | std::shared_ptr<input::InputSender> const& input_sender, |
148 | 239 | std::shared_ptr<mg::CursorImage> const& cursor_image, | 253 | std::shared_ptr<mg::CursorImage> const& cursor_image, |
149 | 240 | std::shared_ptr<SceneReport> const& report) : | 254 | std::shared_ptr<SceneReport> const& report) : |
151 | 241 | BasicSurface(name, rect, std::shared_ptr<Surface>{nullptr}, nonrectangular,buffer_stream, | 255 | BasicSurface(name, rect, std::shared_ptr<Surface>{nullptr}, nonrectangular, layers, |
152 | 242 | input_channel, input_sender, cursor_image, report) | 256 | input_channel, input_sender, cursor_image, report) |
153 | 243 | { | 257 | { |
154 | 244 | } | 258 | } |
155 | 245 | 259 | ||
156 | === modified file 'src/server/scene/basic_surface.h' | |||
157 | --- src/server/scene/basic_surface.h 2016-01-29 08:18:22 +0000 | |||
158 | +++ src/server/scene/basic_surface.h 2016-04-13 15:56:18 +0000 | |||
159 | @@ -65,7 +65,7 @@ | |||
160 | 65 | std::string const& name, | 65 | std::string const& name, |
161 | 66 | geometry::Rectangle rect, | 66 | geometry::Rectangle rect, |
162 | 67 | bool nonrectangular, | 67 | bool nonrectangular, |
164 | 68 | std::shared_ptr<compositor::BufferStream> const& buffer_stream, | 68 | std::list<scene::StreamInfo> const& streams, |
165 | 69 | std::shared_ptr<input::InputChannel> const& input_channel, | 69 | std::shared_ptr<input::InputChannel> const& input_channel, |
166 | 70 | std::shared_ptr<input::InputSender> const& sender, | 70 | std::shared_ptr<input::InputSender> const& sender, |
167 | 71 | std::shared_ptr<graphics::CursorImage> const& cursor_image, | 71 | std::shared_ptr<graphics::CursorImage> const& cursor_image, |
168 | @@ -76,7 +76,7 @@ | |||
169 | 76 | geometry::Rectangle rect, | 76 | geometry::Rectangle rect, |
170 | 77 | std::weak_ptr<Surface> const& parent, | 77 | std::weak_ptr<Surface> const& parent, |
171 | 78 | bool nonrectangular, | 78 | bool nonrectangular, |
173 | 79 | std::shared_ptr<compositor::BufferStream> const& buffer_stream, | 79 | std::list<scene::StreamInfo> const& streams, |
174 | 80 | std::shared_ptr<input::InputChannel> const& input_channel, | 80 | std::shared_ptr<input::InputChannel> const& input_channel, |
175 | 81 | std::shared_ptr<input::InputSender> const& sender, | 81 | std::shared_ptr<input::InputSender> const& sender, |
176 | 82 | std::shared_ptr<graphics::CursorImage> const& cursor_image, | 82 | std::shared_ptr<graphics::CursorImage> const& cursor_image, |
177 | 83 | 83 | ||
178 | === modified file 'src/server/scene/surface_allocator.cpp' | |||
179 | --- src/server/scene/surface_allocator.cpp 2015-06-17 05:20:42 +0000 | |||
180 | +++ src/server/scene/surface_allocator.cpp 2016-04-13 15:56:18 +0000 | |||
181 | @@ -48,19 +48,17 @@ | |||
182 | 48 | } | 48 | } |
183 | 49 | 49 | ||
184 | 50 | std::shared_ptr<ms::Surface> ms::SurfaceAllocator::create_surface( | 50 | std::shared_ptr<ms::Surface> ms::SurfaceAllocator::create_surface( |
186 | 51 | std::shared_ptr<compositor::BufferStream> const& buffer_stream, | 51 | std::list<ms::StreamInfo> const& streams, |
187 | 52 | SurfaceCreationParameters const& params) | 52 | SurfaceCreationParameters const& params) |
188 | 53 | { | 53 | { |
189 | 54 | auto actual_size = geom::Rectangle{params.top_left, buffer_stream->stream_size()}; | ||
190 | 55 | |||
191 | 56 | bool nonrectangular = has_alpha(params.pixel_format); | 54 | bool nonrectangular = has_alpha(params.pixel_format); |
192 | 57 | auto input_channel = input_factory->make_input_channel(); | 55 | auto input_channel = input_factory->make_input_channel(); |
193 | 58 | auto const surface = std::make_shared<BasicSurface>( | 56 | auto const surface = std::make_shared<BasicSurface>( |
194 | 59 | params.name, | 57 | params.name, |
196 | 60 | actual_size, | 58 | geom::Rectangle{params.top_left, params.size}, |
197 | 61 | params.parent, | 59 | params.parent, |
198 | 62 | nonrectangular, | 60 | nonrectangular, |
200 | 63 | buffer_stream, | 61 | streams, |
201 | 64 | input_channel, | 62 | input_channel, |
202 | 65 | input_sender, | 63 | input_sender, |
203 | 66 | default_cursor_image, | 64 | default_cursor_image, |
204 | 67 | 65 | ||
205 | === modified file 'src/server/scene/surface_allocator.h' | |||
206 | --- src/server/scene/surface_allocator.h 2015-06-17 05:20:42 +0000 | |||
207 | +++ src/server/scene/surface_allocator.h 2016-04-13 15:56:18 +0000 | |||
208 | @@ -47,7 +47,7 @@ | |||
209 | 47 | std::shared_ptr<SceneReport> const& report); | 47 | std::shared_ptr<SceneReport> const& report); |
210 | 48 | 48 | ||
211 | 49 | std::shared_ptr<Surface> create_surface( | 49 | std::shared_ptr<Surface> create_surface( |
213 | 50 | std::shared_ptr<compositor::BufferStream> const& buffer_stream, | 50 | std::list<scene::StreamInfo> const& streams, |
214 | 51 | SurfaceCreationParameters const& params) override; | 51 | SurfaceCreationParameters const& params) override; |
215 | 52 | 52 | ||
216 | 53 | private: | 53 | private: |
217 | 54 | 54 | ||
218 | === modified file 'tests/acceptance-tests/throwback/test_presentation_chain.cpp' | |||
219 | --- tests/acceptance-tests/throwback/test_presentation_chain.cpp 2016-03-23 06:39:56 +0000 | |||
220 | +++ tests/acceptance-tests/throwback/test_presentation_chain.cpp 2016-04-13 15:56:18 +0000 | |||
221 | @@ -268,8 +268,7 @@ | |||
222 | 268 | EXPECT_THAT(region.pixel_format, Eq(pf)); | 268 | EXPECT_THAT(region.pixel_format, Eq(pf)); |
223 | 269 | } | 269 | } |
224 | 270 | 270 | ||
227 | 271 | //needs an ABI break to fix | 271 | TEST_F(PresentationChain, submission_will_eventually_call_callback) |
226 | 272 | TEST_F(PresentationChain, DISABLED_submission_will_eventually_call_callback) | ||
228 | 273 | { | 272 | { |
229 | 274 | SurfaceWithChainFromStart surface(connection, size, pf); | 273 | SurfaceWithChainFromStart surface(connection, size, pf); |
230 | 275 | 274 | ||
231 | 276 | 275 | ||
232 | === modified file 'tests/include/mir/test/doubles/mock_surface.h' | |||
233 | --- tests/include/mir/test/doubles/mock_surface.h 2016-01-29 08:18:22 +0000 | |||
234 | +++ tests/include/mir/test/doubles/mock_surface.h 2016-04-13 15:56:18 +0000 | |||
235 | @@ -43,14 +43,15 @@ | |||
236 | 43 | {}, | 43 | {}, |
237 | 44 | {{},{}}, | 44 | {{},{}}, |
238 | 45 | true, | 45 | true, |
240 | 46 | std::make_shared<testing::NiceMock<MockBufferStream>>(), | 46 | { { std::make_shared<testing::NiceMock<MockBufferStream>>(), {0, 0}, {} } }, |
241 | 47 | std::make_shared<StubInputChannel>(), | 47 | std::make_shared<StubInputChannel>(), |
242 | 48 | {}, | 48 | {}, |
243 | 49 | {}, | 49 | {}, |
244 | 50 | mir::report::null_scene_report()) | 50 | mir::report::null_scene_report()) |
245 | 51 | { | 51 | { |
246 | 52 | ON_CALL(*this, primary_buffer_stream()) | 52 | ON_CALL(*this, primary_buffer_stream()) |
248 | 53 | .WillByDefault(testing::Return(std::make_shared<testing::NiceMock<MockBufferStream>>())); | 53 | .WillByDefault(testing::Invoke([this] |
249 | 54 | { return scene::BasicSurface::primary_buffer_stream(); })); | ||
250 | 54 | } | 55 | } |
251 | 55 | 56 | ||
252 | 56 | ~MockSurface() noexcept {} | 57 | ~MockSurface() noexcept {} |
253 | @@ -76,6 +77,7 @@ | |||
254 | 76 | MOCK_CONST_METHOD0(primary_buffer_stream, std::shared_ptr<frontend::BufferStream>()); | 77 | MOCK_CONST_METHOD0(primary_buffer_stream, std::shared_ptr<frontend::BufferStream>()); |
255 | 77 | MOCK_METHOD1(set_streams, void(std::list<scene::StreamInfo> const&)); | 78 | MOCK_METHOD1(set_streams, void(std::list<scene::StreamInfo> const&)); |
256 | 78 | 79 | ||
257 | 80 | std::shared_ptr<MockBufferStream> const stream; | ||
258 | 79 | }; | 81 | }; |
259 | 80 | 82 | ||
260 | 81 | } | 83 | } |
261 | 82 | 84 | ||
262 | === modified file 'tests/include/mir/test/doubles/stub_surface_factory.h' | |||
263 | --- tests/include/mir/test/doubles/stub_surface_factory.h 2016-01-29 08:18:22 +0000 | |||
264 | +++ tests/include/mir/test/doubles/stub_surface_factory.h 2016-04-13 15:56:18 +0000 | |||
265 | @@ -34,7 +34,7 @@ | |||
266 | 34 | { | 34 | { |
267 | 35 | public: | 35 | public: |
268 | 36 | std::shared_ptr<scene::Surface> create_surface( | 36 | std::shared_ptr<scene::Surface> create_surface( |
270 | 37 | std::shared_ptr<compositor::BufferStream> const&, | 37 | std::list<scene::StreamInfo> const&, |
271 | 38 | scene::SurfaceCreationParameters const& params) override | 38 | scene::SurfaceCreationParameters const& params) override |
272 | 39 | { | 39 | { |
273 | 40 | using namespace testing; | 40 | using namespace testing; |
274 | 41 | 41 | ||
275 | === modified file 'tests/integration-tests/surface_composition.cpp' | |||
276 | --- tests/integration-tests/surface_composition.cpp 2015-06-26 08:00:59 +0000 | |||
277 | +++ tests/integration-tests/surface_composition.cpp 2016-04-13 15:56:18 +0000 | |||
278 | @@ -42,14 +42,14 @@ | |||
279 | 42 | { | 42 | { |
280 | 43 | struct SurfaceComposition : Test | 43 | struct SurfaceComposition : Test |
281 | 44 | { | 44 | { |
283 | 45 | auto create_surface() const | 45 | auto create_surface(std::shared_ptr<mc::BufferStream> const& stream) const |
284 | 46 | -> std::shared_ptr<ms::Surface> | 46 | -> std::shared_ptr<ms::Surface> |
285 | 47 | { | 47 | { |
286 | 48 | return std::make_shared<ms::BasicSurface>( | 48 | return std::make_shared<ms::BasicSurface>( |
287 | 49 | std::string("SurfaceComposition"), | 49 | std::string("SurfaceComposition"), |
288 | 50 | geom::Rectangle{{},{}}, | 50 | geom::Rectangle{{},{}}, |
289 | 51 | false, | 51 | false, |
291 | 52 | create_buffer_stream(), | 52 | std::list<ms::StreamInfo> { { stream, {0,0}, {} } }, |
292 | 53 | create_input_channel(), | 53 | create_input_channel(), |
293 | 54 | create_input_sender(), | 54 | create_input_sender(), |
294 | 55 | create_cursor_image(), | 55 | create_cursor_image(), |
295 | @@ -98,7 +98,8 @@ | |||
296 | 98 | // Presumptive cause of lp:1376324 | 98 | // Presumptive cause of lp:1376324 |
297 | 99 | TEST_F(SurfaceComposition, does_not_send_client_buffers_to_dead_surfaces) | 99 | TEST_F(SurfaceComposition, does_not_send_client_buffers_to_dead_surfaces) |
298 | 100 | { | 100 | { |
300 | 101 | auto surface = create_surface(); | 101 | auto stream = create_buffer_stream(); |
301 | 102 | auto surface = create_surface(stream); | ||
302 | 102 | 103 | ||
303 | 103 | mg::Buffer* old_buffer{nullptr}; | 104 | mg::Buffer* old_buffer{nullptr}; |
304 | 104 | 105 | ||
305 | @@ -117,7 +118,7 @@ | |||
306 | 117 | while (called_back) | 118 | while (called_back) |
307 | 118 | { | 119 | { |
308 | 119 | called_back = false; | 120 | called_back = false; |
310 | 120 | surface->primary_buffer_stream()->swap_buffers(old_buffer, callback); | 121 | stream->swap_buffers(old_buffer, callback); |
311 | 121 | } | 122 | } |
312 | 122 | 123 | ||
313 | 123 | auto const renderables = surface->generate_renderables(this); | 124 | auto const renderables = surface->generate_renderables(this); |
314 | 124 | 125 | ||
315 | === modified file 'tests/integration-tests/test_error_reporting.cpp' | |||
316 | --- tests/integration-tests/test_error_reporting.cpp 2016-01-29 08:18:22 +0000 | |||
317 | +++ tests/integration-tests/test_error_reporting.cpp 2016-04-13 15:56:18 +0000 | |||
318 | @@ -113,7 +113,7 @@ | |||
319 | 113 | { | 113 | { |
320 | 114 | std::shared_ptr<mir::scene::Surface> | 114 | std::shared_ptr<mir::scene::Surface> |
321 | 115 | create_surface( | 115 | create_surface( |
323 | 116 | std::shared_ptr<mir::compositor::BufferStream> const&, | 116 | std::list<mir::scene::StreamInfo> const&, |
324 | 117 | mir::scene::SurfaceCreationParameters const&) override | 117 | mir::scene::SurfaceCreationParameters const&) override |
325 | 118 | { | 118 | { |
326 | 119 | throw std::runtime_error{test_exception_text}; | 119 | throw std::runtime_error{test_exception_text}; |
327 | 120 | 120 | ||
328 | === modified file 'tests/integration-tests/test_session.cpp' | |||
329 | --- tests/integration-tests/test_session.cpp 2016-03-29 17:29:46 +0000 | |||
330 | +++ tests/integration-tests/test_session.cpp 2016-04-13 15:56:18 +0000 | |||
331 | @@ -68,13 +68,13 @@ | |||
332 | 68 | } | 68 | } |
333 | 69 | }; | 69 | }; |
334 | 70 | 70 | ||
336 | 71 | void swap_buffers_blocking(mf::Surface& surf, mg::Buffer*& buffer) | 71 | void swap_buffers_blocking(mf::BufferStream& stream, mg::Buffer*& buffer) |
337 | 72 | { | 72 | { |
338 | 73 | std::mutex mutex; | 73 | std::mutex mutex; |
339 | 74 | std::condition_variable cv; | 74 | std::condition_variable cv; |
340 | 75 | bool done = false; | 75 | bool done = false; |
341 | 76 | 76 | ||
343 | 77 | surf.primary_buffer_stream()->swap_buffers(buffer, | 77 | stream.swap_buffers(buffer, |
344 | 78 | [&](mg::Buffer* new_buffer) | 78 | [&](mg::Buffer* new_buffer) |
345 | 79 | { | 79 | { |
346 | 80 | std::unique_lock<decltype(mutex)> lock(mutex); | 80 | std::unique_lock<decltype(mutex)> lock(mutex); |
347 | @@ -128,8 +128,9 @@ | |||
348 | 128 | }; | 128 | }; |
349 | 129 | 129 | ||
350 | 130 | mg::BufferProperties properties(geom::Size{1,1}, mir_pixel_format_abgr_8888, mg::BufferUsage::software); | 130 | mg::BufferProperties properties(geom::Size{1,1}, mir_pixel_format_abgr_8888, mg::BufferUsage::software); |
351 | 131 | auto stream_id = session.create_buffer_stream(properties); | ||
352 | 131 | session.create_surface( | 132 | session.create_surface( |
354 | 132 | ms::a_surface().with_buffer_stream(session.create_buffer_stream(properties)), | 133 | ms::a_surface().with_buffer_stream(stream_id), |
355 | 133 | std::make_shared<mtd::NullEventSink>()); | 134 | std::make_shared<mtd::NullEventSink>()); |
356 | 134 | 135 | ||
357 | 135 | auto compositor = conf.the_compositor(); | 136 | auto compositor = conf.the_compositor(); |
358 | @@ -138,13 +139,13 @@ | |||
359 | 138 | session.default_surface()->configure(mir_surface_attrib_swapinterval, 0); | 139 | session.default_surface()->configure(mir_surface_attrib_swapinterval, 0); |
360 | 139 | 140 | ||
361 | 140 | std::thread client_thread{ | 141 | std::thread client_thread{ |
363 | 141 | [&session] | 142 | [&session, stream_id] |
364 | 142 | { | 143 | { |
365 | 143 | mg::Buffer* buffer{nullptr}; | 144 | mg::Buffer* buffer{nullptr}; |
366 | 144 | for (int i = 0; i < 500; ++i) | 145 | for (int i = 0; i < 500; ++i) |
367 | 145 | { | 146 | { |
370 | 146 | auto surface = session.default_surface(); | 147 | auto stream = session.get_buffer_stream(stream_id); |
371 | 147 | swap_buffers_blocking(*surface, buffer); | 148 | swap_buffers_blocking(*stream, buffer); |
372 | 148 | std::this_thread::sleep_for(std::chrono::microseconds{50}); | 149 | std::this_thread::sleep_for(std::chrono::microseconds{50}); |
373 | 149 | } | 150 | } |
374 | 150 | }}; | 151 | }}; |
375 | 151 | 152 | ||
376 | === modified file 'tests/integration-tests/test_surface_stack_with_compositor.cpp' | |||
377 | --- tests/integration-tests/test_surface_stack_with_compositor.cpp 2016-01-29 08:18:22 +0000 | |||
378 | +++ tests/integration-tests/test_surface_stack_with_compositor.cpp 2016-04-13 15:56:18 +0000 | |||
379 | @@ -122,11 +122,13 @@ | |||
380 | 122 | SurfaceStackCompositor() : | 122 | SurfaceStackCompositor() : |
381 | 123 | timeout{std::chrono::system_clock::now() + std::chrono::seconds(5)}, | 123 | timeout{std::chrono::system_clock::now() + std::chrono::seconds(5)}, |
382 | 124 | mock_buffer_stream(std::make_shared<testing::NiceMock<mtd::MockBufferBundle>>()), | 124 | mock_buffer_stream(std::make_shared<testing::NiceMock<mtd::MockBufferBundle>>()), |
383 | 125 | stream(std::make_shared<mc::BufferStreamSurfaces>(mock_buffer_stream)), | ||
384 | 126 | streams({ { stream, {0,0}, {} } }), | ||
385 | 125 | stub_surface{std::make_shared<ms::BasicSurface>( | 127 | stub_surface{std::make_shared<ms::BasicSurface>( |
386 | 126 | std::string("stub"), | 128 | std::string("stub"), |
387 | 127 | geom::Rectangle{{0,0},{1,1}}, | 129 | geom::Rectangle{{0,0},{1,1}}, |
388 | 128 | false, | 130 | false, |
390 | 129 | std::make_shared<mc::BufferStreamSurfaces>(mock_buffer_stream), | 131 | streams, |
391 | 130 | std::shared_ptr<mir::input::InputChannel>(), | 132 | std::shared_ptr<mir::input::InputChannel>(), |
392 | 131 | std::shared_ptr<mtd::StubInputSender>(), | 133 | std::shared_ptr<mtd::StubInputSender>(), |
393 | 132 | std::shared_ptr<mg::CursorImage>(), | 134 | std::shared_ptr<mg::CursorImage>(), |
394 | @@ -142,6 +144,8 @@ | |||
395 | 142 | StubRendererFactory renderer_factory; | 144 | StubRendererFactory renderer_factory; |
396 | 143 | std::chrono::system_clock::time_point timeout; | 145 | std::chrono::system_clock::time_point timeout; |
397 | 144 | std::shared_ptr<mtd::MockBufferBundle> mock_buffer_stream; | 146 | std::shared_ptr<mtd::MockBufferBundle> mock_buffer_stream; |
398 | 147 | std::shared_ptr<mc::BufferStream> stream; | ||
399 | 148 | std::list<ms::StreamInfo> const streams; | ||
400 | 145 | std::shared_ptr<ms::BasicSurface> stub_surface; | 149 | std::shared_ptr<ms::BasicSurface> stub_surface; |
401 | 146 | ms::SurfaceCreationParameters default_params; | 150 | ms::SurfaceCreationParameters default_params; |
402 | 147 | mtd::StubBuffer stubbuf{geom::Size{1,1}}; | 151 | mtd::StubBuffer stubbuf{geom::Size{1,1}}; |
403 | @@ -197,7 +201,7 @@ | |||
404 | 197 | mt_compositor.start(); | 201 | mt_compositor.start(); |
405 | 198 | 202 | ||
406 | 199 | stack.add_surface(stub_surface, default_params.input_mode); | 203 | stack.add_surface(stub_surface, default_params.input_mode); |
408 | 200 | stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){}); | 204 | stream->swap_buffers(&stubbuf, [](mg::Buffer*){}); |
409 | 201 | 205 | ||
410 | 202 | EXPECT_TRUE(stub_primary_db.has_posted_at_least(1, timeout)); | 206 | EXPECT_TRUE(stub_primary_db.has_posted_at_least(1, timeout)); |
411 | 203 | EXPECT_TRUE(stub_secondary_db.has_posted_at_least(1, timeout)); | 207 | EXPECT_TRUE(stub_secondary_db.has_posted_at_least(1, timeout)); |
412 | @@ -219,7 +223,7 @@ | |||
413 | 219 | mt_compositor.start(); | 223 | mt_compositor.start(); |
414 | 220 | 224 | ||
415 | 221 | stack.add_surface(stub_surface, default_params.input_mode); | 225 | stack.add_surface(stub_surface, default_params.input_mode); |
417 | 222 | stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){}); | 226 | streams.front().stream->swap_buffers(&stubbuf, [](auto){}); |
418 | 223 | 227 | ||
419 | 224 | EXPECT_TRUE(stub_primary_db.has_posted_at_least(5, timeout)); | 228 | EXPECT_TRUE(stub_primary_db.has_posted_at_least(5, timeout)); |
420 | 225 | EXPECT_TRUE(stub_secondary_db.has_posted_at_least(5, timeout)); | 229 | EXPECT_TRUE(stub_secondary_db.has_posted_at_least(5, timeout)); |
421 | @@ -242,7 +246,7 @@ | |||
422 | 242 | mt_compositor.start(); | 246 | mt_compositor.start(); |
423 | 243 | 247 | ||
424 | 244 | stack.add_surface(stub_surface, default_params.input_mode); | 248 | stack.add_surface(stub_surface, default_params.input_mode); |
426 | 245 | stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){}); | 249 | streams.front().stream->swap_buffers(&stubbuf, [](mg::Buffer*){}); |
427 | 246 | 250 | ||
428 | 247 | EXPECT_TRUE(stub_primary_db.has_posted_at_least(5, timeout)); | 251 | EXPECT_TRUE(stub_primary_db.has_posted_at_least(5, timeout)); |
429 | 248 | EXPECT_TRUE(stub_secondary_db.has_posted_at_least(5, timeout)); | 252 | EXPECT_TRUE(stub_secondary_db.has_posted_at_least(5, timeout)); |
430 | @@ -263,7 +267,7 @@ | |||
431 | 263 | mt_compositor.start(); | 267 | mt_compositor.start(); |
432 | 264 | 268 | ||
433 | 265 | stack.add_surface(stub_surface, default_params.input_mode); | 269 | stack.add_surface(stub_surface, default_params.input_mode); |
435 | 266 | stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){}); | 270 | streams.front().stream->swap_buffers(&stubbuf, [](mg::Buffer*){}); |
436 | 267 | 271 | ||
437 | 268 | EXPECT_TRUE(stub_primary_db.has_posted_at_least(1, timeout)); | 272 | EXPECT_TRUE(stub_primary_db.has_posted_at_least(1, timeout)); |
438 | 269 | EXPECT_TRUE(stub_secondary_db.has_posted_at_least(1, timeout)); | 273 | EXPECT_TRUE(stub_secondary_db.has_posted_at_least(1, timeout)); |
439 | @@ -276,7 +280,7 @@ | |||
440 | 276 | 280 | ||
441 | 277 | TEST_F(SurfaceStackCompositor, moving_a_surface_triggers_composition) | 281 | TEST_F(SurfaceStackCompositor, moving_a_surface_triggers_composition) |
442 | 278 | { | 282 | { |
444 | 279 | stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){}); | 283 | streams.front().stream->swap_buffers(&stubbuf, [](mg::Buffer*){}); |
445 | 280 | stack.add_surface(stub_surface, default_params.input_mode); | 284 | stack.add_surface(stub_surface, default_params.input_mode); |
446 | 281 | 285 | ||
447 | 282 | mc::MultiThreadedCompositor mt_compositor( | 286 | mc::MultiThreadedCompositor mt_compositor( |
448 | @@ -295,7 +299,7 @@ | |||
449 | 295 | 299 | ||
450 | 296 | TEST_F(SurfaceStackCompositor, removing_a_surface_triggers_composition) | 300 | TEST_F(SurfaceStackCompositor, removing_a_surface_triggers_composition) |
451 | 297 | { | 301 | { |
453 | 298 | stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){}); | 302 | streams.front().stream->swap_buffers(&stubbuf, [](mg::Buffer*){}); |
454 | 299 | stack.add_surface(stub_surface, default_params.input_mode); | 303 | stack.add_surface(stub_surface, default_params.input_mode); |
455 | 300 | 304 | ||
456 | 301 | mc::MultiThreadedCompositor mt_compositor( | 305 | mc::MultiThreadedCompositor mt_compositor( |
457 | @@ -318,7 +322,7 @@ | |||
458 | 318 | ON_CALL(*mock_buffer_stream, buffers_ready_for_compositor(_)) | 322 | ON_CALL(*mock_buffer_stream, buffers_ready_for_compositor(_)) |
459 | 319 | .WillByDefault(testing::Return(1)); | 323 | .WillByDefault(testing::Return(1)); |
460 | 320 | stack.add_surface(stub_surface, default_params.input_mode); | 324 | stack.add_surface(stub_surface, default_params.input_mode); |
462 | 321 | stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){}); | 325 | streams.front().stream->swap_buffers(&stubbuf, [](mg::Buffer*){}); |
463 | 322 | 326 | ||
464 | 323 | mc::MultiThreadedCompositor mt_compositor( | 327 | mc::MultiThreadedCompositor mt_compositor( |
465 | 324 | mt::fake_shared(stub_display), | 328 | mt::fake_shared(stub_display), |
466 | @@ -328,7 +332,7 @@ | |||
467 | 328 | null_comp_report, default_delay, false); | 332 | null_comp_report, default_delay, false); |
468 | 329 | 333 | ||
469 | 330 | mt_compositor.start(); | 334 | mt_compositor.start(); |
471 | 331 | stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){}); | 335 | streams.front().stream->swap_buffers(&stubbuf, [](mg::Buffer*){}); |
472 | 332 | 336 | ||
473 | 333 | EXPECT_TRUE(stub_primary_db.has_posted_at_least(1, timeout)); | 337 | EXPECT_TRUE(stub_primary_db.has_posted_at_least(1, timeout)); |
474 | 334 | EXPECT_TRUE(stub_secondary_db.has_posted_at_least(1, timeout)); | 338 | EXPECT_TRUE(stub_secondary_db.has_posted_at_least(1, timeout)); |
475 | 335 | 339 | ||
476 | === modified file 'tests/unit-tests/scene/test_abstract_shell.cpp' | |||
477 | --- tests/unit-tests/scene/test_abstract_shell.cpp 2016-03-29 19:07:35 +0000 | |||
478 | +++ tests/unit-tests/scene/test_abstract_shell.cpp 2016-04-13 15:56:18 +0000 | |||
479 | @@ -95,8 +95,7 @@ | |||
480 | 95 | struct MockSurfaceFactory : public ms::SurfaceFactory | 95 | struct MockSurfaceFactory : public ms::SurfaceFactory |
481 | 96 | { | 96 | { |
482 | 97 | MOCK_METHOD2(create_surface, std::shared_ptr<ms::Surface>( | 97 | MOCK_METHOD2(create_surface, std::shared_ptr<ms::Surface>( |
485 | 98 | std::shared_ptr<mir::compositor::BufferStream> const&, | 98 | std::list<ms::StreamInfo> const&, ms::SurfaceCreationParameters const&)); |
484 | 99 | ms::SurfaceCreationParameters const&)); | ||
486 | 100 | }; | 99 | }; |
487 | 101 | 100 | ||
488 | 102 | using NiceMockWindowManager = NiceMock<mtd::MockWindowManager>; | 101 | using NiceMockWindowManager = NiceMock<mtd::MockWindowManager>; |
489 | 103 | 102 | ||
490 | === modified file 'tests/unit-tests/scene/test_application_session.cpp' | |||
491 | --- tests/unit-tests/scene/test_application_session.cpp 2016-04-12 14:10:00 +0000 | |||
492 | +++ tests/unit-tests/scene/test_application_session.cpp 2016-04-13 15:56:18 +0000 | |||
493 | @@ -229,7 +229,7 @@ | |||
494 | 229 | struct MockSurfaceFactory : ms::SurfaceFactory | 229 | struct MockSurfaceFactory : ms::SurfaceFactory |
495 | 230 | { | 230 | { |
496 | 231 | MOCK_METHOD2(create_surface, std::shared_ptr<ms::Surface>( | 231 | MOCK_METHOD2(create_surface, std::shared_ptr<ms::Surface>( |
498 | 232 | std::shared_ptr<mc::BufferStream> const&, ms::SurfaceCreationParameters const& params)); | 232 | std::list<ms::StreamInfo> const&, ms::SurfaceCreationParameters const& params)); |
499 | 233 | }; | 233 | }; |
500 | 234 | } | 234 | } |
501 | 235 | 235 | ||
502 | @@ -653,6 +653,15 @@ | |||
503 | 653 | session->destroy_buffer_stream(id); | 653 | session->destroy_buffer_stream(id); |
504 | 654 | } | 654 | } |
505 | 655 | 655 | ||
506 | 656 | MATCHER_P(HasSingleStream, value, "") | ||
507 | 657 | { | ||
508 | 658 | using namespace testing; | ||
509 | 659 | EXPECT_THAT(arg.size(), Eq(1)); | ||
510 | 660 | if (arg.size() < 1 ) return false; | ||
511 | 661 | EXPECT_THAT(arg.front().stream.get(), Eq(value.get())); | ||
512 | 662 | return !(::testing::Test::HasFailure()); | ||
513 | 663 | } | ||
514 | 664 | |||
515 | 656 | TEST_F(ApplicationSession, surface_uses_prexisting_buffer_stream_if_set) | 665 | TEST_F(ApplicationSession, surface_uses_prexisting_buffer_stream_if_set) |
516 | 657 | { | 666 | { |
517 | 658 | using namespace testing; | 667 | using namespace testing; |
518 | @@ -669,25 +678,17 @@ | |||
519 | 669 | mt::fake_shared(mock_surface_factory)); | 678 | mt::fake_shared(mock_surface_factory)); |
520 | 670 | 679 | ||
521 | 671 | auto id = session->create_buffer_stream(properties); | 680 | auto id = session->create_buffer_stream(properties); |
522 | 681 | auto stream = session->get_buffer_stream(id); | ||
523 | 672 | 682 | ||
532 | 673 | EXPECT_CALL(mock_surface_factory, create_surface(Eq(session->get_buffer_stream(id)),_)) | 683 | EXPECT_CALL(mock_surface_factory, create_surface(HasSingleStream(stream),_)) |
533 | 674 | .WillOnce(Invoke([&](auto bs, auto) | 684 | .WillOnce(Return(make_mock_surface())); |
526 | 675 | { | ||
527 | 676 | auto surface = make_mock_surface(); | ||
528 | 677 | ON_CALL(*surface, primary_buffer_stream()) | ||
529 | 678 | .WillByDefault(Return(bs)); | ||
530 | 679 | return surface; | ||
531 | 680 | })); | ||
534 | 681 | 685 | ||
535 | 682 | ms::SurfaceCreationParameters params = ms::SurfaceCreationParameters{} | 686 | ms::SurfaceCreationParameters params = ms::SurfaceCreationParameters{} |
536 | 683 | .of_name("Aardavks") | 687 | .of_name("Aardavks") |
537 | 684 | .of_type(mir_surface_type_normal) | 688 | .of_type(mir_surface_type_normal) |
538 | 685 | .with_buffer_stream(id); | 689 | .with_buffer_stream(id); |
539 | 686 | 690 | ||
544 | 687 | auto surface_id = session->create_surface(params, event_sink); | 691 | session->create_surface(params, event_sink); |
541 | 688 | auto surface = session->get_surface(surface_id); | ||
542 | 689 | |||
543 | 690 | EXPECT_THAT(surface->primary_buffer_stream(), Eq(session->get_buffer_stream(id))); | ||
545 | 691 | } | 692 | } |
546 | 692 | 693 | ||
547 | 693 | namespace | 694 | namespace |
548 | @@ -770,7 +771,7 @@ | |||
549 | 770 | { | 771 | { |
550 | 771 | public: | 772 | public: |
551 | 772 | std::shared_ptr<ms::Surface> create_surface( | 773 | std::shared_ptr<ms::Surface> create_surface( |
553 | 773 | std::shared_ptr<mir::compositor::BufferStream> const&, | 774 | std::list<ms::StreamInfo> const&, |
554 | 774 | mir::scene::SurfaceCreationParameters const& params) override | 775 | mir::scene::SurfaceCreationParameters const& params) override |
555 | 775 | { | 776 | { |
556 | 776 | using namespace testing; | 777 | using namespace testing; |
557 | 777 | 778 | ||
558 | === modified file 'tests/unit-tests/scene/test_basic_surface.cpp' | |||
559 | --- tests/unit-tests/scene/test_basic_surface.cpp 2016-03-23 06:39:56 +0000 | |||
560 | +++ tests/unit-tests/scene/test_basic_surface.cpp 2016-04-13 15:56:18 +0000 | |||
561 | @@ -72,17 +72,6 @@ | |||
562 | 72 | MOCK_METHOD0(cursor_image_removed, void()); | 72 | MOCK_METHOD0(cursor_image_removed, void()); |
563 | 73 | }; | 73 | }; |
564 | 74 | 74 | ||
565 | 75 | void post_a_frame(ms::BasicSurface& surface) | ||
566 | 76 | { | ||
567 | 77 | /* | ||
568 | 78 | * Make sure there's a frame ready. Otherwise visible()==false and the | ||
569 | 79 | * input_area will never report it containing anything for all the tests | ||
570 | 80 | * that use it. | ||
571 | 81 | */ | ||
572 | 82 | mtd::StubBuffer buffer; | ||
573 | 83 | surface.primary_buffer_stream()->swap_buffers(&buffer, [&](mir::graphics::Buffer*){}); | ||
574 | 84 | } | ||
575 | 85 | |||
576 | 86 | struct BasicSurfaceTest : public testing::Test | 75 | struct BasicSurfaceTest : public testing::Test |
577 | 87 | { | 76 | { |
578 | 88 | std::string const name{"aa"}; | 77 | std::string const name{"aa"}; |
579 | @@ -99,21 +88,17 @@ | |||
580 | 99 | std::make_shared<ms::LegacySurfaceChangeNotification>(mock_change_cb, [this](int){mock_change_cb();}); | 88 | std::make_shared<ms::LegacySurfaceChangeNotification>(mock_change_cb, [this](int){mock_change_cb();}); |
581 | 100 | std::shared_ptr<mi::InputSender> const stub_input_sender = std::make_shared<mtd::StubInputSender>(); | 89 | std::shared_ptr<mi::InputSender> const stub_input_sender = std::make_shared<mtd::StubInputSender>(); |
582 | 101 | testing::NiceMock<mtd::MockInputSender> mock_sender; | 90 | testing::NiceMock<mtd::MockInputSender> mock_sender; |
583 | 91 | std::list<ms::StreamInfo> streams { { mock_buffer_stream, {}, {} } }; | ||
584 | 102 | 92 | ||
585 | 103 | ms::BasicSurface surface{ | 93 | ms::BasicSurface surface{ |
586 | 104 | name, | 94 | name, |
587 | 105 | rect, | 95 | rect, |
588 | 106 | false, | 96 | false, |
590 | 107 | mock_buffer_stream, | 97 | streams, |
591 | 108 | std::shared_ptr<mi::InputChannel>(), | 98 | std::shared_ptr<mi::InputChannel>(), |
592 | 109 | stub_input_sender, | 99 | stub_input_sender, |
593 | 110 | std::shared_ptr<mg::CursorImage>(), | 100 | std::shared_ptr<mg::CursorImage>(), |
594 | 111 | report}; | 101 | report}; |
595 | 112 | |||
596 | 113 | BasicSurfaceTest() | ||
597 | 114 | { | ||
598 | 115 | post_a_frame(surface); | ||
599 | 116 | } | ||
600 | 117 | }; | 102 | }; |
601 | 118 | 103 | ||
602 | 119 | } | 104 | } |
603 | @@ -127,11 +112,6 @@ | |||
604 | 127 | EXPECT_FALSE(renderable->shaped()); | 112 | EXPECT_FALSE(renderable->shaped()); |
605 | 128 | } | 113 | } |
606 | 129 | 114 | ||
607 | 130 | TEST_F(BasicSurfaceTest, primary_buffer_stream) | ||
608 | 131 | { | ||
609 | 132 | EXPECT_THAT(surface.primary_buffer_stream(), Eq(mock_buffer_stream)); | ||
610 | 133 | } | ||
611 | 134 | |||
612 | 135 | TEST_F(BasicSurfaceTest, buffer_stream_ids_always_unique) | 115 | TEST_F(BasicSurfaceTest, buffer_stream_ids_always_unique) |
613 | 136 | { | 116 | { |
614 | 137 | int const n = 10; | 117 | int const n = 10; |
615 | @@ -141,7 +121,9 @@ | |||
616 | 141 | for (auto& surface : surfaces) | 121 | for (auto& surface : surfaces) |
617 | 142 | { | 122 | { |
618 | 143 | surface = std::make_unique<ms::BasicSurface>( | 123 | surface = std::make_unique<ms::BasicSurface>( |
620 | 144 | name, rect, false, std::make_shared<testing::NiceMock<mtd::MockBufferStream>>(), | 124 | name, rect, false, |
621 | 125 | std::list<ms::StreamInfo> { | ||
622 | 126 | { std::make_shared<testing::NiceMock<mtd::MockBufferStream>>(), {}, {} } }, | ||
623 | 145 | std::shared_ptr<mi::InputChannel>(), stub_input_sender, | 127 | std::shared_ptr<mi::InputChannel>(), stub_input_sender, |
624 | 146 | std::shared_ptr<mg::CursorImage>(), report); | 128 | std::shared_ptr<mg::CursorImage>(), report); |
625 | 147 | for (auto& renderable : surface->generate_renderables(this)) | 129 | for (auto& renderable : surface->generate_renderables(this)) |
626 | @@ -160,7 +142,7 @@ | |||
627 | 160 | for (auto& surface : surfaces) | 142 | for (auto& surface : surfaces) |
628 | 161 | { | 143 | { |
629 | 162 | surface = std::make_unique<ms::BasicSurface>( | 144 | surface = std::make_unique<ms::BasicSurface>( |
631 | 163 | name, rect, false, mock_buffer_stream, | 145 | name, rect, false, streams, |
632 | 164 | std::shared_ptr<mi::InputChannel>(), stub_input_sender, | 146 | std::shared_ptr<mi::InputChannel>(), stub_input_sender, |
633 | 165 | std::shared_ptr<mg::CursorImage>(), report); | 147 | std::shared_ptr<mg::CursorImage>(), report); |
634 | 166 | 148 | ||
635 | @@ -175,7 +157,6 @@ | |||
636 | 175 | .Times(1); | 157 | .Times(1); |
637 | 176 | 158 | ||
638 | 177 | surface.add_observer(observer); | 159 | surface.add_observer(observer); |
639 | 178 | post_a_frame(surface); | ||
640 | 179 | 160 | ||
641 | 180 | EXPECT_EQ(rect.top_left, surface.top_left()); | 161 | EXPECT_EQ(rect.top_left, surface.top_left()); |
642 | 181 | 162 | ||
643 | @@ -192,7 +173,6 @@ | |||
644 | 192 | .Times(1); | 173 | .Times(1); |
645 | 193 | 174 | ||
646 | 194 | surface.add_observer(observer); | 175 | surface.add_observer(observer); |
647 | 195 | post_a_frame(surface); | ||
648 | 196 | 176 | ||
649 | 197 | EXPECT_EQ(rect.size, surface.size()); | 177 | EXPECT_EQ(rect.size, surface.size()); |
650 | 198 | EXPECT_NE(new_size, surface.size()); | 178 | EXPECT_NE(new_size, surface.size()); |
651 | @@ -233,7 +213,6 @@ | |||
652 | 233 | .Times(1); | 213 | .Times(1); |
653 | 234 | 214 | ||
654 | 235 | surface.add_observer(observer); | 215 | surface.add_observer(observer); |
655 | 236 | post_a_frame(surface); | ||
656 | 237 | 216 | ||
657 | 238 | auto renderables = surface.generate_renderables(compositor_id); | 217 | auto renderables = surface.generate_renderables(compositor_id); |
658 | 239 | ASSERT_THAT(renderables.size(), testing::Eq(1)); | 218 | ASSERT_THAT(renderables.size(), testing::Eq(1)); |
659 | @@ -258,7 +237,6 @@ | |||
660 | 258 | .Times(1); | 237 | .Times(1); |
661 | 259 | 238 | ||
662 | 260 | surface.add_observer(observer); | 239 | surface.add_observer(observer); |
663 | 261 | post_a_frame(surface); | ||
664 | 262 | 240 | ||
665 | 263 | float alpha = 0.5f; | 241 | float alpha = 0.5f; |
666 | 264 | surface.set_alpha(0.5f); | 242 | surface.set_alpha(0.5f); |
667 | @@ -288,7 +266,7 @@ | |||
668 | 288 | name, | 266 | name, |
669 | 289 | rect, | 267 | rect, |
670 | 290 | false, | 268 | false, |
672 | 291 | mock_buffer_stream, | 269 | streams, |
673 | 292 | std::shared_ptr<mi::InputChannel>(), | 270 | std::shared_ptr<mi::InputChannel>(), |
674 | 293 | stub_input_sender, | 271 | stub_input_sender, |
675 | 294 | std::shared_ptr<mg::CursorImage>(), | 272 | std::shared_ptr<mg::CursorImage>(), |
676 | @@ -315,7 +293,6 @@ | |||
677 | 315 | .Times(1); | 293 | .Times(1); |
678 | 316 | 294 | ||
679 | 317 | surface.add_observer(observer); | 295 | surface.add_observer(observer); |
680 | 318 | post_a_frame(surface); | ||
681 | 319 | 296 | ||
682 | 320 | surface.set_hidden(true); | 297 | surface.set_hidden(true); |
683 | 321 | } | 298 | } |
684 | @@ -329,14 +306,13 @@ | |||
685 | 329 | name, | 306 | name, |
686 | 330 | geom::Rectangle{pt, one_by_one}, | 307 | geom::Rectangle{pt, one_by_one}, |
687 | 331 | false, | 308 | false, |
689 | 332 | mock_buffer_stream, | 309 | streams, |
690 | 333 | std::shared_ptr<mi::InputChannel>(), | 310 | std::shared_ptr<mi::InputChannel>(), |
691 | 334 | stub_input_sender, | 311 | stub_input_sender, |
692 | 335 | std::shared_ptr<mg::CursorImage>(), | 312 | std::shared_ptr<mg::CursorImage>(), |
693 | 336 | report}; | 313 | report}; |
694 | 337 | 314 | ||
695 | 338 | surface.add_observer(observer); | 315 | surface.add_observer(observer); |
696 | 339 | post_a_frame(surface); | ||
697 | 340 | 316 | ||
698 | 341 | std::vector<geom::Point> contained_pt | 317 | std::vector<geom::Point> contained_pt |
699 | 342 | { | 318 | { |
700 | @@ -371,7 +347,7 @@ | |||
701 | 371 | name, | 347 | name, |
702 | 372 | geom::Rectangle{{0,0}, {100,100}}, | 348 | geom::Rectangle{{0,0}, {100,100}}, |
703 | 373 | false, | 349 | false, |
705 | 374 | mock_buffer_stream, | 350 | streams, |
706 | 375 | std::shared_ptr<mi::InputChannel>(), | 351 | std::shared_ptr<mi::InputChannel>(), |
707 | 376 | stub_input_sender, | 352 | stub_input_sender, |
708 | 377 | std::shared_ptr<mg::CursorImage>(), | 353 | std::shared_ptr<mg::CursorImage>(), |
709 | @@ -511,7 +487,7 @@ | |||
710 | 511 | geom::Rectangle{{0,0}, {100,100}}, | 487 | geom::Rectangle{{0,0}, {100,100}}, |
711 | 512 | parent, | 488 | parent, |
712 | 513 | false, | 489 | false, |
714 | 514 | mock_buffer_stream, | 490 | streams, |
715 | 515 | std::shared_ptr<mi::InputChannel>(), | 491 | std::shared_ptr<mi::InputChannel>(), |
716 | 516 | stub_input_sender, | 492 | stub_input_sender, |
717 | 517 | std::shared_ptr<mg::CursorImage>(), | 493 | std::shared_ptr<mg::CursorImage>(), |
718 | @@ -698,7 +674,7 @@ | |||
719 | 698 | name, | 674 | name, |
720 | 699 | rect, | 675 | rect, |
721 | 700 | false, | 676 | false, |
723 | 701 | mock_buffer_stream, | 677 | streams, |
724 | 702 | std::shared_ptr<mi::InputChannel>(), | 678 | std::shared_ptr<mi::InputChannel>(), |
725 | 703 | mt::fake_shared(mock_sender), | 679 | mt::fake_shared(mock_sender), |
726 | 704 | nullptr, | 680 | nullptr, |
727 | @@ -1130,7 +1106,6 @@ | |||
728 | 1130 | 1106 | ||
729 | 1131 | EXPECT_THAT(observer->exposes(), Eq(0)); | 1107 | EXPECT_THAT(observer->exposes(), Eq(0)); |
730 | 1132 | EXPECT_THAT(observer->hides(), Eq(0)); | 1108 | EXPECT_THAT(observer->hides(), Eq(0)); |
731 | 1133 | post_a_frame(surface); | ||
732 | 1134 | surface.configure(mir_surface_attrib_visibility, mir_surface_visibility_exposed); | 1109 | surface.configure(mir_surface_attrib_visibility, mir_surface_visibility_exposed); |
733 | 1135 | 1110 | ||
734 | 1136 | EXPECT_THAT(observer->exposes(), Eq(1)); | 1111 | EXPECT_THAT(observer->exposes(), Eq(1)); |
735 | 1137 | 1112 | ||
736 | === modified file 'tests/unit-tests/scene/test_session_manager.cpp' | |||
737 | --- tests/unit-tests/scene/test_session_manager.cpp 2016-03-29 19:17:37 +0000 | |||
738 | +++ tests/unit-tests/scene/test_session_manager.cpp 2016-04-13 15:56:18 +0000 | |||
739 | @@ -83,7 +83,7 @@ | |||
740 | 83 | std::string("stub"), | 83 | std::string("stub"), |
741 | 84 | geom::Rectangle{{},{}}, | 84 | geom::Rectangle{{},{}}, |
742 | 85 | false, | 85 | false, |
744 | 86 | std::make_shared<mtd::StubBufferStream>(), | 86 | std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } }, |
745 | 87 | std::shared_ptr<mi::InputChannel>(), | 87 | std::shared_ptr<mi::InputChannel>(), |
746 | 88 | std::shared_ptr<mi::InputSender>(), | 88 | std::shared_ptr<mi::InputSender>(), |
747 | 89 | std::shared_ptr<mg::CursorImage>(), | 89 | std::shared_ptr<mg::CursorImage>(), |
748 | 90 | 90 | ||
749 | === modified file 'tests/unit-tests/scene/test_surface.cpp' | |||
750 | --- tests/unit-tests/scene/test_surface.cpp 2016-03-24 22:06:39 +0000 | |||
751 | +++ tests/unit-tests/scene/test_surface.cpp 2016-04-13 15:56:18 +0000 | |||
752 | @@ -193,7 +193,7 @@ | |||
753 | 193 | { | 193 | { |
754 | 194 | SurfaceCreation() | 194 | SurfaceCreation() |
755 | 195 | : surface(surface_name, | 195 | : surface(surface_name, |
757 | 196 | rect, false, mock_buffer_stream, | 196 | rect, false, streams, |
758 | 197 | std::make_shared<mtd::StubInputChannel>(), | 197 | std::make_shared<mtd::StubInputChannel>(), |
759 | 198 | std::make_shared<mtd::StubInputSender>(), | 198 | std::make_shared<mtd::StubInputSender>(), |
760 | 199 | nullptr /* cursor_image */, report) | 199 | nullptr /* cursor_image */, report) |
761 | @@ -215,6 +215,7 @@ | |||
762 | 215 | } | 215 | } |
763 | 216 | 216 | ||
764 | 217 | std::shared_ptr<testing::NiceMock<mtd::MockBufferStream>> mock_buffer_stream = std::make_shared<testing::NiceMock<mtd::MockBufferStream>>(); | 217 | std::shared_ptr<testing::NiceMock<mtd::MockBufferStream>> mock_buffer_stream = std::make_shared<testing::NiceMock<mtd::MockBufferStream>>(); |
765 | 218 | std::list<ms::StreamInfo> streams{ { mock_buffer_stream, {}, {} } }; | ||
766 | 218 | std::function<void()> change_notification; | 219 | std::function<void()> change_notification; |
767 | 219 | int notification_count = 0; | 220 | int notification_count = 0; |
768 | 220 | mtd::StubBuffer stub_buffer; | 221 | mtd::StubBuffer stub_buffer; |
769 | @@ -240,12 +241,6 @@ | |||
770 | 240 | EXPECT_EQ(size, surface.size()); | 241 | EXPECT_EQ(size, surface.size()); |
771 | 241 | } | 242 | } |
772 | 242 | 243 | ||
773 | 243 | TEST_F(SurfaceCreation, constructed_stream_is_primary) | ||
774 | 244 | { | ||
775 | 245 | using namespace testing; | ||
776 | 246 | EXPECT_THAT(surface.primary_buffer_stream(), Eq(mock_buffer_stream)); | ||
777 | 247 | } | ||
778 | 248 | |||
779 | 249 | TEST_F(SurfaceCreation, test_surface_gets_top_left) | 244 | TEST_F(SurfaceCreation, test_surface_gets_top_left) |
780 | 250 | { | 245 | { |
781 | 251 | auto ret_top_left = surface.top_left(); | 246 | auto ret_top_left = surface.top_left(); |
782 | @@ -383,7 +378,7 @@ | |||
783 | 383 | surface_name, | 378 | surface_name, |
784 | 384 | rect, | 379 | rect, |
785 | 385 | false, | 380 | false, |
787 | 386 | mock_buffer_stream, | 381 | streams, |
788 | 387 | mt::fake_shared(channel), | 382 | mt::fake_shared(channel), |
789 | 388 | std::make_shared<mtd::StubInputSender>(), | 383 | std::make_shared<mtd::StubInputSender>(), |
790 | 389 | std::shared_ptr<mg::CursorImage>(), | 384 | std::shared_ptr<mg::CursorImage>(), |
791 | @@ -401,7 +396,7 @@ | |||
792 | 401 | surface_name, | 396 | surface_name, |
793 | 402 | rect, | 397 | rect, |
794 | 403 | false, | 398 | false, |
796 | 404 | mock_buffer_stream, | 399 | streams, |
797 | 405 | std::make_shared<mtd::StubInputChannel>(), | 400 | std::make_shared<mtd::StubInputChannel>(), |
798 | 406 | mt::fake_shared(mock_sender), | 401 | mt::fake_shared(mock_sender), |
799 | 407 | std::shared_ptr<mg::CursorImage>(), | 402 | std::shared_ptr<mg::CursorImage>(), |
800 | 408 | 403 | ||
801 | === modified file 'tests/unit-tests/scene/test_surface_impl.cpp' | |||
802 | --- tests/unit-tests/scene/test_surface_impl.cpp 2016-04-04 03:30:04 +0000 | |||
803 | +++ tests/unit-tests/scene/test_surface_impl.cpp 2016-04-13 15:56:18 +0000 | |||
804 | @@ -82,9 +82,10 @@ | |||
805 | 82 | ON_CALL(*buffer_stream, acquire_client_buffer(_)) | 82 | ON_CALL(*buffer_stream, acquire_client_buffer(_)) |
806 | 83 | .WillByDefault(InvokeArgument<0>(nullptr)); | 83 | .WillByDefault(InvokeArgument<0>(nullptr)); |
807 | 84 | 84 | ||
811 | 85 | surface = std::make_shared<ms::BasicSurface>(std::string("stub"), geom::Rectangle{{},{}}, false, | 85 | surface = std::make_shared<ms::BasicSurface>( |
812 | 86 | buffer_stream, nullptr /* input_channel */, stub_input_sender, | 86 | std::string("stub"), geom::Rectangle{{},{}}, false, |
813 | 87 | nullptr /* cursor_image */, report); | 87 | std::list<ms::StreamInfo> { { buffer_stream, {}, {} } }, |
814 | 88 | nullptr, stub_input_sender, nullptr, report); | ||
815 | 88 | } | 89 | } |
816 | 89 | 90 | ||
817 | 90 | mf::SurfaceId stub_id; | 91 | mf::SurfaceId stub_id; |
818 | @@ -280,7 +281,7 @@ | |||
819 | 280 | std::string("stub"), | 281 | std::string("stub"), |
820 | 281 | geom::Rectangle{{},{}}, | 282 | geom::Rectangle{{},{}}, |
821 | 282 | false, | 283 | false, |
823 | 283 | buffer_stream, | 284 | std::list<ms::StreamInfo> { { buffer_stream, {}, {} } }, |
824 | 284 | std::shared_ptr<mi::InputChannel>(), | 285 | std::shared_ptr<mi::InputChannel>(), |
825 | 285 | stub_input_sender, | 286 | stub_input_sender, |
826 | 286 | std::shared_ptr<mg::CursorImage>(), | 287 | std::shared_ptr<mg::CursorImage>(), |
827 | 287 | 288 | ||
828 | === modified file 'tests/unit-tests/scene/test_surface_stack.cpp' | |||
829 | --- tests/unit-tests/scene/test_surface_stack.cpp 2016-03-23 06:39:56 +0000 | |||
830 | +++ tests/unit-tests/scene/test_surface_stack.cpp 2016-04-13 15:56:18 +0000 | |||
831 | @@ -56,10 +56,10 @@ | |||
832 | 56 | namespace | 56 | namespace |
833 | 57 | { | 57 | { |
834 | 58 | 58 | ||
836 | 59 | void post_a_frame(ms::Surface& s) | 59 | void post_a_frame(mc::BufferStream& s) |
837 | 60 | { | 60 | { |
838 | 61 | mtd::StubBuffer old_buffer; | 61 | mtd::StubBuffer old_buffer; |
840 | 62 | s.primary_buffer_stream()->swap_buffers(&old_buffer, [](mg::Buffer*){}); | 62 | s.swap_buffers(&old_buffer, [](mg::Buffer*){}); |
841 | 63 | } | 63 | } |
842 | 64 | 64 | ||
843 | 65 | MATCHER_P(SurfaceWithInputReceptionMode, mode, "") | 65 | MATCHER_P(SurfaceWithInputReceptionMode, mode, "") |
844 | @@ -67,11 +67,6 @@ | |||
845 | 67 | return arg->reception_mode() == mode; | 67 | return arg->reception_mode() == mode; |
846 | 68 | } | 68 | } |
847 | 69 | 69 | ||
848 | 70 | MATCHER_P(SceneElementForSurface, surface, "") | ||
849 | 71 | { | ||
850 | 72 | return arg->renderable()->id() == surface->primary_buffer_stream().get(); | ||
851 | 73 | } | ||
852 | 74 | |||
853 | 75 | MATCHER_P(SceneElementForStream, stream, "") | 70 | MATCHER_P(SceneElementForStream, stream, "") |
854 | 76 | { | 71 | { |
855 | 77 | return arg->renderable()->id() == stream.get(); | 72 | return arg->renderable()->id() == stream.get(); |
856 | @@ -133,43 +128,39 @@ | |||
857 | 133 | std::string("stub"), | 128 | std::string("stub"), |
858 | 134 | geom::Rectangle{{},{}}, | 129 | geom::Rectangle{{},{}}, |
859 | 135 | false, | 130 | false, |
861 | 136 | std::make_shared<mtd::StubBufferStream>(), | 131 | std::list<ms::StreamInfo> { { stub_buffer_stream1, {}, {} } }, |
862 | 137 | std::shared_ptr<mir::input::InputChannel>(), | 132 | std::shared_ptr<mir::input::InputChannel>(), |
863 | 138 | std::shared_ptr<mir::input::InputSender>(), | 133 | std::shared_ptr<mir::input::InputSender>(), |
864 | 139 | std::shared_ptr<mg::CursorImage>(), | 134 | std::shared_ptr<mg::CursorImage>(), |
865 | 140 | report); | 135 | report); |
866 | 141 | 136 | ||
867 | 142 | post_a_frame(*stub_surface1); | ||
868 | 143 | |||
869 | 144 | stub_surface2 = std::make_shared<ms::BasicSurface>( | 137 | stub_surface2 = std::make_shared<ms::BasicSurface>( |
870 | 145 | std::string("stub"), | 138 | std::string("stub"), |
871 | 146 | geom::Rectangle{{},{}}, | 139 | geom::Rectangle{{},{}}, |
872 | 147 | false, | 140 | false, |
874 | 148 | std::make_shared<mtd::StubBufferStream>(), | 141 | std::list<ms::StreamInfo> { { stub_buffer_stream2, {}, {} } }, |
875 | 149 | std::shared_ptr<mir::input::InputChannel>(), | 142 | std::shared_ptr<mir::input::InputChannel>(), |
876 | 150 | std::shared_ptr<mir::input::InputSender>(), | 143 | std::shared_ptr<mir::input::InputSender>(), |
877 | 151 | std::shared_ptr<mg::CursorImage>(), | 144 | std::shared_ptr<mg::CursorImage>(), |
878 | 152 | report); | 145 | report); |
879 | 153 | 146 | ||
882 | 154 | post_a_frame(*stub_surface2); | 147 | |
881 | 155 | |||
883 | 156 | stub_surface3 = std::make_shared<ms::BasicSurface>( | 148 | stub_surface3 = std::make_shared<ms::BasicSurface>( |
884 | 157 | std::string("stub"), | 149 | std::string("stub"), |
885 | 158 | geom::Rectangle{{},{}}, | 150 | geom::Rectangle{{},{}}, |
886 | 159 | false, | 151 | false, |
888 | 160 | std::make_shared<mtd::StubBufferStream>(), | 152 | std::list<ms::StreamInfo> { { stub_buffer_stream3, {}, {} } }, |
889 | 161 | std::shared_ptr<mir::input::InputChannel>(), | 153 | std::shared_ptr<mir::input::InputChannel>(), |
890 | 162 | std::shared_ptr<mir::input::InputSender>(), | 154 | std::shared_ptr<mir::input::InputSender>(), |
891 | 163 | std::shared_ptr<mg::CursorImage>(), | 155 | std::shared_ptr<mg::CursorImage>(), |
892 | 164 | report); | 156 | report); |
893 | 165 | 157 | ||
896 | 166 | post_a_frame(*stub_surface3); | 158 | |
895 | 167 | |||
897 | 168 | invisible_stub_surface = std::make_shared<ms::BasicSurface>( | 159 | invisible_stub_surface = std::make_shared<ms::BasicSurface>( |
898 | 169 | std::string("stub"), | 160 | std::string("stub"), |
899 | 170 | geom::Rectangle{{},{}}, | 161 | geom::Rectangle{{},{}}, |
900 | 171 | false, | 162 | false, |
902 | 172 | std::make_shared<mtd::StubBufferStream>(), | 163 | std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } }, |
903 | 173 | std::shared_ptr<mir::input::InputChannel>(), | 164 | std::shared_ptr<mir::input::InputChannel>(), |
904 | 174 | std::shared_ptr<mir::input::InputSender>(), | 165 | std::shared_ptr<mir::input::InputSender>(), |
905 | 175 | std::shared_ptr<mg::CursorImage>(), | 166 | std::shared_ptr<mg::CursorImage>(), |
906 | @@ -178,6 +169,10 @@ | |||
907 | 178 | } | 169 | } |
908 | 179 | 170 | ||
909 | 180 | ms::SurfaceCreationParameters default_params; | 171 | ms::SurfaceCreationParameters default_params; |
910 | 172 | std::shared_ptr<mc::BufferStream> stub_buffer_stream1 = std::make_shared<mtd::StubBufferStream>(); | ||
911 | 173 | std::shared_ptr<mc::BufferStream> stub_buffer_stream2 = std::make_shared<mtd::StubBufferStream>(); | ||
912 | 174 | std::shared_ptr<mc::BufferStream> stub_buffer_stream3 = std::make_shared<mtd::StubBufferStream>(); | ||
913 | 175 | |||
914 | 181 | std::shared_ptr<ms::BasicSurface> stub_surface1; | 176 | std::shared_ptr<ms::BasicSurface> stub_surface1; |
915 | 182 | std::shared_ptr<ms::BasicSurface> stub_surface2; | 177 | std::shared_ptr<ms::BasicSurface> stub_surface2; |
916 | 183 | std::shared_ptr<ms::BasicSurface> stub_surface3; | 178 | std::shared_ptr<ms::BasicSurface> stub_surface3; |
917 | @@ -216,9 +211,9 @@ | |||
918 | 216 | EXPECT_THAT( | 211 | EXPECT_THAT( |
919 | 217 | stack.scene_elements_for(compositor_id), | 212 | stack.scene_elements_for(compositor_id), |
920 | 218 | ElementsAre( | 213 | ElementsAre( |
924 | 219 | SceneElementForSurface(stub_surface1), | 214 | SceneElementForStream(stub_buffer_stream1), |
925 | 220 | SceneElementForSurface(stub_surface2), | 215 | SceneElementForStream(stub_buffer_stream2), |
926 | 221 | SceneElementForSurface(stub_surface3))); | 216 | SceneElementForStream(stub_buffer_stream3))); |
927 | 222 | } | 217 | } |
928 | 223 | 218 | ||
929 | 224 | TEST_F(SurfaceStack, stacking_order_with_multiple_buffer_streams) | 219 | TEST_F(SurfaceStack, stacking_order_with_multiple_buffer_streams) |
930 | @@ -228,7 +223,7 @@ | |||
931 | 228 | auto stub_stream1 = std::make_shared<mtd::StubBufferStream>(); | 223 | auto stub_stream1 = std::make_shared<mtd::StubBufferStream>(); |
932 | 229 | auto stub_stream2 = std::make_shared<mtd::StubBufferStream>(); | 224 | auto stub_stream2 = std::make_shared<mtd::StubBufferStream>(); |
933 | 230 | std::list<ms::StreamInfo> streams = { | 225 | std::list<ms::StreamInfo> streams = { |
935 | 231 | { stub_surface1->buffer_stream(), {0,0}, {} }, | 226 | { stub_buffer_stream1, {0,0}, {} }, |
936 | 232 | { stub_stream0, {2,2}, {} }, | 227 | { stub_stream0, {2,2}, {} }, |
937 | 233 | { stub_stream1, {2,3}, {} }, | 228 | { stub_stream1, {2,3}, {} }, |
938 | 234 | }; | 229 | }; |
939 | @@ -236,7 +231,7 @@ | |||
940 | 236 | 231 | ||
941 | 237 | streams = { | 232 | streams = { |
942 | 238 | { stub_stream2, {2,4}, {} }, | 233 | { stub_stream2, {2,4}, {} }, |
944 | 239 | { stub_surface3->buffer_stream(), {0,0}, {} } | 234 | { stub_buffer_stream3, {0,0}, {} } |
945 | 240 | }; | 235 | }; |
946 | 241 | stub_surface3->set_streams(streams); | 236 | stub_surface3->set_streams(streams); |
947 | 242 | 237 | ||
948 | @@ -244,16 +239,15 @@ | |||
949 | 244 | stack.add_surface(stub_surface2, default_params.input_mode); | 239 | stack.add_surface(stub_surface2, default_params.input_mode); |
950 | 245 | stack.add_surface(stub_surface3, default_params.input_mode); | 240 | stack.add_surface(stub_surface3, default_params.input_mode); |
951 | 246 | 241 | ||
952 | 247 | |||
953 | 248 | EXPECT_THAT( | 242 | EXPECT_THAT( |
954 | 249 | stack.scene_elements_for(compositor_id), | 243 | stack.scene_elements_for(compositor_id), |
955 | 250 | ElementsAre( | 244 | ElementsAre( |
957 | 251 | SceneElementForSurface(stub_surface1), | 245 | SceneElementForStream(stub_buffer_stream1), |
958 | 252 | SceneElementForStream(stub_stream0), | 246 | SceneElementForStream(stub_stream0), |
959 | 253 | SceneElementForStream(stub_stream1), | 247 | SceneElementForStream(stub_stream1), |
961 | 254 | SceneElementForSurface(stub_surface2), | 248 | SceneElementForStream(stub_buffer_stream2), |
962 | 255 | SceneElementForStream(stub_stream2), | 249 | SceneElementForStream(stub_stream2), |
964 | 256 | SceneElementForSurface(stub_surface3) | 250 | SceneElementForStream(stub_buffer_stream3) |
965 | 257 | )); | 251 | )); |
966 | 258 | } | 252 | } |
967 | 259 | 253 | ||
968 | @@ -268,8 +262,8 @@ | |||
969 | 268 | EXPECT_THAT( | 262 | EXPECT_THAT( |
970 | 269 | stack.scene_elements_for(compositor_id), | 263 | stack.scene_elements_for(compositor_id), |
971 | 270 | ElementsAre( | 264 | ElementsAre( |
974 | 271 | SceneElementForSurface(stub_surface1), | 265 | SceneElementForStream(stub_buffer_stream1), |
975 | 272 | SceneElementForSurface(stub_surface2))); | 266 | SceneElementForStream(stub_buffer_stream2))); |
976 | 273 | } | 267 | } |
977 | 274 | 268 | ||
978 | 275 | TEST_F(SurfaceStack, decor_name_is_surface_name) | 269 | TEST_F(SurfaceStack, decor_name_is_surface_name) |
979 | @@ -281,7 +275,7 @@ | |||
980 | 281 | std::string("Mary had a little lamb"), | 275 | std::string("Mary had a little lamb"), |
981 | 282 | geom::Rectangle{{},{}}, | 276 | geom::Rectangle{{},{}}, |
982 | 283 | false, | 277 | false, |
984 | 284 | std::make_shared<mtd::StubBufferStream>(), | 278 | std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } }, |
985 | 285 | std::shared_ptr<mir::input::InputChannel>(), | 279 | std::shared_ptr<mir::input::InputChannel>(), |
986 | 286 | std::shared_ptr<mir::input::InputSender>(), | 280 | std::shared_ptr<mir::input::InputSender>(), |
987 | 287 | std::shared_ptr<mg::CursorImage>(), | 281 | std::shared_ptr<mg::CursorImage>(), |
988 | @@ -289,8 +283,7 @@ | |||
989 | 289 | stack.add_surface(surface, default_params.input_mode); | 283 | stack.add_surface(surface, default_params.input_mode); |
990 | 290 | surface->configure(mir_surface_attrib_visibility, | 284 | surface->configure(mir_surface_attrib_visibility, |
991 | 291 | mir_surface_visibility_exposed); | 285 | mir_surface_visibility_exposed); |
994 | 292 | post_a_frame(*surface); | 286 | |
993 | 293 | |||
995 | 294 | auto elements = stack.scene_elements_for(compositor_id); | 287 | auto elements = stack.scene_elements_for(compositor_id); |
996 | 295 | ASSERT_EQ(1, elements.size()); | 288 | ASSERT_EQ(1, elements.size()); |
997 | 296 | 289 | ||
998 | @@ -311,7 +304,7 @@ | |||
999 | 311 | std::string("username@hostname: /"), | 304 | std::string("username@hostname: /"), |
1000 | 312 | geom::Rectangle{{},{}}, | 305 | geom::Rectangle{{},{}}, |
1001 | 313 | false, | 306 | false, |
1003 | 314 | std::make_shared<mtd::StubBufferStream>(), | 307 | std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } }, |
1004 | 315 | std::shared_ptr<mir::input::InputChannel>(), | 308 | std::shared_ptr<mir::input::InputChannel>(), |
1005 | 316 | std::shared_ptr<mir::input::InputSender>(), | 309 | std::shared_ptr<mir::input::InputSender>(), |
1006 | 317 | std::shared_ptr<mg::CursorImage>(), | 310 | std::shared_ptr<mg::CursorImage>(), |
1007 | @@ -319,8 +312,7 @@ | |||
1008 | 319 | stack.add_surface(surface, default_params.input_mode); | 312 | stack.add_surface(surface, default_params.input_mode); |
1009 | 320 | surface->configure(mir_surface_attrib_visibility, | 313 | surface->configure(mir_surface_attrib_visibility, |
1010 | 321 | mir_surface_visibility_exposed); | 314 | mir_surface_visibility_exposed); |
1013 | 322 | post_a_frame(*surface); | 315 | |
1012 | 323 | |||
1014 | 324 | // (change directory in shell app) | 316 | // (change directory in shell app) |
1015 | 325 | surface->rename("username@hostname: ~/Documents"); | 317 | surface->rename("username@hostname: ~/Documents"); |
1016 | 326 | 318 | ||
1017 | @@ -350,11 +342,12 @@ | |||
1018 | 350 | ON_CALL(*mock_queue, compositor_acquire(_)) | 342 | ON_CALL(*mock_queue, compositor_acquire(_)) |
1019 | 351 | .WillByDefault(InvokeWithoutArgs([&]{ready--; return mt::fake_shared(stub_buffer); })); | 343 | .WillByDefault(InvokeWithoutArgs([&]{ready--; return mt::fake_shared(stub_buffer); })); |
1020 | 352 | 344 | ||
1021 | 345 | auto stream = std::make_shared<mc::BufferStreamSurfaces>(mock_queue); | ||
1022 | 353 | auto surface = std::make_shared<ms::BasicSurface>( | 346 | auto surface = std::make_shared<ms::BasicSurface>( |
1023 | 354 | std::string("stub"), | 347 | std::string("stub"), |
1024 | 355 | geom::Rectangle{{},{}}, | 348 | geom::Rectangle{{},{}}, |
1025 | 356 | false, | 349 | false, |
1027 | 357 | std::make_shared<mc::BufferStreamSurfaces>(mock_queue), | 350 | std::list<ms::StreamInfo> { { stream, {}, {} } }, |
1028 | 358 | std::shared_ptr<mir::input::InputChannel>(), | 351 | std::shared_ptr<mir::input::InputChannel>(), |
1029 | 359 | std::shared_ptr<mir::input::InputSender>(), | 352 | std::shared_ptr<mir::input::InputSender>(), |
1030 | 360 | std::shared_ptr<mg::CursorImage>(), | 353 | std::shared_ptr<mg::CursorImage>(), |
1031 | @@ -364,9 +357,9 @@ | |||
1032 | 364 | mir_surface_visibility_exposed); | 357 | mir_surface_visibility_exposed); |
1033 | 365 | 358 | ||
1034 | 366 | EXPECT_EQ(0, stack.frames_pending(this)); | 359 | EXPECT_EQ(0, stack.frames_pending(this)); |
1038 | 367 | post_a_frame(*surface); | 360 | post_a_frame(*stream); |
1039 | 368 | post_a_frame(*surface); | 361 | post_a_frame(*stream); |
1040 | 369 | post_a_frame(*surface); | 362 | post_a_frame(*stream); |
1041 | 370 | EXPECT_EQ(3, stack.frames_pending(this)); | 363 | EXPECT_EQ(3, stack.frames_pending(this)); |
1042 | 371 | 364 | ||
1043 | 372 | for (int expect = 3; expect >= 0; --expect) | 365 | for (int expect = 3; expect >= 0; --expect) |
1044 | @@ -386,11 +379,12 @@ | |||
1045 | 386 | 379 | ||
1046 | 387 | ms::SurfaceStack stack{report}; | 380 | ms::SurfaceStack stack{report}; |
1047 | 388 | stack.register_compositor(this); | 381 | stack.register_compositor(this); |
1048 | 382 | auto stream = std::make_shared<mtd::StubBufferStream>(); | ||
1049 | 389 | auto surface = std::make_shared<ms::BasicSurface>( | 383 | auto surface = std::make_shared<ms::BasicSurface>( |
1050 | 390 | std::string("stub"), | 384 | std::string("stub"), |
1051 | 391 | geom::Rectangle{{},{}}, | 385 | geom::Rectangle{{},{}}, |
1052 | 392 | false, | 386 | false, |
1054 | 393 | std::make_shared<mtd::StubBufferStream>(), | 387 | std::list<ms::StreamInfo> { { stream, {}, {} } }, |
1055 | 394 | std::shared_ptr<mir::input::InputChannel>(), | 388 | std::shared_ptr<mir::input::InputChannel>(), |
1056 | 395 | std::shared_ptr<mir::input::InputSender>(), | 389 | std::shared_ptr<mir::input::InputSender>(), |
1057 | 396 | std::shared_ptr<mg::CursorImage>(), | 390 | std::shared_ptr<mg::CursorImage>(), |
1058 | @@ -402,9 +396,9 @@ | |||
1059 | 402 | elem->occluded(); | 396 | elem->occluded(); |
1060 | 403 | 397 | ||
1061 | 404 | EXPECT_EQ(0, stack.frames_pending(this)); | 398 | EXPECT_EQ(0, stack.frames_pending(this)); |
1065 | 405 | post_a_frame(*surface); | 399 | post_a_frame(*stream); |
1066 | 406 | post_a_frame(*surface); | 400 | post_a_frame(*stream); |
1067 | 407 | post_a_frame(*surface); | 401 | post_a_frame(*stream); |
1068 | 408 | EXPECT_EQ(0, stack.frames_pending(this)); | 402 | EXPECT_EQ(0, stack.frames_pending(this)); |
1069 | 409 | } | 403 | } |
1070 | 410 | 404 | ||
1071 | @@ -419,20 +413,21 @@ | |||
1072 | 419 | 413 | ||
1073 | 420 | stack.register_compositor(comp1); | 414 | stack.register_compositor(comp1); |
1074 | 421 | stack.register_compositor(comp2); | 415 | stack.register_compositor(comp2); |
1075 | 416 | auto stream = std::make_shared<mtd::StubBufferStream>(); | ||
1076 | 422 | auto surface = std::make_shared<ms::BasicSurface>( | 417 | auto surface = std::make_shared<ms::BasicSurface>( |
1077 | 423 | std::string("stub"), | 418 | std::string("stub"), |
1078 | 424 | geom::Rectangle{{},{}}, | 419 | geom::Rectangle{{},{}}, |
1079 | 425 | false, | 420 | false, |
1081 | 426 | std::make_shared<mtd::StubBufferStream>(), | 421 | std::list<ms::StreamInfo> { { stream, {}, {} } }, |
1082 | 427 | std::shared_ptr<mir::input::InputChannel>(), | 422 | std::shared_ptr<mir::input::InputChannel>(), |
1083 | 428 | std::shared_ptr<mir::input::InputSender>(), | 423 | std::shared_ptr<mir::input::InputSender>(), |
1084 | 429 | std::shared_ptr<mg::CursorImage>(), | 424 | std::shared_ptr<mg::CursorImage>(), |
1085 | 430 | report); | 425 | report); |
1086 | 431 | 426 | ||
1087 | 432 | stack.add_surface(surface, default_params.input_mode); | 427 | stack.add_surface(surface, default_params.input_mode); |
1091 | 433 | post_a_frame(*surface); | 428 | post_a_frame(*stream); |
1092 | 434 | post_a_frame(*surface); | 429 | post_a_frame(*stream); |
1093 | 435 | post_a_frame(*surface); | 430 | post_a_frame(*stream); |
1094 | 436 | 431 | ||
1095 | 437 | EXPECT_EQ(3, stack.frames_pending(comp1)); | 432 | EXPECT_EQ(3, stack.frames_pending(comp1)); |
1096 | 438 | EXPECT_EQ(3, stack.frames_pending(comp2)); | 433 | EXPECT_EQ(3, stack.frames_pending(comp2)); |
1097 | @@ -464,9 +459,9 @@ | |||
1098 | 464 | EXPECT_THAT( | 459 | EXPECT_THAT( |
1099 | 465 | stack.scene_elements_for(compositor_id), | 460 | stack.scene_elements_for(compositor_id), |
1100 | 466 | ElementsAre( | 461 | ElementsAre( |
1104 | 467 | SceneElementForSurface(stub_surface1), | 462 | SceneElementForStream(stub_buffer_stream1), |
1105 | 468 | SceneElementForSurface(stub_surface3), | 463 | SceneElementForStream(stub_buffer_stream3), |
1106 | 469 | SceneElementForSurface(stub_surface2))); | 464 | SceneElementForStream(stub_buffer_stream2))); |
1107 | 470 | } | 465 | } |
1108 | 471 | 466 | ||
1109 | 472 | 467 | ||
1110 | @@ -500,18 +495,18 @@ | |||
1111 | 500 | EXPECT_THAT( | 495 | EXPECT_THAT( |
1112 | 501 | stack.scene_elements_for(compositor_id), | 496 | stack.scene_elements_for(compositor_id), |
1113 | 502 | ElementsAre( | 497 | ElementsAre( |
1117 | 503 | SceneElementForSurface(stub_surface1), | 498 | SceneElementForStream(stub_buffer_stream1), |
1118 | 504 | SceneElementForSurface(stub_surface2), | 499 | SceneElementForStream(stub_buffer_stream2), |
1119 | 505 | SceneElementForSurface(stub_surface3))); | 500 | SceneElementForStream(stub_buffer_stream3))); |
1120 | 506 | 501 | ||
1121 | 507 | stack.raise(stub_surface1); | 502 | stack.raise(stub_surface1); |
1122 | 508 | 503 | ||
1123 | 509 | EXPECT_THAT( | 504 | EXPECT_THAT( |
1124 | 510 | stack.scene_elements_for(compositor_id), | 505 | stack.scene_elements_for(compositor_id), |
1125 | 511 | ElementsAre( | 506 | ElementsAre( |
1129 | 512 | SceneElementForSurface(stub_surface2), | 507 | SceneElementForStream(stub_buffer_stream2), |
1130 | 513 | SceneElementForSurface(stub_surface3), | 508 | SceneElementForStream(stub_buffer_stream3), |
1131 | 514 | SceneElementForSurface(stub_surface1))); | 509 | SceneElementForStream(stub_buffer_stream1))); |
1132 | 515 | } | 510 | } |
1133 | 516 | 511 | ||
1134 | 517 | TEST_F(SurfaceStack, raise_throw_behavior) | 512 | TEST_F(SurfaceStack, raise_throw_behavior) |
1135 | @@ -537,13 +532,12 @@ | |||
1136 | 537 | std::string("stub"), | 532 | std::string("stub"), |
1137 | 538 | geom::Rectangle{geom::Point{3 * i, 4 * i},geom::Size{1 * i, 2 * i}}, | 533 | geom::Rectangle{geom::Point{3 * i, 4 * i},geom::Size{1 * i, 2 * i}}, |
1138 | 539 | true, | 534 | true, |
1140 | 540 | std::make_shared<mtd::StubBufferStream>(), | 535 | std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } }, |
1141 | 541 | std::shared_ptr<mir::input::InputChannel>(), | 536 | std::shared_ptr<mir::input::InputChannel>(), |
1142 | 542 | std::shared_ptr<mir::input::InputSender>(), | 537 | std::shared_ptr<mir::input::InputSender>(), |
1143 | 543 | std::shared_ptr<mg::CursorImage>(), | 538 | std::shared_ptr<mg::CursorImage>(), |
1144 | 544 | report); | 539 | report); |
1147 | 545 | post_a_frame(*surface); | 540 | |
1146 | 546 | |||
1148 | 547 | surfaces.emplace_back(surface); | 541 | surfaces.emplace_back(surface); |
1149 | 548 | stack.add_surface(surface, default_params.input_mode); | 542 | stack.add_surface(surface, default_params.input_mode); |
1150 | 549 | } | 543 | } |
1151 | @@ -723,7 +717,7 @@ | |||
1152 | 723 | std::string("stub"), | 717 | std::string("stub"), |
1153 | 724 | geom::Rectangle{geom::Point{3 * i, 4 * i},geom::Size{1 * i, 2 * i}}, | 718 | geom::Rectangle{geom::Point{3 * i, 4 * i},geom::Size{1 * i, 2 * i}}, |
1154 | 725 | true, | 719 | true, |
1156 | 726 | std::make_shared<mtd::StubBufferStream>(), | 720 | std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } }, |
1157 | 727 | std::shared_ptr<mir::input::InputChannel>(), | 721 | std::shared_ptr<mir::input::InputChannel>(), |
1158 | 728 | std::shared_ptr<mir::input::InputSender>(), | 722 | std::shared_ptr<mir::input::InputSender>(), |
1159 | 729 | std::shared_ptr<mg::CursorImage>(), | 723 | std::shared_ptr<mg::CursorImage>(), |
1160 | @@ -756,13 +750,12 @@ | |||
1161 | 756 | std::string("stub"), | 750 | std::string("stub"), |
1162 | 757 | geom::Rectangle{geom::Point{3, 4},geom::Size{1, 2}}, | 751 | geom::Rectangle{geom::Point{3, 4},geom::Size{1, 2}}, |
1163 | 758 | true, | 752 | true, |
1165 | 759 | mock_stream, | 753 | std::list<ms::StreamInfo> { { mock_stream, {}, {} } }, |
1166 | 760 | std::shared_ptr<mir::input::InputChannel>(), | 754 | std::shared_ptr<mir::input::InputChannel>(), |
1167 | 761 | std::shared_ptr<mir::input::InputSender>(), | 755 | std::shared_ptr<mir::input::InputSender>(), |
1168 | 762 | std::shared_ptr<mg::CursorImage>(), | 756 | std::shared_ptr<mg::CursorImage>(), |
1169 | 763 | report); | 757 | report); |
1172 | 764 | post_a_frame(*surface); | 758 | stack.add_surface(surface, default_params.input_mode); |
1171 | 765 | stack.add_surface(surface, default_params.input_mode); | ||
1173 | 766 | 759 | ||
1174 | 767 | auto const elements = stack.scene_elements_for(compositor_id); | 760 | auto const elements = stack.scene_elements_for(compositor_id); |
1175 | 768 | 761 | ||
1176 | @@ -787,13 +780,12 @@ | |||
1177 | 787 | std::string("stub"), | 780 | std::string("stub"), |
1178 | 788 | geom::Rectangle{geom::Point{3, 4},geom::Size{1, 2}}, | 781 | geom::Rectangle{geom::Point{3, 4},geom::Size{1, 2}}, |
1179 | 789 | true, | 782 | true, |
1181 | 790 | mock_stream, | 783 | std::list<ms::StreamInfo> { { mock_stream, {}, {} } }, |
1182 | 791 | std::shared_ptr<mir::input::InputChannel>(), | 784 | std::shared_ptr<mir::input::InputChannel>(), |
1183 | 792 | std::shared_ptr<mir::input::InputSender>(), | 785 | std::shared_ptr<mir::input::InputSender>(), |
1184 | 793 | std::shared_ptr<mg::CursorImage>(), | 786 | std::shared_ptr<mg::CursorImage>(), |
1185 | 794 | report); | 787 | report); |
1188 | 795 | post_a_frame(*surface); | 788 | stack.add_surface(surface, default_params.input_mode); |
1187 | 796 | stack.add_surface(surface, default_params.input_mode); | ||
1189 | 797 | 789 | ||
1190 | 798 | auto const elements = stack.scene_elements_for(compositor_id); | 790 | auto const elements = stack.scene_elements_for(compositor_id); |
1191 | 799 | ASSERT_THAT(elements.size(), Eq(1u)); | 791 | ASSERT_THAT(elements.size(), Eq(1u)); |
1192 | @@ -811,7 +803,7 @@ | |||
1193 | 811 | {}, | 803 | {}, |
1194 | 812 | {{},{}}, | 804 | {{},{}}, |
1195 | 813 | true, | 805 | true, |
1197 | 814 | std::make_shared<mtd::StubBufferStream>(), | 806 | std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } }, |
1198 | 815 | {}, | 807 | {}, |
1199 | 816 | {}, | 808 | {}, |
1200 | 817 | {}, | 809 | {}, |
1201 | @@ -833,8 +825,7 @@ | |||
1202 | 833 | 825 | ||
1203 | 834 | auto const mock_surface = std::make_shared<MockConfigureSurface>(); | 826 | auto const mock_surface = std::make_shared<MockConfigureSurface>(); |
1204 | 835 | mock_surface->show(); | 827 | mock_surface->show(); |
1207 | 836 | post_a_frame(*mock_surface); | 828 | |
1206 | 837 | |||
1208 | 838 | stack.add_surface(mock_surface, default_params.input_mode); | 829 | stack.add_surface(mock_surface, default_params.input_mode); |
1209 | 839 | 830 | ||
1210 | 840 | auto const elements = stack.scene_elements_for(compositor_id); | 831 | auto const elements = stack.scene_elements_for(compositor_id); |
1211 | @@ -858,8 +849,7 @@ | |||
1212 | 858 | stack.register_compositor(compositor_id2); | 849 | stack.register_compositor(compositor_id2); |
1213 | 859 | 850 | ||
1214 | 860 | auto const mock_surface = std::make_shared<MockConfigureSurface>(); | 851 | auto const mock_surface = std::make_shared<MockConfigureSurface>(); |
1217 | 861 | post_a_frame(*mock_surface); | 852 | stack.add_surface(mock_surface, default_params.input_mode); |
1216 | 862 | stack.add_surface(mock_surface, default_params.input_mode); | ||
1218 | 863 | 853 | ||
1219 | 864 | auto const elements = stack.scene_elements_for(compositor_id); | 854 | auto const elements = stack.scene_elements_for(compositor_id); |
1220 | 865 | ASSERT_THAT(elements.size(), Eq(1u)); | 855 | ASSERT_THAT(elements.size(), Eq(1u)); |
1221 | @@ -884,7 +874,6 @@ | |||
1222 | 884 | stack.register_compositor(compositor_id3); | 874 | stack.register_compositor(compositor_id3); |
1223 | 885 | 875 | ||
1224 | 886 | auto const mock_surface = std::make_shared<MockConfigureSurface>(); | 876 | auto const mock_surface = std::make_shared<MockConfigureSurface>(); |
1225 | 887 | post_a_frame(*mock_surface); | ||
1226 | 888 | stack.add_surface(mock_surface, default_params.input_mode); | 877 | stack.add_surface(mock_surface, default_params.input_mode); |
1227 | 889 | 878 | ||
1228 | 890 | auto const elements = stack.scene_elements_for(compositor_id); | 879 | auto const elements = stack.scene_elements_for(compositor_id); |
1229 | @@ -1014,8 +1003,8 @@ | |||
1230 | 1014 | EXPECT_THAT( | 1003 | EXPECT_THAT( |
1231 | 1015 | stack.scene_elements_for(compositor_id), | 1004 | stack.scene_elements_for(compositor_id), |
1232 | 1016 | ElementsAre( | 1005 | ElementsAre( |
1235 | 1017 | SceneElementForSurface(stub_surface1), | 1006 | SceneElementForStream(stub_buffer_stream1), |
1236 | 1018 | SceneElementForSurface(stub_surface2), | 1007 | SceneElementForStream(stub_buffer_stream2), |
1237 | 1019 | SceneElementForStream(mt::fake_shared(r)))); | 1008 | SceneElementForStream(mt::fake_shared(r)))); |
1238 | 1020 | } | 1009 | } |
1239 | 1021 | 1010 | ||
1240 | @@ -1032,8 +1021,8 @@ | |||
1241 | 1032 | EXPECT_THAT( | 1021 | EXPECT_THAT( |
1242 | 1033 | stack.scene_elements_for(compositor_id), | 1022 | stack.scene_elements_for(compositor_id), |
1243 | 1034 | ElementsAre( | 1023 | ElementsAre( |
1246 | 1035 | SceneElementForSurface(stub_surface1), | 1024 | SceneElementForStream(stub_buffer_stream1), |
1247 | 1036 | SceneElementForSurface(stub_surface2), | 1025 | SceneElementForStream(stub_buffer_stream2), |
1248 | 1037 | SceneElementForStream(mt::fake_shared(r)))); | 1026 | SceneElementForStream(mt::fake_shared(r)))); |
1249 | 1038 | 1027 | ||
1250 | 1039 | stack.remove_input_visualization(mt::fake_shared(r)); | 1028 | stack.remove_input_visualization(mt::fake_shared(r)); |
1251 | @@ -1041,8 +1030,8 @@ | |||
1252 | 1041 | EXPECT_THAT( | 1030 | EXPECT_THAT( |
1253 | 1042 | stack.scene_elements_for(compositor_id), | 1031 | stack.scene_elements_for(compositor_id), |
1254 | 1043 | ElementsAre( | 1032 | ElementsAre( |
1257 | 1044 | SceneElementForSurface(stub_surface1), | 1033 | SceneElementForStream(stub_buffer_stream1), |
1258 | 1045 | SceneElementForSurface(stub_surface2))); | 1034 | SceneElementForStream(stub_buffer_stream2))); |
1259 | 1046 | } | 1035 | } |
1260 | 1047 | 1036 | ||
1261 | 1048 | TEST_F(SurfaceStack, scene_observers_notified_of_generic_scene_change) | 1037 | TEST_F(SurfaceStack, scene_observers_notified_of_generic_scene_change) |
1262 | @@ -1140,9 +1129,9 @@ | |||
1263 | 1140 | EXPECT_THAT( | 1129 | EXPECT_THAT( |
1264 | 1141 | stack.scene_elements_for(compositor_id), | 1130 | stack.scene_elements_for(compositor_id), |
1265 | 1142 | ElementsAre( | 1131 | ElementsAre( |
1269 | 1143 | SceneElementForSurface(stub_surface2), | 1132 | SceneElementForStream(stub_buffer_stream2), |
1270 | 1144 | SceneElementForSurface(stub_surface1), | 1133 | SceneElementForStream(stub_buffer_stream1), |
1271 | 1145 | SceneElementForSurface(stub_surface3))); | 1134 | SceneElementForStream(stub_buffer_stream3))); |
1272 | 1146 | 1135 | ||
1273 | 1147 | Mock::VerifyAndClearExpectations(&observer); | 1136 | Mock::VerifyAndClearExpectations(&observer); |
1274 | 1148 | EXPECT_CALL(observer, surfaces_reordered()).Times(1); | 1137 | EXPECT_CALL(observer, surfaces_reordered()).Times(1); |
1275 | @@ -1151,9 +1140,9 @@ | |||
1276 | 1151 | EXPECT_THAT( | 1140 | EXPECT_THAT( |
1277 | 1152 | stack.scene_elements_for(compositor_id), | 1141 | stack.scene_elements_for(compositor_id), |
1278 | 1153 | ElementsAre( | 1142 | ElementsAre( |
1282 | 1154 | SceneElementForSurface(stub_surface1), | 1143 | SceneElementForStream(stub_buffer_stream1), |
1283 | 1155 | SceneElementForSurface(stub_surface2), | 1144 | SceneElementForStream(stub_buffer_stream2), |
1284 | 1156 | SceneElementForSurface(stub_surface3))); | 1145 | SceneElementForStream(stub_buffer_stream3))); |
1285 | 1157 | 1146 | ||
1286 | 1158 | Mock::VerifyAndClearExpectations(&observer); | 1147 | Mock::VerifyAndClearExpectations(&observer); |
1287 | 1159 | EXPECT_CALL(observer, surfaces_reordered()).Times(0); | 1148 | EXPECT_CALL(observer, surfaces_reordered()).Times(0); |
1288 | @@ -1162,7 +1151,7 @@ | |||
1289 | 1162 | EXPECT_THAT( | 1151 | EXPECT_THAT( |
1290 | 1163 | stack.scene_elements_for(compositor_id), | 1152 | stack.scene_elements_for(compositor_id), |
1291 | 1164 | ElementsAre( | 1153 | ElementsAre( |
1295 | 1165 | SceneElementForSurface(stub_surface1), | 1154 | SceneElementForStream(stub_buffer_stream1), |
1296 | 1166 | SceneElementForSurface(stub_surface2), | 1155 | SceneElementForStream(stub_buffer_stream2), |
1297 | 1167 | SceneElementForSurface(stub_surface3))); | 1156 | SceneElementForStream(stub_buffer_stream3))); |
1298 | 1168 | } | 1157 | } |
portending a suggestion to change std::list to std::vector... This reflects the existing set_streams() function that takes a std::list.