Mir
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
test
mir_test_doubles
mock_buffer.h
Go to the documentation of this file.
1
/*
2
* Copyright © 2012 Canonical Ltd.
3
*
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.
7
*
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.
12
*
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/>.
15
*
16
* Authored by: Thomas Voss <thomas.voss@canonical.com>
17
*/
18
19
#ifndef MIR_TEST_DOUBLES_MOCK_BUFFER_H_
20
#define MIR_TEST_DOUBLES_MOCK_BUFFER_H_
21
22
#include "
mir/graphics/buffer_basic.h
"
23
#include "
mir/geometry/size.h
"
24
#include "
mir/graphics/buffer_id.h
"
25
26
#include <gmock/gmock.h>
27
#include <gtest/gtest.h>
28
29
namespace
mir
30
{
31
namespace
test
32
{
33
namespace
doubles
34
{
35
36
struct
MockBuffer
:
public
graphics::Buffer
37
{
38
public
:
39
MockBuffer
()
40
{
41
}
42
43
MockBuffer
(
geometry::Size
size
,
44
geometry::Stride
s,
45
geometry::PixelFormat
pf)
46
{
47
using namespace
testing;
48
ON_CALL(*
this
,
size
())
49
.WillByDefault(Return(size));
50
ON_CALL(*
this
,
stride
())
51
.WillByDefault(Return(s));
52
ON_CALL(*
this
,
pixel_format
())
53
.WillByDefault(Return(pf));
54
55
ON_CALL(*
this
,
id
())
56
.WillByDefault(Return(
graphics::BufferID
{4}));
57
ON_CALL(*
this
,
native_buffer_handle
())
58
.WillByDefault(Return(std::shared_ptr<graphics::NativeBuffer>()));
59
}
60
61
MOCK_CONST_METHOD0
(
size
,
geometry::Size
());
62
MOCK_CONST_METHOD0
(
stride
,
geometry::Stride
());
63
MOCK_CONST_METHOD0
(
pixel_format
,
geometry::PixelFormat
());
64
MOCK_CONST_METHOD0
(
native_buffer_handle
, std::shared_ptr<graphics::NativeBuffer>());
65
66
MOCK_METHOD0
(
bind_to_texture
,
void
());
67
MOCK_CONST_METHOD0
(
id
,
graphics::BufferID
());
68
69
MOCK_CONST_METHOD0
(
can_bypass
,
bool
());
70
};
71
72
}
73
}
74
}
75
76
#endif // MIR_TEST_DOUBLES_MOCK_BUFFER_H_
Copyright © 2012,2013 Canonical Ltd.
Generated on Wed Oct 30 18:52:19 UTC 2013