Covellite++  Version: 2.3.0 Revision: ??? Platform: x64 Build: 23:13 04.01.2025
Кроссплатформенный фреймворк для разработки приложений на С++
Загрузка...
Поиск...
Не найдено
Event.hpp
1
2#pragma once
3
4namespace mock
5{
6
7class AEventProxy :
8 public ::alicorn::extension::testing::Proxy<AEventProxy>
9{
10public:
11 MOCK_METHOD1(GetType, int32_t(const AInputEvent *));
12 MOCK_METHOD1(GetAction, int32_t(const AInputEvent *));
13 MOCK_METHOD2(GetX, float(const AInputEvent *, size_t));
14 MOCK_METHOD2(GetY, float(const AInputEvent *, size_t));
15 MOCK_METHOD1(GetKeyAction, int32_t(const AInputEvent *));
16 MOCK_METHOD1(GetKeyCode, int32_t(const AInputEvent *));
17 MOCK_METHOD3(PollAll, int(int, int *, int *));
18 MOCK_METHOD1(GetLanguage, ::std::string(AConfiguration *));
19 MOCK_METHOD2(Process, void(android_app *, android_poll_source *));
20 MOCK_METHOD1(Finish, void(ANativeActivity *));
21 MOCK_METHOD2(HideSoftInput, void(ANativeActivity *, uint32_t));
22 MOCK_METHOD3(OnCreate, void(ANativeActivity *, void *, size_t));
23 MOCK_METHOD1(GetWidth, int32_t(ANativeWindow *));
24 MOCK_METHOD1(GetHeight, int32_t(ANativeWindow *));
25
26public:
27 void * m_pOutData = nullptr;
28};
29
30} // namespace mock
31
32inline int32_t AInputEvent_getType(const AInputEvent * _Event)
33{
34 return ::mock::AEventProxy::GetInstance()->GetType(_Event);
35}
36
37inline int32_t AMotionEvent_getAction(const AInputEvent * _Event)
38{
39 return ::mock::AEventProxy::GetInstance()->GetAction(_Event);
40}
41
42inline float AMotionEvent_getX(const AInputEvent * _Event, size_t _PointerIndex)
43{
44 return ::mock::AEventProxy::GetInstance()->GetX(_Event, _PointerIndex);
45}
46
47inline float AMotionEvent_getY(const AInputEvent * _Event, size_t _PointerIndex)
48{
49 return ::mock::AEventProxy::GetInstance()->GetY(_Event, _PointerIndex);
50}
51
52inline int32_t AKeyEvent_getAction(const AInputEvent * _Event)
53{
54 return ::mock::AEventProxy::GetInstance()->GetKeyAction(_Event);
55}
56
57inline int32_t AKeyEvent_getKeyCode(const AInputEvent* _Event)
58{
59 return ::mock::AEventProxy::GetInstance()->GetKeyCode(_Event);
60}
61
62inline int ALooper_pollAll(int _TimeoutMillis, int * _pOutFd, int * _pOutEvents,
63 void ** _ppOutData)
64{
65 auto pProxy = ::mock::AEventProxy::GetInstance();
66
67 *_ppOutData = pProxy->m_pOutData;
68 return pProxy->PollAll(_TimeoutMillis, _pOutFd, _pOutEvents);
69}
70
71inline void AConfiguration_getLanguage(AConfiguration * _pConfig,
72 char * _pOutLanguage)
73{
74 const auto Result = ::mock::AEventProxy::GetInstance()->GetLanguage(_pConfig);
75 memcpy(_pOutLanguage, Result.c_str(), Result.length());
76}
77
78inline void Process(android_app * _pApp, android_poll_source * _pSource)
79{
80 ::mock::AEventProxy::GetInstance()->Process(_pApp, _pSource);
81}
82
83inline void ANativeActivity_finish(ANativeActivity * _pActivity)
84{
85 ::mock::AEventProxy::GetInstance()->Finish(_pActivity);
86}
87
88inline void ANativeActivity_hideSoftInput(ANativeActivity * _pActivity,
89 uint32_t _Flags)
90{
91 ::mock::AEventProxy::GetInstance()->HideSoftInput(_pActivity, _Flags);
92}
93
94inline void ANativeActivity_onCreate(ANativeActivity * _pActivity,
95 void * _pSavedState, size_t _SavedStateSize)
96{
97 ::mock::AEventProxy::GetInstance()->OnCreate(_pActivity, _pSavedState,
98 _SavedStateSize);
99}
100
101inline int32_t ANativeWindow_getWidth(ANativeWindow * _pWindow)
102{
103 return ::mock::AEventProxy::GetInstance()->GetWidth(_pWindow);
104}
105
106inline int32_t ANativeWindow_getHeight(ANativeWindow * _pWindow)
107{
108 return ::mock::AEventProxy::GetInstance()->GetHeight(_pWindow);
109}
Definition android_native_app_glue.h:90
Definition android_native_app_glue.h:111