Covellite++  Version: 2.3.0 Revision: ??? Platform: x64 Build: 23:13 04.01.2025
Кроссплатформенный фреймворк для разработки приложений на С++
Загрузка...
Поиск...
Не найдено
Window.mock.hpp
1
2#pragma once
3
4/*
5An example of use:
6
7using ExampleProxy_t = ::mock::covellite::expanse::Window::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::expanse::Window 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 expanse
38{
39
40class Window
41{
42 using WindowApi_t = ::covellite::api::IWindow;
43
44public:
45 class Proxy :
46 public ::alicorn::extension::testing::Proxy<Proxy>
47 {
48 public:
49 MOCK_METHOD2(CreateObject, ObjectId_t(Id_t, const GameObject_t &));
50 MOCK_METHOD2(RemoveObject, void(Id_t, const ObjectId_t));
51 MOCK_METHOD4(Add, void(Id_t, size_t, ObjectId_t, size_t));
52 MOCK_METHOD1(Constructor, Id_t(const WindowApi_t &));
53 };
54
55public:
56 const Id_t m_Id = 0;
57 Window & operator= (const Window &) = delete;
58 bool operator== (const Window & _Value) const { return (m_Id == _Value.m_Id); }
59
60public:
61 ObjectId_t CreateObject(const GameObject_t & _Param1)
62 {
63 return Proxy::GetInstance()->CreateObject(m_Id, _Param1);
64 }
65
66 void RemoveObject(const ObjectId_t _Param1)
67 {
68 Proxy::GetInstance()->RemoveObject(m_Id, _Param1);
69 }
70
71 void Add(const size_t _Param1, const ObjectId_t _Param2, const size_t _Param3 = 0)
72 {
73 Proxy::GetInstance()->Add(m_Id, _Param1, _Param2, _Param3);
74 }
75
76 Window(const WindowApi_t & _Param1) :
77 m_Id(Proxy::GetInstance()->Constructor(_Param1))
78 {
79
80 }
81
82};
83
84} // namespace expanse
85
86} // namespace covellite
87
88} // namespace mock
Класс входит в проект Covellite.Api Интерфейсный класс для всех окон, реализующих различные графиче...
Definition IWindow.hpp:35