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