111
TEST_F(WindowPlacementClientAPI, given_menu_placement_away_from_edges_when_notified_result_is_as_requested)
111
// It would be nice to verify creation and movement placement notifications in separate tests,
112
// However, to avoid a racy test, we need to detect both anyway. This seems like a good trade-off.
113
TEST_F(WindowPlacementClientAPI, given_menu_placements_away_from_edges_when_notified_result_is_as_requested)
113
115
char const* const test_name = __PRETTY_FUNCTION__;
115
MirRectangle aux_rect{10, 20, 3, 4};
117
116
int const dx = 30;
118
117
int const dy = 40;
120
CheckPlacement expected{aux_rect.left+(int)aux_rect.width, aux_rect.top, dx, dy};
122
auto spec = SurfaceSpec::for_for_menu(connection, dx, dy, mir_pixel_format_argb_8888, parent, &aux_rect, mir_edge_attachment_any)
123
.set_event_handler(&CheckPlacement::callback, &expected)
124
.set_name(test_name);
126
spec.create_surface();
121
MirRectangle aux_rect{10, 20, 3, 4};
122
CheckPlacement expected{aux_rect.left+(int)aux_rect.width, aux_rect.top, dx, dy};
124
auto const spec = SurfaceSpec::
125
for_for_menu(connection, dx, dy, mir_pixel_format_argb_8888, parent, &aux_rect, mir_edge_attachment_any)
126
.set_event_handler(&CheckPlacement::callback, &expected)
127
.set_name(test_name);
129
child = spec.create_surface();
132
// subsequent movement
134
MirRectangle aux_rect{50, 60, 5, 7};
135
CheckPlacement expected{aux_rect.left-dx, aux_rect.top, dx, dy};
137
auto const spec = SurfaceSpec::for_changes(connection)
138
.set_event_handler(&CheckPlacement::callback, &expected)
139
.set_placement(&aux_rect, mir_placement_gravity_northwest, mir_placement_gravity_northeast, mir_placement_hints_flip_x, 0, 0);
141
spec.apply_to(child);