Mir

Merge lp:~andreas-pokorny/mir/fix-1646375 into lp:mir

Proposed by Andreas Pokorny
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 4024
Merged at revision: 4024
Proposed branch: lp:~andreas-pokorny/mir/fix-1646375
Merge into: lp:mir
Diff against target: 101 lines (+21/-5)
5 files modified
include/test/mir_test_framework/any_surface.h (+1/-0)
tests/acceptance-tests/test_confined_pointer.cpp (+1/-1)
tests/acceptance-tests/test_nested_input.cpp (+1/-2)
tests/mir_test_framework/any_surface.cpp (+17/-1)
tests/privileged-tests/test_input_events.cpp (+1/-1)
To merge this branch: bzr merge lp:~andreas-pokorny/mir/fix-1646375
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Cemil Azizoglu (community) Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+317094@code.launchpad.net

Commit message

acceptance tests: Make sure that the window event handler is present on window construction (LP: #1646375, LP: #1646558)

Description of the change

This fixes an error in the test setup. I am still not 100% that this will solve the ci failures in all of the tests - but the current state would allow the test to miss the input events.

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

PASSED: Continuous integration, rev:4024
https://mir-jenkins.ubuntu.com/job/mir-ci/2984/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/3965
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4051
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4041
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4041
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4041
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3992
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3992/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/3992
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3992/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3992
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3992/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/3992
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3992/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/3992
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3992/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/3992
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3992/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Great, thanks for these.

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

A familiar bug with a familiar fix.

Ship it! And verify if the bugs are really solved later...

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_framework/any_surface.h'
2--- include/test/mir_test_framework/any_surface.h 2017-01-18 02:29:37 +0000
3+++ include/test/mir_test_framework/any_surface.h 2017-02-13 13:01:22 +0000
4@@ -25,6 +25,7 @@
5 namespace mir_test_framework
6 {
7 MirWindow* make_any_surface(MirConnection *connection);
8+MirWindow* make_any_surface(MirConnection *connection, MirWindowEventCallback callback, void* context);
9 MirWindow* make_surface(MirConnection *connection, mir::geometry::Size size, MirPixelFormat format);
10 }
11
12
13=== modified file 'tests/acceptance-tests/test_confined_pointer.cpp'
14--- tests/acceptance-tests/test_confined_pointer.cpp 2017-01-23 03:38:33 +0000
15+++ tests/acceptance-tests/test_confined_pointer.cpp 2017-02-13 13:01:22 +0000
16@@ -81,6 +81,7 @@
17 mir_window_spec_set_pixel_format(spec, mir_pixel_format_abgr_8888);
18 mir_window_spec_set_pointer_confinement(spec, mir_pointer_confined_to_window);
19 mir_window_spec_set_name(spec, name.c_str());
20+ mir_window_spec_set_event_handler(spec, handle_event, this);
21 window = mir_create_window_sync(spec);
22 mir_window_spec_release(spec);
23 if (!mir_window_is_valid(window))
24@@ -89,7 +90,6 @@
25 mir_window_get_error_message(window)});
26 }
27
28- mir_window_set_event_handler(window, handle_event, this);
29 mir_buffer_stream_swap_buffers_sync(
30 mir_window_get_buffer_stream(window));
31
32
33=== modified file 'tests/acceptance-tests/test_nested_input.cpp'
34--- tests/acceptance-tests/test_nested_input.cpp 2017-02-09 06:56:31 +0000
35+++ tests/acceptance-tests/test_nested_input.cpp 2017-02-13 13:01:22 +0000
36@@ -159,8 +159,7 @@
37 },
38 this);
39
40- window = mtf::make_any_surface(connection);
41- mir_window_set_event_handler(window, handle_event, this);
42+ window = mtf::make_any_surface(connection, handle_event, this);
43 mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window));
44 }
45
46
47=== modified file 'tests/mir_test_framework/any_surface.cpp'
48--- tests/mir_test_framework/any_surface.cpp 2017-01-18 02:29:37 +0000
49+++ tests/mir_test_framework/any_surface.cpp 2017-02-13 13:01:22 +0000
50@@ -22,6 +22,7 @@
51 #include <stdexcept>
52
53 namespace mtf = mir_test_framework;
54+using namespace std::literals::string_literals;
55
56 namespace
57 {
58@@ -35,10 +36,25 @@
59 return mtf::make_surface(connection, mir::geometry::Size{width, height}, format);
60 }
61
62+MirWindow* mtf::make_any_surface(MirConnection *connection, MirWindowEventCallback callback, void* context)
63+{
64+ auto spec = mir_create_normal_window_spec(connection, width, height);
65+ mir_window_spec_set_pixel_format(spec, format);
66+ mir_window_spec_set_event_handler(spec, callback, context);
67+ auto window = mir_create_window_sync(spec);
68+ mir_window_spec_release(spec);
69+
70+ if (!mir_window_is_valid(window))
71+ {
72+ BOOST_THROW_EXCEPTION((
73+ std::runtime_error{"Failed to create window: "s + mir_window_get_error_message(window)}));
74+ }
75+ return window;
76+}
77+
78 MirWindow* mtf::make_surface(
79 MirConnection *connection, mir::geometry::Size size, MirPixelFormat f)
80 {
81- using namespace std::literals::string_literals;
82
83 auto spec = mir_create_normal_window_spec(connection, size.width.as_int(), size.height.as_int());
84 mir_window_spec_set_pixel_format(spec, f);
85
86=== modified file 'tests/privileged-tests/test_input_events.cpp'
87--- tests/privileged-tests/test_input_events.cpp 2017-01-18 02:29:37 +0000
88+++ tests/privileged-tests/test_input_events.cpp 2017-02-13 13:01:22 +0000
89@@ -209,12 +209,12 @@
90 mir_connection_get_available_surface_formats(connection, &pixel_format, 1, &valid_formats);
91 auto spec = mir_create_normal_window_spec(connection, 640, 480);
92 mir_window_spec_set_pixel_format(spec, pixel_format);
93+ mir_window_spec_set_event_handler(spec, handle_input, handler);
94 auto const window = mir_create_window_sync(spec);
95 mir_window_spec_release(spec);
96 if (!mir_window_is_valid(window))
97 throw std::runtime_error("Failed to create MirWindow");
98
99- mir_window_set_event_handler(window, handle_input, handler);
100 mir_buffer_stream_swap_buffers_sync(
101 mir_window_get_buffer_stream(window));
102

Subscribers

People subscribed via source and target branches