Pass the ComponentWindow to ItemVTable::input_event

This commit is contained in:
Simon Hausmann 2020-09-18 13:45:47 +02:00
parent 72ee03a1a5
commit 7053aee0c8
15 changed files with 125 additions and 55 deletions

View file

@ -17,20 +17,24 @@ inline void mock_elapsed_time(int64_t time_in_ms)
cbindgen_private::sixtyfps_mock_elapsed_time(time_in_ms);
}
template<typename Component>
inline void send_mouse_click(Component &component, float x, float y) {
cbindgen_private::sixtyfps_send_mouse_click({&Component::component_type, &component}, x, y);
inline void send_mouse_click(Component &component, float x, float y)
{
cbindgen_private::sixtyfps_send_mouse_click({ &Component::component_type, &component }, x, y,
&component.window);
}
#define assert_eq(A, B) sixtyfps::testing::private_api::assert_eq_impl(A, B, #A, #B, __FILE__, __LINE__)
#define assert_eq(A, B) \
sixtyfps::testing::private_api::assert_eq_impl(A, B, #A, #B, __FILE__, __LINE__)
namespace private_api {
template<typename A, typename B>
void assert_eq_impl(const A &a, const B &b, const char *a_str, const char *b_str,
const char *file, int line) {
void assert_eq_impl(const A &a, const B &b, const char *a_str, const char *b_str, const char *file,
int line)
{
if (a != b) {
std::cerr << file << ":" << line <<": assert_eq FAILED!\n"
<< a_str << ": " << a << "\n"
<< b_str << ": " << b << std::endl;
std::cerr << file << ":" << line << ": assert_eq FAILED!\n"
<< a_str << ": " << a << "\n"
<< b_str << ": " << b << std::endl;
std::abort();
}
}