Covellite++  Version: 2.3.0 Revision: ??? Platform: x64 Build: 23:13 04.01.2025
Кроссплатформенный фреймворк для разработки приложений на С++
Загрузка...
Поиск...
Не найдено
surface.mock.hpp
1
2#pragma once
3
4/*
5An example of use:
6
7using ExampleProxy_t = ::mock::covellite::egl::Surface::Proxy;
8ExampleProxy_t ExampleProxy;
9ExampleProxy_t::GetInstance() = &ExampleProxy;
10
11const ::mock::Id_t ExampleId = 1607301544;
12
13using namespace ::testing;
14
15InSequence Dummy;
16
17EXPECT_CALL(ExampleProxy, Constructor(Value1))
18 .Times(1)
19 .WillOnce(Return(ExampleId));
20
21::mock::covellite::egl::Surface Example(Value1);
22
23EXPECT_CALL(ExampleProxy, Function(ExampleId, Value2))
24 .Times(1)
25 .WillOnce(Return(Value3));
26
27const auto Result = Example.Function(Value2);
28EXPECT_EQ(Value3, Result);
29*/
30
31namespace mock
32{
33
34namespace covellite
35{
36
37namespace egl
38{
39
40class Surface
41{
42
43public:
44 class Proxy :
45 public ::alicorn::extension::testing::Proxy<Proxy>
46 {
47 public:
48 MOCK_METHOD3(Constructor, Id_t(Id_t, Id_t, ANativeWindow *));
49 MOCK_METHOD1(Destructor, void(Id_t));
50 MOCK_METHOD1(SwapBuffers, void(Id_t));
51 MOCK_METHOD1(GetWidth, int32_t(Id_t));
52 MOCK_METHOD1(GetHeight, int32_t(Id_t));
53 };
54
55public:
56 const Id_t m_Id = 0;
57 Surface & operator= (const Surface &) = delete;
58 bool operator== (const Surface & _Value) const { return (m_Id == _Value.m_Id); }
59
60public:
61 ::covellite::egl::EGLSurface m_Surface = nullptr;
62
63public:
64 void SwapBuffers(void) const
65 {
66 Proxy::GetInstance()->SwapBuffers(m_Id);
67 }
68
69 int32_t GetWidth(void) const
70 {
71 return Proxy::GetInstance()->GetWidth(m_Id);
72 }
73
74 int32_t GetHeight(void) const
75 {
76 return Proxy::GetInstance()->GetHeight(m_Id);
77 }
78
79 Surface(const Display & _Display, const Config & _Config,
80 ANativeWindow * _pActivity) :
81 m_Id(Proxy::GetInstance()->Constructor(_Display.m_Id, _Config.m_Id, _pActivity))
82 {
83
84 }
85 ~Surface(void)
86 {
87 Proxy::GetInstance()->Destructor(m_Id);
88 }
89};
90
91} // namespace egl
92
93} // namespace covellite
94
95} // namespace mock