Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mock_renderable.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 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: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_TEST_DOUBLES_MOCK_RENDERABLE_H_
20 #define MIR_TEST_DOUBLES_MOCK_RENDERABLE_H_
21 
24 #include <gmock/gmock.h>
25 
26 namespace mir
27 {
28 namespace test
29 {
30 namespace doubles
31 {
33 {
35  {
36  ON_CALL(*this, screen_position())
37  .WillByDefault(testing::Return(geometry::Rectangle{{},{}}));
38  ON_CALL(*this, buffer(testing::_))
39  .WillByDefault(testing::Return(std::make_shared<StubBuffer>()));
40  ON_CALL(*this, buffers_ready_for_compositor())
41  .WillByDefault(testing::Return(1));
42  ON_CALL(*this, alpha())
43  .WillByDefault(testing::Return(1.0f));
44  ON_CALL(*this, transformation())
45  .WillByDefault(testing::Return(glm::mat4{}));
46  ON_CALL(*this, visible())
47  .WillByDefault(testing::Return(true));
48  }
49 
50  MOCK_CONST_METHOD1(buffer, std::shared_ptr<graphics::Buffer>(void const*));
53  MOCK_CONST_METHOD0(alpha, float());
54  MOCK_CONST_METHOD0(transformation, glm::mat4());
55  MOCK_CONST_METHOD0(visible, bool());
56  MOCK_CONST_METHOD0(shaped, bool());
58 };
59 }
60 }
61 }
62 
63 #endif /* MIR_TEST_DOUBLES_MOCK_RENDERABLE_H_ */
Definition: mock_renderable.h:32
virtual float alpha() const =0
virtual std::shared_ptr< Buffer > buffer(void const *user_id) const =0
Return the next buffer that should be composited/rendered.
virtual glm::mat4 transformation() const =0
Transformation returns the transformation matrix that should be applied to the surface.
virtual int buffers_ready_for_compositor() const =0
virtual bool shaped() const =0
virtual bool alpha_enabled() const =0
MOCK_CONST_METHOD1(buffer, std::shared_ptr< graphics::Buffer >(void const *))
Definition: renderable.h:33
MockRenderable()
Definition: mock_renderable.h:34
virtual geometry::Rectangle screen_position() const =0
Definition: rectangle.h:33
virtual bool visible() const =0
TODO: Its a bit questionable that we have this member function, why not just trim the renderable from...
MOCK_CONST_METHOD0(alpha_enabled, bool())

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014