~ci-train-bot/mir/mir-ubuntu-zesty-2683

« back to all changes in this revision

Viewing changes to tests/unit-tests/platforms/android/server/test_display_buffer.cpp

  • Committer: Bileto Bot
  • Date: 2017-04-13 15:26:17 UTC
  • mfrom: (1160.2883.164 0.27)
  • Revision ID: ci-train-bot@canonical.com-20170413152617-bs7slz07xbzxu2d3
* New upstream release 0.27.0 (https://launchpad.net/mir/+milestone/0.27.0)
  - ABI summary:
    . mirclient ABI unchanged at 9
    . mirserver ABI bumped to 44
    . mircommon ABI unchanged at 7
    . mirplatform ABI bumped to 61
    . mirprotobuf ABI unchanged at 3
    . mirplatformgraphics ABI bumped to 13
    . mirclientplatform ABI unchanged at 5
    . mirinputplatform ABI bumped to 7
    . mircore ABI unchanged at 1
  - Enhancements:
    . Mostly groundwork required to support major enhancements coming in
      future Mir versions.
    . Removed android-input and eliminated the entire "3rd_party/" subtree.
      Now the Mir source tree contains original code only.
    . Added mir_prompt_session_new_fds_for_prompt_providers_sync API.
    . mirout: Added load and save options for keeping display configs
      on disk.
    . mirout: Added "--" support for applying configuration changes under
      Unity8.
    . Fixed failure of DRM hardware cursor {hide(); show(image);}
    . Added server option: "--cursor software" (MIR_SERVER_CURSOR=software)
    . Added letterboxing/black bars support to the GL renderer in preparation
      for generic output cloning.
    . Added client API for getting the logical size of an output.
    . Migrated MirCookie to use SHA-256.
    . Ensure RealKMSOutputConfiguration stays in sync with actual hardware
      state.
    . Added support for drag-and-drop.
    . Lots of other client API enhancements.
    . Minor clean-ups, optimizations and dead code removal.
  - Bugs fixed:
    . [enhancement] Make able to get version information from client /
      server APIs (LP: #1195540)
    . Touch screen coordinates don't rotate with the screen (LP: #1349660)
    . Subpixel order not included in Mir display information (LP: #1393578)
    . [enhancement] Missing client API for relative surface movement (e.g.
      dragging client-decorated windows) (LP: #1420334) . Mir does not reset
      key states when paused or resumed (modifiers get stuck after VT
      switching) (LP: #1536279)
    . Inconsistent behaviour of Num Lock (LP: #1588237)
    . [ FAILED ] NestedInput.nested_event_filter_receives_keyboard_from_host
      (LP: #1613523)
    . Rotating an output left or right without restarting the
      compositor distorts the image (LP: #1643488)
    . support display scaling slider in unity8 (LP: #1645372)
    . [ FAILED ] NestedInputWithMouse.mouse_pointer_coordinates_in_nested_
      server_are_accumulated (LP: #1646375)
    . [ FAILED ] NestedInputWithMouse.mouse_pointer_position_is_in_sync_with_
      host_server (LP: #1646558)
    . abi_check doesn't check mircore (LP: #1649354)
    . Under Unity8, mir_demo_client_target is distorted and input in the
      wrong place on start-up (LP: #1655804)
    . [testsfail] PromptSessionClientAPI.client_pid_is_associated_with_
      session hangs and times out (LP: #1655929)
    . EDID does not change when hotplugging a monitor (LP: #1660017)
    . [regression] Mir 0.26.0 - spinner loading animation, minimize, maximize
      too fast (LP: #1661072)
    . [regression] Unity8 stutters constantly (like half frame rate) using
      Mir 0.26.0 (LP: #1661128)
    . [regression] mir_demo_server refuses to quit on Ctrl+Alt+Backspace or
      Ctrl+C in its terminal (deadlock in DefaultInputDeviceHub::add_device)
      (LP: #1661151)
    . [regression] mirout crashes when connecting to unity8 or any nested
      server: [libprotobuf FATAL
      /usr/include/google/protobuf/repeated_field.h:1408] CHECK failed:
      (index) < (current_size_): (LP: #1661163)
    . [ FAILED ] DefaultInputManagerTest.forwards_pause_continue_state_
      changes_to_platform (LP: #1661187)
    . [regression] Segfault on detect_fd_leaks during acceptance tests (in
      DisplayConfiguration/{DisplayFormatSetting,DisplaySubpixelSetting})
      (LP: #1661498)
    . [regression] Nested server segfaults or rapidly logs exceptions when a
      fullscreen client starts [in mir_presentation_chain_set_dropping_mode
      ... std::exception::what: Operation not permitted] (LP: #1661508)
    . [regression] Windowed clients of nested servers are all black
      (LP: #1661521)
    . mir_window_request_persistent_id_sync seg faults when called twice
      (LP: #1661704)
    . mir_acceptance_tests now takes 10 seconds longer (in r4002 compared to
      r4001) (LP: #1662044)
    . Mir graphics platform ABI broke in series 0.26 but sonames never
      changed (LP: #1662455)
    . libmirclient-dev missing build depndency on libmircore-dev
      (LP: #1662942)
    . [regression] mirscreencast hangs during screencast creation
      (LP: #1662997)
    . [regression] Software clients of nested servers with size >=480x480
      are all black in Mir 0.25.0 and later (or stretched and distorted under
      Unity8) (LP: #1663062)
    . mir_window_spec_set_cursor_name() doesn't trigger
      mir::scene::SurfaceObserver::cursor_image_set_to (LP: #1663197)
    . android complaint during mirscreencast of nested server (LP: #1664562)
    . qtubuntu sends wrong text as part of QKeyEvent (LP: #1664610)
    . Mir server crashed with SIGSEGV in
      mir::compositor::TemporaryBuffer::size() called from
      mir::gl::tessellate_renderable_into_rectangle() (LP: #1664760)
    . mirout reports logical size of a rotated display incorrectly
      (LP: #1665271)
    . Nested servers (Unity8) periodically stutter (half frame rate) with
      Mir 0.26.1 (LP: #1666372)
    . If the only surface in a session cannot take focus the server crashes
      (LP: #1667645)
    . [regression] OSK input shaping no longer works correctly (LP: #1669444)
    . GTK window functions `Always on Top, Move and Resize' don't work in
      Mir/Unity8 (LP: #1669524)
    . [regression] mir_proving_server mode hotkeys (Ctrl+Alt+=/-) cause the
      server to segfault (LP: #1669752)
    . Test takes minutes to complete: MediatingDisplayChangerTest.confirmed_
      configuration_doesnt_revert_after_timeout (LP: #1671033)
    . [ FAILED ] PosixRWMutex.prefer_writer_nonrecursive_prevents_writer_
      starvation (Timeout waiting to acquire write lock) (LP: #1671037)
    . [regression] Mixing screen rotation with mode changes makes the image
      squished (LP: #1672269)
    . unity-system-compositor crashed with SIGSEGV in
      libinput_device_config_accel_is_available() from
      libinput_device_config_accel_set_speed() from
      mir::input::evdev::LibInputDevice::apply_settings() (LP: #1672955)
    . Presentation chains should support various Vulkan presentation modes
      (LP: #1673533)
    . Need an extension for GBM buffers to replace
      mir_buffer_get_buffer_package() (LP: #1673534)
    . cross-compile-chroot.sh (to zesty) fails to build [cannot find -ludev]
      due to libudev.so being in a different directory to where libudev.pc
      searches for it (LP: #1674201)
    . Please transition to Boost 1.62 (LP: #1675138)
    . [regression] Mir is assigning the first output ID = 0 (==
      mir_display_output_id_invalid) (LP: #1675331)
    . Mir sending key repeat events continually to nested shell after VT
      switch (causes Unity8 lockup for a while) (LP: #1675357)
    . mirout commands don't work when followed by -- (LP: #1676320)
    . mir_demo_standalone_render_overlays fails to link (LP: #1677239)
    . [regression] doxygen processing for capnproto/protobuf broken
      (LP: #1679248)
    . mir_window_spec_set_cursor_render_surface does not work (LP: #1679836)

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
namespace
44
44
{
 
45
glm::mat2 const rotate_none;
 
46
glm::mat2 const rotate_left( 0, 1, // transposed
 
47
                            -1, 0);
 
48
glm::mat2 const rotate_right( 0,-1, // transposed
 
49
                              1, 0);
 
50
glm::mat2 const rotate_inverted(-1, 0,
 
51
                                 0,-1);
 
52
 
45
53
struct DisplayBuffer : public ::testing::Test
46
54
{
47
55
    testing::NiceMock<mtd::MockEGL> mock_egl;
69
77
    geom::Size const display_size{433,232};
70
78
    double const refresh_rate{60.0};
71
79
    geom::Displacement top_left{0,0};
 
80
    geom::Rectangle const area{{0,0}, display_size};
72
81
    std::unique_ptr<mga::LayerList> list{
73
82
        new mga::LayerList(std::make_shared<mga::IntegerSourceCrop>(), {}, top_left)};
74
83
    std::shared_ptr<mtd::MockFBBundle> mock_fb_bundle{
75
84
        std::make_shared<testing::NiceMock<mtd::MockFBBundle>>(display_size)};
76
 
    MirOrientation orientation{mir_orientation_normal};
 
85
    glm::mat2 const transformation;
77
86
    mga::DisplayBuffer db{
78
87
        mga::DisplayName::primary,
79
88
        std::unique_ptr<mga::LayerList>(
83
92
        native_window,
84
93
        *gl_context,
85
94
        stub_program_factory,
86
 
        orientation,
87
 
        top_left,
 
95
        transformation,
 
96
        area,
88
97
        mga::OverlayOptimization::enabled};
89
98
 
90
99
};
109
118
    EXPECT_FALSE(db.overlay(renderlist)); 
110
119
}
111
120
 
112
 
TEST_F(DisplayBuffer, defaults_to_normal_orientation)
 
121
TEST_F(DisplayBuffer, defaults_to_no_transformation)
113
122
{
114
 
    EXPECT_EQ(mir_orientation_normal, db.orientation());
 
123
    EXPECT_EQ(glm::mat2(), db.transformation());
115
124
}
116
125
 
117
126
TEST_F(DisplayBuffer, rotation_transposes_dimensions_and_reports_correctly)
118
127
{
119
 
    geom::Size const transposed{display_size.height.as_int(), display_size.width.as_int()};
120
 
    EXPECT_EQ(display_size, db.view_area().size);
121
 
    EXPECT_EQ(db.orientation(), mir_orientation_normal);
122
 
    db.configure(mir_power_mode_on, mir_orientation_inverted, top_left);
123
 
 
124
 
    EXPECT_EQ(display_size, db.view_area().size);
125
 
    EXPECT_EQ(db.orientation(), mir_orientation_inverted);
126
 
    db.configure(mir_power_mode_on, mir_orientation_left, top_left);
127
 
 
128
 
    EXPECT_EQ(transposed, db.view_area().size);
129
 
    EXPECT_EQ(db.orientation(), mir_orientation_left);
130
 
    db.configure(mir_power_mode_on, mir_orientation_right, top_left);
131
 
 
132
 
    EXPECT_EQ(transposed, db.view_area().size);
133
 
    EXPECT_EQ(db.orientation(), mir_orientation_right);
 
128
    geom::Rectangle const transposed{area.top_left, {area.size.height.as_int(),
 
129
                                                     area.size.width.as_int()}};
 
130
    EXPECT_EQ(display_size, db.view_area().size);
 
131
    EXPECT_EQ(db.transformation(), rotate_none);
 
132
    db.configure(mir_power_mode_on, rotate_inverted, area);
 
133
 
 
134
    /*
 
135
     * Note that it's the output that transposes its extents() dimensions
 
136
     * now (which is consistent with all other platforms), and not the
 
137
     * DisplayBuffer class that calculates the transformation. So this test
 
138
     * has lost some of its strength, but it's also now testing a function
 
139
     * which contains no logic (only returns what it's given). So there's not
 
140
     * much to test anyway...
 
141
     */
 
142
 
 
143
    EXPECT_EQ(display_size, db.view_area().size);
 
144
    EXPECT_EQ(db.transformation(), rotate_inverted);
 
145
    db.configure(mir_power_mode_on, rotate_left, transposed);
 
146
 
 
147
    EXPECT_EQ(transposed, db.view_area());
 
148
    EXPECT_EQ(db.transformation(), rotate_left);
 
149
    db.configure(mir_power_mode_on, rotate_right, transposed);
 
150
 
 
151
    EXPECT_EQ(transposed, db.view_area());
 
152
    EXPECT_EQ(db.transformation(), rotate_right);
134
153
}
135
154
 
136
155
TEST_F(DisplayBuffer, reports_correct_size)
171
190
        native_window,
172
191
        *gl_context,
173
192
        stub_program_factory,
174
 
        orientation,
175
 
        top_left,
 
193
        transformation,
 
194
        area,
176
195
        mga::OverlayOptimization::enabled};
177
196
    }
178
197
    
200
219
            native_window,
201
220
            *gl_context,
202
221
            stub_program_factory,
203
 
            orientation,
204
 
            top_left,
 
222
            transformation,
 
223
            area,
205
224
            mga::OverlayOptimization::enabled);
206
225
    }, std::runtime_error);
207
226
 
215
234
            native_window,
216
235
            *gl_context,
217
236
            stub_program_factory,
218
 
            orientation,
219
 
            top_left,
 
237
            transformation,
 
238
            area,
220
239
            mga::OverlayOptimization::enabled);
221
240
    }, std::runtime_error);
222
241
}
261
280
{
262
281
    EXPECT_CALL(*mock_display_device, content_cleared())
263
282
        .Times(3);
264
 
    db.configure(mir_power_mode_off, mir_orientation_normal, top_left);
265
 
    db.configure(mir_power_mode_suspend, mir_orientation_normal, top_left);
266
 
    db.configure(mir_power_mode_standby, mir_orientation_normal, top_left);
267
 
    db.configure(mir_power_mode_on, mir_orientation_normal, top_left);
 
283
    db.configure(mir_power_mode_off, {}, area);
 
284
    db.configure(mir_power_mode_suspend, {}, area);
 
285
    db.configure(mir_power_mode_standby, {}, area);
 
286
    db.configure(mir_power_mode_on, {}, area);
268
287
}
269
288
 
270
289
TEST_F(DisplayBuffer, reject_list_if_option_disabled)
283
302
        native_window,
284
303
        *gl_context,
285
304
        stub_program_factory,
286
 
        orientation,
287
 
        top_left,
 
305
        transformation,
 
306
        area,
288
307
        mga::OverlayOptimization::disabled);
289
308
 
290
309
    EXPECT_FALSE(db.overlay(renderlist)); 
331
350
TEST_F(DisplayBuffer, reports_position_correctly)
332
351
{
333
352
    using namespace testing;
334
 
    geom::Point origin;
335
 
    geom::Displacement offset{100, 100};
 
353
    geom::Displacement const offset{100, 100};
 
354
    geom::Point const top_left_point = area.top_left;
 
355
    geom::Point const offset_top_left_point = top_left_point + offset;
336
356
 
337
 
    EXPECT_THAT(db.view_area().top_left, Eq(origin));
338
 
    db.configure(mir_power_mode_on, orientation, offset);
339
 
    EXPECT_THAT(db.view_area().top_left, Eq(geom::Point{origin + offset}));
 
357
    EXPECT_THAT(db.view_area().top_left, Eq(top_left_point));
 
358
    db.configure(mir_power_mode_on, transformation,
 
359
                 {offset_top_left_point, area.size});
 
360
    EXPECT_THAT(db.view_area().top_left, Eq(offset_top_left_point));
340
361
}
341
362
 
342
363
//lp: #1485070. Could alternitvely rotate all the renderables, once rotation is supported
350
371
        std::make_shared<mtd::StubRenderable>(
351
372
            std::make_shared<mtd::StubBuffer>(std::make_shared<mtd::StubAndroidNativeBuffer>()))};
352
373
 
353
 
    db.configure(mir_power_mode_on, mir_orientation_inverted, geom::Displacement{0,0});
 
374
    db.configure(mir_power_mode_on, rotate_inverted, area);
354
375
    EXPECT_FALSE(db.overlay(renderlist));
355
 
    db.configure(mir_power_mode_on, mir_orientation_normal, geom::Displacement{0,0});
 
376
    db.configure(mir_power_mode_on, rotate_none, area);
356
377
    EXPECT_TRUE(db.overlay(renderlist));
357
378
}