~ubuntu-branches/ubuntu/wily/mir/wily-proposed

« back to all changes in this revision

Viewing changes to tests/acceptance-tests/test_display_configuration.cpp

  • Committer: Package Import Robot
  • Author(s): CI Train Bot
  • Date: 2015-05-12 13:12:55 UTC
  • mto: This revision was merged to the branch mainline in revision 96.
  • Revision ID: package-import@ubuntu.com-20150512131255-y7z12i8n4pbvo70x
Tags: upstream-0.13.0+15.10.20150512
ImportĀ upstreamĀ versionĀ 0.13.0+15.10.20150512

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "mir_test_framework/connected_client_headless_server.h"
25
25
#include "mir_test_doubles/null_platform.h"
26
26
#include "mir_test_doubles/null_display.h"
27
 
#include "mir_test_doubles/null_display_buffer.h"
 
27
#include "mir_test_doubles/null_display_sync_group.h"
28
28
#include "mir_test_doubles/null_platform.h"
29
29
#include "mir_test/display_config_matchers.h"
30
30
#include "mir_test_doubles/stub_display_configuration.h"
64
64
    {
65
65
    }
66
66
 
67
 
    void for_each_display_buffer(std::function<void(mg::DisplayBuffer&)> const& f) override
 
67
    void for_each_display_sync_group(std::function<void(mg::DisplaySyncGroup&)> const& f) override
68
68
    {
69
 
        f(display_buffer);
 
69
        f(display_sync_group);
70
70
    }
71
71
 
72
72
    std::unique_ptr<mg::DisplayConfiguration> configuration() const override
111
111
 
112
112
private:
113
113
    std::shared_ptr<mtd::StubDisplayConfig> config;
114
 
    mtd::NullDisplayBuffer display_buffer;
 
114
    mtd::NullDisplaySyncGroup display_sync_group;
115
115
    mt::Pipe p;
116
116
    std::atomic<bool> handler_called;
117
117
};
232
232
    void connect()
233
233
    {
234
234
        connection = mir_connect_sync(mir_test_socket.c_str(), __PRETTY_FUNCTION__);
 
235
 
 
236
        auto const spec = mir_connection_create_spec_for_normal_surface(connection, 100, 100, mir_pixel_format_abgr_8888);
 
237
        surface = mir_surface_create_sync(spec);
 
238
        mir_surface_spec_release(spec);
 
239
        mir_buffer_stream_swap_buffers_sync(mir_surface_get_buffer_stream(surface));
235
240
    }
236
241
 
237
242
    void disconnect()
238
243
    {
 
244
        mir_surface_release_sync(surface);
239
245
        mir_connection_release(connection);
240
246
    }
241
247
 
242
248
    std::string mir_test_socket;
243
249
    MirConnection* connection{nullptr};
 
250
    MirSurface* surface{nullptr};
244
251
};
245
252
 
246
253
struct DisplayClient : SimpleClient
282
289
{
283
290
    EXPECT_CALL(mock_display, configure(_)).Times(0);
284
291
 
285
 
    DisplayClient display_client{new_connection()};
286
292
    SimpleClient simple_client{new_connection()};
287
293
 
288
 
    display_client.connect();
289
 
 
290
294
    /* Connect the simple client. After this the simple client should have the focus. */
291
295
    simple_client.connect();
292
296
 
293
297
    /* Apply the display config while not focused */
294
 
    display_client.apply_config();
 
298
    auto const configuration = mir_connection_create_display_config(connection);
 
299
    mir_wait_for(mir_connection_apply_display_config(connection, configuration));
 
300
    mir_display_config_destroy(configuration);
295
301
 
296
302
    wait_for_server_actions_to_finish(*server.the_main_loop());
297
303
    testing::Mock::VerifyAndClearExpectations(&mock_display);
306
312
 
307
313
    wait_for_server_actions_to_finish(*server.the_main_loop());
308
314
    testing::Mock::VerifyAndClearExpectations(&mock_display);
309
 
 
310
 
    display_client.disconnect();
311
315
}
312
316
 
313
317
TEST_F(DisplayConfigurationTest, changing_focus_from_client_with_config_to_client_without_config_configures_display)