78
78
dummy_client_module.load_function<mcl::CreateClientPlatform>("create_client_platform")(context, nullptr);
81
void use_egl_native_window(std::shared_ptr<void> /*native_window*/, mir::client::EGLNativeSurface* /*surface*/) override
81
void use_egl_native_window(std::shared_ptr<void> /*native_window*/, mir::client::EGLNativeSurface* /*window*/) override
85
std::shared_ptr<void> create_egl_native_window(mir::client::EGLNativeSurface *surface) override
85
std::shared_ptr<void> create_egl_native_window(mir::client::EGLNativeSurface *window) override
87
87
if (should_fail<Method::create_egl_native_window, failure_set>())
89
89
BOOST_THROW_EXCEPTION(std::runtime_error{exception_text});
91
return stub_platform->create_egl_native_window(surface);
91
return stub_platform->create_egl_native_window(window);
94
94
void populate(MirPlatformPackage& package) const override
217
217
ASSERT_THAT(connection, IsValid());
219
auto spec = mir_connection_create_spec_for_normal_surface(
222
mir_pixel_format_xbgr_8888);
223
auto surface = mir_surface_create_sync(spec);
224
mir_surface_spec_release(spec);
226
ASSERT_NE(surface, nullptr);
227
EXPECT_FALSE(mir_surface_is_valid(surface));
228
EXPECT_THAT(mir_surface_get_error_message(surface), testing::HasSubstr(exception_text));
230
mir_surface_release_sync(surface);
219
auto spec = mir_create_normal_window_spec(connection, 800, 600);
220
mir_window_spec_set_pixel_format(spec, mir_pixel_format_xbgr_8888);
221
auto window = mir_window_create_sync(spec);
222
mir_window_spec_release(spec);
224
ASSERT_NE(window, nullptr);
225
EXPECT_FALSE(mir_window_is_valid(window));
226
EXPECT_THAT(mir_window_get_error_message(window), testing::HasSubstr(exception_text));
228
mir_window_release_sync(window);
231
229
mir_connection_release(connection);
260
258
ASSERT_THAT(connection, IsValid());
262
auto spec = mir_connection_create_spec_for_normal_surface(
265
mir_pixel_format_xbgr_8888);
266
auto surface = mir_surface_create_sync(spec);
267
mir_surface_spec_release(spec);
260
auto spec = mir_create_normal_window_spec(connection, 800, 600);
261
mir_window_spec_set_pixel_format(spec, mir_pixel_format_xbgr_8888);
262
auto window = mir_window_create_sync(spec);
263
mir_window_spec_release(spec);
269
mir_surface_release_sync(surface);
265
mir_window_release_sync(window);
270
266
mir_connection_release(connection);
288
284
ASSERT_THAT(connection, IsValid());
290
auto spec = mir_connection_create_spec_for_normal_surface(
293
mir_pixel_format_xbgr_8888);
294
auto surface = mir_surface_create_sync(spec);
295
mir_surface_spec_release(spec);
286
auto spec = mir_create_normal_window_spec(connection, 800, 600);
287
mir_window_spec_set_pixel_format(spec, mir_pixel_format_xbgr_8888);
288
auto window = mir_window_create_sync(spec);
289
mir_window_spec_release(spec);
297
ASSERT_NE(surface, nullptr);
298
EXPECT_FALSE(mir_surface_is_valid(surface));
299
EXPECT_THAT(mir_surface_get_error_message(surface), testing::HasSubstr(exception_text));
291
ASSERT_NE(window, nullptr);
292
EXPECT_FALSE(mir_window_is_valid(window));
293
EXPECT_THAT(mir_window_get_error_message(window), testing::HasSubstr(exception_text));
301
295
bool callback_called{false};
302
mir_surface_release(surface, &recording_surface_callback, &callback_called);
296
mir_window_release(window, &recording_surface_callback, &callback_called);
303
297
EXPECT_TRUE(callback_called);
304
298
mir_connection_release(connection);
314
308
ASSERT_THAT(connection, IsValid());
316
auto spec = mir_connection_create_spec_for_normal_surface(
319
mir_pixel_format_xbgr_8888);
320
auto surface = mir_surface_create_sync(spec);
321
mir_surface_spec_release(spec);
323
ASSERT_NE(surface, nullptr);
324
EXPECT_FALSE(mir_surface_is_valid(surface));
325
EXPECT_THAT(mir_surface_get_error_message(surface), testing::HasSubstr(exception_text));
327
mir_surface_release_sync(surface);
310
auto spec = mir_create_normal_window_spec(connection, 800, 600);
311
mir_window_spec_set_pixel_format(spec, mir_pixel_format_xbgr_8888);
312
auto window = mir_window_create_sync(spec);
313
mir_window_spec_release(spec);
315
ASSERT_NE(window, nullptr);
316
EXPECT_FALSE(mir_window_is_valid(window));
317
EXPECT_THAT(mir_window_get_error_message(window), testing::HasSubstr(exception_text));
319
mir_window_release_sync(window);
328
320
mir_connection_release(connection);
339
331
// An ID that parses as valid, but doesn't correspond to any
340
332
auto invalid_id = mir_persistent_id_from_string("05f223a2-39e5-48b9-9416-b0ce837351b6");
342
auto spec = mir_connection_create_spec_for_input_method(connection,
344
mir_pixel_format_argb_8888);
334
auto spec = mir_create_input_method_window_spec(connection, 200, 200);
335
mir_window_spec_set_pixel_format(spec, mir_pixel_format_argb_8888);
345
336
MirRectangle rect{
351
mir_surface_spec_attach_to_foreign_parent(spec, invalid_id, &rect, mir_edge_attachment_any);
342
mir_window_spec_attach_to_foreign_parent(spec, invalid_id, &rect, mir_edge_attachment_any);
353
auto surface = mir_surface_create_sync(spec);
354
EXPECT_THAT(surface, Not(IsValid()));
355
EXPECT_THAT(mir_surface_get_error_message(surface), MatchesRegex(".*Lookup.*failed.*"));
344
auto window = mir_window_create_sync(spec);
345
EXPECT_THAT(window, Not(IsValid()));
346
EXPECT_THAT(mir_window_get_error_message(window), MatchesRegex(".*Lookup.*failed.*"));
357
348
mir_persistent_id_release(invalid_id);
358
mir_surface_spec_release(spec);
359
mir_surface_release_sync(surface);
349
mir_window_spec_release(spec);
350
mir_window_release_sync(window);
360
351
mir_connection_release(connection);
405
396
auto connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
407
auto spec = mir_connection_create_spec_for_input_method(connection, 100, 100, mir_pixel_format_argb_8888);
398
auto spec = mir_create_input_method_window_spec(connection, 100, 100);
399
mir_window_spec_set_pixel_format(spec, mir_pixel_format_argb_8888);
409
401
MirRectangle rect{
415
407
MIR_EXPECT_DEATH(
417
mir_surface_spec_attach_to_foreign_parent(spec, nullptr, &rect,
409
mir_window_spec_attach_to_foreign_parent(spec, nullptr, &rect,
418
410
mir_edge_attachment_any);
426
418
auto connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
428
auto spec = mir_connection_create_spec_for_input_method(connection, 100, 100, mir_pixel_format_argb_8888);
420
auto spec = mir_create_input_method_window_spec(connection, 100, 100);
421
mir_window_spec_set_pixel_format(spec, mir_pixel_format_argb_8888);
430
423
auto id = mir_persistent_id_from_string("fa69b2e9-d507-4005-be61-5068f40a5aec");
432
425
MIR_EXPECT_DEATH(
434
mir_surface_spec_attach_to_foreign_parent(spec, id, nullptr,
427
mir_window_spec_attach_to_foreign_parent(spec, id, nullptr,
435
428
mir_edge_attachment_any);