Covellite++  Version: 2.3.0 Revision: ??? Platform: x64 Build: 23:13 04.01.2025
Кроссплатформенный фреймворк для разработки приложений на С++
Загрузка...
Поиск...
Не найдено
Layers.mock.hpp
1
2#pragma once
3#include <Covellite\Gui\ILayer.hpp>
4
5/*
6An example of use:
7
8using ExampleProxy_t = ::mock::alicorn::extension::android::Layers::Proxy;
9ExampleProxy_t ExampleProxy;
10ExampleProxy_t::GetInstance() = &ExampleProxy;
11
12const ::mock::Id_t ExampleId = 1607301544;
13
14using namespace ::testing;
15
16InSequence Dummy;
17
18EXPECT_CALL(ExampleProxy, Constructor(Value1))
19 .Times(1)
20 .WillOnce(Return(ExampleId));
21
22::mock::alicorn::extension::android::Layers Example(Value1);
23
24EXPECT_CALL(ExampleProxy, Function(ExampleId, Value2))
25 .Times(1)
26 .WillOnce(Return(Value3));
27
28const auto Result = Example.Function(Value2);
29EXPECT_EQ(Value3, Result);
30*/
31
32namespace mock
33{
34
35namespace covellite
36{
37
38namespace gui
39{
40
41class Layers
42{
43 using LayerPtr_t = ::std::shared_ptr<::covellite::gui::ILayer>;
44
45public:
46 class Proxy :
47 public ::alicorn::extension::testing::Proxy<Proxy>
48 {
49 public:
50 MOCK_METHOD0(Constructor, Id_t(void));
51 MOCK_METHOD2(Push, void(Id_t, Id_t));
52 MOCK_METHOD1(Pop, bool(Id_t));
53 };
54
55public:
56 const Id_t m_Id = 0;
57 Layers & operator= (const Layers &) = delete;
58 bool operator== (const Layers & _Value) const { return (m_Id == _Value.m_Id); }
59
60public:
61 void Push(const LayerPtr_t & _pLayer)
62 {
63 Proxy::GetInstance()->Push(m_Id,
64 dynamic_cast<const ::mock::covellite::gui::Layer &>(*_pLayer).m_Id);
65 }
66
67 bool Pop(void)
68 {
69 return Proxy::GetInstance()->Pop(m_Id);
70 }
71
72public:
73 Layers(void) :
74 m_Id(Proxy::GetInstance()->Constructor())
75 {
76
77 }
78};
79
80} // namespace gui
81
82} // namespace covellite
83
84} // namespace mock