~alan-griffiths/miral/1.3

« back to all changes in this revision

Viewing changes to test/window_placement_client_api.cpp

  • Committer: Alan Griffiths
  • Date: 2017-07-14 13:54:08 UTC
  • Revision ID: alan@octopull.co.uk-20170714135408-d4t5cm4usm128fwb
Backport code changes to match libmirclientcpp

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17
17
 */
18
18
 
19
 
#include <mir/version.h>
20
 
#include <mir_toolkit/version.h>
21
 
 
22
 
#if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0)
23
 
#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0)
24
 
#include <mir_toolkit/events/surface_placement.h>
25
 
auto const mir_event_get_window_placement_event = mir_event_get_surface_placement_event;
26
 
#else
27
19
#include <mir_toolkit/events/window_placement.h>
28
 
#endif
29
 
#endif
30
20
 
31
 
#include <mir/client/detail/mir_forward_compatibility.h>
32
21
#include <mir/client/window_spec.h>
33
22
#include <mir/client/window.h>
34
23
 
57
46
        char const* const test_name = __PRETTY_FUNCTION__;
58
47
 
59
48
        connection = connect_client(test_name);
60
 
        auto spec = WindowSpec::for_normal_window(connection, 400, 400, mir_pixel_format_argb_8888)
 
49
        auto spec = WindowSpec::for_normal_window(connection, 400, 400)
61
50
            .set_name(test_name);
62
51
 
63
52
        parent = spec.create_window();
78
67
};
79
68
}
80
69
 
81
 
#if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0)
82
 
 
83
 
#if MIR_CLIENT_VERSION == MIR_VERSION_NUMBER(3, 4, 0)
84
 
auto const mir_event_type_window_placement   = mir_event_type_surface_placement;
85
 
#endif
86
 
 
87
70
namespace
88
71
{
89
72
struct CheckPlacement
137
120
        CheckPlacement expected{aux_rect.left+(int)aux_rect.width, aux_rect.top, dx, dy};
138
121
 
139
122
        auto const spec = WindowSpec::
140
 
            for_menu(connection, dx, dy, mir_pixel_format_argb_8888, parent, &aux_rect, mir_edge_attachment_any)
 
123
            for_menu(connection, dx, dy, parent, &aux_rect, mir_edge_attachment_any)
141
124
            .set_event_handler(&CheckPlacement::callback, &expected)
142
125
            .set_name(test_name);
143
126
 
156
139
        spec.apply_to(child);
157
140
    }
158
141
}
159
 
#endif