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