~hikiko/mir/mir.unity8-desktop-session

« back to all changes in this revision

Viewing changes to tests/integration-tests/test_display_info.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Daniel van Vugt, Ubuntu daily release
  • Date: 2014-01-08 02:04:38 UTC
  • mfrom: (1.1.54)
  • Revision ID: package-import@ubuntu.com-20140108020438-ikbu7qqm9v2l026y
Tags: 0.1.3+14.04.20140108-0ubuntu1
[ Daniel van Vugt ]
* Preparing for release 0.1.3

[ Ubuntu daily release ]
* Automatic snapshot from revision 1170

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
 
86
86
mtd::StubDisplayConfig StubChanger::stub_display_config{
87
87
    2,
88
 
    { geom::PixelFormat::xrgb_8888 }
 
88
    { mir_pixel_format_xrgb_8888 }
89
89
};
90
90
 
91
91
char const* const mir_test_socket = mtf::test_socket_file().c_str();
93
93
class StubGraphicBufferAllocator : public mtd::StubBufferAllocator
94
94
{
95
95
public:
96
 
    std::vector<geom::PixelFormat> supported_pixel_formats() override
 
96
    std::vector<MirPixelFormat> supported_pixel_formats() override
97
97
    {
98
98
        return pixel_formats;
99
99
    }
100
100
 
101
 
    static std::vector<geom::PixelFormat> const pixel_formats;
 
101
    static std::vector<MirPixelFormat> const pixel_formats;
102
102
};
103
103
 
104
 
std::vector<geom::PixelFormat> const StubGraphicBufferAllocator::pixel_formats{
105
 
    geom::PixelFormat::argb_8888,
106
 
    geom::PixelFormat::xbgr_8888,
107
 
    geom::PixelFormat::bgr_888
 
104
std::vector<MirPixelFormat> const StubGraphicBufferAllocator::pixel_formats{
 
105
    mir_pixel_format_argb_8888,
 
106
    mir_pixel_format_xbgr_8888,
 
107
    mir_pixel_format_bgr_888
108
108
};
109
109
 
110
110
class StubPlatform : public mtd::NullPlatform
149
149
        {
150
150
            if (!changer)
151
151
                changer = std::make_shared<StubChanger>();
152
 
            return changer; 
 
152
            return changer;
153
153
        }
154
154
 
155
155
        std::shared_ptr<StubChanger> changer;
163
163
        void exec()
164
164
        {
165
165
            MirConnection* connection = mir_connect_sync(mir_test_socket, __PRETTY_FUNCTION__);
 
166
            ASSERT_TRUE(mir_connection_is_valid(connection));
166
167
 
167
168
            unsigned int const format_storage_size = 4;
168
 
            MirPixelFormat formats[format_storage_size]; 
 
169
            MirPixelFormat formats[format_storage_size];
169
170
            unsigned int returned_format_size = 0;
170
171
            mir_connection_get_available_surface_formats(connection,
171
172
                formats, format_storage_size, &returned_format_size);
172
173
 
173
 
            ASSERT_EQ(returned_format_size, StubGraphicBufferAllocator::pixel_formats.size());
 
174
            ASSERT_EQ(StubGraphicBufferAllocator::pixel_formats.size(), returned_format_size);
174
175
            for (auto i=0u; i < returned_format_size; ++i)
175
176
            {
176
177
                EXPECT_EQ(StubGraphicBufferAllocator::pixel_formats[i],
177
 
                          static_cast<geom::PixelFormat>(formats[i])) << "i=" << i;
 
178
                          formats[i]) << "i=" << i;
178
179
            }
179
180
 
180
181
            mir_connection_release(connection);