2
* Copyright © 2013 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Kevin DuBois <kevin.dubois@canonical.com>
19
#ifndef MIR_TEST_DOUBLES_STUB_DISPLAY_BUFFER_FACTORY_H_
20
#define MIR_TEST_DOUBLES_STUB_DISPLAY_BUFFER_FACTORY_H_
22
#include "src/server/graphics/android/android_display_buffer_factory.h"
23
#include "stub_display_buffer.h"
24
#include "stub_display_device.h"
25
#include <gmock/gmock.h>
33
struct StubDisplayBufferFactory : public graphics::android::AndroidDisplayBufferFactory
35
StubDisplayBufferFactory(std::shared_ptr<graphics::android::DisplayDevice> const& stub_dev, geometry::Size sz)
36
: stub_dev(stub_dev), sz(sz)
40
StubDisplayBufferFactory()
41
: StubDisplayBufferFactory(std::make_shared<StubDisplayDevice>(), geometry::Size{0,0})
45
StubDisplayBufferFactory(geometry::Size sz)
46
: StubDisplayBufferFactory(std::make_shared<StubDisplayDevice>(), sz)
50
StubDisplayBufferFactory(std::shared_ptr<graphics::android::DisplayDevice> const& stub_dev)
51
: stub_dev(stub_dev), sz(geometry::Size{0,0})
55
std::unique_ptr<graphics::DisplayBuffer> create_display_buffer(
56
std::shared_ptr<graphics::android::DisplayDevice> const&,
57
EGLDisplay, EGLConfig, EGLContext)
59
return std::unique_ptr<graphics::DisplayBuffer>(
60
new StubDisplayBuffer(geometry::Rectangle{{0,0},sz}));
63
std::shared_ptr<graphics::android::DisplayDevice> create_display_device()
68
std::shared_ptr<graphics::android::DisplayDevice> const stub_dev;
75
#endif /* MIR_TEST_DOUBLES_STUB_DISPLAY_BUFFER_FACTORY_H_ */