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
1=== modified file 'include/test/mir/test/event_matchers.h'
2--- include/test/mir/test/event_matchers.h 2016-12-09 02:54:31 +0000
3+++ include/test/mir/test/event_matchers.h 2017-01-05 00:29:40 +0000
4@@ -586,6 +586,11 @@
5 y == mir_input_device_state_event_pointer_axis(device_state, mir_pointer_axis_y);
6 }
7
8+MATCHER_P(RectanglesMatches, rectangles, "")
9+{
10+ return arg == rectangles;
11+}
12+
13 }
14 }
15
16
17=== modified file 'tests/acceptance-tests/test_confined_pointer.cpp'
18--- tests/acceptance-tests/test_confined_pointer.cpp 2016-12-09 02:54:31 +0000
19+++ tests/acceptance-tests/test_confined_pointer.cpp 2017-01-05 00:29:40 +0000
20@@ -248,26 +248,32 @@
21 TEST_F(PointerConfinement, test_we_update_our_confined_region_on_a_resize)
22 {
23 positions[first] = geom::Rectangle{{0,0}, {surface_width, surface_height}};
24+
25+ geom::Rectangles main_region{{positions[first]}};
26+ EXPECT_CALL(*mock_seat_observer, seat_set_confinement_region_called(mt::RectanglesMatches(main_region)))
27+ .Times(1);
28+
29 Client client(new_connection(), first);
30
31 auto fake = mt::fake_shared(surface_observer);
32 latest_shell_surface()->add_observer(fake);
33
34- geom::Size new_size = {surface_width + 100, surface_height};
35+ geom::Size new_size = {surface_width * 2, surface_height};
36 EXPECT_CALL(surface_observer, resized_to(new_size)).Times(1);
37
38- EXPECT_CALL(*mock_seat_observer, seat_set_confinement_region_called(_)).
39- WillRepeatedly(InvokeWithoutArgs([&] { change_observed(); }));
40+ geom::Rectangles confinement_region{{{0, 0}, new_size}};
41+ EXPECT_CALL(*mock_seat_observer, seat_set_confinement_region_called(mt::RectanglesMatches(confinement_region)))
42+ .WillRepeatedly(InvokeWithoutArgs([&] { change_observed(); }));
43
44- client.resize(surface_width + 100, surface_height);
45+ client.resize(surface_width * 2, surface_height);
46 resized_signaled.wait_for(1s);
47
48 InSequence seq;
49- EXPECT_CALL(client, handle_input(mt::PointerEnterEventWithPosition(surface_width + 100 - 1, 0)));
50- EXPECT_CALL(client, handle_input(AllOf(mt::PointerEventWithPosition(surface_width + 100 - 1, 0), mt::PointerEventWithDiff(10, 0))))
51+ EXPECT_CALL(client, handle_input(mt::PointerEnterEventWithPosition(surface_width * 2 - 1, 0)));
52+ EXPECT_CALL(client, handle_input(AllOf(mt::PointerEventWithPosition(surface_width * 2 - 1, 0), mt::PointerEventWithDiff(10, 0))))
53 .WillOnce(mt::WakeUp(&client.all_events_received));
54
55- fake_mouse->emit_event(mis::a_pointer_event().with_movement(surface_width + 101, 0));
56+ fake_mouse->emit_event(mis::a_pointer_event().with_movement(surface_width * 2 + 1, 0));
57 fake_mouse->emit_event(mis::a_pointer_event().with_movement(10, 0));
58
59 client.all_events_received.wait_for(10s);

Subscribers

People subscribed via source and target branches