~ubuntu-branches/ubuntu/wily/mir/wily-proposed

« back to all changes in this revision

Viewing changes to tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp

  • Committer: Package Import Robot
  • Author(s): CI Train Bot
  • Date: 2015-05-12 13:12:55 UTC
  • mto: This revision was merged to the branch mainline in revision 96.
  • Revision ID: package-import@ubuntu.com-20150512131255-y7z12i8n4pbvo70x
Tags: upstream-0.13.0+15.10.20150512
ImportĀ upstreamĀ versionĀ 0.13.0+15.10.20150512

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Authored by: Alberto Aguirre <alberto.aguirre@canonical.com>
17
17
 */
18
18
 
19
 
#define MIR_INCLUDE_DEPRECATED_EVENT_HEADER
20
 
 
21
 
#include "src/server/graphics/nested/nested_output.h"
 
19
#include "src/server/graphics/nested/display_buffer.h"
22
20
#include "src/server/graphics/nested/host_connection.h"
23
21
#include "src/server/input/null_input_dispatcher.h"
24
22
 
25
23
#include "mir_test_doubles/mock_egl.h"
26
24
#include "mir_test_doubles/stub_gl_config.h"
 
25
#include "mir_test_doubles/stub_cursor_listener.h"
27
26
#include "mir_test/fake_shared.h"
28
27
 
29
28
#include <gtest/gtest.h>
30
29
#include <gmock/gmock.h>
31
30
 
32
31
namespace geom = mir::geometry;
33
 
namespace mgn = mir::graphics::nested;
34
 
namespace mgnd = mir::graphics::nested::detail;
 
32
namespace mg = mir::graphics;
 
33
namespace mgn = mg::nested;
 
34
namespace mgnd = mg::nested::detail;
35
35
namespace mi = mir::input;
36
36
namespace mt = mir::test;
37
37
namespace mtd = mir::test::doubles;
40
40
{
41
41
public:
42
42
    EGLNativeWindowType egl_native_window() override { return {}; }
43
 
    void set_event_handler(MirEventDelegate const*) override {}
 
43
    void set_event_handler(mir_surface_event_callback, void*) override {}
44
44
};
45
45
 
46
46
struct NestedDisplayBufferTest : testing::Test
54
54
    mtd::StubGLConfig stub_gl_config;
55
55
    NullHostSurface null_host_surface;
56
56
    mi::NullInputDispatcher null_input_dispatcher;
 
57
    std::shared_ptr<mi::CursorListener> cursor =
 
58
        std::make_shared<mtd::StubCursorListener>();
57
59
    mgnd::EGLDisplayHandle egl_disp_handle;
58
60
    geom::Rectangle const default_rect;
59
61
};
60
62
 
61
63
TEST_F(NestedDisplayBufferTest, alpha_enabled_pixel_format_enables_destination_alpha)
62
64
{
63
 
    mgnd::NestedOutput db{
 
65
    mgnd::DisplayBuffer db{
64
66
        egl_disp_handle,
65
67
        mt::fake_shared(null_host_surface),
66
68
        default_rect,
67
69
        mt::fake_shared(null_input_dispatcher),
 
70
        cursor,
68
71
        mir_pixel_format_abgr_8888};
69
72
 
70
73
    EXPECT_TRUE(db.uses_alpha());
72
75
 
73
76
TEST_F(NestedDisplayBufferTest, non_alpha_pixel_format_disables_destination_alpha)
74
77
{
75
 
    mgnd::NestedOutput db{
 
78
    mgnd::DisplayBuffer db{
76
79
        egl_disp_handle,
77
80
        mt::fake_shared(null_host_surface),
78
81
        default_rect,
79
82
        mt::fake_shared(null_input_dispatcher),
 
83
        cursor,
80
84
        mir_pixel_format_xbgr_8888};
81
85
 
82
86
    EXPECT_FALSE(db.uses_alpha());