~ubuntu-branches/ubuntu/utopic/mir/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/mir_test_framework/stubbed_server_configuration.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-03-10 19:28:46 UTC
  • mto: This revision was merged to the branch mainline in revision 63.
  • Revision ID: package-import@ubuntu.com-20140310192846-rq9qm3ec26yrelo2
Tags: upstream-0.1.6+14.04.20140310
Import upstream version 0.1.6+14.04.20140310

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright © 2013 Canonical Ltd.
 
2
 * Copyright © 2013-2014 Canonical Ltd.
3
3
 *
4
4
 * This program is free software: you can redistribute it and/or modify it
5
5
 * under the terms of the GNU General Public License version 3,
18
18
 
19
19
#include "mir_test_framework/stubbed_server_configuration.h"
20
20
 
 
21
#include "mir/options/default_configuration.h"
21
22
#include "mir/geometry/rectangle.h"
22
23
#include "mir/graphics/buffer_ipc_packer.h"
23
24
#include "mir/input/input_channel.h"
29
30
#include "mir_test_doubles/stub_buffer.h"
30
31
#include "mir_test_doubles/stub_buffer_allocator.h"
31
32
#include "mir_test_doubles/stub_display_buffer.h"
 
33
#include "mir_test_doubles/stub_renderer.h"
32
34
 
33
35
#ifdef ANDROID
34
36
#include "mir_test_doubles/mock_android_native_buffer.h"
49
51
namespace mc = mir::compositor;
50
52
namespace mg = mir::graphics;
51
53
namespace mi = mir::input;
 
54
namespace mo = mir::options;
52
55
namespace mtd = mir::test::doubles;
53
56
namespace mtf = mir_test_framework;
54
57
 
202
205
    }
203
206
};
204
207
 
205
 
class StubRenderer : public mc::Renderer
206
 
{
207
 
public:
208
 
    void begin(float) const override
209
 
    {
210
 
    }
211
 
 
212
 
    void render(mc::CompositingCriteria const&, mg::Buffer&) const override
213
 
    {
214
 
    }
215
 
 
216
 
    void end() const override
217
 
    {
218
 
    }
219
 
 
220
 
    void suspend() override
221
 
    {
222
 
    }
223
 
};
224
 
 
225
208
class StubRendererFactory : public mc::RendererFactory
226
209
{
227
210
public:
228
211
    std::unique_ptr<mc::Renderer> create_renderer_for(geom::Rectangle const&)
229
212
    {
230
 
        return std::unique_ptr<StubRenderer>(new StubRenderer());
 
213
        return std::unique_ptr<mc::Renderer>(new mtd::StubRenderer());
231
214
    }
232
215
};
233
216
 
258
241
}
259
242
 
260
243
mtf::StubbedServerConfiguration::StubbedServerConfiguration() :
261
 
    DefaultServerConfiguration(::argc, ::argv)
 
244
    DefaultServerConfiguration([]
 
245
    {
 
246
        auto result = std::make_shared<mo::DefaultConfiguration>(::argc, ::argv);
 
247
 
 
248
        namespace po = boost::program_options;
 
249
 
 
250
        result->add_options()
 
251
                ("tests-use-real-graphics", po::value<bool>()->default_value(false), "Use real graphics in tests.")
 
252
                ("tests-use-real-input", po::value<bool>()->default_value(false), "Use real input in tests.");
 
253
 
 
254
        return result;
 
255
    }())
262
256
{
263
 
    namespace po = boost::program_options;
264
 
 
265
 
    add_options()
266
 
        ("tests-use-real-graphics", po::value<bool>()->default_value(false), "Use real graphics in tests.")
267
 
        ("tests-use-real-input", po::value<bool>()->default_value(false), "Use real input in tests.");
268
257
}
269
258
 
270
259
std::shared_ptr<mg::Platform> mtf::StubbedServerConfiguration::the_graphics_platform()