Covellite++  Version: 2.3.0 Revision: ??? Platform: x64 Build: 23:13 04.01.2025
Кроссплатформенный фреймворк для разработки приложений на С++
Загрузка...
Поиск...
Не найдено
config.mock.hpp
1
2#pragma once
3
4/*
5An example of use:
6
7using ExampleProxy_t = ::mock::covellite::egl::Config::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::Config 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 Config
41{
42
43public:
44 class Proxy :
45 public ::alicorn::extension::testing::Proxy<Proxy>
46 {
47 public:
48 MOCK_METHOD2(Constructor, Id_t(Id_t, ANativeWindow *));
49 MOCK_METHOD1(Destructor, void(Id_t));
50 };
51
52public:
53 ::covellite::egl::EGLConfig m_Config = nullptr;
54
55public:
56 const Id_t m_Id = 0;
57 Config & operator= (const Config &) = delete;
58 bool operator== (const Config & _Value) const { return (m_Id == _Value.m_Id); }
59
60public:
61 Config(const Display & _Param1, ANativeWindow * _Param2) :
62 m_Id(Proxy::GetInstance()->Constructor(_Param1.m_Id, _Param2))
63 {
64
65 }
66
67 ~Config(void)
68 {
69 Proxy::GetInstance()->Destructor(m_Id);
70 }
71};
72
73} // namespace egl
74
75} // namespace covellite
76
77} // namespace mock