~mir-team/miral/release

« back to all changes in this revision

Viewing changes to test/window_id.cpp

  • Committer: Bileto Bot
  • Date: 2017-06-21 08:34:34 UTC
  • mfrom: (360.1.1 miral-release)
  • Revision ID: ci-train-bot@canonical.com-20170621083434-e7ftkyg5qr2fzsao
* New upstream release 1.4.0 (https://launchpad.net/miral/+milestone/1.4.0)
  - ABI summary:
    . miral ABI unchanged at 2
  - Enhancements:
    . Support for passing messages to enable Drag & Drop
    . Support for client requested move
    . Port to the undeprecated Mir APIs
    . Added "--cursor-theme" option when configuring a cursor theme
    . Drop support for Mir versions before 0.26
  - Bugs fixed:

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
    }
43
43
};
44
44
 
45
 
#if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 24, 0)
46
45
TEST_F(WindowId, server_can_identify_window_specified_by_client)
47
46
{
48
47
    char const* const test_name = __PRETTY_FUNCTION__;
49
48
    using namespace mir::client;
50
49
 
51
50
    auto const connection = connect_client(test_name);
52
 
    auto const spec = WindowSpec::for_normal_window(connection, 50, 50, mir_pixel_format_argb_8888)
 
51
    auto const spec = WindowSpec::for_normal_window(connection, 50, 50)
53
52
        .set_name(test_name);
54
53
 
55
54
    Window const surface{spec.create_window()};
71
70
    using namespace mir::client;
72
71
 
73
72
    auto const connection = connect_client(test_name);
74
 
    auto const spec = WindowSpec::for_normal_window(connection, 50, 50, mir_pixel_format_argb_8888)
 
73
    auto const spec = WindowSpec::for_normal_window(connection, 50, 50)
75
74
        .set_name(test_name);
76
75
 
77
76
    Window const surface{spec.create_window()};
86
85
            ASSERT_THAT(client_surface_id.c_str(), Eq(id));
87
86
        });
88
87
}
89
 
#else
90
 
TEST_F(WindowId, server_fails_gracefully_to_identify_window_specified_by_client)
91
 
{
92
 
    char const* const test_name = __PRETTY_FUNCTION__;
93
 
    using namespace mir::client;
94
 
 
95
 
    auto const connection = connect_client(test_name);
96
 
    auto const spec = WindowSpec::for_normal_window(connection, 50, 50, mir_pixel_format_argb_8888)
97
 
        .set_name(test_name);
98
 
 
99
 
    Window const surface{spec.create_window()};
100
 
 
101
 
    mir::client::WindowId client_surface_id{surface};
102
 
 
103
 
    invoke_tools([&](miral::WindowManagerTools& tools)
104
 
        {
105
 
            EXPECT_THROW(tools.info_for_window_id(client_surface_id.c_str()), std::runtime_error);
106
 
        });
107
 
}
108
 
 
109
 
TEST_F(WindowId, server_fails_gracefully_to_return_id_for_window)
110
 
{
111
 
    char const* const test_name = __PRETTY_FUNCTION__;
112
 
    using namespace mir::client;
113
 
 
114
 
    auto const connection = connect_client(test_name);
115
 
    auto const spec = WindowSpec::for_normal_window(connection, 50, 50, mir_pixel_format_argb_8888)
116
 
        .set_name(test_name);
117
 
 
118
 
    Window const surface{spec.create_window()};
119
 
 
120
 
    mir::client::WindowId client_surface_id{surface};
121
 
 
122
 
    invoke_tools([&](miral::WindowManagerTools& tools)
123
 
        {
124
 
            auto window = get_first_window(tools);
125
 
            EXPECT_THROW(tools.id_for_window(window), std::runtime_error);
126
 
        });
127
 
}
128
 
#endif
129
88
 
130
89
TEST_F(WindowId, server_fails_gracefully_to_identify_window_from_garbage_id)
131
90
{
133
92
    using namespace mir::client;
134
93
 
135
94
    auto const connection = connect_client(test_name);
136
 
    auto const spec = WindowSpec::for_normal_window(connection, 50, 50, mir_pixel_format_argb_8888)
137
 
        .set_name(test_name);
 
95
    auto const spec = WindowSpec::for_normal_window(connection, 50, 50).set_name(test_name);
138
96
 
139
97
    Window const surface{spec.create_window()};
140
98