Mir

Merge lp:~brandontschaefer/mir/fix-confined-region-test into lp:mir

Proposed by Brandon Schaefer
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 3905
Proposed branch: lp:~brandontschaefer/mir/fix-confined-region-test
Merge into: lp:mir
Diff against target: 59 lines (+18/-7)
2 files modified
include/test/mir/test/event_matchers.h (+5/-0)
tests/acceptance-tests/test_confined_pointer.cpp (+13/-7)
To merge this branch: bzr merge lp:~brandontschaefer/mir/fix-confined-region-test
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+314049@code.launchpad.net

Commit message

If we take *any* rectangles for our set region we can sometimes get the base set region of 0,0,100,100 of the window. We need to first expect 0,0,100,100 then we then expect our 0,0,200,100.
(LP: #1606418)

Description of the change

If we take *any* rectangles for our set region we can sometimes get the base set region of 0,0,100,100 of the window. We need to first expect 0,0,100,100 then we then expect our 0,0,200,100.

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3902
https://mir-jenkins.ubuntu.com/job/mir-ci/2524/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/3285
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3352
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3344
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3344
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3344
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3314
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3314/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3314
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3314/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3314
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3314/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3314
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3314/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3314
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3314/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3314
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3314/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/2524/rebuild

review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Sounds vaguely sensible. You don't have to fix a race if your algorithm can instead just expect and support the racing (which was my intent with resizing from the beginning).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'include/test/mir/test/event_matchers.h'
--- include/test/mir/test/event_matchers.h 2016-12-09 02:54:31 +0000
+++ include/test/mir/test/event_matchers.h 2017-01-05 00:29:40 +0000
@@ -586,6 +586,11 @@
586 y == mir_input_device_state_event_pointer_axis(device_state, mir_pointer_axis_y);586 y == mir_input_device_state_event_pointer_axis(device_state, mir_pointer_axis_y);
587}587}
588588
589MATCHER_P(RectanglesMatches, rectangles, "")
590{
591 return arg == rectangles;
592}
593
589}594}
590}595}
591596
592597
=== modified file 'tests/acceptance-tests/test_confined_pointer.cpp'
--- tests/acceptance-tests/test_confined_pointer.cpp 2016-12-09 02:54:31 +0000
+++ tests/acceptance-tests/test_confined_pointer.cpp 2017-01-05 00:29:40 +0000
@@ -248,26 +248,32 @@
248TEST_F(PointerConfinement, test_we_update_our_confined_region_on_a_resize)248TEST_F(PointerConfinement, test_we_update_our_confined_region_on_a_resize)
249{249{
250 positions[first] = geom::Rectangle{{0,0}, {surface_width, surface_height}};250 positions[first] = geom::Rectangle{{0,0}, {surface_width, surface_height}};
251
252 geom::Rectangles main_region{{positions[first]}};
253 EXPECT_CALL(*mock_seat_observer, seat_set_confinement_region_called(mt::RectanglesMatches(main_region)))
254 .Times(1);
255
251 Client client(new_connection(), first);256 Client client(new_connection(), first);
252257
253 auto fake = mt::fake_shared(surface_observer);258 auto fake = mt::fake_shared(surface_observer);
254 latest_shell_surface()->add_observer(fake);259 latest_shell_surface()->add_observer(fake);
255260
256 geom::Size new_size = {surface_width + 100, surface_height};261 geom::Size new_size = {surface_width * 2, surface_height};
257 EXPECT_CALL(surface_observer, resized_to(new_size)).Times(1);262 EXPECT_CALL(surface_observer, resized_to(new_size)).Times(1);
258263
259 EXPECT_CALL(*mock_seat_observer, seat_set_confinement_region_called(_)).264 geom::Rectangles confinement_region{{{0, 0}, new_size}};
260 WillRepeatedly(InvokeWithoutArgs([&] { change_observed(); }));265 EXPECT_CALL(*mock_seat_observer, seat_set_confinement_region_called(mt::RectanglesMatches(confinement_region)))
266 .WillRepeatedly(InvokeWithoutArgs([&] { change_observed(); }));
261267
262 client.resize(surface_width + 100, surface_height);268 client.resize(surface_width * 2, surface_height);
263 resized_signaled.wait_for(1s);269 resized_signaled.wait_for(1s);
264270
265 InSequence seq;271 InSequence seq;
266 EXPECT_CALL(client, handle_input(mt::PointerEnterEventWithPosition(surface_width + 100 - 1, 0)));272 EXPECT_CALL(client, handle_input(mt::PointerEnterEventWithPosition(surface_width * 2 - 1, 0)));
267 EXPECT_CALL(client, handle_input(AllOf(mt::PointerEventWithPosition(surface_width + 100 - 1, 0), mt::PointerEventWithDiff(10, 0))))273 EXPECT_CALL(client, handle_input(AllOf(mt::PointerEventWithPosition(surface_width * 2 - 1, 0), mt::PointerEventWithDiff(10, 0))))
268 .WillOnce(mt::WakeUp(&client.all_events_received));274 .WillOnce(mt::WakeUp(&client.all_events_received));
269275
270 fake_mouse->emit_event(mis::a_pointer_event().with_movement(surface_width + 101, 0));276 fake_mouse->emit_event(mis::a_pointer_event().with_movement(surface_width * 2 + 1, 0));
271 fake_mouse->emit_event(mis::a_pointer_event().with_movement(10, 0));277 fake_mouse->emit_event(mis::a_pointer_event().with_movement(10, 0));
272278
273 client.all_events_received.wait_for(10s);279 client.all_events_received.wait_for(10s);

Subscribers

People subscribed via source and target branches